diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-09-11 16:30:00 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-10-15 16:28:40 +0200 |
commit | 3acc776dd6d221e5247b4fee37ec394bd6a54ddb (patch) | |
tree | e2c48101043152004bf375ebf0af0ca56882f1fe /sys/androidmedia | |
parent | 266bc5bf69b3ed8406dc915e2b6c1c7716bbb68e (diff) | |
download | gstreamer-plugins-bad-3acc776dd6d221e5247b4fee37ec394bd6a54ddb.tar.gz |
Really implement stride conversion for NV12 too
Diffstat (limited to 'sys/androidmedia')
-rw-r--r-- | sys/androidmedia/gstamcvideodec.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/sys/androidmedia/gstamcvideodec.c b/sys/androidmedia/gstamcvideodec.c index ef6050f87..0539329d4 100644 --- a/sys/androidmedia/gstamcvideodec.c +++ b/sys/androidmedia/gstamcvideodec.c @@ -701,6 +701,7 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx, if (buffer_info->size == GST_BUFFER_SIZE (outbuf)) { memcpy (GST_BUFFER_DATA (outbuf), buf->data + buffer_info->offset, buffer_info->size); + ret = TRUE; goto done; } @@ -749,8 +750,44 @@ gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, gint idx, case COLOR_FormatYUV420SemiPlanar: case COLOR_TI_FormatYUV420PackedSemiPlanar: case COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced: - case COLOR_QCOM_FormatYUV420SemiPlanar: + case COLOR_QCOM_FormatYUV420SemiPlanar:{ + gint i, j, height; + guint8 *src, *dest; + gint src_stride, dest_stride; + + for (i = 0; i < 2; i++) { + if (i == 0) { + src_stride = self->stride; + dest_stride = GST_VIDEO_INFO_COMP_STRIDE (info, i); + + /* XXX: Try this if no stride was set */ + if (src_stride == 0) + src_stride = dest_stride; + } else { + src_stride = self->stride / 2; + dest_stride = GST_VIDEO_INFO_COMP_STRIDE (info, i); + + /* XXX: Try this if no stride was set */ + if (src_stride == 0) + src_stride = dest_stride; + } + + src = buf->data + buffer_info->offset; + if (i == 1) + src += self->slice_height * self->stride; + + dest = GST_BUFFER_DATA (outbuf) + GST_VIDEO_INFO_COMP_OFFSET (info, i); + height = GST_VIDEO_INFO_COMP_HEIGHT (info, i); + + for (j = 0; j < height; j++) { + memcpy (dest, src, MIN (src_stride, dest_stride)); + src += src_stride; + dest += dest_stride; + } + } + ret = TRUE; break; + } default: GST_ERROR_OBJECT (self, "Unsupported color format %d", self->color_format); |