auddec: stop using deprecated getters

https://bugzilla.gnome.org/show_bug.cgi?id=792900
This commit is contained in:
Mathieu Duponchelle 2018-06-29 21:46:00 +02:00
parent 2ec542f7c2
commit 1035d6c820

View file

@ -356,15 +356,14 @@ static gboolean
settings_changed (GstFFMpegAudDec * ffmpegdec, AVFrame * frame) settings_changed (GstFFMpegAudDec * ffmpegdec, AVFrame * frame)
{ {
GstAudioFormat format; GstAudioFormat format;
gint channels = gint channels = av_get_channel_layout_nb_channels (frame->channel_layout);
av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame));
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); format = gst_ffmpeg_smpfmt_to_audioformat (frame->format);
if (format == GST_AUDIO_FORMAT_UNKNOWN) if (format == GST_AUDIO_FORMAT_UNKNOWN)
return TRUE; return TRUE;
return !(ffmpegdec->info.rate == return !(ffmpegdec->info.rate ==
av_frame_get_sample_rate (frame) && frame->sample_rate &&
ffmpegdec->info.channels == channels && ffmpegdec->info.channels == channels &&
ffmpegdec->info.finfo->format == format); ffmpegdec->info.finfo->format == format);
} }
@ -383,10 +382,9 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); format = gst_ffmpeg_smpfmt_to_audioformat (frame->format);
if (format == GST_AUDIO_FORMAT_UNKNOWN) if (format == GST_AUDIO_FORMAT_UNKNOWN)
goto no_caps; goto no_caps;
channels = channels = av_get_channel_layout_nb_channels (frame->channel_layout);
av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame));
if (channels == 0) if (channels == 0)
channels = av_frame_get_channels (frame); channels = frame->channels;
if (channels == 0) if (channels == 0)
goto no_caps; goto no_caps;
@ -396,11 +394,9 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
GST_DEBUG_OBJECT (ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec,
"Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)", "Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)",
ffmpegdec->info.rate, ffmpegdec->info.channels, ffmpegdec->info.rate, ffmpegdec->info.channels,
ffmpegdec->info.finfo->format, av_frame_get_sample_rate (frame), channels, ffmpegdec->info.finfo->format, frame->sample_rate, channels, format);
format);
gst_ffmpeg_channel_layout_to_gst (av_frame_get_channel_layout (frame), gst_ffmpeg_channel_layout_to_gst (frame->channel_layout, channels, pos);
channels, pos);
memcpy (ffmpegdec->ffmpeg_layout, pos, memcpy (ffmpegdec->ffmpeg_layout, pos,
sizeof (GstAudioChannelPosition) * channels); sizeof (GstAudioChannelPosition) * channels);
@ -409,7 +405,7 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec,
ffmpegdec->needs_reorder = ffmpegdec->needs_reorder =
memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0; memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0;
gst_audio_info_set_format (&ffmpegdec->info, format, gst_audio_info_set_format (&ffmpegdec->info, format,
av_frame_get_sample_rate (frame), channels, pos); frame->sample_rate, channels, pos);
if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec), if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec),
&ffmpegdec->info)) &ffmpegdec->info))