[Libav-user] AVStream->codec deprecation
Charles
linux2 at orion15.org
Mon Aug 22 04:42:06 EEST 2016
On 08/21/2016 08:31 PM, salsaman wrote:
> Here we go, I can answer definitively now:
>
> https://ffmpeg.org/doxygen/3.1/ffplay_8c_source.html
>
>
> AVCodecContext <https://ffmpeg.org/doxygen/3.1/structAVCodecContext.html> *avctx;
>
> avctx = avcodec_alloc_context3 <https://ffmpeg.org/doxygen/3.1/group__lavc__core.html#gae80afec6f26df6607eaacf39b561c315>(NULL
> <https://ffmpeg.org/doxygen/3.1/coverity_8c.html#a070d2ce7b6bb7e5c05602aa8c308d0c4>);
> if (!avctx)
> return AVERROR <https://ffmpeg.org/doxygen/3.1/group__lavu__error.html#gae4bb6f165973d09584e0ec0f335f69ca>(ENOMEM);
>
> ret = avcodec_parameters_to_context <https://ffmpeg.org/doxygen/3.1/group__lavc__core.html#gac7b282f51540ca7a99416a3ba6ee0d16>(avctx,
> ic->streams <https://ffmpeg.org/doxygen/3.1/structAVFormatContext.html#acfefb6b6cf21e87a0dcbd1a547ba2348>[stream_index]->codecpar
> <https://ffmpeg.org/doxygen/3.1/structAVStream.html#a12826d21779289356722971d362c583c>);
> if (ret < 0)
> goto fail <https://ffmpeg.org/doxygen/3.1/checkasm_8h.html#a73a3b169ac8c3419cbe15327e75ffcfd>;
>
>
> Gabriel.
>
> http://lives-video.com
> https://www.openhub.net/accounts/salsaman
>
> On Sun, Aug 21, 2016 at 10:05 PM, salsaman <salsaman at gmail.com <mailto:salsaman at gmail.com>> wrote:
>
> There was some post on here a few days ago about it being replaced with AVCodecParameters.
>
> https://ffmpeg.org/doxygen/3.1/structAVCodecParameters.html <https://ffmpeg.org/doxygen/3.1/structAVCodecParameters.html>
>
> So you could try stream->codecparameters
>
> http://lives-video.com
> https://www.openhub.net/accounts/salsaman <https://www.openhub.net/accounts/salsaman>
>
> On Sun, Aug 21, 2016 at 9:27 PM, Brian Brice <bbrice at gmail.com <mailto:bbrice at gmail.com>> wrote:
>
> This is a great question. I'm just now trying to familiarize myself
> with the 3.1 API, and little things like this come up. I'd like to
> know the answer to this as well.
>
> Perette, have you tried the IRC channel?
> chat.freenode.net <http://chat.freenode.net> / #ffmpeg
>
> On Sun, Aug 21, 2016 at 5:00 PM, Perette Barella <perette at barella.org <mailto:perette at barella.org>> wrote:
> > In the structure AVStream, member ‘AVCodecContext *codec’ is marked
> > deprecated, and my use of it is causes compile warnings.
> >
> > avformat_new_stream documentation
> > https://ffmpeg.org/doxygen/3.1/group__lavf__core.html#gadcb0fd3e507d9b58fe78f61f8ad39827
> <https://ffmpeg.org/doxygen/3.1/group__lavf__core.html#gadcb0fd3e507d9b58fe78f61f8ad39827>
> > indicates I’m to "call avcodec_close() and avformat_free_context() to clean
> > up the allocation by avformat_new_stream()”.
> >
> > avcodec_close requires an AVCodecContext, which is in the deprecated
> > “codec”.
> >
> > So what’s the deal? Is there a new way I’m supposed to access this member?
> >
> > Perette
> >
> --
> Brian Brice
> http://heapify.org/
> _______________________________________________
same but different?
AVCodec * codec = avcodec_find_decoder( av_fmt_ctx->streams[ stream_id ]->codecpar->codec_id );
if ( !codec )
[...]
av_codec_ctx = avcodec_alloc_context3( codec );
if ( !av_codec_ctx )
[...]
if ( avcodec_parameters_to_context( av_codec_ctx, av_fmt_ctx->streams[ stream_id ]->codecpar ) < 0 )
Thanks
cco
More information about the Libav-user
mailing list