[FFmpeg-devel] [PATCH] avformat/hlsenc: support TAG span multiple lines when parse playlist

Steven Liu lingjiujianke at gmail.com
Tue May 9 03:43:21 EEST 2017


2017-05-05 16:55 GMT+08:00 Steven Liu <lingjiujianke at gmail.com>:

>
>
> 2017-05-06 0:50 GMT+08:00 Steven Liu <lq at chinaffmpeg.org>:
>
>> refer to: https://developer.apple.com/library/content/technotes/tn2288
>> /_index.html
>>
>> support to parse the EXT-X-KEY span multiple lines:
>>  #EXTM3U
>>  #EXT-X-VERSION:3
>>  #EXT-X-TARGETDURATION:10
>>  #EXT-X-MEDIA-SEQUENCE:0
>>  #EXT-X-KEY:METHOD=AES-128,URI="/file.key", \
>>  IV=0x498c8325965f907960e3d94d20c4d138
>>  #EXTINF:10.000000,
>>  out0.ts
>>  #EXTINF:8.640000,
>>  out1.ts
>>  #EXTINF:9.160000,
>>  out2.ts
>>
>> Reported-by: Aaron Levinson <alevinsn at aracnet.com>
>> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
>> ---
>>  libavformat/hlsenc.c |   21 +++++++++++++++++++--
>>  1 files changed, 19 insertions(+), 2 deletions(-)
>>
>> diff --git a/libavformat/hlsenc.c b/libavformat/hlsenc.c
>> index 221089c..c167624 100644
>> --- a/libavformat/hlsenc.c
>> +++ b/libavformat/hlsenc.c
>> @@ -500,10 +500,27 @@ static int hls_encryption_start(AVFormatContext *s)
>>
>>  static int read_chomp_line(AVIOContext *s, char *buf, int maxlen)
>>  {
>> -    int len = ff_get_line(s, buf, maxlen);
>> +    int len = 0;
>> +    int total_len = 0;
>> +
>> +re_get_line:
>> +    if (maxlen > total_len) {
>> +        len = ff_get_line(s, buf, maxlen - total_len);
>> +    } else {
>> +        av_log(s, AV_LOG_WARNING, "The tag is too long, context only can
>> get %s\n", buf);
>> +        return maxlen;
>> +    }
>>      while (len > 0 && av_isspace(buf[len - 1]))
>>          buf[--len] = '\0';
>> -    return len;
>> +
>> +    if (buf[len - 1] == '\\') {
>> +        buf += len - 1;
>> +        total_len += len - 1;
>> +        goto re_get_line;
>> +    }
>> +
>> +    total_len += len;
>> +    return total_len;
>>  }
>>
>>  static int hls_mux_init(AVFormatContext *s)
>> --
>> 1.7.1
>>
>>
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>
>
> Hi Aaron Levinson
>
> What about this one?
>

ping


More information about the ffmpeg-devel mailing list