[FFmpeg-devel] HLS and HTTP options

Micah Galizia micahgalizia at gmail.com
Thu Dec 20 04:51:45 CET 2012


Hello,

I'd like to fix one of the problems I am having playing back HLS streams
from Fox Soccer2Go (US provider of the EPL and champions league).

Any HTTP AVOptions that are set and used to get the top-level m3u8 file are
ignored in subsequent HTTP requests (for sub-m3u8 files or for the actual
video segments). So, for example if the user-agent HTTP option is set
externally, it changes back to "Lavf..." after the request for the initial
playlist. The same problem also occurs if a Cookie header (previously set
by the server in a Set-Cookie response header for authentication) is
specified with an AVOption.

To fix this, calls to avio_open2 and av_probe_input_buffer from
hls_read_header and parse_playlist (both in hls.c) need to be passed a copy
of the original options (AVDictionary). Looking through the code, I think
the easiest solution to this problem is to store a copy of the original
options (in their original AVDictionary form) into the AVFormatContext (or
its AVIOContext).

Alternatively, the AVProbeData passed to an AVInputFormat's read_probe
method in init_input (in utils.c) could get the options to the
AVInputFormat. However, doing so would require changes to
av_probe_input_buffer{2,3} in addition to the modifying the struct.

I also looked at pulling AVOptions from URLContext->priv_data in
hls_read_header, but that is more complex and would involve casting back to
string from a few different types so it seems less than ideal.

Anyway, I hope I've clearly illustrated the problem. If this seems
reasonable I'll make a patch.

Thanks in advance!
-- 
"The mark of an immature man is that he wants to die nobly for a cause,
while the mark of the mature man is that he wants to live humbly for
one."   --W. Stekel


More information about the ffmpeg-devel mailing list