From 7afaf5c02050fcac18006abfdc01287f8dba16eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Olivier=20Cr=C3=AAte?= Date: Sat, 25 Jul 2015 03:05:25 -0400 Subject: [PATCH] avauddec: Access field using accessors Those fields are documented to only be safe to access using accessors as their position is not part of the ABI. --- ext/libav/gstavauddec.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index baca8fc401..360d168719 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -351,14 +351,15 @@ static gboolean settings_changed (GstFFMpegAudDec * ffmpegdec, AVFrame * frame) { GstAudioFormat format; - gint channels = av_get_channel_layout_nb_channels (frame->channel_layout); + gint channels = + av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame)); format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); if (format == GST_AUDIO_FORMAT_UNKNOWN) return TRUE; return !(ffmpegdec->info.rate == - frame->sample_rate && + av_frame_get_sample_rate (frame) && ffmpegdec->info.channels == channels && ffmpegdec->info.finfo->format == format); } @@ -377,7 +378,8 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, format = gst_ffmpeg_smpfmt_to_audioformat (frame->format); if (format == GST_AUDIO_FORMAT_UNKNOWN) goto no_caps; - channels = av_get_channel_layout_nb_channels (frame->channel_layout); + channels = + av_get_channel_layout_nb_channels (av_frame_get_channel_layout (frame)); if (channels == 0) goto no_caps; @@ -387,9 +389,11 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, GST_DEBUG_OBJECT (ffmpegdec, "Renegotiating audio from %dHz@%dchannels (%d) to %dHz@%dchannels (%d)", ffmpegdec->info.rate, ffmpegdec->info.channels, - ffmpegdec->info.finfo->format, frame->sample_rate, channels, format); + ffmpegdec->info.finfo->format, av_frame_get_sample_rate (frame), channels, + format); - gst_ffmpeg_channel_layout_to_gst (frame->channel_layout, channels, pos); + gst_ffmpeg_channel_layout_to_gst (av_frame_get_channel_layout (frame), + channels, pos); memcpy (ffmpegdec->ffmpeg_layout, pos, sizeof (GstAudioChannelPosition) * channels); @@ -398,7 +402,7 @@ gst_ffmpegauddec_negotiate (GstFFMpegAudDec * ffmpegdec, ffmpegdec->needs_reorder = memcmp (pos, ffmpegdec->ffmpeg_layout, sizeof (pos[0]) * channels) != 0; gst_audio_info_set_format (&ffmpegdec->info, format, - frame->sample_rate, channels, pos); + av_frame_get_sample_rate (frame), channels, pos); if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (ffmpegdec), &ffmpegdec->info))