On Thu, 20 Feb 2014 09:45:09 +0100, wm4 <nfx...@googlemail.com> wrote:
> On Wed, 19 Feb 2014 21:16:45 +0100
> Anton Khirnov <an...@khirnov.net> wrote:
> 
> > +    /**
> > +     * An array of side data that applies to the whole stream (i.e. the
> > +     * container does not allow it to change between packets).
> > +     *
> > +     * - decoding: Set by libavformat when the stream is created.
> > +     * - encoding: May be set by the caller before 
> > avformat_find_stream_info().
> > +     *
> > +     * Freed by libavformat in avformat_free_context().
> > +     */
> > +    AVPacketSideData *side_data;
> > +    /**
> > +     * The number of elements in the AVStream.side_data array.
> > +     */
> > +    int            nb_side_data;
> > +
> 
> Sounds like a good idea. This allows using the same data structures
> (side data entries) for demuxers that can change parameters and
> demuxers where they never change.
> 
> Maybe there should be clear rules when and how often side data appears
> in AVStream and AVPackets. For example, for that files that allow
> parameter changes you could do one of the following:
> 
> A) have no side data in AVStream, always send it with the packet, and
>    the first packet will have the initial parameters
> B) have initial parameters as side data in AVStream, and AVPacket side
>    data is used only when the parameters change
> C) do both, and initial parameters will be both in AVStream, and the
>    first AVPacket
> 

I think the least messy/confusing approach would be A -- i.e. what appears in
the stream side data never appears in packets and vice versa. Otherwise we run
into ambiguities with stuff like seeking.
Of course the caller can always copy the side data from the stream to whatever
packet he considers 'initial' (like avconv does in a later patch). We could
possibly even provide a convenience function for it.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to