summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWang,Fei <fei.w.wang@intel.com>2018-03-13 13:54:17 -0800
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>2018-03-13 13:54:17 -0800
commit0c69867d523a560c6ca55afdb2880a62abcab632 (patch)
tree381898cad7e3136724737e1dfb60efffff3cd5ee
parent84da104b06c67ab625cbb9b024f5ffb64b3cce5f (diff)
downloadgstreamer-plugins-bad-0c69867d523a560c6ca55afdb2880a62abcab632.tar.gz
msdk: Fix the I420 video format support
Make sure I420 surface mapping works as expected by using YV12 format and swap U/V plane's offset and pitches. https://bugzilla.gnome.org/show_bug.cgi?id=793865
-rw-r--r--sys/msdk/gstmsdkvideomemory.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/msdk/gstmsdkvideomemory.c b/sys/msdk/gstmsdkvideomemory.c
index 2951b8037..ab02ab9d7 100644
--- a/sys/msdk/gstmsdkvideomemory.c
+++ b/sys/msdk/gstmsdkvideomemory.c
@@ -136,6 +136,7 @@ gst_video_meta_map_msdk_memory (GstVideoMeta * meta, guint plane,
GstMsdkMemoryID *mem_id;
guint offset = 0;
gint pitch = 0;
+ guint plane_id = plane;
g_return_val_if_fail (mem, FALSE);
@@ -165,9 +166,14 @@ gst_video_meta_map_msdk_memory (GstVideoMeta * meta, guint plane,
mem->mapped++;
mem_id = mem->surface->Data.MemId;
+ /* msdk doesn't support I420 format and we used YV12 internally
+ * So we need to swap U/V planes for mapping */
+ if (meta->format == GST_VIDEO_FORMAT_I420)
+ plane_id = plane ? (plane == 1 ? 2 : 1) : plane;
+
#ifndef _WIN32
- offset = mem_id->image.offsets[plane];
- pitch = mem_id->image.pitches[plane];
+ offset = mem_id->image.offsets[plane_id];
+ pitch = mem_id->image.pitches[plane_id];
#else
/* TODO: This is just to avoid compile errors on Windows.
* Implement handling Windows-specific video-memory.