[libav-api] AVStream dispose

Ronald S. Bultje rsbultje at gmail.com
Wed Aug 31 23:01:36 CEST 2011


Hi,

On Wed, Aug 31, 2011 at 1:24 AM, Mark Kenna
<mark.kenna at sureviewsystems.com> wrote:
> Hi
>
> I am using the "av_new_stream" function to manually add a set of streams to
> a FormatContext, my question is how to "properly" remove some (but not all)
> of them
>
> For example I want to:
>
> //create 10 streams
> for (int i = 0; i < 10; i++)
> {
>     AVStream *st = av_new_stream(_formatContext, 0);
>     ...
>     ...
> }
>
> //close the first stream
> AVStream *firstStream = _formatContext.streams[0];
> av_free_stream(firstStream, _formatContext); //anything like this?
>
> //at this point I would expect _formatContext.nb_streams = 9
>
> Of course I could manually free the stream and decrement nb_streams right?

Right. There is no wrapper function for this.

I wonder if this may cause issues for those demuxers that have private
contexts for each stream. Changing the layout of streams[] would make
that private context data invalid...

Ronald


More information about the libav-api mailing list