videoconvert: pass frame interlaced flag to pack/unpack
authorWim Taymans <wim.taymans@collabora.co.uk>
Mon, 4 Feb 2013 14:19:35 +0000 (15:19 +0100)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 4 Feb 2013 14:19:35 +0000 (15:19 +0100)
If the frame is interlaced, pass the interlaced flag to the pack/unpack
functions to make it unpack correctly.

gst/videoconvert/videoconvert.c

index dcb73da..676bede 100644 (file)
@@ -369,12 +369,20 @@ videoconvert_dither_halftone (VideoConvert * convert, guint16 * pixels, int j)
 
 #define TO_16(x) (((x)<<8) | (x))
 
-#define UNPACK_FRAME(frame,dest,line,width) \
-  frame->info.finfo->unpack_func (frame->info.finfo, GST_VIDEO_PACK_FLAG_NONE, \
-      dest, frame->data, frame->info.stride, 0, line, width)
-#define PACK_FRAME(frame,dest,line,width) \
-  frame->info.finfo->pack_func (frame->info.finfo, GST_VIDEO_PACK_FLAG_NONE, \
-      dest, 0, frame->data, frame->info.stride, frame->info.chroma_site, line, width);
+#define UNPACK_FRAME(frame,dest,line,width)          \
+  frame->info.finfo->unpack_func (frame->info.finfo, \
+      (GST_VIDEO_FRAME_IS_INTERLACED (frame) ?       \
+        GST_VIDEO_PACK_FLAG_INTERLACED :             \
+        GST_VIDEO_PACK_FLAG_NONE),                   \
+      dest, frame->data, frame->info.stride, 0,      \
+      line, width)
+#define PACK_FRAME(frame,dest,line,width)            \
+  frame->info.finfo->pack_func (frame->info.finfo,   \
+      (GST_VIDEO_FRAME_IS_INTERLACED (frame) ?       \
+        GST_VIDEO_PACK_FLAG_INTERLACED :             \
+        GST_VIDEO_PACK_FLAG_NONE),                   \
+      dest, 0, frame->data, frame->info.stride,      \
+      frame->info.chroma_site, line, width);
 
 static void
 videoconvert_convert_generic (VideoConvert * convert, GstVideoFrame * dest,