[FFmpeg-cvslog] avformat/hlsenc: refine the code readable for time unit

Steven Liu git at videolan.org
Tue Jan 24 06:32:16 EET 2017


ffmpeg | branch: master | Steven Liu <lq at chinaffmpeg.org> | Tue Jan 24 12:29:01 2017 +0800| [2f7cc21b61220d205e3c57384f354187417971fb] | committer: Steven Liu

avformat/hlsenc: refine the code readable for time unit

Reviewed-by: Bodecs Bela <bodecsb at vivanet.hu>
Reviewed-by: James Almer <jamrial at gmail.com>
Signed-off-by: Steven Liu <lq at chinaffmpeg.org>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f7cc21b61220d205e3c57384f354187417971fb
---

 libavformat/hlsenc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 85d3955..7e3a7f2 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",



More information about the ffmpeg-cvslog mailing list