diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-12-12 13:04:38 +0000 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-12-12 13:04:38 +0000 |
commit | 1bec18edce7b7cf639807218dc0f12dc590ae306 (patch) | |
tree | 29a52d8d717bcf0681400738b9f10a386a9bfc1f /ext/libav/gstavauddec.c | |
parent | 338b147374f4e4557b532c89b9eb6b6b907fa955 (diff) | |
download | gst-libav-1bec18edce7b7cf639807218dc0f12dc590ae306.tar.gz |
avauddec: Properly handle planar audio formats with more than AV_NUM_DATA_POINTERS channels
Diffstat (limited to 'ext/libav/gstavauddec.c')
-rw-r--r-- | ext/libav/gstavauddec.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/ext/libav/gstavauddec.c b/ext/libav/gstavauddec.c index 5ed9eae..c179563 100644 --- a/ext/libav/gstavauddec.c +++ b/ext/libav/gstavauddec.c @@ -252,6 +252,7 @@ gst_ffmpegauddec_get_buffer (AVCodecContext * context, AVFrame * frame) gst_buffer_map (buffer_info->buffer, &buffer_info->map, GST_MAP_WRITE); frame->opaque = buffer_info; frame->data[0] = buffer_info->map.data; + frame->extended_data = frame->data; frame->linesize[0] = buffer_info->map.size; frame->type = FF_BUFFER_TYPE_USER; @@ -454,7 +455,8 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, gst_buffer_unmap (buffer_info->buffer, &buffer_info->map); g_slice_free (BufferInfo, buffer_info); frame.opaque = NULL; - } else if (av_sample_fmt_is_planar (ffmpegdec->context->sample_fmt)) { + } else if (av_sample_fmt_is_planar (ffmpegdec->context->sample_fmt) + && ffmpegdec->info.channels > 1) { gint i, j; gint nsamples, channels; GstMapInfo minfo; @@ -466,6 +468,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, (ffmpegdec), frame.linesize[0] * channels); gst_buffer_map (*outbuf, &minfo, GST_MAP_WRITE); + nsamples = frame.nb_samples; switch (ffmpegdec->info.finfo->width) { case 8:{ @@ -473,7 +476,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, for (i = 0; i < nsamples; i++) { for (j = 0; j < channels; j++) { - odata[j] = ((const guint8 *) frame.data[j])[i]; + odata[j] = ((const guint8 *) frame.extended_data[j])[i]; } odata += channels; } @@ -484,7 +487,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, for (i = 0; i < nsamples; i++) { for (j = 0; j < channels; j++) { - odata[j] = ((const guint16 *) frame.data[j])[i]; + odata[j] = ((const guint16 *) frame.extended_data[j])[i]; } odata += channels; } @@ -495,7 +498,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, for (i = 0; i < nsamples; i++) { for (j = 0; j < channels; j++) { - odata[j] = ((const guint32 *) frame.data[j])[i]; + odata[j] = ((const guint32 *) frame.extended_data[j])[i]; } odata += channels; } @@ -506,7 +509,7 @@ gst_ffmpegauddec_audio_frame (GstFFMpegAudDec * ffmpegdec, for (i = 0; i < nsamples; i++) { for (j = 0; j < channels; j++) { - odata[j] = ((const guint64 *) frame.data[j])[i]; + odata[j] = ((const guint64 *) frame.extended_data[j])[i]; } odata += channels; } |