decoder: propagate MVC metadata ("view-id", head of multiview set).
authorGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 17:01:35 +0000 (19:01 +0200)
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>
Mon, 30 Jun 2014 17:13:25 +0000 (19:13 +0200)
Add new GstVaapiSurfaceProxy flag FFB, which means "first frame in
bundle", and really expresses the first view component of a multi
view coded frame. e.g. in H.264 MVC, the surface proxy has flag FFB
set if VOIdx = 0.

Likewise, new API is exposed to retrieve the associated "view-id".

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

index 76bc79d..516ff69 100644 (file)
@@ -332,6 +332,12 @@ do_output (GstVaapiPicture * picture)
     GST_VIDEO_CODEC_FRAME_FLAG_SET (out_frame,
         GST_VIDEO_CODEC_FRAME_FLAG_DECODE_ONLY);
 
+  if (GST_VAAPI_PICTURE_IS_MVC (picture)) {
+    if (picture->voc == 0)
+      flags |= GST_VAAPI_SURFACE_PROXY_FLAG_FFB;
+    GST_VAAPI_SURFACE_PROXY_VIEW_ID (proxy) = picture->view_id;
+  }
+
   if (GST_VAAPI_PICTURE_IS_INTERLACED (picture)) {
     flags |= GST_VAAPI_SURFACE_PROXY_FLAG_INTERLACED;
     if (GST_VAAPI_PICTURE_IS_TFF (picture))
index cb014da..ab8f508 100644 (file)
@@ -91,6 +91,7 @@ gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool)
     proxy->surface = gst_vaapi_video_pool_get_object(proxy->pool);
     if (!proxy->surface)
         goto error;
+    proxy->view_id = 0;
     proxy->timestamp = GST_CLOCK_TIME_NONE;
     proxy->duration = GST_CLOCK_TIME_NONE;
     proxy->has_crop_rect = FALSE;
@@ -246,6 +247,22 @@ gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy)
 }
 
 /**
+ * gst_vaapi_surface_proxy_get_view_id:
+ * @proxy: a #GstVaapiSurfaceProxy
+ *
+ * Returns the decoded view-id stored in the @proxy.
+ *
+ * Return value: the #GstVaapiID
+ */
+guintptr
+gst_vaapi_surface_proxy_get_view_id(GstVaapiSurfaceProxy *proxy)
+{
+    g_return_val_if_fail(proxy != NULL, 0);
+
+    return GST_VAAPI_SURFACE_PROXY_VIEW_ID(proxy);
+}
+
+/**
  * gst_vaapi_surface_proxy_get_timestamp:
  * @proxy: a #GstVaapiSurfaceProxy
  *
index 1b05af0..b36be5d 100644 (file)
@@ -36,6 +36,8 @@ G_BEGIN_DECLS
  * @GST_VAAPI_SURFACE_PROXY_FLAG_TFF: top-field-first
  * @GST_VAAPI_SURFACE_PROXY_FLAG_RFF: repeat-field-first
  * @GST_VAAPI_SURFACE_PROXY_FLAG_ONEFIELD: only one field is available
+ * @GST_VAAPI_SURFACE_PROXY_FLAG_FFB: first frame in bundle, e.g. the first
+ *   view component of a MultiView Coded (MVC) frame
  * @GST_VAAPI_SURFACE_PROXY_FLAG_LAST: first flag that can be used by subclasses
  *
  * Flags for #GstVaapiDecoderFrame.
@@ -45,6 +47,7 @@ typedef enum {
     GST_VAAPI_SURFACE_PROXY_FLAG_TFF            = (1 << 1),
     GST_VAAPI_SURFACE_PROXY_FLAG_RFF            = (1 << 2),
     GST_VAAPI_SURFACE_PROXY_FLAG_ONEFIELD       = (1 << 3),
+    GST_VAAPI_SURFACE_PROXY_FLAG_FFB            = (1 << 4),
     GST_VAAPI_SURFACE_PROXY_FLAG_LAST           = (1 << 8)
 } GstVaapiSurfaceProxyFlags;
 
@@ -68,6 +71,16 @@ typedef enum {
     gst_vaapi_surface_proxy_get_surface_id(proxy)
 
 /**
+ * GST_VAAPI_SURFACE_PROXY_VIEW_ID:
+ * @proxy: a #GstVaapiSurfaceProxy
+ *
+ * Macro that evaluates to the decoded view ID of the underlying @proxy
+ * surface.
+ */
+#define GST_VAAPI_SURFACE_PROXY_VIEW_ID(proxy) \
+    gst_vaapi_surface_proxy_get_view_id(proxy)
+
+/**
  * GST_VAAPI_SURFACE_PROXY_TIMESTAMP:
  * @proxy: a #GstVaapiSurfaceProxy
  *
@@ -112,6 +125,9 @@ gst_vaapi_surface_proxy_get_surface(GstVaapiSurfaceProxy *proxy);
 GstVaapiID
 gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy);
 
+guintptr
+gst_vaapi_surface_proxy_get_view_id(GstVaapiSurfaceProxy *proxy);
+
 GstClockTime
 gst_vaapi_surface_proxy_get_timestamp(GstVaapiSurfaceProxy *proxy);
 
index a74cddf..2404399 100644 (file)
@@ -40,6 +40,7 @@ struct _GstVaapiSurfaceProxy {
 
     GstVaapiVideoPool  *pool;
     GstVaapiSurface    *surface;
+    guintptr            view_id;
     GstClockTime        timestamp;
     GstClockTime        duration;
     GDestroyNotify      destroy_func;
@@ -78,6 +79,19 @@ struct _GstVaapiSurfaceProxy {
     GST_VAAPI_OBJECT_ID(GST_VAAPI_SURFACE_PROXY(proxy)->surface)
 
 /**
+ * GST_VAAPI_SURFACE_PROXY_VIEW_ID:
+ * @proxy: a #GstVaapiSurfaceProxy
+ *
+ * Macro that evaluates to the decoded view ID of the underlying @proxy
+ * surface.
+ *
+ * This is an internal macro that does not do any run-time type check.
+ */
+#undef  GST_VAAPI_SURFACE_PROXY_VIEW_ID
+#define GST_VAAPI_SURFACE_PROXY_VIEW_ID(proxy) \
+    GST_VAAPI_SURFACE_PROXY(proxy)->view_id
+
+/**
  * GST_VAAPI_SURFACE_PROXY_TIMESTAMP:
  * @proxy: a #GstVaapiSurfaceProxy
  *