2010-03-12 23:48:50 +00:00
|
|
|
/*
|
2013-03-21 16:06:43 +00:00
|
|
|
* gstvaapivideobuffer.c - Gstreamer/VA video buffer
|
2010-03-12 23:48:50 +00:00
|
|
|
*
|
2012-01-16 09:41:10 +00:00
|
|
|
* Copyright (C) 2010-2011 Splitted-Desktop Systems
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@splitted-desktop.com>
|
2013-01-29 13:14:45 +00:00
|
|
|
* Copyright (C) 2011-2013 Intel Corporation
|
2013-11-22 04:57:18 +00:00
|
|
|
* Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
|
2010-03-12 23:48:50 +00:00
|
|
|
*
|
2011-06-14 11:51:41 +00:00
|
|
|
* 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.
|
2010-03-12 23:48:50 +00:00
|
|
|
*
|
2011-06-14 11:51:41 +00:00
|
|
|
* This library is distributed in the hope that it will be useful,
|
2010-03-12 23:48:50 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2011-06-14 11:51:41 +00:00
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
2010-03-12 23:48:50 +00:00
|
|
|
*
|
2011-06-14 11:51:41 +00:00
|
|
|
* 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
|
2010-03-12 23:48:50 +00:00
|
|
|
*/
|
|
|
|
|
2010-03-19 16:41:52 +00:00
|
|
|
/**
|
2010-03-24 08:16:32 +00:00
|
|
|
* SECTION:gstvaapivideobuffer
|
|
|
|
* @short_description: VA video buffer for GStreamer
|
2010-03-19 16:41:52 +00:00
|
|
|
*/
|
|
|
|
|
2013-03-21 16:06:43 +00:00
|
|
|
#include "gst/vaapi/sysdeps.h"
|
2010-03-12 23:48:50 +00:00
|
|
|
#include "gstvaapivideobuffer.h"
|
2013-05-21 16:42:39 +00:00
|
|
|
#if USE_X11 && !GST_CHECK_VERSION(1,1,0)
|
2013-07-22 09:58:33 +00:00
|
|
|
# include "gstvaapivideoconverter_x11.h"
|
|
|
|
#endif
|
2013-05-21 16:42:39 +00:00
|
|
|
#if USE_GLX && !GST_CHECK_VERSION(1,1,0)
|
2013-03-21 16:17:53 +00:00
|
|
|
# include "gstvaapivideoconverter_glx.h"
|
|
|
|
#endif
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2013-05-21 16:42:39 +00:00
|
|
|
#if GST_CHECK_VERSION(1,1,0)
|
|
|
|
static inline GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_surface_buffer_new (void)
|
2013-05-21 16:42:39 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return gst_buffer_new ();
|
2013-05-21 16:42:39 +00:00
|
|
|
}
|
|
|
|
#elif GST_CHECK_VERSION(1,0,0)
|
2013-04-15 11:48:43 +00:00
|
|
|
#include <gst/video/gstsurfacemeta.h>
|
|
|
|
|
|
|
|
#define GST_VAAPI_SURFACE_META_CAST(obj) \
|
2014-08-21 08:45:31 +00:00
|
|
|
((GstVaapiSurfaceMeta *) (obj))
|
2013-04-15 11:48:43 +00:00
|
|
|
|
|
|
|
typedef struct _GstVaapiSurfaceMeta GstVaapiSurfaceMeta;
|
2014-08-21 08:45:31 +00:00
|
|
|
struct _GstVaapiSurfaceMeta
|
|
|
|
{
|
|
|
|
GstSurfaceMeta base;
|
|
|
|
GstBuffer *buffer;
|
2013-04-15 11:48:43 +00:00
|
|
|
};
|
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
#define GST_VAAPI_SURFACE_META_INFO \
|
|
|
|
gst_vaapi_surface_meta_get_info ()
|
|
|
|
|
2013-04-15 11:48:43 +00:00
|
|
|
static const GstMetaInfo *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_meta_get_info (void);
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
typedef GstSurfaceConverter *(*GstSurfaceConverterCreateFunc) (GstSurfaceMeta *
|
|
|
|
meta, const gchar * type, GValue * dest);
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2013-07-22 09:58:33 +00:00
|
|
|
#if USE_X11
|
|
|
|
static GstSurfaceConverter *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_create_converter_x11 (GstSurfaceMeta * base_meta,
|
|
|
|
const gchar * type, GValue * dest)
|
2013-07-22 09:58:33 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
|
2013-07-22 09:58:33 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return gst_vaapi_video_converter_x11_new (meta->buffer, type, dest);
|
2013-07-22 09:58:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#undef gst_vaapi_video_converter_x11_new
|
|
|
|
#define gst_vaapi_video_converter_x11_new \
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_create_converter_x11
|
2013-07-22 09:58:33 +00:00
|
|
|
#endif
|
|
|
|
|
2013-04-15 11:48:43 +00:00
|
|
|
#if USE_GLX
|
|
|
|
static GstSurfaceConverter *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_create_converter_glx (GstSurfaceMeta * base_meta,
|
|
|
|
const gchar * type, GValue * dest)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return gst_vaapi_video_converter_glx_new (meta->buffer, type, dest);
|
2013-04-15 11:48:43 +00:00
|
|
|
}
|
|
|
|
|
2013-07-22 09:58:33 +00:00
|
|
|
#undef gst_vaapi_video_converter_glx_new
|
2013-04-15 11:48:43 +00:00
|
|
|
#define gst_vaapi_video_converter_glx_new \
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_create_converter_glx
|
2013-04-15 11:48:43 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
static GstSurfaceConverter *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_create_converter (GstSurfaceMeta * base_meta,
|
|
|
|
const gchar * type, GValue * dest)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
|
|
|
|
GstVaapiVideoMeta *const vmeta =
|
|
|
|
gst_buffer_get_vaapi_video_meta (meta->buffer);
|
|
|
|
GstSurfaceConverterCreateFunc func;
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
if (G_UNLIKELY (!vmeta))
|
|
|
|
return NULL;
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
func = (GstSurfaceConverterCreateFunc)
|
|
|
|
gst_vaapi_video_meta_get_surface_converter (vmeta);
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return func ? func (base_meta, type, dest) : NULL;
|
2013-04-15 11:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_meta_init (GstVaapiSurfaceMeta * meta, gpointer params,
|
|
|
|
GstBuffer * buffer)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
meta->base.create_converter = gst_vaapi_surface_create_converter;
|
|
|
|
meta->buffer = buffer;
|
|
|
|
return TRUE;
|
2013-04-15 11:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_meta_free (GstVaapiSurfaceMeta * meta, GstBuffer * buffer)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_meta_transform (GstBuffer * dst_buffer, GstMeta * meta,
|
|
|
|
GstBuffer * src_buffer, GQuark type, gpointer data)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiVideoMeta *const src_vmeta =
|
|
|
|
gst_buffer_get_vaapi_video_meta (src_buffer);
|
|
|
|
|
|
|
|
if (GST_META_TRANSFORM_IS_COPY (type)) {
|
|
|
|
GstVaapiSurfaceMeta *const dst_smeta =
|
|
|
|
GST_VAAPI_SURFACE_META_CAST (gst_buffer_add_meta (dst_buffer,
|
|
|
|
GST_VAAPI_SURFACE_META_INFO, NULL));
|
|
|
|
|
|
|
|
/* Note: avoid meta lookups in gst_vaapi_surface_create_converter()
|
|
|
|
by directly calling the GstVaapiVideoMeta::surface_converter hook */
|
|
|
|
dst_smeta->base.create_converter = (GstSurfaceConverterCreateFunc)
|
|
|
|
gst_vaapi_video_meta_get_surface_converter (src_vmeta);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
2013-04-15 11:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
const GstMetaInfo *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_surface_meta_get_info (void)
|
2013-04-15 11:48:43 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
static gsize g_meta_info;
|
|
|
|
|
|
|
|
if (g_once_init_enter (&g_meta_info)) {
|
|
|
|
gsize meta_info =
|
|
|
|
GPOINTER_TO_SIZE (gst_meta_register (GST_SURFACE_META_API_TYPE,
|
|
|
|
"GstVaapiSurfaceMeta", sizeof (GstVaapiSurfaceMeta),
|
|
|
|
(GstMetaInitFunction) gst_vaapi_surface_meta_init,
|
|
|
|
(GstMetaFreeFunction) gst_vaapi_surface_meta_free,
|
|
|
|
(GstMetaTransformFunction) gst_vaapi_surface_meta_transform));
|
|
|
|
g_once_init_leave (&g_meta_info, meta_info);
|
|
|
|
}
|
|
|
|
return GSIZE_TO_POINTER (g_meta_info);
|
2013-04-15 11:48:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_surface_buffer_new (void)
|
2012-09-03 11:00:25 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstBuffer *const buffer = gst_buffer_new ();
|
2013-04-15 11:48:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
if (buffer)
|
|
|
|
gst_buffer_add_meta (buffer, GST_VAAPI_SURFACE_META_INFO, NULL);
|
|
|
|
return buffer;
|
2012-09-03 11:00:25 +00:00
|
|
|
}
|
|
|
|
#else
|
|
|
|
#include <gst/video/gstsurfacebuffer.h>
|
|
|
|
|
2013-03-21 16:06:43 +00:00
|
|
|
#define GST_VAAPI_TYPE_VIDEO_BUFFER \
|
2014-08-21 08:45:31 +00:00
|
|
|
(gst_vaapi_video_buffer_get_type ())
|
|
|
|
#define GST_VAAPI_VIDEO_BUFFER(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_VAAPI_TYPE_VIDEO_BUFFER, \
|
|
|
|
GstVaapiVideoBuffer))
|
|
|
|
#define GST_VAAPI_VIDEO_BUFFER_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST ((klass), GST_VAAPI_TYPE_VIDEO_BUFFER, \
|
|
|
|
GstVaapiVideoBufferClass))
|
2013-03-21 16:06:43 +00:00
|
|
|
#define GST_VAAPI_IS_VIDEO_BUFFER(obj) \
|
2014-08-21 08:45:31 +00:00
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_VAAPI_TYPE_VIDEO_BUFFER))
|
2013-03-21 16:06:43 +00:00
|
|
|
#define GST_VAAPI_IS_VIDEO_BUFFER_CLASS(klass) \
|
2014-08-21 08:45:31 +00:00
|
|
|
(G_TYPE_CHECK_CLASS_TYPE ((klass), GST_VAAPI_TYPE_VIDEO_BUFFER))
|
|
|
|
#define GST_VAAPI_VIDEO_BUFFER_GET_CLASS(obj) \
|
|
|
|
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_VAAPI_TYPE_VIDEO_BUFFER, \
|
|
|
|
GstVaapiVideoBufferClass))
|
2013-03-21 16:06:43 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
typedef struct _GstVaapiVideoBufferClass GstVaapiVideoBufferClass;
|
2013-03-21 16:06:43 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiVideoBuffer:
|
|
|
|
*
|
|
|
|
* A #GstBuffer holding video objects (#GstVaapiSurface and #GstVaapiImage).
|
|
|
|
*/
|
2014-08-21 08:45:31 +00:00
|
|
|
struct _GstVaapiVideoBuffer
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstSurfaceBuffer parent_instance;
|
2013-03-21 16:06:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstVaapiVideoBufferClass:
|
|
|
|
*
|
|
|
|
* A #GstBuffer holding video objects
|
|
|
|
*/
|
2014-08-21 08:45:31 +00:00
|
|
|
struct _GstVaapiVideoBufferClass
|
|
|
|
{
|
|
|
|
/*< private >*/
|
|
|
|
GstSurfaceBufferClass parent_class;
|
2013-03-21 16:06:43 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
GType
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_get_type (void) G_GNUC_CONST;
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
G_DEFINE_TYPE (GstVaapiVideoBuffer,
|
|
|
|
gst_vaapi_video_buffer, GST_TYPE_SURFACE_BUFFER);
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
typedef GstSurfaceConverter *
|
|
|
|
(*GstSurfaceConverterCreateFunc) (GstSurfaceBuffer * surface,
|
|
|
|
const gchar * type, GValue * dest);
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2013-01-05 16:37:13 +00:00
|
|
|
static GstSurfaceConverter *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_create_converter (GstSurfaceBuffer * surface,
|
|
|
|
const gchar * type, GValue * dest)
|
2010-03-16 17:10:02 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiVideoMeta *const meta =
|
|
|
|
gst_buffer_get_vaapi_video_meta (GST_BUFFER (surface));
|
|
|
|
GstSurfaceConverterCreateFunc func;
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
g_return_val_if_fail (meta != NULL, NULL);
|
2013-08-26 15:14:33 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
func = (GstSurfaceConverterCreateFunc)
|
|
|
|
gst_vaapi_video_meta_get_surface_converter (meta);
|
2010-05-11 16:19:30 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return func ? func (surface, type, dest) : NULL;
|
2010-03-12 23:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_class_init (GstVaapiVideoBufferClass * klass)
|
2010-03-12 23:48:50 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstSurfaceBufferClass *const surface_class = GST_SURFACE_BUFFER_CLASS (klass);
|
2010-03-12 23:48:50 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
surface_class->create_converter = gst_vaapi_video_buffer_create_converter;
|
2010-03-12 23:48:50 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_init (GstVaapiVideoBuffer * buffer)
|
2010-03-12 23:48:50 +00:00
|
|
|
{
|
2012-07-24 11:52:06 +00:00
|
|
|
}
|
|
|
|
|
2012-09-03 11:00:25 +00:00
|
|
|
static inline GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_surface_buffer_new (void)
|
2012-09-03 11:00:25 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return GST_BUFFER_CAST (gst_mini_object_new (GST_VAAPI_TYPE_VIDEO_BUFFER));
|
2012-09-03 11:00:25 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-03-21 16:17:53 +00:00
|
|
|
static GFunc
|
2014-08-21 08:45:31 +00:00
|
|
|
get_surface_converter (GstVaapiDisplay * display)
|
2013-03-21 16:17:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GFunc func;
|
2013-03-21 16:17:53 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
switch (gst_vaapi_display_get_display_type (display)) {
|
2013-05-21 16:42:39 +00:00
|
|
|
#if USE_X11 && !GST_CHECK_VERSION(1,1,0)
|
2013-07-22 09:58:33 +00:00
|
|
|
case GST_VAAPI_DISPLAY_TYPE_X11:
|
2014-08-21 08:45:31 +00:00
|
|
|
func = (GFunc) gst_vaapi_video_converter_x11_new;
|
|
|
|
break;
|
2013-07-22 09:58:33 +00:00
|
|
|
#endif
|
2013-05-21 16:42:39 +00:00
|
|
|
#if USE_GLX && !GST_CHECK_VERSION(1,1,0)
|
2013-03-21 16:17:53 +00:00
|
|
|
case GST_VAAPI_DISPLAY_TYPE_GLX:
|
2014-08-21 08:45:31 +00:00
|
|
|
func = (GFunc) gst_vaapi_video_converter_glx_new;
|
|
|
|
break;
|
2013-03-21 16:17:53 +00:00
|
|
|
#endif
|
|
|
|
default:
|
2014-08-21 08:45:31 +00:00
|
|
|
func = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return func;
|
2013-03-21 16:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
new_vbuffer (GstVaapiVideoMeta * meta)
|
2010-04-29 21:56:10 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstBuffer *buffer;
|
2010-05-11 16:19:30 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
g_return_val_if_fail (meta != NULL, NULL);
|
2010-05-11 16:19:30 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_meta_set_surface_converter (meta,
|
|
|
|
get_surface_converter (gst_vaapi_video_meta_get_display (meta)));
|
2010-05-11 16:19:30 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
buffer = gst_surface_buffer_new ();
|
|
|
|
if (buffer)
|
|
|
|
gst_buffer_set_vaapi_video_meta (buffer, meta);
|
|
|
|
gst_vaapi_video_meta_unref (meta);
|
|
|
|
return buffer;
|
2010-03-12 23:48:50 +00:00
|
|
|
}
|
|
|
|
|
2013-03-26 17:45:53 +00:00
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new (GstVaapiVideoMeta * meta)
|
2013-03-26 17:45:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
g_return_val_if_fail (meta != NULL, NULL);
|
2013-03-26 17:45:53 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return new_vbuffer (gst_vaapi_video_meta_ref (meta));
|
2013-03-26 17:45:53 +00:00
|
|
|
}
|
|
|
|
|
2013-10-03 17:04:07 +00:00
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new_empty (void)
|
2013-10-03 17:04:07 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return gst_surface_buffer_new ();
|
2013-10-03 17:04:07 +00:00
|
|
|
}
|
|
|
|
|
2013-03-21 16:17:53 +00:00
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new_from_pool (GstVaapiVideoPool * pool)
|
2013-03-21 16:17:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return new_vbuffer (gst_vaapi_video_meta_new_from_pool (pool));
|
2013-03-21 16:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new_from_buffer (GstBuffer * buffer)
|
2013-03-21 16:17:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
GstVaapiVideoMeta *const meta = gst_buffer_get_vaapi_video_meta (buffer);
|
2013-03-21 16:17:53 +00:00
|
|
|
|
2014-08-21 08:45:31 +00:00
|
|
|
return meta ? new_vbuffer (gst_vaapi_video_meta_ref (meta)) : NULL;
|
2013-03-21 16:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new_with_image (GstVaapiImage * image)
|
2013-03-21 16:17:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return new_vbuffer (gst_vaapi_video_meta_new_with_image (image));
|
2013-03-21 16:17:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GstBuffer *
|
2014-08-21 08:45:31 +00:00
|
|
|
gst_vaapi_video_buffer_new_with_surface_proxy (GstVaapiSurfaceProxy * proxy)
|
2013-03-21 16:17:53 +00:00
|
|
|
{
|
2014-08-21 08:45:31 +00:00
|
|
|
return new_vbuffer (gst_vaapi_video_meta_new_with_surface_proxy (proxy));
|
2013-03-21 16:17:53 +00:00
|
|
|
}
|