decoder: propagate MVC metadata ("view-id", head of multiview set).

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".
This commit is contained in:
Gwenole Beauchesne 2014-06-30 19:01:35 +02:00
parent 70a48e0962
commit 702de9ad2f
4 changed files with 53 additions and 0 deletions

View 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))

View 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;
@ -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

View 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;
@ -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);

View file

@ -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