decoder: propagate "one-field" flags.
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 16:46:45 +0000 (18:46 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 17:13:25 +0000 (19:13 +0200)
Allow decoders to set the "one-field" attribute when the decoded frame
genuinely has a single field, or if the second field was mis-decoded but
we still want to display the first field.

gst-libs/gst/vaapi/gstvaapidecoder_objects.c
gst-libs/gst/vaapi/gstvaapidecoder_objects.h

index edd9a62..76bc79d 100644 (file)
@@ -336,6 +336,8 @@ do_output (GstVaapiPicture * picture)
     flags |= GST_VAAPI_SURFACE_PROXY_FLAG_INTERLACED;
     if (GST_VAAPI_PICTURE_IS_TFF (picture))
       flags |= GST_VAAPI_SURFACE_PROXY_FLAG_TFF;
+    if (GST_VAAPI_PICTURE_IS_ONEFIELD (picture))
+      flags |= GST_VAAPI_SURFACE_PROXY_FLAG_ONEFIELD;
   }
   GST_VAAPI_SURFACE_PROXY_FLAG_SET (proxy, flags);
 
index e2790cb..6499574 100644 (file)
@@ -65,6 +65,7 @@ typedef enum
  * @GST_VAAPI_PICTURE_FLAG_INTERLACED: interlaced frame
  * @GST_VAAPI_PICTURE_FLAG_FF: first-field
  * @GST_VAAPI_PICTURE_FLAG_TFF: top-field-first
+ * @GST_VAAPI_PICTURE_FLAG_ONEFIELD: only one field is valid
  * @GST_VAAPI_PICTURE_FLAG_MVC: multiview component
  * @GST_VAAPI_PICTURE_FLAG_LAST: first flag that can be used by subclasses
  *
@@ -78,8 +79,9 @@ typedef enum
   GST_VAAPI_PICTURE_FLAG_INTERLACED = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 3),
   GST_VAAPI_PICTURE_FLAG_FF         = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 4),
   GST_VAAPI_PICTURE_FLAG_TFF        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 5),
-  GST_VAAPI_PICTURE_FLAG_MVC        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 6),
-  GST_VAAPI_PICTURE_FLAG_LAST       = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 7),
+  GST_VAAPI_PICTURE_FLAG_ONEFIELD   = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 6),
+  GST_VAAPI_PICTURE_FLAG_MVC        = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 7),
+  GST_VAAPI_PICTURE_FLAG_LAST       = (GST_VAAPI_CODEC_OBJECT_FLAG_LAST << 8),
 } GstVaapiPictureFlags;
 
 #define GST_VAAPI_PICTURE_FLAGS         GST_VAAPI_MINI_OBJECT_FLAGS
@@ -105,12 +107,16 @@ typedef enum
 #define GST_VAAPI_PICTURE_IS_TFF(picture) \
   GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_TFF)
 
+#define GST_VAAPI_PICTURE_IS_ONEFIELD(picture) \
+  GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_ONEFIELD)
+
 #define GST_VAAPI_PICTURE_IS_FRAME(picture) \
   (GST_VAAPI_PICTURE (picture)->structure == GST_VAAPI_PICTURE_STRUCTURE_FRAME)
 
 #define GST_VAAPI_PICTURE_IS_COMPLETE(picture)          \
   (GST_VAAPI_PICTURE_IS_FRAME (picture) ||              \
-      !GST_VAAPI_PICTURE_IS_FIRST_FIELD (picture))
+   GST_VAAPI_PICTURE_IS_ONEFIELD (picture) ||           \
+   !GST_VAAPI_PICTURE_IS_FIRST_FIELD (picture))
 
 #define GST_VAAPI_PICTURE_IS_MVC(picture) \
   (GST_VAAPI_PICTURE_FLAG_IS_SET (picture, GST_VAAPI_PICTURE_FLAG_MVC))