From patchwork Mon Jan 23 11:01:14 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Liu Steven X-Patchwork-Id: 2295 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp1180409vsb; Mon, 23 Jan 2017 03:01:34 -0800 (PST) X-Received: by 10.28.209.202 with SMTP id i193mr14767424wmg.20.1485169294457; Mon, 23 Jan 2017 03:01:34 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f18si13865792wme.57.2017.01.23.03.01.34; Mon, 23 Jan 2017 03:01:34 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 1BEBF68A1F6; Mon, 23 Jan 2017 13:01:20 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from smtpbgau2.qq.com (smtpbgau2.qq.com [54.206.34.216]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id F10FE68A1D2 for ; Mon, 23 Jan 2017 13:01:12 +0200 (EET) X-QQ-mid: bizesmtp7t1485169277tu62m87kv Received: from localhost (unknown [47.90.47.25]) by esmtp4.qq.com (ESMTP) with id ; Mon, 23 Jan 2017 19:01:16 +0800 (CST) X-QQ-SSF: 01100000002000F0F720000A0000000 X-QQ-FEAT: nSUdqPGu3tuNxgXvvazlrCHwByOeUXVvzQ7wCMOOdZYTuQsQ8pzngdN0HfmaT gGDLxu5j9jMY6voVPLhUL8p+to6UYdxaaEJO7SMpVTAQTLue0toZIExgGl+3ASwVBgBJ81W XEJsIE1utjQzAfEnYrTdhYM36LMNCqyTtbf3bECmitKm30oAq5SxJhTjxoJKmE75qv222Vt WIiHM5wkzvKRtxZKjM0ErhywLB7u2+NJiAuSFF0DNne0Q4BwTfqJdjPHwqUx2ULbqaIgxzY DBEsqr+TBDigimvBVbDgSkjb4= X-QQ-GoodBg: 0 From: Steven Liu To: ffmpeg-devel@ffmpeg.org Date: Mon, 23 Jan 2017 19:01:14 +0800 Message-Id: <20170123110114.10849-1-lq@chinaffmpeg.org> X-Mailer: git-send-email 2.10.1.382.ga23ca1b.dirty X-QQ-SENDSIZE: 520 X-QQ-Bgrelay: 1 Subject: [FFmpeg-devel] [PATCH v2] avformat/hlsenc: improve the code readable of 1000000 X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: Steven Liu MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Reviewed-by: Bodecs Bela Signed-off-by: Steven Liu --- libavformat/hlsenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c index 85d3955..0170b34 100644 --- a/libavformat/hlsenc.c +++ b/libavformat/hlsenc.c @@ -47,6 +47,7 @@ typedef enum { #define KEYSIZE 16 #define LINE_BUFFER_SIZE 1024 +#define HLS_MICROSECOND_UNIT 1000000 typedef struct HLSSegment { char filename[1024]; @@ -501,7 +502,7 @@ static int hls_append_segment(struct AVFormatContext *s, HLSContext *hls, double return AVERROR(ENOMEM); } if (replace_int_data_in_filename(hls->avf->filename, sizeof(hls->avf->filename), - filename, 't', (int64_t)round(1000000 * duration)) < 1) { + filename, 't', (int64_t)round(duration * HLS_MICROSECOND_UNIT)) < 1) { av_log(hls, AV_LOG_ERROR, "Invalid second level segment filename template '%s', " "you can try to remove second_level_segment_time flag\n",