[FFmpeg-devel] [PATCH] hls: add underlying format option for hls input format

Michael Niedermayer michaelni at gmx.at
Wed Jul 9 14:03:12 CEST 2014


On Wed, Jul 09, 2014 at 03:23:01PM +0400, Ivan Grokhotkov wrote:
> Hi,
> 
> By default, hls will autodetect the input format of the downloaded segments. 
> This new option allows to force some specific format, which is useful for 
> hardware decoders that accept only TS (by supplying 
> hls_force_input_format="mpegtsraw" option to avformat_open_input).
> 
> The situation has been mentioned in the FFmpeg-users mailing list, so
> this patch might be useful:
> https://lists.ffmpeg.org/pipermail/ffmpeg-user/2013-October/018306.html
> 
> This option should probably be documented somewhere, but I failed to
> find an appropriate place. Please comment, so I can update the patch.
> 
> 
> Thanks,
> Ivan
> 
> 
> Signed-off-by: Ivan Grokhotkov <igrokhotkov at spbtv.com>
> ---
> libavformat/hls.c | 7 +++++++
> 1 file changed, 7 insertions(+)
> 
> 
> diff --git a/libavformat/hls.c b/libavformat/hls.c
> index 3897723..7ed5fc0 100644
> --- a/libavformat/hls.c
> +++ b/libavformat/hls.c
> @@ -1318,6 +1318,7 @@ static int hls_read_header(AVFormatContext *s)
>     for (i = 0; i < c->n_playlists; i++) {
>         struct playlist *pls = c->playlists[i];
>         AVInputFormat *in_fmt = NULL;
> +        AVDictionaryEntry *dict_entry;
> 
>         if (pls->n_segments == 0)
>             continue;
> @@ -1336,6 +1337,12 @@ static int hls_read_header(AVFormatContext *s)
>         ffio_init_context(&pls->pb, pls->read_buffer, INITIAL_BUFFER_SIZE, 0, pls,
>                           read_data, NULL, NULL);
>         pls->pb.seekable = 0;
> +
> +        dict_entry = av_dict_get(s->metadata, "hls_force_input_format", NULL, 0);
> +        if (dict_entry){
> +            in_fmt = av_find_input_format(dict_entry->value);
> +        }

this should be using AVOptions like other demuxers not metadata

documentation could be put in doc/demuxers.texi

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I know you won't believe me, but the highest form of Human Excellence is
to question oneself and others. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140709/91f94885/attachment.asc>


More information about the ffmpeg-devel mailing list