From d256f1d283066a87f2930a40770d3dca8336a8d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=ADctor=20Manuel=20J=C3=A1quez=20Leal?= Date: Fri, 3 Apr 2015 16:55:27 +0300 Subject: [PATCH] Removal of gstreamer-0.10 support This patch removes all the pre-processor conditional code compilation guarded for gstreamer-0.10. https://bugzilla.gnome.org/show_bug.cgi?id=745728 https://bugzilla.gnome.org/show_bug.cgi?id=732666 Signed-off-by: Gwenole Beauchesne --- gst-libs/gst/vaapi/gstcompat.h | 280 ------------- gst-libs/gst/vaapi/gstvaapicontext_overlay.c | 5 - gst-libs/gst/vaapi/gstvaapidecoder.c | 15 - gst-libs/gst/vaapi/gstvaapiimage.c | 47 --- gst-libs/gst/vaapi/gstvaapisubpicture.c | 14 +- gst-libs/gst/vaapi/video-format.c | 49 --- gst-libs/gst/vaapi/video-format.h | 3 - gst/vaapi/gstvaapi.c | 18 - gst/vaapi/gstvaapidecode.c | 25 -- gst/vaapi/gstvaapidecodebin.c | 2 - gst/vaapi/gstvaapidownload.c | 585 --------------------------- gst/vaapi/gstvaapidownload.h | 67 --- gst/vaapi/gstvaapiencode.c | 29 -- gst/vaapi/gstvaapiencode_h264.c | 8 - gst/vaapi/gstvaapiencode_jpeg.c | 4 - gst/vaapi/gstvaapiencode_mpeg2.c | 8 - gst/vaapi/gstvaapiencode_vp8.c | 4 - gst/vaapi/gstvaapiparse.c | 8 - gst/vaapi/gstvaapipluginbase.c | 57 --- gst/vaapi/gstvaapipluginbase.h | 4 - gst/vaapi/gstvaapipluginutil.c | 43 -- gst/vaapi/gstvaapipluginutil.h | 9 - gst/vaapi/gstvaapipostproc.c | 62 +-- gst/vaapi/gstvaapisink.c | 54 --- gst/vaapi/gstvaapiupload.c | 445 -------------------- gst/vaapi/gstvaapiupload.h | 77 ---- gst/vaapi/gstvaapiuploader.c | 4 - gst/vaapi/gstvaapivideobuffer.c | 88 +--- gst/vaapi/gstvaapivideoconverter_glx.c | 5 - gst/vaapi/gstvaapivideoconverter_x11.c | 7 - gst/vaapi/gstvaapivideometa.c | 88 +--- gst/vaapi/gstvaapivideometa.h | 2 - tests/test-filter.c | 2 +- tests/test-subpicture.c | 6 - 34 files changed, 6 insertions(+), 2118 deletions(-) delete mode 100644 gst/vaapi/gstvaapidownload.c delete mode 100644 gst/vaapi/gstvaapidownload.h delete mode 100644 gst/vaapi/gstvaapiupload.c delete mode 100644 gst/vaapi/gstvaapiupload.h diff --git a/gst-libs/gst/vaapi/gstcompat.h b/gst-libs/gst/vaapi/gstcompat.h index 9abc2fd..ad5a172 100644 --- a/gst-libs/gst/vaapi/gstcompat.h +++ b/gst-libs/gst/vaapi/gstcompat.h @@ -25,11 +25,6 @@ #include -/* ------------------------------------------------------------------------ */ -/* --- GStreamer >= 1.0 --- */ -/* ------------------------------------------------------------------------ */ - -#if GST_CHECK_VERSION(1,0,0) #include /* GstStructure */ @@ -73,279 +68,4 @@ typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, GstCaps *); #define GST_MAKE_FORMAT_STRING(FORMAT) \ "format=(string)" G_STRINGIFY(FORMAT) -/* ------------------------------------------------------------------------ */ -/* --- GStreamer = 0.10 --- */ -/* ------------------------------------------------------------------------ */ - -#else - -/* GstMemory */ -typedef enum { - GST_MEMORY_FLAG_READONLY = GST_MINI_OBJECT_FLAG_READONLY -} GstMemoryFlags; - -typedef enum { - GST_BUFFER_COPY_META = GST_BUFFER_COPY_QDATA, - GST_BUFFER_COPY_MEMORY = 0, -} GstBufferCopyFlags1_0; - -typedef enum { - GST_MAP_READ = 1 << 0, - GST_MAP_WRITE = 1 << 1 -} GstMapFlags; - -typedef struct { - GstMapFlags flags; - guint8 *data; - gsize size; -} GstMapInfo; - -/* GstBuffer */ -#undef gst_buffer_new_wrapped -#define gst_buffer_new_wrapped(data, size) \ - gst_compat_buffer_new_wrapped_full(0, data, size, 0, size, data, g_free) -#undef gst_buffer_new_wrapped_full -#define gst_buffer_new_wrapped_full(flags, data, maxsize, ofs, size, ud, udd) \ - gst_compat_buffer_new_wrapped_full(flags, data, maxsize, ofs, size, ud, udd) -#undef gst_buffer_new_allocate -#define gst_buffer_new_allocate(allocator, size, params) \ - gst_compat_buffer_new_allocate((allocator), (size), (params)) -#undef gst_buffer_get_size -#define gst_buffer_get_size(buffer) gst_compat_buffer_get_size(buffer) -#undef gst_buffer_map -#define gst_buffer_map(buffer, mip, f) gst_compat_buffer_map(buffer, mip, f) -#undef gst_buffer_unmap -#define gst_buffer_unmap(buffer, mip) gst_compat_buffer_unmap(buffer, mip) -#undef gst_buffer_extract -#define gst_buffer_extract(buffer, offset, dest, size) \ - gst_compat_buffer_extract(buffer, offset, dest, size) -#undef gst_buffer_fill -#define gst_buffer_fill(buffer, offset, src, size) \ - gst_compat_buffer_fill((buffer), (offset), (src), (size)) -#undef gst_buffer_copy_into -#define gst_buffer_copy_into(dest, src, flags, offset, size) \ - gst_compat_buffer_copy_into(dest, src, flags, offset, size) - -static inline GstBuffer * -gst_compat_buffer_new_wrapped_full(GstMemoryFlags flags, gpointer data, - gsize maxsize, gsize offset, gsize size, gpointer user_data, - GDestroyNotify notify) -{ - GstBuffer *buffer; - - /* XXX: unsupported */ - g_return_val_if_fail(maxsize >= size, NULL); - - buffer = gst_buffer_new(); - if (!buffer) - return NULL; - - GST_BUFFER_DATA(buffer) = data + offset; - GST_BUFFER_SIZE(buffer) = size; - - if (notify) - gst_mini_object_weak_ref(GST_MINI_OBJECT_CAST(buffer), - (GstMiniObjectWeakNotify)notify, user_data); - return buffer; -} - -static inline GstBuffer * -gst_compat_buffer_new_allocate(gpointer allocator, gsize size, gpointer params) -{ - /* XXX: unsupported */ - g_return_val_if_fail(allocator == NULL, NULL); - g_return_val_if_fail(params == NULL, NULL); - - return gst_buffer_new_and_alloc(size); -} - -static inline gsize -gst_compat_buffer_get_size(GstBuffer *buffer) -{ - return GST_BUFFER_SIZE(buffer); -} - -static inline gboolean -gst_compat_buffer_map(GstBuffer *buffer, GstMapInfo *mip, GstMapFlags flags) -{ - mip->flags = flags; - mip->data = GST_BUFFER_DATA(buffer); - mip->size = GST_BUFFER_SIZE(buffer); - return TRUE; -} - -static inline void -gst_compat_buffer_unmap(GstBuffer *buffer, GstMapInfo *mip) -{ -} - -static inline gsize -gst_compat_buffer_extract(GstBuffer *buffer, gsize offset, gpointer dest, - gsize size) -{ - gsize esize; - - if (!buffer || !dest || offset >= GST_BUFFER_SIZE(buffer)) - return 0; - - esize = MIN(size, GST_BUFFER_SIZE(buffer) - offset); - memcpy(dest, GST_BUFFER_DATA(buffer) + offset, esize); - return esize; -} - -static inline gsize -gst_compat_buffer_fill(GstBuffer *buffer, gsize offset, gconstpointer src, - gsize size) -{ - gsize fsize; - - if (!buffer || !src || offset >= GST_BUFFER_SIZE(buffer)) - return 0; - - fsize = MIN(size, GST_BUFFER_SIZE(buffer) - offset); - memcpy(GST_BUFFER_DATA(buffer) + offset, src, fsize); - return fsize; -} - -static inline void -gst_compat_buffer_copy_into(GstBuffer *dest, GstBuffer *src, - GstBufferCopyFlags flags, gsize offset, gsize size) -{ - g_return_if_fail(offset == 0); - g_return_if_fail(size == (gsize)-1); - - gst_buffer_copy_metadata(dest, src, flags); -} - -/* GstAdapter */ -#include - -#undef gst_adapter_map -#define gst_adapter_map(adapter, size) gst_compat_adapter_map(adapter, size) -#undef gst_adapter_unmap -#define gst_adapter_unmap(adapter) gst_compat_adapter_unmap(adapter) - -static inline gconstpointer -gst_compat_adapter_map(GstAdapter *adapter, gsize size) -{ - return gst_adapter_peek(adapter, size); -} - -static inline void -gst_compat_adapter_unmap(GstAdapter *adapter) -{ -} - -/* GstCaps */ -#undef gst_caps_merge -#define gst_caps_merge(caps1, caps2) gst_compat_caps_merge(caps1, caps2) -#undef gst_caps_merge_structure -#define gst_caps_merge_structure(caps, structure) \ - gst_compat_caps_merge_structure(caps, structure) - -static inline GstCaps * -gst_compat_caps_merge(GstCaps *caps1, GstCaps *caps2) -{ - (gst_caps_merge)(caps1, caps2); - return caps1; -} - -static inline GstCaps * -gst_compat_caps_merge_structure(GstCaps *caps, GstStructure *structure) -{ - (gst_caps_merge_structure)(caps, structure); - return caps; -} - -/* GstVideoOverlayComposition */ -#include - -#undef gst_video_overlay_rectangle_get_pixels_unscaled_raw -#define gst_video_overlay_rectangle_get_pixels_unscaled_raw(rect, flags) \ - gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw(rect, flags) - -#ifndef HAVE_GST_VIDEO_OVERLAY_HWCAPS -#define gst_video_overlay_rectangle_get_flags(rect) (0) -#define gst_video_overlay_rectangle_get_global_alpha(rect) (1.0f) -#endif - -static inline GstBuffer * -gst_compat_video_overlay_rectangle_get_pixels_unscaled_raw( - GstVideoOverlayRectangle *rect, GstVideoOverlayFormatFlags flags) -{ - guint width, height, stride; - - /* Try to retrieve the original buffer that was passed to - gst_video_overlay_rectangle_new_argb(). This will only work if - there was no previous user that required pixels with non native - alpha type */ - return gst_video_overlay_rectangle_get_pixels_unscaled_argb(rect, - &width, &height, &stride, flags); -} - -typedef enum { - GST_VIDEO_BUFFER_FLAG_TFF = GST_VIDEO_BUFFER_TFF, - GST_VIDEO_BUFFER_FLAG_RFF = GST_VIDEO_BUFFER_RFF, - GST_VIDEO_BUFFER_FLAG_ONEFIELD = GST_VIDEO_BUFFER_ONEFIELD -} GstVideoBufferFlags; - -/* GstPad */ -#undef GST_FLOW_EOS -#define GST_FLOW_EOS GST_FLOW_UNEXPECTED -#undef GST_FLOW_FLUSHING -#define GST_FLOW_FLUSHING GST_FLOW_WRONG_STATE - -#define GST_PAD_CHAIN_FUNCTION_ARGS \ - GstPad *pad, GstBuffer *buffer -#define GST_PAD_EVENT_FUNCTION_ARGS \ - GstPad *pad, GstEvent *event - -static inline gboolean -gst_compat_pad_start_task(GstPad *pad, GstTaskFunction func, gpointer user_data, - GDestroyNotify notify) -{ - g_return_val_if_fail(notify == NULL, FALSE); - - return gst_pad_start_task(pad, func, user_data); -} - -#undef gst_pad_start_task -#define gst_pad_start_task(pad, func, user_data, notify) \ - gst_compat_pad_start_task(pad, func, user_data, notify) - -/* GstElement */ -#undef GST_ELEMENT_FLAG_SINK -#define GST_ELEMENT_FLAG_SINK GST_ELEMENT_IS_SINK -#undef gst_element_class_set_static_metadata -#define gst_element_class_set_static_metadata(klass, name, path, desc, author) \ - gst_compat_element_class_set_static_metadata(klass, name, path, desc, author) - -static inline void -gst_compat_element_class_set_static_metadata(GstElementClass *klass, - const gchar *name, const char *path, const gchar *desc, const gchar *author) -{ - gst_element_class_set_details_simple(klass, name, path, desc, author); -} - -/* GstTypeFind */ -#undef GstTypeFindPeekFunction -#define GstTypeFindPeekFunction GstCompatTypeFindPeekFunction -#undef GstTypeFindSuggestFunction -#define GstTypeFindSuggestFunction GstCompatTypeFindSuggestFunction - -typedef guint8 *(*GstCompatTypeFindPeekFunction)(gpointer, gint64, guint); -typedef void (*GstCompatTypeFindSuggestFunction)(gpointer, guint, const GstCaps *); - -/* GstQuery */ -#define GST_PAD_QUERY_FUNCTION_ARGS \ - GstPad *pad, GstQuery *query -#define GST_PAD_QUERY_FUNCTION_CALL(func, pad, parent, query) \ - (func)(pad, query) - -/* Misc helpers */ -#define GST_MAKE_FORMAT_STRING(FORMAT) \ - "format=(fourcc)" G_STRINGIFY(FORMAT) - -#endif - #endif /* GST_COMPAT_H */ diff --git a/gst-libs/gst/vaapi/gstvaapicontext_overlay.c b/gst-libs/gst/vaapi/gstvaapicontext_overlay.c index b38e62e..117f0d8 100644 --- a/gst-libs/gst/vaapi/gstvaapicontext_overlay.c +++ b/gst-libs/gst/vaapi/gstvaapicontext_overlay.c @@ -198,7 +198,6 @@ overlay_rectangle_changed_pixels (GstVaapiOverlayRectangle * overlay, buffer = gst_video_overlay_rectangle_get_pixels_unscaled_raw (rect, flags); if (!buffer) return FALSE; -#if GST_CHECK_VERSION(1,0,0) { const guint n_blocks = gst_buffer_n_memory (buffer); gsize ofs; @@ -217,10 +216,6 @@ overlay_rectangle_changed_pixels (GstVaapiOverlayRectangle * overlay, return FALSE; } } -#else - if (GST_BUFFER_DATA (overlay->rect_buffer) != GST_BUFFER_DATA (buffer)) - return FALSE; -#endif return TRUE; } diff --git a/gst-libs/gst/vaapi/gstvaapidecoder.c b/gst-libs/gst/vaapi/gstvaapidecoder.c index 3ef4cba..87801f1 100644 --- a/gst-libs/gst/vaapi/gstvaapidecoder.c +++ b/gst-libs/gst/vaapi/gstvaapidecoder.c @@ -816,21 +816,6 @@ gst_vaapi_decoder_get_frame_with_timeout (GstVaapiDecoder * decoder, if (!out_frame) return GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA; -#if !GST_CHECK_VERSION(1,0,0) - if (!GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY (out_frame)) { - const guint flags = GST_VAAPI_SURFACE_PROXY_FLAGS (out_frame->user_data); - guint out_flags = 0; - - if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_TFF) - out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_TFF; - if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_RFF) - out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_RFF; - if (flags & GST_VAAPI_SURFACE_PROXY_FLAG_ONEFIELD) - out_flags |= GST_VIDEO_CODEC_FRAME_FLAG_ONEFIELD; - GST_VIDEO_CODEC_FRAME_FLAG_SET (out_frame, out_flags); - } -#endif - *out_frame_ptr = out_frame; return GST_VAAPI_DECODER_STATUS_SUCCESS; } diff --git a/gst-libs/gst/vaapi/gstvaapiimage.c b/gst-libs/gst/vaapi/gstvaapiimage.c index 41d4a1c..8a295a5 100644 --- a/gst-libs/gst/vaapi/gstvaapiimage.c +++ b/gst-libs/gst/vaapi/gstvaapiimage.c @@ -698,7 +698,6 @@ gst_vaapi_image_get_data_size(GstVaapiImage *image) return image->image.data_size; } -#if GST_CHECK_VERSION(1,0,0) #include static gboolean @@ -715,52 +714,6 @@ init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer) return vmeta ? init_image_from_video_meta(raw_image, vmeta) : FALSE; } -#else -static gboolean -init_image_from_buffer(GstVaapiImageRaw *raw_image, GstBuffer *buffer) -{ - GstCaps *caps; - guchar *data; - guint32 data_size; - GstVideoInfo vi; - guint i, frame_size; - - data = GST_BUFFER_DATA(buffer); - data_size = GST_BUFFER_SIZE(buffer); - caps = GST_BUFFER_CAPS(buffer); - - if (!caps) - return FALSE; - - if (!gst_video_info_from_caps(&vi, caps)) - goto error_unsupported_caps; - - /* Check for compatible data size */ - frame_size = GST_VIDEO_INFO_SIZE(&vi); - if (frame_size != data_size) - goto error_incompatible_size; - - raw_image->format = GST_VIDEO_INFO_FORMAT(&vi); - raw_image->width = GST_VIDEO_INFO_WIDTH(&vi); - raw_image->height = GST_VIDEO_INFO_HEIGHT(&vi); - - raw_image->num_planes = GST_VIDEO_INFO_N_PLANES(&vi); - for (i = 0; i < raw_image->num_planes; i++) { - raw_image->pixels[i] = data + GST_VIDEO_INFO_PLANE_OFFSET(&vi, i); - raw_image->stride[i] = GST_VIDEO_INFO_PLANE_STRIDE(&vi, i); - } - return TRUE; - - /* ERRORS */ -error_unsupported_caps: - GST_ERROR("unsupported caps %" GST_PTR_FORMAT, caps); - return FALSE; -error_incompatible_size: - GST_ERROR("incompatible frame size (%u) with buffer size (%u)", - frame_size, data_size); - return FALSE; -} -#endif /* Copy N lines of an image */ static inline void diff --git a/gst-libs/gst/vaapi/gstvaapisubpicture.c b/gst-libs/gst/vaapi/gstvaapisubpicture.c index e8d28a4..370ff87 100644 --- a/gst-libs/gst/vaapi/gstvaapisubpicture.c +++ b/gst-libs/gst/vaapi/gstvaapisubpicture.c @@ -191,10 +191,8 @@ gst_vaapi_subpicture_new_from_overlay_rectangle( gfloat global_alpha; guint width, height, stride; guint hw_flags, flags; -#if GST_CHECK_VERSION(1,0,0) GstVideoMeta *vmeta; GstMapInfo map_info; -#endif g_return_val_if_fail(GST_IS_VIDEO_OVERLAY_RECTANGLE(rect), NULL); @@ -206,11 +204,10 @@ gst_vaapi_subpicture_new_from_overlay_rectangle( #endif if (!gst_vaapi_display_has_subpicture_format(display, format, &hw_flags)) return NULL; - + flags = hw_flags & from_GstVideoOverlayFormatFlags( gst_video_overlay_rectangle_get_flags(rect)); -#if GST_CHECK_VERSION(1,0,0) buffer = gst_video_overlay_rectangle_get_pixels_unscaled_argb(rect, to_GstVideoOverlayFormatFlags(flags)); if (!buffer) @@ -225,13 +222,6 @@ gst_vaapi_subpicture_new_from_overlay_rectangle( if (!gst_video_meta_map(vmeta, 0, &map_info, (gpointer *)&data, (gint *)&stride, GST_MAP_READ)) return NULL; -#else - buffer = (gst_video_overlay_rectangle_get_pixels_unscaled_argb)(rect, - &width, &height, &stride, to_GstVideoOverlayFormatFlags(flags)); - if (!buffer) - return NULL; - data = GST_BUFFER_DATA(buffer); -#endif image = gst_vaapi_image_new(display, format, width, height); if (!image) @@ -251,9 +241,7 @@ gst_vaapi_subpicture_new_from_overlay_rectangle( subpicture = gst_vaapi_subpicture_new(image, flags); gst_vaapi_object_unref(image); -#if GST_CHECK_VERSION(1,0,0) gst_video_meta_unmap(vmeta, 0, &map_info); -#endif if (!subpicture) return NULL; diff --git a/gst-libs/gst/vaapi/video-format.c b/gst-libs/gst/vaapi/video-format.c index 8877879..34c70aa 100644 --- a/gst-libs/gst/vaapi/video-format.c +++ b/gst-libs/gst/vaapi/video-format.c @@ -126,55 +126,6 @@ get_map (GstVideoFormat format) } /** - * gst_vaapi_video_format_from_string: - * @str: a string representation of #GstVideoFormat - * - * Returns the #GstVideoFormat represented as the string @str. - * - * Return value: #GstVideoFormat for the string representation of - * video format in @str. - */ -GstVideoFormat -gst_vaapi_video_format_from_string (const gchar * str) -{ -#if GST_CHECK_VERSION(1,0,0) - return gst_video_format_from_string (str); -#else - GstVideoFormat format = GST_VIDEO_FORMAT_UNKNOWN; - - do { - /* Validate input string */ - if (!str) - break; - - /* Fast path: assume this represents a common fourcc value */ - const guint32 fourcc = GST_MAKE_FOURCC (str[0], str[1], str[2], str[3]); - format = gst_video_format_from_fourcc (fourcc); - if (format != GST_VIDEO_FORMAT_UNKNOWN) - break; - - /* Slow path: check through all registered enum values */ - GEnumClass *const enum_class = g_type_class_ref (GST_TYPE_VIDEO_FORMAT); - if (!enum_class) - break; - - gchar *const video_format_str = - g_strdup_printf ("GST_VIDEO_FORMAT_%s", str); - if (video_format_str) { - const GEnumValue *const enum_value = - g_enum_get_value_by_name (enum_class, video_format_str); - - if (enum_value) - format = enum_value->value; - g_free (video_format_str); - } - g_type_class_unref (enum_class); - } while (0); - return format; -#endif -} - -/** * gst_vaapi_video_format_to_string: * @format: a #GstVideoFormat * diff --git a/gst-libs/gst/vaapi/video-format.h b/gst-libs/gst/vaapi/video-format.h index acc333d..4830522 100644 --- a/gst-libs/gst/vaapi/video-format.h +++ b/gst-libs/gst/vaapi/video-format.h @@ -29,9 +29,6 @@ G_BEGIN_DECLS -GstVideoFormat -gst_vaapi_video_format_from_string (const gchar * str); - const gchar * gst_vaapi_video_format_to_string (GstVideoFormat format); diff --git a/gst/vaapi/gstvaapi.c b/gst/vaapi/gstvaapi.c index 4926d01..bf39038 100644 --- a/gst/vaapi/gstvaapi.c +++ b/gst/vaapi/gstvaapi.c @@ -24,8 +24,6 @@ #include "gst/vaapi/sysdeps.h" #include -#include "gstvaapidownload.h" -#include "gstvaapiupload.h" #include "gstvaapidecode.h" #include "gstvaapipostproc.h" #include "gstvaapisink.h" @@ -51,14 +49,6 @@ static gboolean plugin_init (GstPlugin *plugin) { -#if !GST_CHECK_VERSION(1,0,0) - gst_element_register(plugin, "vaapidownload", - GST_RANK_SECONDARY, - GST_TYPE_VAAPIDOWNLOAD); - gst_element_register(plugin, "vaapiupload", - GST_RANK_PRIMARY, - GST_TYPE_VAAPIUPLOAD); -#endif gst_element_register(plugin, "vaapidecode", GST_RANK_PRIMARY + 1, GST_TYPE_VAAPIDECODE); @@ -95,14 +85,6 @@ plugin_init (GstPlugin *plugin) return TRUE; } -#if GST_CHECK_VERSION(1,0,0) -/* XXX: use PLUGIN_NAME when GST_PLUGIN_DEFINE is fixed to use - G_STRINGIFY() for name argument, instead of plain #name */ GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, vaapi, PLUGIN_DESC, plugin_init, PACKAGE_VERSION, PLUGIN_LICENSE, PACKAGE, PACKAGE_BUGREPORT) -#else -GST_PLUGIN_DEFINE(GST_VERSION_MAJOR, GST_VERSION_MINOR, - PLUGIN_NAME, PLUGIN_DESC, plugin_init, - PACKAGE_VERSION, PLUGIN_LICENSE, PACKAGE, PACKAGE_BUGREPORT) -#endif diff --git a/gst/vaapi/gstvaapidecode.c b/gst/vaapi/gstvaapidecode.c index 04851f4..7ada2b5 100644 --- a/gst/vaapi/gstvaapidecode.c +++ b/gst/vaapi/gstvaapidecode.c @@ -39,10 +39,8 @@ #if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL) #include "gstvaapivideometa_texture.h" #endif -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideobufferpool.h" #include "gstvaapivideomemory.h" -#endif #include #include @@ -263,11 +261,9 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, GstVaapiDecode *const decode = GST_VAAPIDECODE (vdec); GstVaapiSurfaceProxy *proxy; GstFlowReturn ret; -#if GST_CHECK_VERSION(1,0,0) const GstVaapiRectangle *crop_rect; GstVaapiVideoMeta *meta; guint flags; -#endif if (!GST_VIDEO_CODEC_FRAME_IS_DECODE_ONLY (out_frame)) { proxy = gst_video_codec_frame_get_user_data (out_frame); @@ -275,7 +271,6 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, gst_vaapi_surface_proxy_set_destroy_notify (proxy, (GDestroyNotify) gst_vaapidecode_release, gst_object_ref (decode)); -#if GST_CHECK_VERSION(1,0,0) ret = gst_video_decoder_allocate_output_frame (vdec, out_frame); if (ret != GST_FLOW_OK) goto error_create_buffer; @@ -312,12 +307,6 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, if (decode->has_texture_upload_meta) gst_buffer_ensure_texture_upload_meta (out_frame->output_buffer); #endif -#else - out_frame->output_buffer = - gst_vaapi_video_buffer_new_with_surface_proxy (proxy); - if (!out_frame->output_buffer) - goto error_create_buffer; -#endif } ret = gst_video_decoder_finish_frame (vdec, out_frame); @@ -341,7 +330,6 @@ error_create_buffer: gst_video_codec_frame_unref (out_frame); return GST_FLOW_ERROR; } -#if GST_CHECK_VERSION(1,0,0) error_get_meta: { GST_ELEMENT_ERROR (vdec, STREAM, FAILED, @@ -351,7 +339,6 @@ error_get_meta: gst_video_codec_frame_unref (out_frame); return GST_FLOW_ERROR; } -#endif error_commit_buffer: { if (ret != GST_FLOW_FLUSHING) @@ -539,7 +526,6 @@ gst_vaapidecode_finish (GstVideoDecoder * vdec) return gst_vaapidecode_push_all_decoded_frames (decode); } -#if GST_CHECK_VERSION(1,0,0) static gboolean gst_vaapidecode_decide_allocation (GstVideoDecoder * vdec, GstQuery * query) { @@ -571,7 +557,6 @@ gst_vaapidecode_decide_allocation (GstVideoDecoder * vdec, GstQuery * query) return gst_vaapi_plugin_base_decide_allocation (GST_VAAPI_PLUGIN_BASE (vdec), query, feature); } -#endif static inline gboolean gst_vaapidecode_ensure_display (GstVaapiDecode * decode) @@ -861,11 +846,8 @@ gst_vaapidecode_class_init (GstVaapiDecodeClass * klass) #if GST_CHECK_VERSION(1,5,0) vdec_class->drain = GST_DEBUG_FUNCPTR (gst_vaapidecode_drain); #endif - -#if GST_CHECK_VERSION(1,0,0) vdec_class->decide_allocation = GST_DEBUG_FUNCPTR (gst_vaapidecode_decide_allocation); -#endif #if GST_CHECK_VERSION(1,4,0) vdec_class->src_query = GST_DEBUG_FUNCPTR (gst_vaapidecode_src_query); vdec_class->sink_query = GST_DEBUG_FUNCPTR (gst_vaapidecode_sink_query); @@ -1001,7 +983,6 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query) } switch (GST_QUERY_TYPE (query)) { -#if GST_CHECK_VERSION(1,0,0) case GST_QUERY_CAPS:{ GstCaps *caps, *filter = NULL; GstPad *pad = GST_VIDEO_DECODER_SINK_PAD (vdec); @@ -1019,7 +1000,6 @@ gst_vaapidecode_sink_query (GstVideoDecoder * vdec, GstQuery * query) gst_caps_unref (caps); break; } -#endif default:{ #if GST_CHECK_VERSION(1,4,0) ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->sink_query @@ -1052,7 +1032,6 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) } switch (GST_QUERY_TYPE (query)) { -#if GST_CHECK_VERSION(1,0,0) case GST_QUERY_CAPS:{ GstCaps *caps, *filter = NULL; GstPad *pad = GST_VIDEO_DECODER_SRC_PAD (vdec); @@ -1070,7 +1049,6 @@ gst_vaapidecode_src_query (GstVideoDecoder * vdec, GstQuery * query) gst_caps_unref (caps); break; } -#endif default:{ #if GST_CHECK_VERSION(1,4,0) ret = GST_VIDEO_DECODER_CLASS (gst_vaapidecode_parent_class)->src_query @@ -1110,9 +1088,6 @@ gst_vaapidecode_init (GstVaapiDecode * decode) /* Pad through which data comes in to the element */ GstPad *pad = GST_VAAPI_PLUGIN_BASE_SINK_PAD (decode); gst_pad_set_query_function (pad, GST_DEBUG_FUNCPTR (gst_vaapidecode_query)); -#if !GST_CHECK_VERSION(1,0,0) - gst_pad_set_getcaps_function (pad, gst_vaapidecode_get_caps); -#endif /* Pad through which data goes out of the element */ pad = GST_VAAPI_PLUGIN_BASE_SRC_PAD (decode); diff --git a/gst/vaapi/gstvaapidecodebin.c b/gst/vaapi/gstvaapidecodebin.c index 388ff02..6454cb9 100644 --- a/gst/vaapi/gstvaapidecodebin.c +++ b/gst/vaapi/gstvaapidecodebin.c @@ -80,9 +80,7 @@ static const char gst_vaapi_decode_bin_src_caps_str[] = GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ", " GST_CAPS_INTERLACED_FALSE "; " #endif -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ diff --git a/gst/vaapi/gstvaapidownload.c b/gst/vaapi/gstvaapidownload.c deleted file mode 100644 index 045a6de..0000000 --- a/gst/vaapi/gstvaapidownload.c +++ /dev/null @@ -1,585 +0,0 @@ -/* - * gstvaapidownload.c - VA-API video downloader - * - * Copyright (C) 2010-2011 Splitted-Desktop Systems - * Author: Gwenole Beauchesne - * Copyright (C) 2011-2013 Intel Corporation - * Author: Gwenole Beauchesne - * - * 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 - */ - -/** - * SECTION:gstvaapidownload - * @short_description: A VA to video flow filter - * - * vaapidownload converts from VA surfaces to raw YUV pixels. - */ - -#include "gst/vaapi/sysdeps.h" -#include -#include - -#include "gstvaapidownload.h" -#include "gstvaapipluginutil.h" -#include "gstvaapivideobuffer.h" - -#define GST_PLUGIN_NAME "vaapidownload" -#define GST_PLUGIN_DESC "A VA to video flow filter" - -GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapidownload); -#define GST_CAT_DEFAULT gst_debug_vaapidownload - -/* Default templates */ -static const char gst_vaapidownload_yuv_caps_str[] = - "video/x-raw-yuv, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ]; "; - -static const char gst_vaapidownload_vaapi_caps_str[] = - GST_VAAPI_SURFACE_CAPS; - -static GstStaticPadTemplate gst_vaapidownload_sink_factory = - GST_STATIC_PAD_TEMPLATE( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapidownload_vaapi_caps_str)); - -static GstStaticPadTemplate gst_vaapidownload_src_factory = - GST_STATIC_PAD_TEMPLATE( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapidownload_yuv_caps_str)); - -typedef struct _TransformSizeCache TransformSizeCache; -struct _TransformSizeCache { - GstCaps *caps; - guint size; -}; - -struct _GstVaapiDownload { - /*< private >*/ - GstVaapiPluginBase parent_instance; - - GstCaps *allowed_caps; - TransformSizeCache transform_size_cache[2]; - GstVaapiVideoPool *images; - GstVideoFormat image_format; - guint image_width; - guint image_height; - unsigned int images_reset : 1; -}; - -struct _GstVaapiDownloadClass { - /*< private >*/ - GstVaapiPluginBaseClass parent_class; -}; - -G_DEFINE_TYPE_WITH_CODE( - GstVaapiDownload, - gst_vaapidownload, - GST_TYPE_BASE_TRANSFORM, - GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES) - -static gboolean -gst_vaapidownload_start(GstBaseTransform *trans); - -static gboolean -gst_vaapidownload_stop(GstBaseTransform *trans); - -static void -gst_vaapidownload_before_transform(GstBaseTransform *trans, GstBuffer *buffer); - -static GstFlowReturn -gst_vaapidownload_transform( - GstBaseTransform *trans, - GstBuffer *inbuf, - GstBuffer *outbuf -); - -static GstCaps * -gst_vaapidownload_transform_caps( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps -); - -static gboolean -gst_vaapidownload_transform_size( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps, - guint size, - GstCaps *othercaps, - guint *othersize -); - -static gboolean -gst_vaapidownload_set_caps( - GstBaseTransform *trans, - GstCaps *incaps, - GstCaps *outcaps -); - -static gboolean -gst_vaapidownload_query( - GstPad *pad, - GstQuery *query -); - -static void -gst_vaapidownload_destroy(GstVaapiDownload *download) -{ - guint i; - - for (i = 0; i < G_N_ELEMENTS(download->transform_size_cache); i++) { - TransformSizeCache * const tsc = &download->transform_size_cache[i]; - if (tsc->caps) { - gst_caps_unref(tsc->caps); - tsc->caps = NULL; - tsc->size = 0; - } - } - - if (download->allowed_caps) { - gst_caps_unref(download->allowed_caps); - download->allowed_caps = NULL; - } - - gst_vaapi_video_pool_replace(&download->images, NULL); - GST_VAAPI_PLUGIN_BASE_DISPLAY_REPLACE(download, NULL); -} - -static void -gst_vaapidownload_finalize(GObject *object) -{ - gst_vaapidownload_destroy(GST_VAAPIDOWNLOAD(object)); - - gst_vaapi_plugin_base_finalize(GST_VAAPI_PLUGIN_BASE(object)); - G_OBJECT_CLASS(gst_vaapidownload_parent_class)->finalize(object); -} - -static void -gst_vaapidownload_class_init(GstVaapiDownloadClass *klass) -{ - GObjectClass * const object_class = G_OBJECT_CLASS(klass); - GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass); - GstElementClass * const element_class = GST_ELEMENT_CLASS(klass); - GstPadTemplate *pad_template; - - GST_DEBUG_CATEGORY_INIT(gst_debug_vaapidownload, - GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); - - gst_vaapi_plugin_base_class_init(GST_VAAPI_PLUGIN_BASE_CLASS(klass)); - - object_class->finalize = gst_vaapidownload_finalize; - trans_class->start = gst_vaapidownload_start; - trans_class->stop = gst_vaapidownload_stop; - trans_class->before_transform = gst_vaapidownload_before_transform; - trans_class->transform = gst_vaapidownload_transform; - trans_class->transform_caps = gst_vaapidownload_transform_caps; - trans_class->transform_size = gst_vaapidownload_transform_size; - trans_class->set_caps = gst_vaapidownload_set_caps; - - gst_element_class_set_static_metadata(element_class, - "VA-API colorspace converter", - "Filter/Converter/Video", - GST_PLUGIN_DESC, - "Gwenole Beauchesne "); - - /* sink pad */ - pad_template = gst_static_pad_template_get(&gst_vaapidownload_sink_factory); - gst_element_class_add_pad_template(element_class, pad_template); - - /* src pad */ - pad_template = gst_static_pad_template_get(&gst_vaapidownload_src_factory); - gst_element_class_add_pad_template(element_class, pad_template); -} - -static void -gst_vaapidownload_init(GstVaapiDownload *download) -{ - GstPad *sinkpad, *srcpad; - - gst_vaapi_plugin_base_init(GST_VAAPI_PLUGIN_BASE(download), GST_CAT_DEFAULT); - - download->allowed_caps = NULL; - download->images = NULL; - download->images_reset = FALSE; - download->image_format = GST_VIDEO_FORMAT_UNKNOWN; - download->image_width = 0; - download->image_height = 0; - - /* Override buffer allocator on sink pad */ - sinkpad = gst_element_get_static_pad(GST_ELEMENT(download), "sink"); - gst_pad_set_query_function(sinkpad, gst_vaapidownload_query); - gst_object_unref(sinkpad); - - /* Override query on src pad */ - srcpad = gst_element_get_static_pad(GST_ELEMENT(download), "src"); - gst_pad_set_query_function(srcpad, gst_vaapidownload_query); - gst_object_unref(srcpad); -} - -static inline gboolean -gst_vaapidownload_ensure_display(GstVaapiDownload *download) -{ - return gst_vaapi_plugin_base_ensure_display(GST_VAAPI_PLUGIN_BASE(download)); -} - -static gboolean -gst_vaapidownload_start(GstBaseTransform *trans) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - - if (!gst_vaapi_plugin_base_open(GST_VAAPI_PLUGIN_BASE(trans))) - return FALSE; - if (!gst_vaapidownload_ensure_display(download)) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapidownload_stop(GstBaseTransform *trans) -{ - gst_vaapi_plugin_base_close(GST_VAAPI_PLUGIN_BASE(trans)); - return TRUE; -} - -static GstVideoFormat -get_surface_format(GstVaapiSurface *surface) -{ - GstVaapiImage *image; - GstVideoFormat format = GST_VIDEO_FORMAT_NV12; - - /* XXX: NV12 is assumed by default */ - image = gst_vaapi_surface_derive_image(surface); - if (image) { - format = gst_vaapi_image_get_format(image); - gst_vaapi_object_unref(image); - } - return format; -} - -static gboolean -gst_vaapidownload_update_src_caps(GstVaapiDownload *download, GstBuffer *buffer) -{ - GstVaapiVideoMeta *meta; - GstVaapiSurface *surface; - GstVideoFormat format; - GstVideoInfo vi; - GstPad *srcpad; - GstCaps *in_caps, *out_caps; - - meta = gst_buffer_get_vaapi_video_meta(buffer); - surface = gst_vaapi_video_meta_get_surface(meta); - if (!surface) { - GST_WARNING("failed to retrieve VA surface from buffer"); - return FALSE; - } - - format = get_surface_format(surface); - if (format == download->image_format) - return TRUE; - - in_caps = GST_BUFFER_CAPS(buffer); - if (!in_caps || !gst_caps_is_fixed(in_caps)) { - GST_WARNING("failed to retrieve caps from buffer"); - return FALSE; - } - - if (!gst_video_info_from_caps(&vi, in_caps)) { - GST_WARNING("failed to parse caps %" GST_PTR_FORMAT, in_caps); - return FALSE; - } - - gst_video_info_set_format(&vi, download->image_format, - GST_VIDEO_INFO_WIDTH(&vi), GST_VIDEO_INFO_HEIGHT(&vi)); - out_caps = gst_video_info_to_caps(&vi); - if (!out_caps) { - GST_WARNING("failed to create caps from format %s", - gst_video_format_to_string(download->image_format)); - return FALSE; - } - - /* Try to renegotiate downstream caps */ - srcpad = gst_element_get_static_pad(GST_ELEMENT(download), "src"); - gst_pad_set_caps(srcpad, out_caps); - gst_object_unref(srcpad); - - gst_vaapidownload_set_caps(GST_BASE_TRANSFORM(download), in_caps, out_caps); - gst_caps_replace(&download->allowed_caps, out_caps); - gst_caps_unref(out_caps); - return TRUE; -} - -static void -gst_vaapidownload_before_transform(GstBaseTransform *trans, GstBuffer *buffer) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - - gst_vaapidownload_update_src_caps(download, buffer); -} - -static GstFlowReturn -gst_vaapidownload_transform( - GstBaseTransform *trans, - GstBuffer *inbuf, - GstBuffer *outbuf -) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - GstVaapiVideoMeta *meta; - GstVaapiSurface *surface; - GstVaapiImage *image = NULL; - gboolean success; - - meta = gst_buffer_get_vaapi_video_meta(inbuf); - surface = gst_vaapi_video_meta_get_surface(meta); - if (!surface) - return GST_FLOW_UNEXPECTED; - - image = gst_vaapi_video_pool_get_object(download->images); - if (!image) - return GST_FLOW_UNEXPECTED; - if (!gst_vaapi_surface_get_image(surface, image)) - goto error_get_image; - - success = gst_vaapi_image_get_buffer(image, outbuf, NULL); - gst_vaapi_video_pool_put_object(download->images, image); - if (!success) - goto error_get_buffer; - return GST_FLOW_OK; - -error_get_image: - { - const GstVideoFormat format = gst_vaapi_image_get_format(image); - GST_WARNING("failed to download %s image from surface 0x%08x", - gst_video_format_to_string(format), - gst_vaapi_surface_get_id(surface)); - gst_vaapi_video_pool_put_object(download->images, image); - return GST_FLOW_UNEXPECTED; - } - -error_get_buffer: - { - GST_WARNING("failed to transfer image to output video buffer"); - return GST_FLOW_UNEXPECTED; - } -} - -static GstCaps * -gst_vaapidownload_transform_caps( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps -) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - GstPad *srcpad; - GstCaps *allowed_caps, *tmp_caps, *out_caps = NULL; - GstStructure *structure; - GArray *formats; - - g_return_val_if_fail(GST_IS_CAPS(caps), NULL); - - structure = gst_caps_get_structure(caps, 0); - - if (direction == GST_PAD_SINK) { - if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME)) - return NULL; - if (!gst_vaapidownload_ensure_display(download)) - return NULL; - out_caps = gst_caps_from_string(gst_vaapidownload_yuv_caps_str); - - /* Build up allowed caps */ - /* XXX: we don't know the decoded surface format yet so we - expose whatever VA images we support */ - if (download->allowed_caps) - allowed_caps = gst_caps_ref(download->allowed_caps); - else { - formats = gst_vaapi_display_get_image_formats( - GST_VAAPI_PLUGIN_BASE_DISPLAY(download)); - if (G_UNLIKELY(!formats)) - allowed_caps = gst_caps_new_empty(); - else { - allowed_caps = - gst_vaapi_video_format_new_template_caps_from_list(formats); - g_array_unref(formats); - } - if (!allowed_caps) - return NULL; - } - tmp_caps = gst_caps_intersect(out_caps, allowed_caps); - gst_caps_unref(allowed_caps); - gst_caps_unref(out_caps); - out_caps = tmp_caps; - - /* Intersect with allowed caps from the peer, if any */ - srcpad = gst_element_get_static_pad(GST_ELEMENT(download), "src"); - allowed_caps = gst_pad_peer_get_caps(srcpad); - if (allowed_caps) { - tmp_caps = gst_caps_intersect(out_caps, allowed_caps); - gst_caps_unref(allowed_caps); - gst_caps_unref(out_caps); - out_caps = tmp_caps; - } - } - else { - if (!gst_structure_has_name(structure, "video/x-raw-yuv")) - return NULL; - out_caps = gst_caps_from_string(gst_vaapidownload_vaapi_caps_str); - - structure = gst_caps_get_structure(out_caps, 0); - gst_structure_set( - structure, - "type", G_TYPE_STRING, "vaapi", - "opengl", G_TYPE_BOOLEAN, USE_GLX, - NULL - ); - } - - if (!gst_vaapi_append_surface_caps(out_caps, caps)) { - gst_caps_unref(out_caps); - return NULL; - } - return out_caps; -} - -static gboolean -gst_vaapidownload_ensure_image_pool(GstVaapiDownload *download, GstCaps *caps) -{ - GstVideoInfo vi; - GstVideoFormat format; - guint width, height; - - if (!gst_video_info_from_caps(&vi, caps)) - return FALSE; - - format = GST_VIDEO_INFO_FORMAT(&vi); - width = GST_VIDEO_INFO_WIDTH(&vi); - height = GST_VIDEO_INFO_HEIGHT(&vi); - - if (format != download->image_format || - width != download->image_width || - height != download->image_height) { - download->image_format = format; - download->image_width = width; - download->image_height = height; - gst_vaapi_video_pool_replace(&download->images, NULL); - download->images = gst_vaapi_image_pool_new( - GST_VAAPI_PLUGIN_BASE_DISPLAY(download), &vi); - if (!download->images) - return FALSE; - download->images_reset = TRUE; - } - return TRUE; -} - -static inline gboolean -gst_vaapidownload_negotiate_buffers( - GstVaapiDownload *download, - GstCaps *incaps, - GstCaps *outcaps -) -{ - if (!gst_vaapidownload_ensure_image_pool(download, outcaps)) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapidownload_set_caps( - GstBaseTransform *trans, - GstCaps *incaps, - GstCaps *outcaps -) -{ - GstVaapiPluginBase * const plugin = GST_VAAPI_PLUGIN_BASE(trans); - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - - if (!gst_vaapi_plugin_base_set_caps(plugin, incaps, outcaps)) - return FALSE; - if (!gst_vaapidownload_negotiate_buffers(download, incaps, outcaps)) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapidownload_transform_size( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps, - guint size, - GstCaps *othercaps, - guint *othersize -) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(trans); - GstStructure * const structure = gst_caps_get_structure(othercaps, 0); - GstVideoFormat format; - gint width, height; - guint i; - - /* Lookup in cache */ - for (i = 0; i < G_N_ELEMENTS(download->transform_size_cache); i++) { - TransformSizeCache * const tsc = &download->transform_size_cache[i]; - if (tsc->caps && tsc->caps == othercaps) { - *othersize = tsc->size; - return TRUE; - } - } - - /* Compute requested buffer size */ - if (gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME)) - *othersize = 0; - else { - if (!gst_video_format_parse_caps(othercaps, &format, &width, &height)) - return FALSE; - *othersize = gst_video_format_get_size(format, width, height); - } - - /* Update cache */ - for (i = 0; i < G_N_ELEMENTS(download->transform_size_cache); i++) { - TransformSizeCache * const tsc = &download->transform_size_cache[i]; - if (!tsc->caps) { - gst_caps_replace(&tsc->caps, othercaps); - tsc->size = *othersize; - } - } - return TRUE; -} - -static gboolean -gst_vaapidownload_query(GstPad *pad, GstQuery *query) -{ - GstVaapiDownload * const download = GST_VAAPIDOWNLOAD(gst_pad_get_parent_element(pad)); - GstVaapiDisplay * const display = GST_VAAPI_PLUGIN_BASE_DISPLAY(download); - gboolean res; - - GST_DEBUG("sharing display %p", display); - - if (gst_vaapi_reply_to_query(query, display)) - res = TRUE; - else - res = gst_pad_query_default(pad, query); - - gst_object_unref(download); - return res; - -} diff --git a/gst/vaapi/gstvaapidownload.h b/gst/vaapi/gstvaapidownload.h deleted file mode 100644 index bb29fca..0000000 --- a/gst/vaapi/gstvaapidownload.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * gstvaapidownload.h - VA-API video downloader - * - * Copyright (C) 2010-2011 Splitted-Desktop Systems - * Author: Gwenole Beauchesne - * Copyright (C) 2011-2013 Intel Corporation - * Author: Gwenole Beauchesne - * - * This program 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 program 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 program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA -*/ - -#ifndef GST_VAAPIDOWNLOAD_H -#define GST_VAAPIDOWNLOAD_H - -#include "gstvaapipluginbase.h" -#include -#include -#include - -G_BEGIN_DECLS - -#define GST_TYPE_VAAPIDOWNLOAD \ - (gst_vaapidownload_get_type()) - -#define GST_VAAPIDOWNLOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GST_TYPE_VAAPIDOWNLOAD, \ - GstVaapiDownload)) - -#define GST_VAAPIDOWNLOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GST_TYPE_VAAPIDOWNLOAD, \ - GstVaapiDownloadClass)) - -#define GST_IS_VAAPIDOWNLOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPIDOWNLOAD)) - -#define GST_IS_VAAPIDOWNLOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPIDOWNLOAD)) - -#define GST_VAAPIDOWNLOAD_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GST_TYPE_VAAPIDOWNLOAD, \ - GstVaapiDownloadClass)) - -typedef struct _GstVaapiDownload GstVaapiDownload; -typedef struct _GstVaapiDownloadClass GstVaapiDownloadClass; - -GType -gst_vaapidownload_get_type(void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* GST_VAAPIDOWNLOAD_H */ diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index 6209f36..1167490 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -27,10 +27,8 @@ #include "gstvaapiencode.h" #include "gstvaapipluginutil.h" #include "gstvaapivideometa.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" #include "gstvaapivideobufferpool.h" -#endif #define GST_PLUGIN_NAME "vaapiencode" #define GST_PLUGIN_DESC "A VA-API based video encoder" @@ -187,13 +185,9 @@ gst_vaapiencode_default_alloc_buffer (GstVaapiEncode * encode, if (buf_size <= 0) goto error_invalid_buffer; -#if GST_CHECK_VERSION(1,0,0) buf = gst_video_encoder_allocate_output_buffer (GST_VIDEO_ENCODER_CAST (encode), buf_size); -#else - buf = gst_buffer_new_and_alloc (buf_size); -#endif if (!buf) goto error_create_buffer; if (!gst_vaapi_coded_buffer_copy_into (buf, coded_buf)) @@ -248,10 +242,8 @@ ensure_output_state (GstVaapiEncode * encode) return FALSE; } -#if GST_CHECK_VERSION(1,0,0) if (!gst_video_encoder_negotiate (venc)) return FALSE; -#endif encode->input_state_changed = FALSE; return TRUE; @@ -350,24 +342,11 @@ gst_vaapiencode_get_caps_impl (GstVideoEncoder * venc) if (plugin->sinkpad_caps) caps = gst_caps_ref (plugin->sinkpad_caps); else { -#if GST_CHECK_VERSION(1,0,0) caps = gst_pad_get_pad_template_caps (plugin->sinkpad); -#else - caps = gst_caps_from_string (GST_VAAPI_SURFACE_CAPS); - - if (caps && ensure_uploader (GST_VAAPIENCODE_CAST (plugin))) { - GstCaps *const yuv_caps = GST_VAAPI_PLUGIN_BASE_UPLOADER_CAPS (plugin); - if (yuv_caps) { - caps = gst_caps_make_writable (caps); - gst_caps_append (caps, gst_caps_copy (yuv_caps)); - } - } -#endif } return caps; } -#if GST_CHECK_VERSION(1,0,0) static GstCaps * gst_vaapiencode_get_caps (GstVideoEncoder * venc, GstCaps * filter) { @@ -381,9 +360,6 @@ gst_vaapiencode_get_caps (GstVideoEncoder * venc, GstCaps * filter) } return out_caps; } -#else -#define gst_vaapiencode_get_caps gst_vaapiencode_get_caps_impl -#endif static gboolean gst_vaapiencode_destroy (GstVaapiEncode * encode) @@ -615,7 +591,6 @@ gst_vaapiencode_change_state (GstElement * element, GstStateChange transition) change_state (element, transition); } -#if GST_CHECK_VERSION(1,0,0) static gboolean gst_vaapiencode_propose_allocation (GstVideoEncoder * venc, GstQuery * query) { @@ -625,7 +600,6 @@ gst_vaapiencode_propose_allocation (GstVideoEncoder * venc, GstQuery * query) return FALSE; return TRUE; } -#endif static void gst_vaapiencode_finalize (GObject * object) @@ -678,11 +652,8 @@ gst_vaapiencode_class_init (GstVaapiEncodeClass * klass) venc_class->handle_frame = GST_DEBUG_FUNCPTR (gst_vaapiencode_handle_frame); venc_class->finish = GST_DEBUG_FUNCPTR (gst_vaapiencode_finish); venc_class->getcaps = GST_DEBUG_FUNCPTR (gst_vaapiencode_get_caps); - -#if GST_CHECK_VERSION(1,0,0) venc_class->propose_allocation = GST_DEBUG_FUNCPTR (gst_vaapiencode_propose_allocation); -#endif klass->get_property = gst_vaapiencode_default_get_property; klass->set_property = gst_vaapiencode_default_set_property; diff --git a/gst/vaapi/gstvaapiencode_h264.c b/gst/vaapi/gstvaapiencode_h264.c index 93d6288..3c16c91 100644 --- a/gst/vaapi/gstvaapiencode_h264.c +++ b/gst/vaapi/gstvaapiencode_h264.c @@ -27,9 +27,7 @@ #include #include "gstvaapiencode_h264.h" #include "gstvaapipluginutil.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapiencode_h264" #define GST_PLUGIN_DESC "A VA-API based H.264 video encoder" @@ -51,13 +49,7 @@ static const char gst_vaapiencode_h264_sink_caps_str[] = GST_VAAPI_SURFACE_CAPS ", " #endif GST_CAPS_INTERLACED_FALSE "; " -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#else - "video/x-raw-yuv, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ], " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ diff --git a/gst/vaapi/gstvaapiencode_jpeg.c b/gst/vaapi/gstvaapiencode_jpeg.c index 826b06c..07ce6ea 100644 --- a/gst/vaapi/gstvaapiencode_jpeg.c +++ b/gst/vaapi/gstvaapiencode_jpeg.c @@ -25,9 +25,7 @@ #include #include "gstvaapiencode_jpeg.h" #include "gstvaapipluginutil.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapiencode_jpeg" #define GST_PLUGIN_DESC "A VA-API based JPEG video encoder" @@ -47,9 +45,7 @@ static const char gst_vaapiencode_jpeg_sink_caps_str[] = GST_VAAPI_SURFACE_CAPS ", " #endif GST_CAPS_INTERLACED_FALSE "; " -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ diff --git a/gst/vaapi/gstvaapiencode_mpeg2.c b/gst/vaapi/gstvaapiencode_mpeg2.c index 95c0edc..0d6fb74 100644 --- a/gst/vaapi/gstvaapiencode_mpeg2.c +++ b/gst/vaapi/gstvaapiencode_mpeg2.c @@ -26,9 +26,7 @@ #include #include "gstvaapiencode_mpeg2.h" #include "gstvaapipluginutil.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapiencode_mpeg2" #define GST_PLUGIN_DESC "A VA-API based MPEG-2 video encoder" @@ -49,13 +47,7 @@ static const char gst_vaapiencode_mpeg2_sink_caps_str[] = GST_VAAPI_SURFACE_CAPS ", " #endif GST_CAPS_INTERLACED_FALSE "; " -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#else - "video/x-raw-yuv, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ], " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ diff --git a/gst/vaapi/gstvaapiencode_vp8.c b/gst/vaapi/gstvaapiencode_vp8.c index e236206..0cba42b 100644 --- a/gst/vaapi/gstvaapiencode_vp8.c +++ b/gst/vaapi/gstvaapiencode_vp8.c @@ -25,9 +25,7 @@ #include #include "gstvaapiencode_vp8.h" #include "gstvaapipluginutil.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapiencode_vp8" #define GST_PLUGIN_DESC "A VA-API based VP8 video encoder" @@ -47,9 +45,7 @@ static const char gst_vaapiencode_vp8_sink_caps_str[] = GST_VAAPI_SURFACE_CAPS ", " #endif GST_CAPS_INTERLACED_FALSE "; " -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ diff --git a/gst/vaapi/gstvaapiparse.c b/gst/vaapi/gstvaapiparse.c index 3b1e9fc..81724be 100644 --- a/gst/vaapi/gstvaapiparse.c +++ b/gst/vaapi/gstvaapiparse.c @@ -40,14 +40,6 @@ plugin_init (GstPlugin * plugin) return !failure; } -#if GST_CHECK_VERSION(1,0,0) -/* XXX: use PLUGIN_NAME when GST_PLUGIN_DEFINE is fixed to use - G_STRINGIFY() for name argument, instead of plain #name */ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, vaapiparse, PLUGIN_DESC, plugin_init, PACKAGE_VERSION, PLUGIN_LICENSE, PACKAGE, PACKAGE_BUGREPORT) -#else -GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_VERSION_MINOR, - PLUGIN_NAME, PLUGIN_DESC, plugin_init, - PACKAGE_VERSION, PLUGIN_LICENSE, PACKAGE, PACKAGE_BUGREPORT) -#endif diff --git a/gst/vaapi/gstvaapipluginbase.c b/gst/vaapi/gstvaapipluginbase.c index a5f1ad0..7a9a3fa 100644 --- a/gst/vaapi/gstvaapipluginbase.c +++ b/gst/vaapi/gstvaapipluginbase.c @@ -29,9 +29,7 @@ #include "gstvaapipluginutil.h" #include "gstvaapivideocontext.h" #include "gstvaapivideometa.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideobufferpool.h" -#endif #if GST_CHECK_VERSION(1,1,0) #include #endif @@ -39,25 +37,6 @@ /* Default debug category is from the subclass */ #define GST_CAT_DEFAULT (plugin->debug_category) -/* GstImplementsInterface interface */ -#if !GST_CHECK_VERSION(1,0,0) -static gboolean -implements_interface_supported (GstImplementsInterface * iface, GType type) -{ - GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (iface); - - if (type == GST_TYPE_VIDEO_CONTEXT) - return TRUE; - return GST_VAAPI_PLUGIN_BASE_GET_CLASS (plugin)->has_interface (plugin, type); -} - -static void -implements_interface_init (GstImplementsInterfaceClass * iface) -{ - iface->supported = implements_interface_supported; -} -#endif - /* GstVideoContext interface */ static void plugin_set_display (GstVaapiPluginBase * plugin, GstVaapiDisplay * display) @@ -112,10 +91,6 @@ video_context_interface_init (GstVideoContextInterface * iface) void gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id) { -#if !GST_CHECK_VERSION(1,0,0) - G_IMPLEMENT_INTERFACE (GST_TYPE_IMPLEMENTS_INTERFACE, - implements_interface_init); -#endif #if !GST_CHECK_VERSION(1,1,0) G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT, video_context_interface_init); #endif @@ -300,13 +275,11 @@ gst_vaapi_plugin_base_close (GstVaapiPluginBase * plugin) gst_caps_replace (&plugin->sinkpad_caps, NULL); plugin->sinkpad_caps_changed = FALSE; gst_video_info_init (&plugin->sinkpad_info); -#if GST_CHECK_VERSION(1,0,0) if (plugin->sinkpad_buffer_pool) { gst_object_unref (plugin->sinkpad_buffer_pool); plugin->sinkpad_buffer_pool = NULL; } g_clear_object (&plugin->srcpad_buffer_pool); -#endif gst_caps_replace (&plugin->srcpad_caps, NULL); plugin->srcpad_caps_changed = FALSE; @@ -489,7 +462,6 @@ has_dmabuf_capable_peer (GstVaapiPluginBase * plugin, GstPad * pad) static gboolean ensure_sinkpad_buffer_pool (GstVaapiPluginBase * plugin, GstCaps * caps) { -#if GST_CHECK_VERSION(1,0,0) GstBufferPool *pool; GstCaps *pool_caps; GstStructure *config; @@ -546,9 +518,6 @@ error_pool_config: gst_object_unref (pool); return FALSE; } -#else - return TRUE; -#endif } /** @@ -603,7 +572,6 @@ gst_vaapi_plugin_base_set_caps (GstVaapiPluginBase * plugin, GstCaps * incaps, * * Returns: %TRUE if successful, %FALSE otherwise. */ -#if GST_CHECK_VERSION(1,0,0) gboolean gst_vaapi_plugin_base_propose_allocation (GstVaapiPluginBase * plugin, GstQuery * query) @@ -648,7 +616,6 @@ error_pool_config: return FALSE; } } -#endif /** * gst_vaapi_plugin_base_decide_allocation: @@ -661,7 +628,6 @@ error_pool_config: * * Returns: %TRUE if successful, %FALSE otherwise. */ -#if GST_CHECK_VERSION(1,0,0) gboolean gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, GstQuery * query, guint feature) @@ -816,7 +782,6 @@ error_create_pool: return FALSE; } } -#endif /** * gst_vaapi_plugin_base_allocate_input_buffer: @@ -880,16 +845,13 @@ gst_vaapi_plugin_base_get_input_buffer (GstVaapiPluginBase * plugin, { GstVaapiVideoMeta *meta; GstBuffer *outbuf; -#if GST_CHECK_VERSION(1,0,0) GstVideoFrame src_frame, out_frame; gboolean success; -#endif g_return_val_if_fail (inbuf != NULL, GST_FLOW_ERROR); g_return_val_if_fail (outbuf_ptr != NULL, GST_FLOW_ERROR); meta = gst_buffer_get_vaapi_video_meta (inbuf); -#if GST_CHECK_VERSION(1,0,0) if (meta) { *outbuf_ptr = gst_buffer_ref (inbuf); return GST_FLOW_OK; @@ -963,25 +925,6 @@ error_map_src_buffer: gst_buffer_unref (outbuf); return GST_FLOW_NOT_SUPPORTED; } -#else - if (meta) - outbuf = gst_buffer_ref (inbuf); - else if (plugin->sinkpad_caps_is_raw) { - outbuf = gst_vaapi_uploader_get_buffer (plugin->uploader); - if (!outbuf) - goto error_create_buffer; - gst_buffer_copy_metadata (outbuf, inbuf, - GST_BUFFER_COPY_FLAGS | GST_BUFFER_COPY_TIMESTAMPS); - } else - goto error_invalid_buffer; - - if (plugin->sinkpad_caps_is_raw && - !gst_vaapi_uploader_process (plugin->uploader, inbuf, outbuf)) - goto error_copy_buffer; - - *outbuf_ptr = outbuf; - return GST_FLOW_OK; -#endif /* ERRORS */ error_invalid_buffer: diff --git a/gst/vaapi/gstvaapipluginbase.h b/gst/vaapi/gstvaapipluginbase.h index d444c6a..e64e9a8 100644 --- a/gst/vaapi/gstvaapipluginbase.h +++ b/gst/vaapi/gstvaapipluginbase.h @@ -130,19 +130,15 @@ struct _GstVaapiPluginBase gboolean sinkpad_caps_is_raw; GstVideoInfo sinkpad_info; GstPadQueryFunction sinkpad_query; -#if GST_CHECK_VERSION(1,0,0) GstBufferPool *sinkpad_buffer_pool; guint sinkpad_buffer_size; -#endif GstPad *srcpad; GstCaps *srcpad_caps; gboolean srcpad_caps_changed; GstVideoInfo srcpad_info; GstPadQueryFunction srcpad_query; -#if GST_CHECK_VERSION(1,0,0) GstBufferPool *srcpad_buffer_pool; -#endif GstVaapiDisplay *display; GstVaapiDisplayType display_type; diff --git a/gst/vaapi/gstvaapipluginutil.c b/gst/vaapi/gstvaapipluginutil.c index e075f836..d9dfd5e 100644 --- a/gst/vaapi/gstvaapipluginutil.c +++ b/gst/vaapi/gstvaapipluginutil.c @@ -482,17 +482,12 @@ gst_vaapi_append_surface_caps (GstCaps * out_caps, GstCaps * in_caps) gboolean gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer) { -#if GST_CHECK_VERSION(1,0,0) GstVideoOverlayCompositionMeta *const cmeta = gst_buffer_get_video_overlay_composition_meta (buffer); GstVideoOverlayComposition *composition = NULL; if (cmeta) composition = cmeta->overlay; -#else - GstVideoOverlayComposition *const composition = - gst_video_buffer_get_overlay_composition (buffer); -#endif return gst_vaapi_surface_set_subpictures_from_composition (surface, composition, TRUE); } @@ -500,7 +495,6 @@ gst_vaapi_apply_composition (GstVaapiSurface * surface, GstBuffer * buffer) gboolean gst_vaapi_value_set_format (GValue * value, GstVideoFormat format) { -#if GST_CHECK_VERSION(1,0,0) const gchar *str; str = gst_video_format_to_string (format); @@ -509,16 +503,6 @@ gst_vaapi_value_set_format (GValue * value, GstVideoFormat format) g_value_init (value, G_TYPE_STRING); g_value_set_string (value, str); -#else - guint32 fourcc; - - fourcc = gst_video_format_to_fourcc (format); - if (!fourcc) - return FALSE; - - g_value_init (value, GST_TYPE_FOURCC); - gst_value_set_fourcc (value, fourcc); -#endif return TRUE; } @@ -555,7 +539,6 @@ set_video_template_caps (GstCaps * caps) GstCaps * gst_vaapi_video_format_new_template_caps (GstVideoFormat format) { -#if GST_CHECK_VERSION(1,0,0) GstCaps *caps; g_return_val_if_fail (format != GST_VIDEO_FORMAT_UNKNOWN, NULL); @@ -568,15 +551,11 @@ gst_vaapi_video_format_new_template_caps (GstVideoFormat format) "format", G_TYPE_STRING, gst_video_format_to_string (format), NULL); set_video_template_caps (caps); return caps; -#else - return gst_video_format_new_template_caps (format); -#endif } GstCaps * gst_vaapi_video_format_new_template_caps_from_list (GArray * formats) { -#if GST_CHECK_VERSION(1,0,0) GValue v_formats = G_VALUE_INIT; GstCaps *caps; @@ -592,23 +571,6 @@ gst_vaapi_video_format_new_template_caps_from_list (GArray * formats) gst_caps_set_value (caps, "format", &v_formats); set_video_template_caps (caps); g_value_unset (&v_formats); -#else - GstCaps *caps, *tmp_caps; - guint i; - - g_return_val_if_fail (formats != NULL, NULL); - - caps = gst_caps_new_empty (); - if (!caps) - return NULL; - - for (i = 0; i < formats->len; i++) { - const GstVideoFormat format = g_array_index (formats, GstVideoFormat, i); - tmp_caps = gst_vaapi_video_format_new_template_caps (format); - if (tmp_caps) - gst_caps_append (caps, tmp_caps); - } -#endif return caps; } @@ -783,7 +745,6 @@ gst_vaapi_caps_feature_to_string (GstVaapiCapsFeature feature) gboolean gst_caps_set_interlaced (GstCaps * caps, GstVideoInfo * vip) { -#if GST_CHECK_VERSION(1,0,0) GstVideoInterlaceMode mode; const gchar *mode_str; @@ -805,10 +766,6 @@ gst_caps_set_interlaced (GstCaps * caps, GstVideoInfo * vip) } gst_caps_set_simple (caps, "interlace-mode", G_TYPE_STRING, mode_str, NULL); -#else - gst_caps_set_simple (caps, "interlaced", G_TYPE_BOOLEAN, - vip ? GST_VIDEO_INFO_IS_INTERLACED (vip) : FALSE, NULL); -#endif return TRUE; } diff --git a/gst/vaapi/gstvaapipluginutil.h b/gst/vaapi/gstvaapipluginutil.h index 7520cdd..9d07a49 100644 --- a/gst/vaapi/gstvaapipluginutil.h +++ b/gst/vaapi/gstvaapipluginutil.h @@ -27,9 +27,7 @@ #include #include -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideomemory.h" -#endif G_GNUC_INTERNAL gboolean @@ -99,17 +97,10 @@ const gchar * gst_vaapi_caps_feature_to_string (GstVaapiCapsFeature feature); /* Helpers to handle interlaced contents */ -#if GST_CHECK_VERSION(1,0,0) # define GST_CAPS_INTERLACED_MODES \ "interlace-mode = (string){ progressive, interleaved, mixed }" # define GST_CAPS_INTERLACED_FALSE \ "interlace-mode = (string)progressive" -#else -# define GST_CAPS_INTERLACED_MODES \ - "interlaced = (boolean){ true, false }" -# define GST_CAPS_INTERLACED_FALSE \ - "interlaced = (boolean)false" -#endif G_GNUC_INTERNAL gboolean diff --git a/gst/vaapi/gstvaapipostproc.c b/gst/vaapi/gstvaapipostproc.c index 75bc9fb..f47a419 100644 --- a/gst/vaapi/gstvaapipostproc.c +++ b/gst/vaapi/gstvaapipostproc.c @@ -35,10 +35,8 @@ #include "gstvaapipostproc.h" #include "gstvaapipluginutil.h" #include "gstvaapivideobuffer.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideobufferpool.h" #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapipostproc" #define GST_PLUGIN_DESC "A video postprocessing filter" @@ -60,14 +58,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapipostproc); static const char gst_vaapipostproc_sink_caps_str[] = GST_VAAPIPOSTPROC_SURFACE_CAPS ", " GST_CAPS_INTERLACED_MODES "; " -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#else - "video/x-raw-yuv, " - "width = " GST_VIDEO_SIZE_RANGE ", " - "height = " GST_VIDEO_SIZE_RANGE ", " - "framerate = " GST_VIDEO_FPS_RANGE ", " -#endif GST_CAPS_INTERLACED_MODES; /* *INDENT-ON* */ @@ -80,14 +71,7 @@ static const char gst_vaapipostproc_src_caps_str[] = GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ", " GST_CAPS_INTERLACED_FALSE "; " #endif -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", " -#else - "video/x-raw-yuv, " - "width = " GST_VIDEO_SIZE_RANGE ", " - "height = " GST_VIDEO_SIZE_RANGE ", " - "framerate = " GST_VIDEO_FPS_RANGE ", " -#endif GST_CAPS_INTERLACED_FALSE; /* *INDENT-ON* */ @@ -359,13 +343,8 @@ should_deinterlace_buffer (GstVaapiPostproc * postproc, GstBuffer * buf) case GST_VIDEO_INTERLACE_MODE_PROGRESSIVE: return FALSE; case GST_VIDEO_INTERLACE_MODE_MIXED: -#if GST_CHECK_VERSION(1,0,0) if (GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_FLAG_INTERLACED)) return TRUE; -#else - if (!GST_BUFFER_FLAG_IS_SET (buf, GST_VIDEO_BUFFER_PROGRESSIVE)) - return TRUE; -#endif break; default: GST_ERROR ("unhandled \"interlace-mode\", disabling deinterlacing"); @@ -379,7 +358,6 @@ create_output_buffer (GstVaapiPostproc * postproc) { GstBuffer *outbuf; -#if GST_CHECK_VERSION(1,0,0) GstBufferPool *const pool = GST_VAAPI_PLUGIN_BASE (postproc)->srcpad_buffer_pool; GstFlowReturn ret; @@ -393,25 +371,14 @@ create_output_buffer (GstVaapiPostproc * postproc) ret = gst_buffer_pool_acquire_buffer (pool, &outbuf, NULL); if (ret != GST_FLOW_OK || !outbuf) goto error_create_buffer; -#else - /* Create a raw VA video buffer without GstVaapiVideoMeta attached - to it yet, as this will be done next in the transform() hook */ - outbuf = gst_vaapi_video_buffer_new_empty (); - if (!outbuf) - goto error_create_buffer; - - gst_buffer_set_caps (outbuf, GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAPS (postproc)); -#endif return outbuf; /* ERRORS */ -#if GST_CHECK_VERSION(1,0,0) error_activate_pool: { GST_ERROR ("failed to activate output video buffer pool"); return NULL; } -#endif error_create_buffer: { GST_ERROR ("failed to create output video buffer"); @@ -429,7 +396,6 @@ append_output_buffer_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf, gst_buffer_copy_into (outbuf, inbuf, flags | GST_BUFFER_COPY_FLAGS, 0, -1); /* GstVideoCropMeta */ -#if GST_CHECK_VERSION(1,0,0) if (!postproc->use_vpp) { GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (inbuf); if (crop_meta) { @@ -439,7 +405,6 @@ append_output_buffer_metadata (GstVaapiPostproc * postproc, GstBuffer * outbuf, *out_crop_meta = *crop_meta; } } -#endif /* GstVaapiVideoMeta */ inbuf_meta = gst_buffer_get_vaapi_video_meta (inbuf); @@ -524,9 +489,7 @@ gst_vaapipostproc_process_vpp (GstBaseTransform * trans, GstBuffer * inbuf, guint flags, deint_flags; gboolean tff, deint, deint_refs, deint_changed; GstVaapiRectangle *crop_rect = NULL; -#if GST_CHECK_VERSION(1,0,0) GstVaapiRectangle tmp_rect; -#endif /* Validate filters */ if ((postproc->flags & GST_VAAPI_POSTPROC_FLAG_FORMAT) && @@ -568,7 +531,6 @@ gst_vaapipostproc_process_vpp (GstBaseTransform * trans, GstBuffer * inbuf, goto error_invalid_buffer; inbuf_surface = gst_vaapi_video_meta_get_surface (inbuf_meta); -#if GST_CHECK_VERSION(1,0,0) GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (inbuf); if (crop_meta) { crop_rect = &tmp_rect; @@ -577,7 +539,6 @@ gst_vaapipostproc_process_vpp (GstBaseTransform * trans, GstBuffer * inbuf, crop_rect->width = crop_meta->width; crop_rect->height = crop_meta->height; } -#endif if (!crop_rect) crop_rect = (GstVaapiRectangle *) gst_vaapi_video_meta_get_render_rect (inbuf_meta); @@ -1186,7 +1147,6 @@ gst_vaapipostproc_transform_caps_impl (GstBaseTransform * trans, return out_caps; } -#if GST_CHECK_VERSION(1,0,0) static GstCaps * gst_vaapipostproc_transform_caps (GstBaseTransform * trans, GstPadDirection direction, GstCaps * caps, GstCaps * filter) @@ -1201,21 +1161,11 @@ gst_vaapipostproc_transform_caps (GstBaseTransform * trans, } return caps; } -#else -#define gst_vaapipostproc_transform_caps \ - gst_vaapipostproc_transform_caps_impl -#endif - -#if GST_CHECK_VERSION(1,0,0) -typedef gsize GstBaseTransformSizeType; -#else -typedef guint GstBaseTransformSizeType; -#endif static gboolean gst_vaapipostproc_transform_size (GstBaseTransform * trans, - GstPadDirection direction, GstCaps * caps, GstBaseTransformSizeType size, - GstCaps * othercaps, GstBaseTransformSizeType * othersize) + GstPadDirection direction, GstCaps * caps, gsize size, + GstCaps * othercaps, gsize * othersize) { GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans); @@ -1271,9 +1221,6 @@ done: static GstFlowReturn gst_vaapipostproc_prepare_output_buffer (GstBaseTransform * trans, GstBuffer * inbuf, -#if !GST_CHECK_VERSION(1,0,0) - gint size, GstCaps * caps, -#endif GstBuffer ** outbuf_ptr) { GstVaapiPostproc *const postproc = GST_VAAPIPOSTPROC (trans); @@ -1354,7 +1301,6 @@ gst_vaapipostproc_query (GstBaseTransform * trans, GstPadDirection direction, direction, query); } -#if GST_CHECK_VERSION(1,0,0) static gboolean gst_vaapipostproc_propose_allocation (GstBaseTransform * trans, GstQuery * decide_query, GstQuery * query) @@ -1376,7 +1322,6 @@ gst_vaapipostproc_decide_allocation (GstBaseTransform * trans, GstQuery * query) return gst_vaapi_plugin_base_decide_allocation (GST_VAAPI_PLUGIN_BASE (trans), query, 0); } -#endif static void gst_vaapipostproc_finalize (GObject * object) @@ -1525,11 +1470,8 @@ gst_vaapipostproc_class_init (GstVaapiPostprocClass * klass) trans_class->transform = gst_vaapipostproc_transform; trans_class->set_caps = gst_vaapipostproc_set_caps; trans_class->query = gst_vaapipostproc_query; - -#if GST_CHECK_VERSION(1,0,0) trans_class->propose_allocation = gst_vaapipostproc_propose_allocation; trans_class->decide_allocation = gst_vaapipostproc_decide_allocation; -#endif trans_class->prepare_output_buffer = gst_vaapipostproc_prepare_output_buffer; diff --git a/gst/vaapi/gstvaapisink.c b/gst/vaapi/gstvaapisink.c index 7572c8e..192cfa2 100644 --- a/gst/vaapi/gstvaapisink.c +++ b/gst/vaapi/gstvaapisink.c @@ -38,34 +38,15 @@ #include /* Supported interfaces */ -#if GST_CHECK_VERSION(1,0,0) # include # include # include -#else -# include -# include - -# define GST_TYPE_VIDEO_OVERLAY GST_TYPE_X_OVERLAY -# define GST_VIDEO_OVERLAY GST_X_OVERLAY -# define GstVideoOverlay GstXOverlay -# define GstVideoOverlayInterface GstXOverlayClass - -# define gst_video_overlay_prepare_window_handle(sink) \ - gst_x_overlay_prepare_xwindow_id(sink) -# define gst_video_overlay_got_window_handle(sink, window_handle) \ - gst_x_overlay_got_window_handle(sink, window_handle) - -# define GstColorBalanceInterface GstColorBalanceClass -#endif #include "gstvaapisink.h" #include "gstvaapipluginutil.h" #include "gstvaapivideometa.h" -#if GST_CHECK_VERSION(1,0,0) #include "gstvaapivideobufferpool.h" #include "gstvaapivideomemory.h" -#endif #define GST_PLUGIN_NAME "vaapisink" #define GST_PLUGIN_DESC "A VA-API based videosink" @@ -81,13 +62,7 @@ static const char gst_vaapisink_sink_caps_str[] = "{ ENCODED, NV12, I420, YV12 }") ";" GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL); #else -#if GST_CHECK_VERSION(1,0,0) GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) "; " -#else - "video/x-raw-yuv, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ]; " -#endif GST_VAAPI_SURFACE_CAPS; #endif /* *INDENT-ON* */ @@ -831,11 +806,7 @@ gst_vaapisink_color_balance_iface_init (GstColorBalanceInterface * iface) iface->list_channels = gst_vaapisink_color_balance_list_channels; iface->set_value = gst_vaapisink_color_balance_set_value; iface->get_value = gst_vaapisink_color_balance_get_value; -#if GST_CHECK_VERSION(1,0,0) iface->get_balance_type = gst_vaapisink_color_balance_get_type; -#else - iface->balance_type = gst_vaapisink_color_balance_get_type (NULL); -#endif } /* ------------------------------------------------------------------------ */ @@ -1250,7 +1221,6 @@ gst_vaapisink_get_caps_impl (GstBaseSink * base_sink) return out_caps; } -#if GST_CHECK_VERSION(1,0,0) static inline GstCaps * gst_vaapisink_get_caps (GstBaseSink * base_sink, GstCaps * filter) { @@ -1264,14 +1234,10 @@ gst_vaapisink_get_caps (GstBaseSink * base_sink, GstCaps * filter) out_caps = caps; return out_caps; } -#else -#define gst_vaapisink_get_caps gst_vaapisink_get_caps_impl -#endif static void update_colorimetry (GstVaapiSink * sink, GstVideoColorimetry * cinfo) { -#if GST_CHECK_VERSION(1,0,0) if (gst_video_colorimetry_matches (cinfo, GST_VIDEO_COLORIMETRY_BT601)) sink->color_standard = GST_VAAPI_COLOR_STANDARD_ITUR_BT_601; else if (gst_video_colorimetry_matches (cinfo, GST_VIDEO_COLORIMETRY_BT709)) @@ -1289,7 +1255,6 @@ update_colorimetry (GstVaapiSink * sink, GstVideoColorimetry * cinfo) g_free (colorimetry_string); } #endif -#endif } static gboolean @@ -1357,13 +1322,10 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer) GstBuffer *buffer; guint flags; GstVaapiRectangle *surface_rect = NULL; -#if GST_CHECK_VERSION(1,0,0) GstVaapiRectangle tmp_rect; -#endif GstFlowReturn ret; gint32 view_id; -#if GST_CHECK_VERSION(1,0,0) GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (src_buffer); if (crop_meta) { @@ -1373,7 +1335,6 @@ gst_vaapisink_show_frame_unlocked (GstVaapiSink * sink, GstBuffer * src_buffer) surface_rect->width = crop_meta->width; surface_rect->height = crop_meta->height; } -#endif ret = gst_vaapi_plugin_base_get_input_buffer (GST_VAAPI_PLUGIN_BASE (sink), src_buffer, &buffer); @@ -1454,7 +1415,6 @@ gst_vaapisink_show_frame (GstBaseSink * base_sink, GstBuffer * src_buffer) return ret; } -#if GST_CHECK_VERSION(1,0,0) static gboolean gst_vaapisink_propose_allocation (GstBaseSink * base_sink, GstQuery * query) { @@ -1468,16 +1428,6 @@ gst_vaapisink_propose_allocation (GstBaseSink * base_sink, GstQuery * query) GST_VIDEO_OVERLAY_COMPOSITION_META_API_TYPE, NULL); return TRUE; } -#else -static GstFlowReturn -gst_vaapisink_buffer_alloc (GstBaseSink * base_sink, guint64 offset, guint size, - GstCaps * caps, GstBuffer ** outbuf_ptr) -{ - return - gst_vaapi_plugin_base_allocate_input_buffer (GST_VAAPI_PLUGIN_BASE - (base_sink), caps, outbuf_ptr); -} -#endif static gboolean gst_vaapisink_query (GstBaseSink * base_sink, GstQuery * query) @@ -1631,11 +1581,7 @@ gst_vaapisink_class_init (GstVaapiSinkClass * klass) basesink_class->preroll = gst_vaapisink_show_frame; basesink_class->render = gst_vaapisink_show_frame; basesink_class->query = gst_vaapisink_query; -#if GST_CHECK_VERSION(1,0,0) basesink_class->propose_allocation = gst_vaapisink_propose_allocation; -#else - basesink_class->buffer_alloc = gst_vaapisink_buffer_alloc; -#endif element_class->set_bus = gst_vaapisink_set_bus; gst_element_class_set_static_metadata (element_class, diff --git a/gst/vaapi/gstvaapiupload.c b/gst/vaapi/gstvaapiupload.c deleted file mode 100644 index e90ef30..0000000 --- a/gst/vaapi/gstvaapiupload.c +++ /dev/null @@ -1,445 +0,0 @@ -/* - * gstvaapiupload.c - VA-API video upload element - * - * Copyright (C) 2010-2011 Splitted-Desktop Systems - * Author: Gwenole Beauchesne - * Copyright (C) 2011-2013 Intel Corporation - * Author: Gwenole Beauchesne - * - * 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 - */ - -/** - * SECTION:gstvaapiupload - * @short_description: A video to VA flow filter - * - * vaapiupload converts from raw YUV pixels to VA surfaces suitable - * for the vaapisink element, for example. - */ - -#include "gst/vaapi/sysdeps.h" -#include -#include - -#include "gstvaapiupload.h" -#include "gstvaapipluginutil.h" -#include "gstvaapivideobuffer.h" - -#define GST_PLUGIN_NAME "vaapiupload" -#define GST_PLUGIN_DESC "A video to VA flow filter" - -GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapiupload); -#define GST_CAT_DEFAULT gst_debug_vaapiupload - -/* Default templates */ -static const char gst_vaapiupload_yuv_caps_str[] = - "video/x-raw-yuv, " - "width = (int) [ 1, MAX ], " - "height = (int) [ 1, MAX ]; "; - -static const char gst_vaapiupload_vaapi_caps_str[] = - GST_VAAPI_SURFACE_CAPS; - -static GstStaticPadTemplate gst_vaapiupload_sink_factory = - GST_STATIC_PAD_TEMPLATE( - "sink", - GST_PAD_SINK, - GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapiupload_yuv_caps_str)); - -static GstStaticPadTemplate gst_vaapiupload_src_factory = - GST_STATIC_PAD_TEMPLATE( - "src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS(gst_vaapiupload_vaapi_caps_str)); - -G_DEFINE_TYPE_WITH_CODE( - GstVaapiUpload, - gst_vaapiupload, - GST_TYPE_BASE_TRANSFORM, - GST_VAAPI_PLUGIN_BASE_INIT_INTERFACES) - -static gboolean -gst_vaapiupload_start(GstBaseTransform *trans); - -static gboolean -gst_vaapiupload_stop(GstBaseTransform *trans); - -static GstFlowReturn -gst_vaapiupload_transform( - GstBaseTransform *trans, - GstBuffer *inbuf, - GstBuffer *outbuf -); - -static GstCaps * -gst_vaapiupload_transform_caps( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps -); - -static gboolean -gst_vaapiupload_set_caps( - GstBaseTransform *trans, - GstCaps *incaps, - GstCaps *outcaps -); - -static gboolean -gst_vaapiupload_get_unit_size( - GstBaseTransform *trans, - GstCaps *caps, - guint *size -); - -static GstFlowReturn -gst_vaapiupload_sinkpad_buffer_alloc( - GstPad *pad, - guint64 offset, - guint size, - GstCaps *caps, - GstBuffer **pbuf -); - -static GstFlowReturn -gst_vaapiupload_prepare_output_buffer( - GstBaseTransform *trans, - GstBuffer *inbuf, - gint size, - GstCaps *caps, - GstBuffer **poutbuf -); - -static gboolean -gst_vaapiupload_query( - GstPad *pad, - GstQuery *query -); - -static void -gst_vaapiupload_destroy(GstVaapiUpload *upload) -{ - g_clear_object(&upload->uploader); -} - -static void -gst_vaapiupload_finalize(GObject *object) -{ - gst_vaapiupload_destroy(GST_VAAPIUPLOAD(object)); - - gst_vaapi_plugin_base_finalize(GST_VAAPI_PLUGIN_BASE(object)); - G_OBJECT_CLASS(gst_vaapiupload_parent_class)->finalize(object); -} - -static void -gst_vaapiupload_class_init(GstVaapiUploadClass *klass) -{ - GObjectClass * const object_class = G_OBJECT_CLASS(klass); - GstElementClass * const element_class = GST_ELEMENT_CLASS(klass); - GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass); - GstPadTemplate *pad_template; - - GST_DEBUG_CATEGORY_INIT(gst_debug_vaapiupload, - GST_PLUGIN_NAME, 0, GST_PLUGIN_DESC); - - gst_vaapi_plugin_base_class_init(GST_VAAPI_PLUGIN_BASE_CLASS(klass)); - - object_class->finalize = gst_vaapiupload_finalize; - - 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; - - gst_element_class_set_static_metadata(element_class, - "VA-API colorspace converter", - "Filter/Converter/Video", - GST_PLUGIN_DESC, - "Gwenole Beauchesne "); - - /* sink pad */ - pad_template = gst_static_pad_template_get(&gst_vaapiupload_sink_factory); - gst_element_class_add_pad_template(element_class, pad_template); - - /* src pad */ - pad_template = gst_static_pad_template_get(&gst_vaapiupload_src_factory); - gst_element_class_add_pad_template(element_class, pad_template); -} - -static void -gst_vaapiupload_init(GstVaapiUpload *upload) -{ - GstPad *sinkpad, *srcpad; - - gst_vaapi_plugin_base_init(GST_VAAPI_PLUGIN_BASE(upload), GST_CAT_DEFAULT); - - /* Override buffer allocator on sink pad */ - sinkpad = gst_element_get_static_pad(GST_ELEMENT(upload), "sink"); - gst_pad_set_bufferalloc_function( - sinkpad, - gst_vaapiupload_sinkpad_buffer_alloc - ); - gst_pad_set_query_function(sinkpad, gst_vaapiupload_query); - gst_object_unref(sinkpad); - - /* Override query on src pad */ - srcpad = gst_element_get_static_pad(GST_ELEMENT(upload), "src"); - gst_pad_set_query_function(srcpad, gst_vaapiupload_query); - gst_object_unref(srcpad); -} - -static inline gboolean -gst_vaapiupload_ensure_display(GstVaapiUpload *upload) -{ - return gst_vaapi_plugin_base_ensure_display(GST_VAAPI_PLUGIN_BASE(upload)); -} - -static gboolean -gst_vaapiupload_ensure_uploader(GstVaapiUpload *upload) -{ - if (!gst_vaapiupload_ensure_display(upload)) - return FALSE; - - if (!upload->uploader) { - upload->uploader = gst_vaapi_uploader_new( - GST_VAAPI_PLUGIN_BASE_DISPLAY(upload)); - if (!upload->uploader) - return FALSE; - } - if (!gst_vaapi_uploader_ensure_display(upload->uploader, - GST_VAAPI_PLUGIN_BASE_DISPLAY(upload))) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapiupload_start(GstBaseTransform *trans) -{ - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - - if (!gst_vaapi_plugin_base_open(GST_VAAPI_PLUGIN_BASE(trans))) - return FALSE; - if (!gst_vaapiupload_ensure_uploader(upload)) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapiupload_stop(GstBaseTransform *trans) -{ - gst_vaapi_plugin_base_close(GST_VAAPI_PLUGIN_BASE(trans)); - return TRUE; -} - -static GstFlowReturn -gst_vaapiupload_transform( - GstBaseTransform *trans, - GstBuffer *inbuf, - GstBuffer *outbuf -) -{ - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - - if (!gst_vaapi_uploader_process(upload->uploader, inbuf, outbuf)) - return GST_FLOW_UNEXPECTED; - return GST_FLOW_OK; -} - -static GstCaps * -gst_vaapiupload_transform_caps( - GstBaseTransform *trans, - GstPadDirection direction, - GstCaps *caps -) -{ - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - GstCaps *out_caps = NULL; - GstStructure *structure; - - g_return_val_if_fail(GST_IS_CAPS(caps), NULL); - - structure = gst_caps_get_structure(caps, 0); - - if (direction == GST_PAD_SINK) { - if (!gst_structure_has_name(structure, "video/x-raw-yuv")) - return NULL; - out_caps = gst_caps_from_string(gst_vaapiupload_vaapi_caps_str); - - structure = gst_caps_get_structure(out_caps, 0); - gst_structure_set( - structure, - "type", G_TYPE_STRING, "vaapi", - "opengl", G_TYPE_BOOLEAN, USE_GLX, - NULL - ); - } - else { - if (!gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME)) - return NULL; - out_caps = gst_caps_from_string(gst_vaapiupload_yuv_caps_str); - if (gst_vaapiupload_ensure_uploader(upload)) { - GstCaps *allowed_caps, *inter_caps; - allowed_caps = gst_vaapi_uploader_get_caps(upload->uploader); - if (!allowed_caps) - return NULL; - inter_caps = gst_caps_intersect(out_caps, allowed_caps); - gst_caps_unref(out_caps); - out_caps = inter_caps; - } - } - - if (!gst_vaapi_append_surface_caps(out_caps, caps)) { - gst_caps_unref(out_caps); - return NULL; - } - return out_caps; -} - -static gboolean -gst_vaapiupload_set_caps( - GstBaseTransform *trans, - GstCaps *incaps, - GstCaps *outcaps -) -{ - GstVaapiPluginBase * const plugin = GST_VAAPI_PLUGIN_BASE(trans); - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - - if (!gst_vaapi_plugin_base_set_caps(plugin, incaps, outcaps)) - return FALSE; - if (!gst_vaapi_uploader_ensure_caps(upload->uploader, incaps, outcaps)) - return FALSE; - return TRUE; -} - -static gboolean -gst_vaapiupload_get_unit_size( - GstBaseTransform *trans, - GstCaps *caps, - guint *size -) -{ - GstStructure * const structure = gst_caps_get_structure(caps, 0); - GstVideoFormat format; - gint width, height; - - if (gst_structure_has_name(structure, GST_VAAPI_SURFACE_CAPS_NAME)) - *size = 0; - else { - if (!gst_video_format_parse_caps(caps, &format, &width, &height)) - return FALSE; - *size = gst_video_format_get_size(format, width, height); - } - return TRUE; -} - -static GstFlowReturn -gst_vaapiupload_buffer_alloc( - GstBaseTransform *trans, - guint size, - GstCaps *caps, - GstBuffer **pbuf -) -{ - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - - *pbuf = NULL; - - if (!gst_vaapi_uploader_ensure_display(upload->uploader, - GST_VAAPI_PLUGIN_BASE_DISPLAY(upload))) - return GST_FLOW_NOT_SUPPORTED; - if (!gst_vaapi_uploader_ensure_caps(upload->uploader, caps, NULL)) - return GST_FLOW_NOT_SUPPORTED; - - /* Allocate a regular GstBuffer if direct rendering is not supported */ - if (!gst_vaapi_uploader_has_direct_rendering(upload->uploader)) - return GST_FLOW_OK; - - *pbuf = gst_vaapi_uploader_get_buffer(upload->uploader); - return GST_FLOW_OK; -} - -static GstFlowReturn -gst_vaapiupload_sinkpad_buffer_alloc( - GstPad *pad, - guint64 offset, - guint size, - GstCaps *caps, - GstBuffer **pbuf -) -{ - GstBaseTransform *trans; - GstFlowReturn ret; - - trans = GST_BASE_TRANSFORM(gst_pad_get_parent_element(pad)); - if (!trans) - return GST_FLOW_UNEXPECTED; - - ret = gst_vaapiupload_buffer_alloc(trans, size, caps, pbuf); - gst_object_unref(trans); - return ret; -} - -static GstFlowReturn -gst_vaapiupload_prepare_output_buffer( - GstBaseTransform *trans, - GstBuffer *inbuf, - gint size, - GstCaps *caps, - GstBuffer **poutbuf -) -{ - GstVaapiUpload * const upload = GST_VAAPIUPLOAD(trans); - GstBuffer *buffer; - - *poutbuf = NULL; - - if (!gst_vaapi_uploader_has_direct_rendering(upload->uploader)) - buffer = gst_vaapi_uploader_get_buffer(upload->uploader); - else - buffer = gst_vaapi_video_buffer_new_from_buffer(inbuf); - if (!buffer) - return GST_FLOW_UNEXPECTED; - - gst_buffer_set_caps(buffer, caps); - GST_BUFFER_DATA(buffer) = NULL; - GST_BUFFER_SIZE(buffer) = 0; - - *poutbuf = buffer; - return GST_FLOW_OK; -} - -static gboolean -gst_vaapiupload_query(GstPad *pad, GstQuery *query) -{ - GstVaapiUpload *upload = GST_VAAPIUPLOAD (gst_pad_get_parent_element (pad)); - gboolean res; - - GST_DEBUG ("sharing display %p", GST_VAAPI_PLUGIN_BASE_DISPLAY(upload)); - - if (gst_vaapi_reply_to_query (query, GST_VAAPI_PLUGIN_BASE_DISPLAY(upload))) - res = TRUE; - else - res = gst_pad_query_default (pad, query); - - gst_object_unref (upload); - return res; -} diff --git a/gst/vaapi/gstvaapiupload.h b/gst/vaapi/gstvaapiupload.h deleted file mode 100644 index 6a2c077..0000000 --- a/gst/vaapi/gstvaapiupload.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * gstvaapiupload.h - VA-API video upload element - * - * Copyright (C) 2010-2011 Splitted-Desktop Systems - * Author: Gwenole Beauchesne - * Copyright (C) 2011-2012 Intel Corporation - * Author: Gwenole Beauchesne - * - * This program 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 program 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 program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301 USA -*/ - -#ifndef GST_VAAPIUPLOAD_H -#define GST_VAAPIUPLOAD_H - -#include "gstvaapipluginbase.h" -#include "gstvaapiuploader.h" - -G_BEGIN_DECLS - -#define GST_TYPE_VAAPIUPLOAD \ - (gst_vaapiupload_get_type()) - -#define GST_VAAPIUPLOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST((obj), \ - GST_TYPE_VAAPIUPLOAD, \ - GstVaapiUpload)) - -#define GST_VAAPIUPLOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST((klass), \ - GST_TYPE_VAAPIUPLOAD, \ - GstVaapiUploadClass)) - -#define GST_IS_VAAPIUPLOAD(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPIUPLOAD)) - -#define GST_IS_VAAPIUPLOAD_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPIUPLOAD)) - -#define GST_VAAPIUPLOAD_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS((obj), \ - GST_TYPE_VAAPIUPLOAD, \ - GstVaapiUploadClass)) - -typedef struct _GstVaapiUpload GstVaapiUpload; -typedef struct _GstVaapiUploadClass GstVaapiUploadClass; - -struct _GstVaapiUpload { - /*< private >*/ - GstVaapiPluginBase parent_instance; - - GstVaapiUploader *uploader; -}; - -struct _GstVaapiUploadClass { - /*< private >*/ - GstVaapiPluginBaseClass parent_class; -}; - -GType -gst_vaapiupload_get_type(void) G_GNUC_CONST; - -G_END_DECLS - -#endif /* GST_VAAPIUPLOAD_H */ diff --git a/gst/vaapi/gstvaapiuploader.c b/gst/vaapi/gstvaapiuploader.c index c4e5d14..7d696e4 100644 --- a/gst/vaapi/gstvaapiuploader.c +++ b/gst/vaapi/gstvaapiuploader.c @@ -479,10 +479,6 @@ gst_vaapi_uploader_get_buffer (GstVaapiUploader * uploader) GST_WARNING ("failed to map VA image"); goto error; } -#if !GST_CHECK_VERSION(1,0,0) - GST_BUFFER_DATA (buffer) = gst_vaapi_image_get_plane (image, 0); - GST_BUFFER_SIZE (buffer) = gst_vaapi_image_get_data_size (image); -#endif return buffer; error: diff --git a/gst/vaapi/gstvaapivideobuffer.c b/gst/vaapi/gstvaapivideobuffer.c index 1a5bff5..17641ea 100644 --- a/gst/vaapi/gstvaapivideobuffer.c +++ b/gst/vaapi/gstvaapivideobuffer.c @@ -42,7 +42,7 @@ gst_surface_buffer_new (void) { return gst_buffer_new (); } -#elif GST_CHECK_VERSION(1,0,0) +#else #include #define GST_VAAPI_SURFACE_META_CAST(obj) \ @@ -173,93 +173,7 @@ gst_surface_buffer_new (void) gst_buffer_add_meta (buffer, GST_VAAPI_SURFACE_META_INFO, NULL); return buffer; } -#else -#include - -#define GST_VAAPI_TYPE_VIDEO_BUFFER \ - (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)) -#define GST_VAAPI_IS_VIDEO_BUFFER(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_VAAPI_TYPE_VIDEO_BUFFER)) -#define GST_VAAPI_IS_VIDEO_BUFFER_CLASS(klass) \ - (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)) - -typedef struct _GstVaapiVideoBufferClass GstVaapiVideoBufferClass; -/** - * GstVaapiVideoBuffer: - * - * A #GstBuffer holding video objects (#GstVaapiSurface and #GstVaapiImage). - */ -struct _GstVaapiVideoBuffer -{ - /*< private >*/ - GstSurfaceBuffer parent_instance; -}; - -/** - * GstVaapiVideoBufferClass: - * - * A #GstBuffer holding video objects - */ -struct _GstVaapiVideoBufferClass -{ - /*< private >*/ - GstSurfaceBufferClass parent_class; -}; - -GType -gst_vaapi_video_buffer_get_type (void) G_GNUC_CONST; - -G_DEFINE_TYPE (GstVaapiVideoBuffer, - gst_vaapi_video_buffer, GST_TYPE_SURFACE_BUFFER); - -typedef GstSurfaceConverter * -(*GstSurfaceConverterCreateFunc) (GstSurfaceBuffer * surface, - const gchar * type, GValue * dest); - -static GstSurfaceConverter * -gst_vaapi_video_buffer_create_converter (GstSurfaceBuffer * surface, - const gchar * type, GValue * dest) -{ - GstVaapiVideoMeta *const meta = - gst_buffer_get_vaapi_video_meta (GST_BUFFER (surface)); - GstSurfaceConverterCreateFunc func; - - g_return_val_if_fail (meta != NULL, NULL); - - func = (GstSurfaceConverterCreateFunc) - gst_vaapi_video_meta_get_surface_converter (meta); - - return func ? func (surface, type, dest) : NULL; -} - -static void -gst_vaapi_video_buffer_class_init (GstVaapiVideoBufferClass * klass) -{ - GstSurfaceBufferClass *const surface_class = GST_SURFACE_BUFFER_CLASS (klass); - - surface_class->create_converter = gst_vaapi_video_buffer_create_converter; -} - -static void -gst_vaapi_video_buffer_init (GstVaapiVideoBuffer * buffer) -{ -} - -static inline GstBuffer * -gst_surface_buffer_new (void) -{ - return GST_BUFFER_CAST (gst_mini_object_new (GST_VAAPI_TYPE_VIDEO_BUFFER)); -} #endif static GFunc diff --git a/gst/vaapi/gstvaapivideoconverter_glx.c b/gst/vaapi/gstvaapivideoconverter_glx.c index 4512d17..60c1678 100644 --- a/gst/vaapi/gstvaapivideoconverter_glx.c +++ b/gst/vaapi/gstvaapivideoconverter_glx.c @@ -29,13 +29,8 @@ #include "gstvaapipluginutil.h" #include "gstvaapivideometa.h" -#if GST_CHECK_VERSION(1,0,0) typedef gboolean (*GstSurfaceUploadFunction) (GstSurfaceConverter *, GstBuffer *); -#else -typedef gboolean (*GstSurfaceUploadFunction) (GstSurfaceConverter *, - GstSurfaceBuffer *); -#endif static void gst_vaapi_video_converter_glx_iface_init (GstSurfaceConverterInterface * iface); diff --git a/gst/vaapi/gstvaapivideoconverter_x11.c b/gst/vaapi/gstvaapivideoconverter_x11.c index 0855562..22ddd13 100644 --- a/gst/vaapi/gstvaapivideoconverter_x11.c +++ b/gst/vaapi/gstvaapivideoconverter_x11.c @@ -26,13 +26,8 @@ #include "gstvaapipluginutil.h" #include "gstvaapivideometa.h" -#if GST_CHECK_VERSION(1,0,0) -typedef gboolean (*GstSurfaceUploadFunction) (GstSurfaceConverter *, - GstBuffer *); -#else typedef gboolean (*GstSurfaceUploadFunction) (GstSurfaceConverter *, GstSurfaceBuffer *); -#endif static void gst_vaapi_video_converter_x11_iface_init (GstSurfaceConverterInterface * iface); @@ -175,7 +170,6 @@ gst_vaapi_video_converter_x11_upload (GstSurfaceConverter * self, if (!gst_vaapi_apply_composition (surface, buffer)) GST_WARNING ("could not update subtitles"); -#if GST_CHECK_VERSION(1,0,0) GstVideoCropMeta *const crop_meta = gst_buffer_get_video_crop_meta (buffer); if (crop_meta) { GstVaapiRectangle crop_rect_tmp; @@ -185,7 +179,6 @@ gst_vaapi_video_converter_x11_upload (GstSurfaceConverter * self, crop_rect_tmp.width = crop_meta->width; crop_rect_tmp.height = crop_meta->height; } -#endif if (!crop_rect) crop_rect = gst_vaapi_video_meta_get_render_rect (meta); diff --git a/gst/vaapi/gstvaapivideometa.c b/gst/vaapi/gstvaapivideometa.c index ab97be5..ceff5d1 100644 --- a/gst/vaapi/gstvaapivideometa.c +++ b/gst/vaapi/gstvaapivideometa.c @@ -31,10 +31,7 @@ #include #include #include "gstvaapivideometa.h" - -#if GST_CHECK_VERSION(1,0,0) -# include "gstvaapivideomemory.h" -#endif +#include "gstvaapivideomemory.h" #define GST_VAAPI_VIDEO_META(obj) \ ((GstVaapiVideoMeta *) (obj)) @@ -61,14 +58,12 @@ ensure_surface_proxy (GstVaapiVideoMeta * meta) if (!meta->proxy) return FALSE; -#if GST_CHECK_VERSION(1,0,0) if (meta->buffer) { GstMemory *const mem = gst_buffer_peek_memory (meta->buffer, 0); if (GST_VAAPI_IS_VIDEO_MEMORY (mem)) return gst_vaapi_video_memory_sync (GST_VAAPI_VIDEO_MEMORY_CAST (mem)); } -#endif return TRUE; } @@ -146,24 +141,6 @@ gst_vaapi_video_meta_destroy_proxy (GstVaapiVideoMeta * meta) gst_vaapi_surface_proxy_replace (&meta->proxy, NULL); } -#if !GST_CHECK_VERSION(1,0,0) -#define GST_VAAPI_TYPE_VIDEO_META gst_vaapi_video_meta_get_type () -static GType -gst_vaapi_video_meta_get_type (void) -{ - static gsize g_type; - - if (g_once_init_enter (&g_type)) { - GType type; - type = g_boxed_type_register_static ("GstVaapiVideoMeta", - (GBoxedCopyFunc) gst_vaapi_video_meta_ref, - (GBoxedFreeFunc) gst_vaapi_video_meta_unref); - g_once_init_leave (&g_type, type); - } - return (GType) g_type; -} -#endif - static void gst_vaapi_video_meta_finalize (GstVaapiVideoMeta * meta) { @@ -707,8 +684,6 @@ gst_vaapi_video_meta_set_render_rect (GstVaapiVideoMeta * meta, meta->render_rect = *rect; } -#if GST_CHECK_VERSION(1,0,0) - #define GST_VAAPI_VIDEO_META_HOLDER(meta) \ ((GstVaapiVideoMetaHolder *) (meta)) @@ -812,64 +787,3 @@ gst_buffer_set_vaapi_video_meta (GstBuffer * buffer, GstVaapiVideoMeta * meta) if (m) GST_VAAPI_VIDEO_META_HOLDER (m)->meta = gst_vaapi_video_meta_ref (meta); } -#else - -#define GST_VAAPI_VIDEO_META_QUARK gst_vaapi_video_meta_quark_get () -static GQuark -gst_vaapi_video_meta_quark_get (void) -{ - static gsize g_quark; - - if (g_once_init_enter (&g_quark)) { - gsize quark = (gsize) g_quark_from_static_string ("GstVaapiVideoMeta"); - g_once_init_leave (&g_quark, quark); - } - return g_quark; -} - -#define META_QUARK meta_quark_get () -static GQuark -meta_quark_get (void) -{ - static gsize g_quark; - - if (g_once_init_enter (&g_quark)) { - gsize quark = (gsize) g_quark_from_static_string ("meta"); - g_once_init_leave (&g_quark, quark); - } - return g_quark; -} - -GstVaapiVideoMeta * -gst_buffer_get_vaapi_video_meta (GstBuffer * buffer) -{ - GstVaapiVideoMeta *meta; - const GstStructure *structure; - const GValue *value; - - g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL); - - structure = gst_buffer_get_qdata (buffer, GST_VAAPI_VIDEO_META_QUARK); - if (!structure) - return NULL; - - value = gst_structure_id_get_value (structure, META_QUARK); - if (!value) - return NULL; - - meta = GST_VAAPI_VIDEO_META (g_value_get_boxed (value)); - meta->buffer = buffer; - return meta; -} - -void -gst_buffer_set_vaapi_video_meta (GstBuffer * buffer, GstVaapiVideoMeta * meta) -{ - g_return_if_fail (GST_IS_BUFFER (buffer)); - g_return_if_fail (GST_VAAPI_IS_VIDEO_META (meta)); - - gst_buffer_set_qdata (buffer, GST_VAAPI_VIDEO_META_QUARK, - gst_structure_id_new (GST_VAAPI_VIDEO_META_QUARK, - META_QUARK, GST_VAAPI_TYPE_VIDEO_META, meta, NULL)); -} -#endif diff --git a/gst/vaapi/gstvaapivideometa.h b/gst/vaapi/gstvaapivideometa.h index 21fd35a..62f4322 100644 --- a/gst/vaapi/gstvaapivideometa.h +++ b/gst/vaapi/gstvaapivideometa.h @@ -35,14 +35,12 @@ G_BEGIN_DECLS typedef struct _GstVaapiVideoMeta GstVaapiVideoMeta; -#if GST_CHECK_VERSION(1,0,0) #define GST_VAAPI_VIDEO_META_API_TYPE \ gst_vaapi_video_meta_api_get_type () G_GNUC_INTERNAL GType gst_vaapi_video_meta_api_get_type (void) G_GNUC_CONST; -#endif G_GNUC_INTERNAL GstVaapiVideoMeta * diff --git a/tests/test-filter.c b/tests/test-filter.c index 8e19fab..05dfee9 100644 --- a/tests/test-filter.c +++ b/tests/test-filter.c @@ -100,7 +100,7 @@ create_test_surface(GstVaapiDisplay *display, guint width, guint height, GError *error = NULL; if (g_src_format_str) { - format = gst_vaapi_video_format_from_string(g_src_format_str); + format = gst_video_format_from_string(g_src_format_str); if (format == GST_VIDEO_FORMAT_UNKNOWN) goto error_invalid_format; } diff --git a/tests/test-subpicture.c b/tests/test-subpicture.c index 87cbace..782be08 100644 --- a/tests/test-subpicture.c +++ b/tests/test-subpicture.c @@ -130,7 +130,6 @@ main(int argc, char *argv[]) subrect.height = subinfo.height; subrect.width = subinfo.width; -#if GST_CHECK_VERSION(1,0,0) { GstVideoMeta * const vmeta = gst_buffer_add_video_meta(buffer, GST_VIDEO_FRAME_FLAG_NONE, @@ -142,11 +141,6 @@ main(int argc, char *argv[]) overlay = gst_video_overlay_rectangle_new_raw(buffer, subrect.x, subrect.y, subrect.width, subrect.height, flags); } -#else - overlay = gst_video_overlay_rectangle_new_argb(buffer, - subinfo.width, subinfo.height, subinfo.width * 4, - subrect.x, subrect.y, subrect.width, subrect.height, flags); -#endif if (!overlay) g_error("could not create video overlay"); gst_buffer_unref(buffer); -- 2.7.4