[FFmpeg-devel] [PATCH] avformat/hlsenc: support fmp4 single file mode

Steven Liu lingjiujianke at gmail.com
Tue Aug 1 17:51:09 EEST 2017


2017-08-01 20:41 GMT+08:00 Derek Buitenhuis <derek.buitenhuis at gmail.com>:
> On 7/31/2017 5:03 AM, Steven Liu wrote:
>> add byterange mode of the hls fmp4
>>
>> Signed-off-by: Steven Liu <lq at onvideo.cn>
>> ---
>>  libavformat/hlsenc.c | 72 ++++++++++++++++++++++++++++++++--------------------
>>  1 file changed, 44 insertions(+), 28 deletions(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index f98f041..cfc28d2 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -531,6 +531,7 @@ static int hls_mux_init(AVFormatContext *s)
>>      HLSContext *hls = s->priv_data;
>>      AVFormatContext *oc;
>>      AVFormatContext *vtt_oc = NULL;
>> +    int byterange_mode = (hls->flags & HLS_SINGLE_FILE) || (hls->max_seg_size > 0);
>
> Not quite sure I understand the '|| (hls->max_seg_size > 0)' part. Is there ever a time
> that byte range mode is used with more than one file, allowed by the spec?
more than one file is old version support and user require and be used
ok, so this is no problem, maybe this modify to
 int byterange_mode = ((hls->flags & HLS_SINGLE_FILE) ||
(hls->max_seg_size > 0)); will clearly

>
>>      if (hls->segment_type == SEGMENT_TYPE_FMP4) {
>> -        hls->fmp4_init_mode = 1;
>> +        if (byterange_mode) {
>> +            hls->fmp4_init_mode = 0;
>> +        } else {
>> +            hls->fmp4_init_mode = 1;
>> +        }
>
> hls->fmp4_init_mode = !byterange_mode;
looks good, will use this style code :)
>
>>      if(hls->has_subtitle) {
>> -
>>          if (hls->flags & HLS_SINGLE_FILE)
>
> Accidental white space change.
used
>
>> +    if ((hls->flags & HLS_SINGLE_FILE) && (hls->segment_type == SEGMENT_TYPE_FMP4)) {
>> +        hls->fmp4_init_filename  = av_strdup(hls->basename);
>
> Missing NULL check.
accept
>
> - Derek
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


patch will upadte later.


More information about the ffmpeg-devel mailing list