On Mon, 30 Jan 2012 17:05:45 -0800, "Ronald S. Bultje" <[email protected]> 
wrote:
> Hi,
> 
> On Sun, Jan 29, 2012 at 9:24 AM, Anton Khirnov <[email protected]> wrote:
> > This way, if the AVCodecContext is allocated for a specific codec, the
> > caller doesn't need to store this codec separately and then pass it
> > again to avcodec_open2().
> >
> > It also allows to set codec private options using av_opt_set_* before
> > opening the codec.
> > ---
> >  libavcodec/avcodec.h |    5 +++++
> >  libavcodec/options.c |    1 +
> >  libavcodec/utils.c   |   11 ++++++-----
> >  libavformat/utils.c  |    8 +++++---
> >  4 files changed, 17 insertions(+), 8 deletions(-)
> [..]
> >  * @param avctx The context to initialize.
> > + * @param codec The codec to open this context for. If a non-NULL codec 
> > has been
> > + *              previously passed to avcodec_alloc_context3() or
> > + *              avcodec_get_context_defaults3() for this context, then this
> > + *              parameter MUST be either NULL or equal to the previously 
> > passed
> > + *              codec.
> 
> Why NULL? Seems like additional complexity with no real gain.

Huh?
The user must pass a non-NULL codec in either one of those places:
1) avcodec_alloc_context3()
2) avcodec_get_context_defaults3()
3) avcodec_open2()
If he does so in 1) or 2), the codec is already known so there's no
point in passing it again to avcodec_open2().

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to