[Libav-user] New api and deprecation warning

Philippe Gorley philippe.gorley at savoirfairelinux.com
Wed Mar 14 21:43:48 EET 2018


On 2018-03-14 03:26 PM, Michael IV wrote:
> Hi. I am trying to get rid of deprecation warning in the API. I am 
> running with
> ffmpeg -20170711 version. I have a code where I don't explicitly create 
> AVCodecContext
> because I multiplex already existing h264 NALS. But I still have to 
> setup AVStream which has AVCodecContext which it creates internally 
> based on the codec I pass into
> 
> avformat_new_stream
> 
> .So I have something like this then:
> 
> mVideoOutStream->codec->gop_size = muxerParams.gopSize;
> mVideoOutStream->codec->time_base.den = mVideoOutStream->time_base.den;
> mVideoOutStream->codec->time_base.num = mVideoOutStream->time_base.num;
> 
> EYE_ASSERT(mVideoOutStream);
> 
> if (mOutputFormatContext->oformat->flags & AVFMT_GLOBALHEADER)
> {
> mVideoOutStream->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
> }
> 
> Every place I access '->codec->' the compiler says it's deprecated,and 
> the FFMPEG says
> I have to use codecpar instead.But codecpar doesn't have those params. 

For demuxing/decoding:
avcodec_parameters_to_context(codec_ctx, stream->codecpar);

For muxing/encoding:
avcodec_parameters_from_context(stream->codecpar, codec_ctx);

Documentation for these functions can be found here: 
https://www.ffmpeg.org/doxygen/trunk/group__lavc__core.html

doc/examples/transcoding.c shows how to use both.

> What do I do in this case? Create explicitly codec context and assign it 
> to the stream? Looks like newer API has some design gaps > Thanks.
> 
> 
> 
> 
> 
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
> 

-- 
Philippe Gorley
Free Software Consultant | Montréal, Qc
Savoir-faire Linux

Confidentiality Message: This communication (including any files
transmitted with it) is intended solely for the person or entity to
whom it is addressed, and may contain confidential or privileged
information.
The disclosure, distribution or copying of this message is strictly
forbidden. Should you have received this communication in error,
kindly contact the sender promptly, destroy any copies and delete
this message from your computer system.


More information about the Libav-user mailing list