[FFmpeg-devel] [PATCH] lavc/avcodec.h: extend documentation for avcodec_open2()
Stefano Sabatini
stefasab at gmail.com
Sun Mar 5 13:57:38 EET 2023
On date Wednesday 2023-03-01 15:04:16 +0800, "zhilizhao(赵志立)" wrote:
> > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> > index 9a0fe97cad..fbf1d3d83c 100644
> > --- a/libavcodec/avcodec.h
> > +++ b/libavcodec/avcodec.h
> > @@ -2418,8 +2418,14 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
> > * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for
> > * retrieving a codec.
> > *
> > - * @note Always call this function before using decoding routines (such as
> > - * @ref avcodec_receive_frame()).
> > + * Depending on the codec, you might need to set options in the codec context
> > + * also for decoding (e.g. width, height, or the pixel or audio sample format in
> > + * case the information is not is not available in the bitstream, e.g. as in
>
> 'is not is not'
>
> > + * case of decoding raw audio or video).
>
> in ’the’ case of.
>
> > + *
> > + * Options on the codec context can be either set by providing the options
> > + * specified in an AVDictionary, or by setting the values on the context itself,
> > + * directly or by using the av_opt_set() API.
> > *
> > * @code
> > * av_dict_set(&opts, "b", "2.5M", 0);
> > @@ -2433,17 +2439,35 @@ int avcodec_parameters_to_context(AVCodecContext *codec,
> > * exit(1);
> > * @endcode
> > *
> > + * In case AVCodecParameters are available (e.g. when demuxing a stream using
> > + * libavformat, and accessing the AVStream contained in the demuxer), the codec
> > + * parameters can be copied to the codec context using
> > + * avcodec_parameters_to_context(), as in the following code:
> > + *
> > + * @code
> > + * context = avcodec_alloc_context3(codec);
> > + * if (avcodec_parameters_to_context(*dec_ctx, codecpar) < 0)
> > + * exit(1);
> > + * if (avcodec_open2(context, codec, NULL) < 0)
> > + * exit(1);
>
> What’s the dec_ctx?
Updated, thanks for the feedback.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-lavc-avcodec.h-extend-documentation-for-avcodec_open.patch
Type: text/x-diff
Size: 3519 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230305/ffe51300/attachment.patch>
More information about the ffmpeg-devel
mailing list