[FFmpeg-devel,1/2,v2] avformat/hlsenc: fix typo of AV_TIME_BASE

Submitted by Steven Liu on Jan. 23, 2017, 9:05 a.m.

Details

Message ID 20170123090513.9138-1-lq@chinaffmpeg.org
State New
Headers show

Commit Message

Steven Liu Jan. 23, 2017, 9:05 a.m.
the code use 1000000 * duration, use AV_TIME_BASE replace 1000000

Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
---
 libavformat/hlsenc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Bodecs Bela Jan. 23, 2017, 10:43 a.m.
2017.01.23. 10:05 keltezéssel, Steven Liu írta:
> the code use 1000000 * duration, use AV_TIME_BASE replace 1000000
>
> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
> ---
>   libavformat/hlsenc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
> index 85d3955..f070bc3 100644
> --- a/libavformat/hlsenc.c
> +++ b/libavformat/hlsenc.c
> @@ -501,7 +501,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(AV_TIME_BASE * duration)) < 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",

I used 1000000 because the duration is in seconds and the replacement 
should be in microseconds.
The filename will contain the duration in microseconds.
So this is a "seconds  to microseconds" conversion.  It would be a 
mistake to use AV_TIME_BASE here.
Maybe a comment should be added to the code about it.

The reasoning behind to put duration in microseconds into filename 
instead of seconds was to avoid comma in filename.

bb
Steven Liu Jan. 23, 2017, 10:59 a.m.
2017-01-23 18:43 GMT+08:00 Bodecs Bela <bodecsb@vivanet.hu>:

>
>
> 2017.01.23. 10:05 keltezéssel, Steven Liu írta:
>
>> the code use 1000000 * duration, use AV_TIME_BASE replace 1000000
>>
>> Signed-off-by: Steven Liu <lq@chinaffmpeg.org>
>> ---
>>   libavformat/hlsenc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 85d3955..f070bc3 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -501,7 +501,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(AV_TIME_BASE * duration))
>> < 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",
>>
>
> I used 1000000 because the duration is in seconds and the replacement
> should be in microseconds.
> The filename will contain the duration in microseconds.
> So this is a "seconds  to microseconds" conversion.  It would be a mistake
> to use AV_TIME_BASE here.
> Maybe a comment should be added to the code about it.
>
> The reasoning behind to put duration in microseconds into filename instead
> of seconds was to avoid comma in filename.

resend a new patch! :)

>
>
> bb
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

Patch hide | download patch | download mbox

diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
index 85d3955..f070bc3 100644
--- a/libavformat/hlsenc.c
+++ b/libavformat/hlsenc.c
@@ -501,7 +501,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(AV_TIME_BASE * duration)) < 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",