surfaceproxy: add more attributes for raw decoding modes.

Add more attributes for raw decoding modes, i.e. directly through the
libgstvaapi helper library. In particular, add presentation timestamp,
duration and a couple of flags (interlaced, TFF, RFF, one-field).
This commit is contained in:
Gwenole Beauchesne 2013-04-16 18:35:48 +02:00
parent 0bd929dfa2
commit c7dff071c7
5 changed files with 225 additions and 26 deletions

View file

@ -521,8 +521,11 @@ GST_VAAPI_DECODER_VC1_GET_CLASS
<SECTION>
<FILE>gstvaapisurfaceproxy</FILE>
<TITLE>GstVaapiSurfaceProxy</TITLE>
gst_vaapi_surface_proxy_get_duration
gst_vaapi_surface_proxy_get_flags
gst_vaapi_surface_proxy_get_surface
gst_vaapi_surface_proxy_get_surface_id
gst_vaapi_surface_proxy_get_timestamp
gst_vaapi_surface_proxy_new_from_pool
gst_vaapi_surface_proxy_ref
gst_vaapi_surface_proxy_replace

View file

@ -113,6 +113,7 @@ libgstvaapi_source_priv_h = \
gstvaapiminiobject.h \
gstvaapiobject_priv.h \
gstvaapisurface_priv.h \
gstvaapisurfaceproxy_priv.h \
gstvaapiutils.h \
gstvaapiversion.h \
gstvaapiworkarounds.h \

View file

@ -27,28 +27,11 @@
#include "sysdeps.h"
#include "gstvaapisurfaceproxy.h"
#include "gstvaapiobject_priv.h"
#include "gstvaapiminiobject.h"
#include "gstvaapisurfaceproxy_priv.h"
#define DEBUG 1
#include "gstvaapidebug.h"
#define GST_VAAPI_SURFACE_PROXY(obj) \
((GstVaapiSurfaceProxy *)(obj))
#define GST_VAAPI_IS_SURFACE_PROXY(obj) \
(GST_VAAPI_SURFACE_PROXY(obj) != NULL)
struct _GstVaapiSurfaceProxy {
/*< private >*/
GstVaapiMiniObject parent_instance;
GstVaapiVideoPool *pool;
GstVaapiSurface *surface;
GDestroyNotify destroy_func;
gpointer destroy_data;
};
static void
gst_vaapi_surface_proxy_finalize(GstVaapiSurfaceProxy *proxy)
{
@ -86,10 +69,12 @@ gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool)
if (!proxy)
return NULL;
proxy->pool = g_object_ref(pool);
proxy->pool = g_object_ref(pool);
proxy->surface = gst_vaapi_video_pool_get_object(proxy->pool);
if (!proxy->surface)
goto error;
proxy->timestamp = GST_CLOCK_TIME_NONE;
proxy->duration = GST_CLOCK_TIME_NONE;
proxy->destroy_func = NULL;
g_object_ref(proxy->surface);
return proxy;
@ -163,7 +148,24 @@ gst_vaapi_surface_proxy_get_surface(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), NULL);
return proxy->surface;
return GST_VAAPI_SURFACE_PROXY_SURFACE(proxy);
}
/**
* gst_vaapi_surface_proxy_get_flags:
* @proxy: a #GstVaapiSurfaceProxy
*
* Returns the #GstVaapiSurfaceProxyFlags associated with this surface
* @proxy.
*
* Return value: the set of #GstVaapiSurfaceProxyFlags
*/
guint
gst_vaapi_surface_proxy_get_flags(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), 0);
return GST_VAAPI_SURFACE_PROXY_FLAGS(proxy);
}
/**
@ -180,7 +182,39 @@ gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy)
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), GST_VAAPI_ID_NONE);
g_return_val_if_fail(proxy->surface != NULL, GST_VAAPI_ID_NONE);
return GST_VAAPI_OBJECT_ID(proxy->surface);
return GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy);
}
/**
* gst_vaapi_surface_proxy_get_timestamp:
* @proxy: a #GstVaapiSurfaceProxy
*
* Returns the presentation timestamp for this surface @proxy.
*
* Return value: the presentation timestamp
*/
GstClockTime
gst_vaapi_surface_proxy_get_timestamp(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), 0);
return GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy);
}
/**
* gst_vaapi_surface_proxy_get_duration:
* @proxy: a #GstVaapiSurfaceProxy
*
* Returns the presentation duration for this surface @proxy.
*
* Return value: the presentation duration
*/
GstClockTime
gst_vaapi_surface_proxy_get_duration(GstVaapiSurfaceProxy *proxy)
{
g_return_val_if_fail(GST_VAAPI_IS_SURFACE_PROXY(proxy), 0);
return GST_VAAPI_SURFACE_PROXY_DURATION(proxy);
}
/**

View file

@ -29,13 +29,61 @@
G_BEGIN_DECLS
/**
* GST_VAAPI_SURFACE_PROXY_SURFACE:
* @surface: a #GstVaapiSurfaceProxy
* GstVaapiSurfaceProxyFlags:
* @GST_VAAPI_SURFACE_PROXY_FLAG_INTERLACED: interlaced frame
* @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_LAST: first flag that can be used by subclasses
*
* Macro that evaluates to the #GstVaapiSurface of @surface.
* Flags for #GstVaapiDecoderFrame.
*/
#define GST_VAAPI_SURFACE_PROXY_SURFACE(surface) \
gst_vaapi_surface_proxy_get_surface(surface)
typedef enum {
GST_VAAPI_SURFACE_PROXY_FLAG_INTERLACED = (1 << 0),
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_LAST = (1 << 8)
} GstVaapiSurfaceProxyFlags;
/**
* GST_VAAPI_SURFACE_PROXY_SURFACE:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the #GstVaapiSurface of @proxy.
*/
#define GST_VAAPI_SURFACE_PROXY_SURFACE(proxy) \
gst_vaapi_surface_proxy_get_surface(proxy)
/**
* GST_VAAPI_SURFACE_PROXY_SURFACE_ID:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the VA surface ID of the underlying @proxy
* surface.
*/
#define GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) \
gst_vaapi_surface_proxy_get_surface_id(proxy)
/**
* GST_VAAPI_SURFACE_PROXY_TIMESTAMP:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the presentation timestamp of the
* underlying @proxy surface.
*/
#define GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy) \
gst_vaapi_surface_proxy_get_timestamp(proxy)
/**
* GST_VAAPI_SURFACE_PROXY_DURATION:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the presentation duration of the
* underlying @proxy surface.
*/
#define GST_VAAPI_SURFACE_PROXY_DURATION(proxy) \
gst_vaapi_surface_proxy_get_duration(proxy)
GstVaapiSurfaceProxy *
gst_vaapi_surface_proxy_new_from_pool(GstVaapiSurfacePool *pool);
@ -50,12 +98,21 @@ void
gst_vaapi_surface_proxy_replace(GstVaapiSurfaceProxy **old_proxy_ptr,
GstVaapiSurfaceProxy *new_proxy);
guint
gst_vaapi_surface_proxy_get_flags(GstVaapiSurfaceProxy *proxy);
GstVaapiSurface *
gst_vaapi_surface_proxy_get_surface(GstVaapiSurfaceProxy *proxy);
GstVaapiID
gst_vaapi_surface_proxy_get_surface_id(GstVaapiSurfaceProxy *proxy);
GstClockTime
gst_vaapi_surface_proxy_get_timestamp(GstVaapiSurfaceProxy *proxy);
GstClockTime
gst_vaapi_surface_proxy_get_duration(GstVaapiSurfaceProxy *proxy);
void
gst_vaapi_surface_proxy_set_destroy_notify(GstVaapiSurfaceProxy *proxy,
GDestroyNotify destroy_func, gpointer user_data);

View file

@ -0,0 +1,104 @@
/*
* gstvaapisurfaceproxy_priv.h - VA surface proxy (private definitions)
*
* Copyright (C) 2010-2011 Splitted-Desktop Systems
* Copyright (C) 2011-2012 Intel Corporation
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
* Boston, MA 02110-1301 USA
*/
#ifndef GST_VAAPI_SURFACE_PROXY_PRIV_H
#define GST_VAAPI_SURFACE_PROXY_PRIV_H
#include "gstvaapiminiobject.h"
#include "gstvaapisurfaceproxy.h"
#include "gstvaapiobject_priv.h"
#include "gstvaapisurface_priv.h"
#define GST_VAAPI_SURFACE_PROXY(obj) \
((GstVaapiSurfaceProxy *)(obj))
#define GST_VAAPI_IS_SURFACE_PROXY(obj) \
(GST_VAAPI_SURFACE_PROXY(obj) != NULL)
struct _GstVaapiSurfaceProxy {
/*< private >*/
GstVaapiMiniObject parent_instance;
GstVaapiVideoPool *pool;
GstVaapiSurface *surface;
GstClockTime timestamp;
GstClockTime duration;
GDestroyNotify destroy_func;
gpointer destroy_data;
};
#define GST_VAAPI_SURFACE_PROXY_FLAGS GST_VAAPI_MINI_OBJECT_FLAGS
#define GST_VAAPI_SURFACE_PROXY_FLAG_IS_SET GST_VAAPI_MINI_OBJECT_FLAG_IS_SET
#define GST_VAAPI_SURFACE_PROXY_FLAG_SET GST_VAAPI_MINI_OBJECT_FLAG_SET
#define GST_VAAPI_SURFACE_PROXY_FLAG_UNSET GST_VAAPI_MINI_OBJECT_FLAG_UNSET
/**
* GST_VAAPI_SURFACE_PROXY_SURFACE:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the #GstVaapiSurface of @proxy.
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_SURFACE_PROXY_SURFACE
#define GST_VAAPI_SURFACE_PROXY_SURFACE(proxy) \
proxy->surface
/**
* GST_VAAPI_SURFACE_PROXY_SURFACE_ID:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the VA surface 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_SURFACE_ID
#define GST_VAAPI_SURFACE_PROXY_SURFACE_ID(proxy) \
GST_VAAPI_OBJECT_ID(proxy->surface)
/**
* GST_VAAPI_SURFACE_PROXY_TIMESTAMP:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the presentation timestamp of the
* underlying @proxy surface.
*
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_SURFACE_PROXY_TIMESTAMP
#define GST_VAAPI_SURFACE_PROXY_TIMESTAMP(proxy) \
proxy->timestamp
/**
* GST_VAAPI_SURFACE_PROXY_DURATION:
* @proxy: a #GstVaapiSurfaceProxy
*
* Macro that evaluates to the presentation duration of the
* underlying @proxy surface.
*
* This is an internal macro that does not do any run-time type check.
*/
#undef GST_VAAPI_SURFACE_PROXY_DURATION
#define GST_VAAPI_SURFACE_PROXY_DURATION(proxy) \
proxy->duration
#endif /* GST_VAAPI_SURFACE_PROXY_PRIV_H */