Browse Source

avcodec: fix libavutil version check for av_channel_layout_default()

It was added in c41899a3770cb4510e15b223fa34d129305b1589 which
was libavutil 57.23.100 at the time but the minor version was not updated in
that commit so we check 57.24.100.

The same check applies for av_channel_layout_copy() added in the same commit.

This is part of FFmpeg 5.1.

086a804806
pull/162/head
Steve Lhomme 2 years ago
parent
commit
195f0c9859
  1. 8
      modules/codec/avcodec/encoder.c
  2. 2
      modules/demux/avformat/mux.c

8
modules/codec/avcodec/encoder.c

@ -778,7 +778,7 @@ int InitVideoEnc( vlc_object_t *p_this )
int i_channels_src = 0;
msg_Dbg( p_enc, "Creating channel order for reordering");
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
av_channel_layout_default( &p_context->ch_layout, p_enc->fmt_out.audio.i_channels );
uint64_t channel_mask = p_context->ch_layout.u.mask;
#else
@ -933,7 +933,7 @@ errmsg:
if( p_enc->fmt_out.audio.i_channels > 2 )
{
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
av_channel_layout_default( &p_context->ch_layout, 2 );
#else
p_context->channels = 2;
@ -1298,7 +1298,7 @@ static block_t *handle_delay_buffer( encoder_t *p_enc, encoder_sys_t *p_sys, uns
av_frame_unref( p_sys->frame );
p_sys->frame->format = p_sys->p_context->sample_fmt;
p_sys->frame->nb_samples = leftover_samples + p_sys->i_samples_delay;
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
#else
p_sys->frame->channel_layout = p_sys->p_context->channel_layout;
@ -1432,7 +1432,7 @@ static block_t *EncodeAudio( encoder_t *p_enc, block_t *p_aout_buf )
else
p_sys->frame->nb_samples = p_sys->i_frame_size;
p_sys->frame->format = p_sys->p_context->sample_fmt;
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100) && LIBAVUTIL_VERSION_CHECK(57, 24, 100)
av_channel_layout_copy(&p_sys->frame->ch_layout, &p_sys->p_context->ch_layout);
#else
p_sys->frame->channel_layout = p_sys->p_context->channel_layout;

2
modules/demux/avformat/mux.c

@ -271,7 +271,7 @@ static int AddStream( sout_mux_t *p_mux, sout_input_t *p_input )
{
case AUDIO_ES:
codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
#if LIBAVCODEC_VERSION_CHECK(59, 24, 100)
#if LIBAVUTIL_VERSION_CHECK(57, 24, 100)
av_channel_layout_default( &codecpar->ch_layout, fmt->audio.i_channels );
#else
codecpar->channels = fmt->audio.i_channels;

Loading…
Cancel
Save