diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c index 76bc79df44..516ff69cb0 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder_objects.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder_objects.c @@ -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)) diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c index cb014dae68..ab8f508a73 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.c @@ -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; @@ -245,6 +246,22 @@ gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy) return GST_VAAPI_SURFACE_PROXY_SURFACE_ID(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 diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h index 1b05af0b94..b36be5db43 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy.h @@ -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; @@ -67,6 +70,16 @@ typedef enum { #define GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) \ 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); diff --git a/gst-libs/gst/vaapi/gstvaapisurfaceproxy_priv.h b/gst-libs/gst/vaapi/gstvaapisurfaceproxy_priv.h index a74cddf768..24043994dc 100644 --- a/gst-libs/gst/vaapi/gstvaapisurfaceproxy_priv.h +++ b/gst-libs/gst/vaapi/gstvaapisurfaceproxy_priv.h @@ -40,6 +40,7 @@ struct _GstVaapiSurfaceProxy { GstVaapiVideoPool *pool; GstVaapiSurface *surface; + guintptr view_id; GstClockTime timestamp; GstClockTime duration; GDestroyNotify destroy_func; @@ -77,6 +78,19 @@ struct _GstVaapiSurfaceProxy { #define GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) \ 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