diff options
-rw-r--r-- | NEWS | 5 | ||||
-rw-r--r-- | README | 2 | ||||
-rw-r--r-- | debian.upstream/control.in | 2 | ||||
-rw-r--r-- | docs/reference/plugins/plugins-docs.xml.in | 2 | ||||
-rw-r--r-- | docs/reference/plugins/plugins-sections.txt | 20 | ||||
-rw-r--r-- | docs/reference/plugins/plugins.types | 2 | ||||
-rw-r--r-- | gst/vaapi/Makefile.am | 4 | ||||
-rw-r--r-- | gst/vaapi/gstvaapi.c | 6 | ||||
-rw-r--r-- | gst/vaapi/gstvaapiupload.c (renamed from gst/vaapi/gstvaapiconvert.c) | 348 | ||||
-rw-r--r-- | gst/vaapi/gstvaapiupload.h (renamed from gst/vaapi/gstvaapiconvert.h) | 50 |
10 files changed, 222 insertions, 219 deletions
@@ -1,7 +1,10 @@ -gst-vaapi NEWS -- summary of changes. 2011-12-16 +gst-vaapi NEWS -- summary of changes. 2012-01-DD Copyright (C) 2010-2011 Splitted-Desktop Systems Copyright (C) 2011 Intel Corporation +Version 0.3.2 - DD.Jan.2012 +* Rename vaapiconvert element to vaapiupload + Version 0.3.1 - 16.Dec.2011 * Fix check for supported VA images * Add support for partial VA image updates @@ -23,7 +23,7 @@ GStreamer and helper libraries. videos to video/x-vaapi-surfaces surfaces, depending on the underlying HW capabilities. - * `vaapiconvert' is used to convert from video/x-raw-yuv pixels to + * `vaapiupload' is used to convert from video/x-raw-yuv pixels to video/x-vaapi-surface surfaces. * `vaapisink' is used to display video/x-vaapi-surface surfaces to diff --git a/debian.upstream/control.in b/debian.upstream/control.in index 579d8496..98bbdfac 100644 --- a/debian.upstream/control.in +++ b/debian.upstream/control.in @@ -18,7 +18,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends} Suggests: gstreamer@GST_MAJORMINOR@-vaapi-doc Description: VA-API plugins for GStreamer This package contains GStreamer plugins for VA-API support: - - `vaapiconvert': converts from YUV pixels to VA surfaces + - `vaapiupload': converts from YUV pixels to VA surfaces - `vaapisink': a VA-API based video sink Package: gstreamer@GST_MAJORMINOR@-vaapi-doc diff --git a/docs/reference/plugins/plugins-docs.xml.in b/docs/reference/plugins/plugins-docs.xml.in index 47779996..b02060fd 100644 --- a/docs/reference/plugins/plugins-docs.xml.in +++ b/docs/reference/plugins/plugins-docs.xml.in @@ -12,7 +12,7 @@ <chapter> <title>gst-plugins-vaapi Plugins</title> <xi:include href="xml/gstvaapidecode.xml"/> - <xi:include href="xml/gstvaapiconvert.xml"/> + <xi:include href="xml/gstvaapiupload.xml"/> <xi:include href="xml/gstvaapisink.xml"/> </chapter> diff --git a/docs/reference/plugins/plugins-sections.txt b/docs/reference/plugins/plugins-sections.txt index a0c0a31b..9db963af 100644 --- a/docs/reference/plugins/plugins-sections.txt +++ b/docs/reference/plugins/plugins-sections.txt @@ -27,15 +27,15 @@ GST_VAAPIDECODE_GET_CLASS </SECTION> <SECTION> -<FILE>gstvaapiconvert</FILE> -<TITLE>GstVaapiConvert</TITLE> -GstVaapiConvert +<FILE>gstvaapiupload</FILE> +<TITLE>GstVaapiUpload</TITLE> +GstVaapiUpload <SUBSECTION Standard> -GST_VAAPICONVERT -GST_IS_VAAPICONVERT -GST_TYPE_VAAPICONVERT -gst_vaapiconvert_get_type -GST_VAAPICONVERT_CLASS -GST_IS_VAAPICONVERT_CLASS -GST_VAAPICONVERT_GET_CLASS +GST_VAAPIUPLOAD +GST_IS_VAAPIUPLOAD +GST_TYPE_VAAPIUPLOAD +gst_vaapiupload_get_type +GST_VAAPIUPLOAD_CLASS +GST_IS_VAAPIUPLOAD_CLASS +GST_VAAPIUPLOAD_GET_CLASS </SECTION> diff --git a/docs/reference/plugins/plugins.types b/docs/reference/plugins/plugins.types index db94655e..a6b5ab9c 100644 --- a/docs/reference/plugins/plugins.types +++ b/docs/reference/plugins/plugins.types @@ -1,3 +1,3 @@ gst_vaapisink_get_type gst_vaapidecode_get_type -gst_vaapiconvert_get_type +gst_vaapiupload_get_type diff --git a/gst/vaapi/Makefile.am b/gst/vaapi/Makefile.am index 8b1bbf85..3ff3b4ac 100644 --- a/gst/vaapi/Makefile.am +++ b/gst/vaapi/Makefile.am @@ -17,17 +17,17 @@ endif libgstvaapi_la_SOURCES = \ gstvaapi.c \ - gstvaapiconvert.c \ gstvaapidecode.c \ gstvaapipluginutil.c \ gstvaapisink.c \ + gstvaapiupload.c \ $(NULL) noinst_HEADERS = \ - gstvaapiconvert.h \ gstvaapidecode.h \ gstvaapipluginutil.h \ gstvaapisink.h \ + gstvaapiupload.h \ $(NULL) libgstvaapi_la_CFLAGS = \ diff --git a/gst/vaapi/gstvaapi.c b/gst/vaapi/gstvaapi.c index 1675a2a7..44fb2e89 100644 --- a/gst/vaapi/gstvaapi.c +++ b/gst/vaapi/gstvaapi.c @@ -27,16 +27,16 @@ #include <gst/gst.h> -#include "gstvaapiconvert.h" +#include "gstvaapiupload.h" #include "gstvaapidecode.h" #include "gstvaapisink.h" static gboolean plugin_init (GstPlugin *plugin) { - gst_element_register(plugin, "vaapiconvert", + gst_element_register(plugin, "vaapiupload", GST_RANK_PRIMARY, - GST_TYPE_VAAPICONVERT); + GST_TYPE_VAAPIUPLOAD); gst_element_register(plugin, "vaapidecode", GST_RANK_PRIMARY, GST_TYPE_VAAPIDECODE); diff --git a/gst/vaapi/gstvaapiconvert.c b/gst/vaapi/gstvaapiupload.c index a0db024d..803b9072 100644 --- a/gst/vaapi/gstvaapiconvert.c +++ b/gst/vaapi/gstvaapiupload.c @@ -1,5 +1,5 @@ /* - * gstvaapiconvert.c - VA-API video converter + * gstvaapiupload.c - VA-API video uploader * * gstreamer-vaapi (C) 2010-2011 Splitted-Desktop Systems * Copyright (C) 2011 Intel Corporation @@ -21,11 +21,11 @@ */ /** - * SECTION:gstvaapiconvert - * @short_description: A VA-API based video pixels format converter + * SECTION:gstvaapiupload + * @short_description: A video to VA flow filter * - * vaapiconvert converts from raw YUV pixels to surfaces suitable for - * the vaapisink element. + * vaapiupload converts from raw YUV pixels to VA surfaces suitable + * for the vaapisink element, for example. */ #include "config.h" @@ -45,16 +45,16 @@ #endif #include "gstvaapipluginutil.h" -#include "gstvaapiconvert.h" +#include "gstvaapiupload.h" -#define GST_PLUGIN_NAME "vaapiconvert" -#define GST_PLUGIN_DESC "A VA-API based video pixels format converter" +#define GST_PLUGIN_NAME "vaapiupload" +#define GST_PLUGIN_DESC "A video to VA flow filter" -GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapiconvert); -#define GST_CAT_DEFAULT gst_debug_vaapiconvert +GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapiupload); +#define GST_CAT_DEFAULT gst_debug_vaapiupload /* ElementFactory information */ -static const GstElementDetails gst_vaapiconvert_details = +static const GstElementDetails gst_vaapiupload_details = GST_ELEMENT_DETAILS( "VA-API colorspace converter", "Filter/Converter/Video", @@ -62,32 +62,32 @@ static const GstElementDetails gst_vaapiconvert_details = "Gwenole Beauchesne <gwenole.beauchesne@intel.com>"); /* Default templates */ -static const char gst_vaapiconvert_yuv_caps_str[] = +static const char gst_vaapiupload_yuv_caps_str[] = "video/x-raw-yuv, " "width = (int) [ 1, MAX ], " "height = (int) [ 1, MAX ]; "; -static const char gst_vaapiconvert_vaapi_caps_str[] = +static const char gst_vaapiupload_vaapi_caps_str[] = GST_VAAPI_SURFACE_CAPS; -static GstStaticPadTemplate gst_vaapiconvert_sink_factory = +static GstStaticPadTemplate gst_vaapiupload_sink_factory = GST_STATIC_PAD_TEMPLATE( "sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapiconvert_yuv_caps_str)); + GST_STATIC_CAPS(gst_vaapiupload_yuv_caps_str)); -static GstStaticPadTemplate gst_vaapiconvert_src_factory = +static GstStaticPadTemplate gst_vaapiupload_src_factory = GST_STATIC_PAD_TEMPLATE( "src", GST_PAD_SRC, GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapiconvert_vaapi_caps_str)); + GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str)); #define GstVideoContextClass GstVideoContextInterface GST_BOILERPLATE_WITH_INTERFACE( - GstVaapiConvert, - gst_vaapiconvert, + GstVaapiUpload, + gst_vaapiupload, GstBaseTransform, GST_TYPE_BASE_TRANSFORM, GstVideoContext, @@ -97,8 +97,8 @@ GST_BOILERPLATE_WITH_INTERFACE( /* * Direct rendering levels (direct-rendering) * 0: upstream allocated YUV pixels - * 1: vaapiconvert allocated YUV pixels (mapped from VA image) - * 2: vaapiconvert allocated YUV pixels (mapped from VA surface) + * 1: vaapiupload allocated YUV pixels (mapped from VA image) + * 2: vaapiupload allocated YUV pixels (mapped from VA surface) */ #define DIRECT_RENDERING_DEFAULT 2 @@ -109,41 +109,41 @@ enum { }; static gboolean -gst_vaapiconvert_start(GstBaseTransform *trans); +gst_vaapiupload_start(GstBaseTransform *trans); static gboolean -gst_vaapiconvert_stop(GstBaseTransform *trans); +gst_vaapiupload_stop(GstBaseTransform *trans); static GstFlowReturn -gst_vaapiconvert_transform( +gst_vaapiupload_transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBuffer *outbuf ); static GstCaps * -gst_vaapiconvert_transform_caps( +gst_vaapiupload_transform_caps( GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps ); static gboolean -gst_vaapiconvert_set_caps( +gst_vaapiupload_set_caps( GstBaseTransform *trans, GstCaps *incaps, GstCaps *outcaps ); static gboolean -gst_vaapiconvert_get_unit_size( +gst_vaapiupload_get_unit_size( GstBaseTransform *trans, GstCaps *caps, guint *size ); static GstFlowReturn -gst_vaapiconvert_sinkpad_buffer_alloc( +gst_vaapiupload_sinkpad_buffer_alloc( GstPad *pad, guint64 offset, guint size, @@ -152,7 +152,7 @@ gst_vaapiconvert_sinkpad_buffer_alloc( ); static GstFlowReturn -gst_vaapiconvert_prepare_output_buffer( +gst_vaapiupload_prepare_output_buffer( GstBaseTransform *trans, GstBuffer *inbuf, gint size, @@ -161,7 +161,7 @@ gst_vaapiconvert_prepare_output_buffer( ); static gboolean -gst_vaapiconvert_query( +gst_vaapiupload_query( GstPad *pad, GstQuery *query ); @@ -169,15 +169,15 @@ gst_vaapiconvert_query( /* GstVideoContext interface */ static void -gst_vaapiconvert_set_video_context(GstVideoContext *context, const gchar *type, +gst_vaapiupload_set_video_context(GstVideoContext *context, const gchar *type, const GValue *value) { - GstVaapiConvert *convert = GST_VAAPICONVERT (context); - gst_vaapi_set_display (type, value, &convert->display); + GstVaapiUpload *upload = GST_VAAPIUPLOAD (context); + gst_vaapi_set_display (type, value, &upload->display); } static gboolean -gst_video_context_supported (GstVaapiConvert *convert, GType iface_type) +gst_video_context_supported (GstVaapiUpload *upload, GType iface_type) { return (iface_type == GST_TYPE_VIDEO_CONTEXT); } @@ -185,72 +185,72 @@ gst_video_context_supported (GstVaapiConvert *convert, GType iface_type) static void gst_video_context_interface_init(GstVideoContextInterface *iface) { - iface->set_context = gst_vaapiconvert_set_video_context; + iface->set_context = gst_vaapiupload_set_video_context; } static void -gst_vaapiconvert_destroy(GstVaapiConvert *convert) +gst_vaapiupload_destroy(GstVaapiUpload *upload) { - if (convert->images) { - g_object_unref(convert->images); - convert->images = NULL; + if (upload->images) { + g_object_unref(upload->images); + upload->images = NULL; } - if (convert->surfaces) { - g_object_unref(convert->surfaces); - convert->surfaces = NULL; + if (upload->surfaces) { + g_object_unref(upload->surfaces); + upload->surfaces = NULL; } - if (convert->display) { - g_object_unref(convert->display); - convert->display = NULL; + if (upload->display) { + g_object_unref(upload->display); + upload->display = NULL; } } static void -gst_vaapiconvert_base_init(gpointer klass) +gst_vaapiupload_base_init(gpointer klass) { GstElementClass * const element_class = GST_ELEMENT_CLASS(klass); - gst_element_class_set_details(element_class, &gst_vaapiconvert_details); + gst_element_class_set_details(element_class, &gst_vaapiupload_details); /* sink pad */ gst_element_class_add_pad_template( element_class, - gst_static_pad_template_get(&gst_vaapiconvert_sink_factory) + gst_static_pad_template_get(&gst_vaapiupload_sink_factory) ); /* src pad */ gst_element_class_add_pad_template( element_class, - gst_static_pad_template_get(&gst_vaapiconvert_src_factory) + gst_static_pad_template_get(&gst_vaapiupload_src_factory) ); } static void -gst_vaapiconvert_finalize(GObject *object) +gst_vaapiupload_finalize(GObject *object) { - gst_vaapiconvert_destroy(GST_VAAPICONVERT(object)); + gst_vaapiupload_destroy(GST_VAAPIUPLOAD(object)); G_OBJECT_CLASS(parent_class)->finalize(object); } static void -gst_vaapiconvert_set_property( +gst_vaapiupload_set_property( GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(object); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(object); switch (prop_id) { case PROP_DIRECT_RENDERING: - GST_OBJECT_LOCK(convert); - convert->direct_rendering = g_value_get_uint(value); - GST_OBJECT_UNLOCK(convert); + GST_OBJECT_LOCK(upload); + upload->direct_rendering = g_value_get_uint(value); + GST_OBJECT_UNLOCK(upload); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -259,18 +259,18 @@ gst_vaapiconvert_set_property( } static void -gst_vaapiconvert_get_property( +gst_vaapiupload_get_property( GObject *object, guint prop_id, GValue *value, GParamSpec *pspec ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(object); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(object); switch (prop_id) { case PROP_DIRECT_RENDERING: - g_value_set_uint(value, convert->direct_rendering); + g_value_set_uint(value, upload->direct_rendering); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); @@ -279,28 +279,28 @@ gst_vaapiconvert_get_property( } static void -gst_vaapiconvert_class_init(GstVaapiConvertClass *klass) +gst_vaapiupload_class_init(GstVaapiUploadClass *klass) { GObjectClass * const object_class = G_OBJECT_CLASS(klass); GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass); - GST_DEBUG_CATEGORY_INIT(gst_debug_vaapiconvert, + GST_DEBUG_CATEGORY_INIT(gst_debug_vaapiupload, GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); - object_class->finalize = gst_vaapiconvert_finalize; - object_class->set_property = gst_vaapiconvert_set_property; - object_class->get_property = gst_vaapiconvert_get_property; + object_class->finalize = gst_vaapiupload_finalize; + object_class->set_property = gst_vaapiupload_set_property; + object_class->get_property = gst_vaapiupload_get_property; - trans_class->start = gst_vaapiconvert_start; - trans_class->stop = gst_vaapiconvert_stop; - trans_class->transform = gst_vaapiconvert_transform; - trans_class->transform_caps = gst_vaapiconvert_transform_caps; - trans_class->set_caps = gst_vaapiconvert_set_caps; - trans_class->get_unit_size = gst_vaapiconvert_get_unit_size; - trans_class->prepare_output_buffer = gst_vaapiconvert_prepare_output_buffer; + trans_class->start = gst_vaapiupload_start; + trans_class->stop = gst_vaapiupload_stop; + trans_class->transform = gst_vaapiupload_transform; + trans_class->transform_caps = gst_vaapiupload_transform_caps; + trans_class->set_caps = gst_vaapiupload_set_caps; + trans_class->get_unit_size = gst_vaapiupload_get_unit_size; + trans_class->prepare_output_buffer = gst_vaapiupload_prepare_output_buffer; /** - * GstVaapiConvert:direct-rendering: + * GstVaapiUpload:direct-rendering: * * Selects the direct rendering level. * <orderedlist> @@ -330,67 +330,67 @@ gst_vaapiconvert_class_init(GstVaapiConvertClass *klass) } static void -gst_vaapiconvert_init(GstVaapiConvert *convert, GstVaapiConvertClass *klass) +gst_vaapiupload_init(GstVaapiUpload *upload, GstVaapiUploadClass *klass) { GstPad *sinkpad, *srcpad; - convert->display = NULL; - convert->images = NULL; - convert->images_reset = FALSE; - convert->image_width = 0; - convert->image_height = 0; - convert->surfaces = NULL; - convert->surfaces_reset = FALSE; - convert->surface_width = 0; - convert->surface_height = 0; - convert->direct_rendering_caps = 0; - convert->direct_rendering = G_MAXUINT32; + upload->display = NULL; + upload->images = NULL; + upload->images_reset = FALSE; + upload->image_width = 0; + upload->image_height = 0; + upload->surfaces = NULL; + upload->surfaces_reset = FALSE; + upload->surface_width = 0; + upload->surface_height = 0; + upload->direct_rendering_caps = 0; + upload->direct_rendering = G_MAXUINT32; /* Override buffer allocator on sink pad */ - sinkpad = gst_element_get_static_pad(GST_ELEMENT(convert), "sink"); + sinkpad = gst_element_get_static_pad(GST_ELEMENT(upload), "sink"); gst_pad_set_bufferalloc_function( sinkpad, - gst_vaapiconvert_sinkpad_buffer_alloc + gst_vaapiupload_sinkpad_buffer_alloc ); - gst_pad_set_query_function(sinkpad, gst_vaapiconvert_query); + gst_pad_set_query_function(sinkpad, gst_vaapiupload_query); g_object_unref(sinkpad); /* Override query on src pad */ - srcpad = gst_element_get_static_pad(GST_ELEMENT(convert), "src"); - gst_pad_set_query_function(srcpad, gst_vaapiconvert_query); + srcpad = gst_element_get_static_pad(GST_ELEMENT(upload), "src"); + gst_pad_set_query_function(srcpad, gst_vaapiupload_query); } static gboolean -gst_vaapiconvert_start(GstBaseTransform *trans) +gst_vaapiupload_start(GstBaseTransform *trans) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - if (!gst_vaapi_ensure_display(convert, &convert->display)) + if (!gst_vaapi_ensure_display(upload, &upload->display)) return FALSE; return TRUE; } static gboolean -gst_vaapiconvert_stop(GstBaseTransform *trans) +gst_vaapiupload_stop(GstBaseTransform *trans) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - if (convert->display) { - g_object_unref(convert->display); - convert->display = NULL; + if (upload->display) { + g_object_unref(upload->display); + upload->display = NULL; } return TRUE; } static GstFlowReturn -gst_vaapiconvert_transform( +gst_vaapiupload_transform( GstBaseTransform *trans, GstBuffer *inbuf, GstBuffer *outbuf ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); GstVaapiVideoBuffer *vbuffer; GstVaapiSurface *surface; GstVaapiImage *image; @@ -401,7 +401,7 @@ gst_vaapiconvert_transform( if (!surface) return GST_FLOW_UNEXPECTED; - if (convert->direct_rendering) { + if (upload->direct_rendering) { if (!GST_VAAPI_IS_VIDEO_BUFFER(inbuf)) { GST_DEBUG("GstVaapiVideoBuffer was expected"); return GST_FLOW_UNEXPECTED; @@ -414,20 +414,20 @@ gst_vaapiconvert_transform( if (!gst_vaapi_image_unmap(image)) return GST_FLOW_UNEXPECTED; - if (convert->direct_rendering < 2) { + if (upload->direct_rendering < 2) { if (!gst_vaapi_surface_put_image(surface, image)) goto error_put_image; } return GST_FLOW_OK; } - image = gst_vaapi_video_pool_get_object(convert->images); + image = gst_vaapi_video_pool_get_object(upload->images); if (!image) return GST_FLOW_UNEXPECTED; gst_vaapi_image_update_from_buffer(image, inbuf, NULL); success = gst_vaapi_surface_put_image(surface, image); - gst_vaapi_video_pool_put_object(convert->images, image); + gst_vaapi_video_pool_put_object(upload->images, image); if (!success) goto error_put_image; return GST_FLOW_OK; @@ -443,13 +443,13 @@ error_put_image: } static GstCaps * -gst_vaapiconvert_transform_caps( +gst_vaapiupload_transform_caps( GstBaseTransform *trans, GstPadDirection direction, GstCaps *caps ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); GstCaps *out_caps = NULL; GstStructure *structure; const GValue *v_width, *v_height, *v_framerate, *v_par; @@ -468,15 +468,15 @@ gst_vaapiconvert_transform_caps( if (direction == GST_PAD_SINK) { if (!gst_structure_has_name(structure, "video/x-raw-yuv")) return NULL; - out_caps = gst_caps_from_string(gst_vaapiconvert_vaapi_caps_str); + out_caps = gst_caps_from_string(gst_vaapiupload_vaapi_caps_str); } else { if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME)) return NULL; - out_caps = gst_caps_from_string(gst_vaapiconvert_yuv_caps_str); - if (convert->display) { + out_caps = gst_caps_from_string(gst_vaapiupload_yuv_caps_str); + if (upload->display) { GstCaps *allowed_caps, *inter_caps; - allowed_caps = gst_vaapi_display_get_image_caps(convert->display); + allowed_caps = gst_vaapi_display_get_image_caps(upload->display); if (!allowed_caps) return NULL; inter_caps = gst_caps_intersect(out_caps, allowed_caps); @@ -499,7 +499,7 @@ gst_vaapiconvert_transform_caps( } static gboolean -gst_vaapiconvert_ensure_image_pool(GstVaapiConvert *convert, GstCaps *caps) +gst_vaapiupload_ensure_image_pool(GstVaapiUpload *upload, GstCaps *caps) { GstStructure * const structure = gst_caps_get_structure(caps, 0); gint width, height; @@ -507,21 +507,21 @@ gst_vaapiconvert_ensure_image_pool(GstVaapiConvert *convert, GstCaps *caps) gst_structure_get_int(structure, "width", &width); gst_structure_get_int(structure, "height", &height); - if (width != convert->image_width || height != convert->image_height) { - convert->image_width = width; - convert->image_height = height; - if (convert->images) - g_object_unref(convert->images); - convert->images = gst_vaapi_image_pool_new(convert->display, caps); - if (!convert->images) + if (width != upload->image_width || height != upload->image_height) { + upload->image_width = width; + upload->image_height = height; + if (upload->images) + g_object_unref(upload->images); + upload->images = gst_vaapi_image_pool_new(upload->display, caps); + if (!upload->images) return FALSE; - convert->images_reset = TRUE; + upload->images_reset = TRUE; } return TRUE; } static gboolean -gst_vaapiconvert_ensure_surface_pool(GstVaapiConvert *convert, GstCaps *caps) +gst_vaapiupload_ensure_surface_pool(GstVaapiUpload *upload, GstCaps *caps) { GstStructure * const structure = gst_caps_get_structure(caps, 0); gint width, height; @@ -529,22 +529,22 @@ gst_vaapiconvert_ensure_surface_pool(GstVaapiConvert *convert, GstCaps *caps) gst_structure_get_int(structure, "width", &width); gst_structure_get_int(structure, "height", &height); - if (width != convert->surface_width || height != convert->surface_height) { - convert->surface_width = width; - convert->surface_height = height; - if (convert->surfaces) - g_object_unref(convert->surfaces); - convert->surfaces = gst_vaapi_surface_pool_new(convert->display, caps); - if (!convert->surfaces) + if (width != upload->surface_width || height != upload->surface_height) { + upload->surface_width = width; + upload->surface_height = height; + if (upload->surfaces) + g_object_unref(upload->surfaces); + upload->surfaces = gst_vaapi_surface_pool_new(upload->display, caps); + if (!upload->surfaces) return FALSE; - convert->surfaces_reset = TRUE; + upload->surfaces_reset = TRUE; } return TRUE; } static void -gst_vaapiconvert_ensure_direct_rendering_caps( - GstVaapiConvert *convert, +gst_vaapiupload_ensure_direct_rendering_caps( + GstVaapiUpload *upload, GstCaps *caps ) { @@ -555,12 +555,12 @@ gst_vaapiconvert_ensure_direct_rendering_caps( GstStructure *structure; gint width, height; - if (!convert->images_reset && !convert->surfaces_reset) + if (!upload->images_reset && !upload->surfaces_reset) return; - convert->images_reset = FALSE; - convert->surfaces_reset = FALSE; - convert->direct_rendering_caps = 0; + upload->images_reset = FALSE; + upload->surfaces_reset = FALSE; + upload->direct_rendering_caps = 0; structure = gst_caps_get_structure(caps, 0); if (!structure) @@ -578,78 +578,78 @@ gst_vaapiconvert_ensure_direct_rendering_caps( return; /* Check if we can alias sink & output buffers (same data_size) */ - image = gst_vaapi_video_pool_get_object(convert->images); + image = gst_vaapi_video_pool_get_object(upload->images); if (image) { - if (convert->direct_rendering_caps == 0 && + if (upload->direct_rendering_caps == 0 && (gst_vaapi_image_get_format(image) == vaformat && gst_vaapi_image_is_linear(image) && (gst_vaapi_image_get_data_size(image) == gst_video_format_get_size(vformat, width, height)))) - convert->direct_rendering_caps = 1; - gst_vaapi_video_pool_put_object(convert->images, image); + upload->direct_rendering_caps = 1; + gst_vaapi_video_pool_put_object(upload->images, image); } /* Check if we can access to the surface pixels directly */ - surface = gst_vaapi_video_pool_get_object(convert->surfaces); + surface = gst_vaapi_video_pool_get_object(upload->surfaces); if (surface) { image = gst_vaapi_surface_derive_image(surface); if (image) { if (gst_vaapi_image_map(image)) { - if (convert->direct_rendering_caps == 1 && + if (upload->direct_rendering_caps == 1 && (gst_vaapi_image_get_format(image) == vaformat && gst_vaapi_image_is_linear(image) && (gst_vaapi_image_get_data_size(image) == gst_video_format_get_size(vformat, width, height)))) - convert->direct_rendering_caps = 2; + upload->direct_rendering_caps = 2; gst_vaapi_image_unmap(image); } g_object_unref(image); } - gst_vaapi_video_pool_put_object(convert->surfaces, surface); + gst_vaapi_video_pool_put_object(upload->surfaces, surface); } } static gboolean -gst_vaapiconvert_negotiate_buffers( - GstVaapiConvert *convert, +gst_vaapiupload_negotiate_buffers( + GstVaapiUpload *upload, GstCaps *incaps, GstCaps *outcaps ) { guint dr; - if (!gst_vaapiconvert_ensure_image_pool(convert, incaps)) + if (!gst_vaapiupload_ensure_image_pool(upload, incaps)) return FALSE; - if (!gst_vaapiconvert_ensure_surface_pool(convert, outcaps)) + if (!gst_vaapiupload_ensure_surface_pool(upload, outcaps)) return FALSE; - gst_vaapiconvert_ensure_direct_rendering_caps(convert, incaps); - dr = MIN(convert->direct_rendering, convert->direct_rendering_caps); - if (convert->direct_rendering != dr) { - convert->direct_rendering = dr; + gst_vaapiupload_ensure_direct_rendering_caps(upload, incaps); + dr = MIN(upload->direct_rendering, upload->direct_rendering_caps); + if (upload->direct_rendering != dr) { + upload->direct_rendering = dr; GST_DEBUG("direct-rendering level: %d", dr); } return TRUE; } static gboolean -gst_vaapiconvert_set_caps( +gst_vaapiupload_set_caps( GstBaseTransform *trans, GstCaps *incaps, GstCaps *outcaps ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - if (!gst_vaapiconvert_negotiate_buffers(convert, incaps, outcaps)) + if (!gst_vaapiupload_negotiate_buffers(upload, incaps, outcaps)) return FALSE; return TRUE; } static gboolean -gst_vaapiconvert_get_unit_size( +gst_vaapiupload_get_unit_size( GstBaseTransform *trans, GstCaps *caps, guint *size @@ -670,28 +670,28 @@ gst_vaapiconvert_get_unit_size( } static GstFlowReturn -gst_vaapiconvert_buffer_alloc( +gst_vaapiupload_buffer_alloc( GstBaseTransform *trans, guint size, GstCaps *caps, GstBuffer **pbuf ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); GstBuffer *buffer = NULL; GstVaapiImage *image = NULL; GstVaapiSurface *surface = NULL; GstVaapiVideoBuffer *vbuffer; /* Check if we can use direct-rendering */ - if (!gst_vaapiconvert_negotiate_buffers(convert, caps, caps)) + if (!gst_vaapiupload_negotiate_buffers(upload, caps, caps)) goto error; - if (!convert->direct_rendering) + if (!upload->direct_rendering) return GST_FLOW_OK; - switch (convert->direct_rendering) { + switch (upload->direct_rendering) { case 2: - buffer = gst_vaapi_video_buffer_new_from_pool(convert->surfaces); + buffer = gst_vaapi_video_buffer_new_from_pool(upload->surfaces); if (!buffer) goto error; vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer); @@ -705,12 +705,12 @@ gst_vaapiconvert_buffer_alloc( } /* We can't use the derive-image optimization. Disable it. */ - convert->direct_rendering = 1; + upload->direct_rendering = 1; gst_buffer_unref(buffer); buffer = NULL; case 1: - buffer = gst_vaapi_video_buffer_new_from_pool(convert->images); + buffer = gst_vaapi_video_buffer_new_from_pool(upload->images); if (!buffer) goto error; vbuffer = GST_VAAPI_VIDEO_BUFFER(buffer); @@ -735,12 +735,12 @@ error: GST_DEBUG("disable in/out buffer optimization"); if (buffer) gst_buffer_unref(buffer); - convert->direct_rendering = 0; + upload->direct_rendering = 0; return GST_FLOW_OK; } static GstFlowReturn -gst_vaapiconvert_sinkpad_buffer_alloc( +gst_vaapiupload_sinkpad_buffer_alloc( GstPad *pad, guint64 offset, guint size, @@ -755,13 +755,13 @@ gst_vaapiconvert_sinkpad_buffer_alloc( if (!trans) return GST_FLOW_UNEXPECTED; - ret = gst_vaapiconvert_buffer_alloc(trans, size, caps, pbuf); + ret = gst_vaapiupload_buffer_alloc(trans, size, caps, pbuf); g_object_unref(trans); return ret; } static GstFlowReturn -gst_vaapiconvert_prepare_output_buffer( +gst_vaapiupload_prepare_output_buffer( GstBaseTransform *trans, GstBuffer *inbuf, gint size, @@ -769,22 +769,22 @@ gst_vaapiconvert_prepare_output_buffer( GstBuffer **poutbuf ) { - GstVaapiConvert * const convert = GST_VAAPICONVERT(trans); + GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); GstBuffer *buffer = NULL; - if (convert->direct_rendering == 2) { + if (upload->direct_rendering == 2) { if (GST_VAAPI_IS_VIDEO_BUFFER(inbuf)) { buffer = gst_vaapi_video_buffer_new_from_buffer(inbuf); GST_BUFFER_SIZE(buffer) = size; } else { GST_DEBUG("upstream element destroyed our in/out buffer"); - convert->direct_rendering = 1; + upload->direct_rendering = 1; } } if (!buffer) { - buffer = gst_vaapi_video_buffer_new_from_pool(convert->surfaces); + buffer = gst_vaapi_video_buffer_new_from_pool(upload->surfaces); if (!buffer) return GST_FLOW_UNEXPECTED; } @@ -795,18 +795,18 @@ gst_vaapiconvert_prepare_output_buffer( } static gboolean -gst_vaapiconvert_query(GstPad *pad, GstQuery *query) +gst_vaapiupload_query(GstPad *pad, GstQuery *query) { - GstVaapiConvert *convert = GST_VAAPICONVERT (gst_pad_get_parent_element (pad)); + GstVaapiUpload *upload = GST_VAAPIUPLOAD (gst_pad_get_parent_element (pad)); gboolean res; - GST_DEBUG ("sharing display %p", convert->display); + GST_DEBUG ("sharing display %p", upload->display); - if (gst_vaapi_reply_to_query (query, convert->display)) + if (gst_vaapi_reply_to_query (query, upload->display)) res = TRUE; else res = gst_pad_query_default (pad, query); - g_object_unref (convert); + g_object_unref (upload); return res; } diff --git a/gst/vaapi/gstvaapiconvert.h b/gst/vaapi/gstvaapiupload.h index 7c29c6cd..07e57717 100644 --- a/gst/vaapi/gstvaapiconvert.h +++ b/gst/vaapi/gstvaapiupload.h @@ -1,5 +1,5 @@ /* - * gstvaapiconvert.h - VA-API video converter + * gstvaapiupload.h - VA-API video uploader * * gstreamer-vaapi (C) 2010-2011 Splitted-Desktop Systems * @@ -19,8 +19,8 @@ * Boston, MA 02110-1301 USA */ -#ifndef GST_VAAPICONVERT_H -#define GST_VAAPICONVERT_H +#ifndef GST_VAAPIUPLOAD_H +#define GST_VAAPIUPLOAD_H #include <gst/base/gstbasetransform.h> #include <gst/vaapi/gstvaapidisplay.h> @@ -31,37 +31,37 @@ G_BEGIN_DECLS -#define GST_TYPE_VAAPICONVERT \ - (gst_vaapiconvert_get_type()) +#define GST_TYPE_VAAPIUPLOAD \ + (gst_vaapiupload_get_type()) -#define GST_VAAPICONVERT(obj) \ +#define GST_VAAPIUPLOAD(obj) \ (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GST_TYPE_VAAPICONVERT, \ - GstVaapiConvert)) + GST_TYPE_VAAPIUPLOAD, \ + GstVaapiUpload)) -#define GST_VAAPICONVERT_CLASS(klass) \ +#define GST_VAAPIUPLOAD_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), \ - GST_TYPE_VAAPICONVERT, \ - GstVaapiConvertClass)) + GST_TYPE_VAAPIUPLOAD, \ + GstVaapiUploadClass)) -#define GST_IS_VAAPICONVERT(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPICONVERT)) +#define GST_IS_VAAPIUPLOAD(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPIUPLOAD)) -#define GST_IS_VAAPICONVERT_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPICONVERT)) +#define GST_IS_VAAPIUPLOAD_CLASS(klass) \ + (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPIUPLOAD)) -#define GST_VAAPICONVERT_GET_CLASS(obj) \ +#define GST_VAAPIUPLOAD_GET_CLASS(obj) \ (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GST_TYPE_VAAPICONVERT, \ - GstVaapiConvertClass)) + GST_TYPE_VAAPIUPLOAD, \ + GstVaapiUploadClass)) -typedef struct _GstVaapiConvert GstVaapiConvert; -typedef struct _GstVaapiConvertClass GstVaapiConvertClass; +typedef struct _GstVaapiUpload GstVaapiUpload; +typedef struct _GstVaapiUploadClass GstVaapiUploadClass; /* Max output surfaces */ -#define GST_VAAPICONVERT_MAX_SURFACES 2 +#define GST_VAAPIUPLOAD_MAX_SURFACES 2 -struct _GstVaapiConvert { +struct _GstVaapiUpload { /*< private >*/ GstBaseTransform parent_instance; @@ -78,14 +78,14 @@ struct _GstVaapiConvert { unsigned int surfaces_reset : 1; }; -struct _GstVaapiConvertClass { +struct _GstVaapiUploadClass { /*< private >*/ GstBaseTransformClass parent_class; }; GType -gst_vaapiconvert_get_type(void); +gst_vaapiupload_get_type(void); G_END_DECLS -#endif /* GST_VAAPICONVERT_H */ +#endif /* GST_VAAPIUPLOAD_H */ |