[Libav-user] Cannot disable HLS variant in runtime

Artem Moroz artem.moroz at gmail.com
Mon Sep 22 15:21:27 CEST 2014


I am trying to implement the HLS adaptive streaming.

I am disabling unneeded variants with setting AVDISCARD_ALL in
AVStream->discard.

for (i = 0; i < player->input_format_ctx->nb_streams; i++)
                {
                    AVStream* stream = player->input_format_ctx->streams[i];
                    AVDictionary* metadaat = stream->metadata;
                    AVDictionaryEntry* tag = NULL;
                    int nReadBitrate = 0;

                    discard = AVDISCARD_ALL;

                    tag = av_dict_get(metadaat, "variant_bitrate", NULL, 0);
                    if (tag != NULL)
                    {
                        nReadBitrate = atoi(tag->value);
                        if (nReadBitrate == 600000)
                        {
                            discard = AVDISCARD_NONE;
                            LOGI(3, "player_read_from_stream enabled
bitrate %d for input stream %d", nReadBitrate, i);
                        }
                        else
                        {
                            discard = AVDISCARD_ALL;
                            LOGI(3, "player_read_from_stream disabled
bitrate %d for input stream %d", nReadBitrate, i);
                        }
                    }


                    stream->discard = discard;
                }


 But once I enable stream bitrate, I cannot disable it again back. It still
downloads disabled bitrates!
 How can I disable fetching of live streams?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://ffmpeg.org/pipermail/libav-user/attachments/20140922/394842cb/attachment.html>


More information about the Libav-user mailing list