[Libav-user] AVStream->codec deprecation

Perette Barella perette at barella.org
Mon Aug 22 04:44:18 EEST 2016


On 2016年08月21日, at 21:31, salsaman <salsaman at gmail.com> wrote:
> 
> Here we go, I can answer definitively now:
> 
> https://ffmpeg.org/doxygen/3.1/ffplay_8c_source.html <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>;

You are explaining what replaces codec parameter setting, which I have already familiarized myself with.  This does not answer the question I originally asked, which is how I am to call avcodec_close (and other functions) which require an AVCodecContext, when that field is deprecated.  Using avformat_new_stream’s docucomments specify these calls are necessary to clean up when done with the stream.

Perette

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20160821/ee338f07/attachment.html>


More information about the Libav-user mailing list