[Libav-user] New api and deprecation warning

Michael IV explomaster at gmail.com
Wed Mar 14 22:18:27 EET 2018


Hi  Philippe!

These two,for example are super confusing:

avcodec_parameters_from_context(mAudioOutStream->codecpar,
inStream->codec)

avcodec_parameters_to_context(mAudioOutStream->codec, inStream->codecpar)

In my case the first option didn't copy everything ,I had to add props
manually for the muxer to work. The second  function is better. I didn't
have to manually copy params after calling it.
But looking at the signatures of these two methods it is hard to understand
which to use when.
So you wrote the second one is used for demuxing. In my case I actually do
muxing of input inStream into  mAudioOutStream... So I don't get it.




On Wed, Mar 14, 2018 at 9:52 PM Michael IV <explomaster at gmail.com> wrote:

> Exactly:
>
>
> *For muxing/encoding:avcodec_parameters_from_context(stream->codecpar,
> codec_ctx); *
>
> That's what I am talking about.In my case ,codec_ctx is context I access
> from the input stream.
> I don't create it. So the deprecation warning is appears in this case. I
> don't see why I have to
> create codec context just to get rid of those warnings.
>
>
>
> On Wed, Mar 14, 2018 at 9:44 PM Philippe Gorley <
> philippe.gorley at savoirfairelinux.com> wrote:
>
>> 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.
>> _______________________________________________
>> Libav-user mailing list
>> Libav-user at ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/libav-user
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20180314/08d66489/attachment.html>


More information about the Libav-user mailing list