The support for GStreamer 1.0 has been obsoleted in 0.5.10 release.
GStreamer 1.2 is the a minimal requirement for building the gstreamer-vaapi.
This patch removes all the pre-processor conditional code compilation guarded
for gstreamer-1.0.
Thus, all the video converters were removed too.
https://bugzilla.gnome.org/show_bug.cgi?id=745728
Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
Signed-off-by: Sreerenj Balachandran <sreerenj.balachandran@intel.com>
#include "gstvaapidecode.h"
#include "gstvaapipluginutil.h"
#include "gstvaapivideobuffer.h"
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
#include "gstvaapivideometa_texture.h"
#endif
#include "gstvaapivideobufferpool.h"
;
static const char gst_vaapidecode_src_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES(
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }") ";"
GST_VIDEO_CAPS_MAKE_WITH_FEATURES(
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ";"
GST_VIDEO_CAPS_MAKE("{ I420, YV12, NV12 }");
-#else
- GST_VAAPI_SURFACE_CAPS;
-#endif
static GstStaticPadTemplate gst_vaapidecode_sink_factory =
GST_STATIC_PAD_TEMPLATE(
ref_state = decode->input_state;
-#if GST_CHECK_VERSION(1,1,0)
GstCapsFeatures *features = NULL;
GstVaapiCapsFeature feature;
default:
break;
}
-#endif
state = gst_video_decoder_set_output_state (vdec, format,
ref_state->info.width, ref_state->info.height,
vi = &state->info;
-#if GST_CHECK_VERSION(1,1,0)
state->caps = gst_video_info_to_caps (vi);
if (features)
gst_caps_set_features (state->caps, 0, features);
-#else
- /* XXX: gst_video_info_to_caps() from GStreamer 0.10 does not
- reconstruct suitable caps for "encoded" video formats */
- state->caps = gst_caps_from_string (GST_VAAPI_SURFACE_CAPS_NAME);
- if (!state->caps)
- return FALSE;
-
- gst_caps_set_simple (state->caps,
- "type", G_TYPE_STRING, "vaapi",
- "opengl", G_TYPE_BOOLEAN, USE_GLX,
- "width", G_TYPE_INT, vi->width,
- "height", G_TYPE_INT, vi->height,
- "framerate", GST_TYPE_FRACTION, vi->fps_n, vi->fps_d,
- "pixel-aspect-ratio", GST_TYPE_FRACTION, vi->par_n, vi->par_d, NULL);
-
- gst_caps_set_interlaced (state->caps, vi);
-#endif
gst_caps_replace (&decode->srcpad_caps, state->caps);
gst_video_codec_state_unref (state);
return TRUE;
crop_meta->height = crop_rect->height;
}
}
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
if (decode->has_texture_upload_meta)
gst_buffer_ensure_texture_upload_meta (out_frame->output_buffer);
#endif
gst_vaapi_find_preferred_caps_feature (GST_VIDEO_DECODER_SRC_PAD (vdec),
GST_VIDEO_FORMAT_ENCODED, &out_format);
decode->has_texture_upload_meta = FALSE;
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
decode->has_texture_upload_meta =
(feature == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META) &&
gst_query_find_allocation_meta (query,
PROP_MAX_SIZE_TIME
};
-#if GST_CHECK_VERSION(1,1,0)
#define GST_VAAPI_DECODE_BIN_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
-#else
-#define GST_VAAPI_DECODE_BIN_SURFACE_CAPS \
- GST_VAAPI_SURFACE_CAPS
-#endif
/* Default templates */
#define GST_CAPS_CODEC(CODEC) CODEC "; "
static const char gst_vaapi_decode_bin_src_caps_str[] =
GST_VAAPI_DECODE_BIN_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ", "
GST_CAPS_INTERLACED_FALSE "; "
-#endif
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-ON* */
/* *INDENT-OFF* */
static const char gst_vaapiencode_h264_sink_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
-#else
- GST_VAAPI_SURFACE_CAPS ", "
-#endif
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-OFF* */
static const char gst_vaapiencode_jpeg_sink_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
-#else
- GST_VAAPI_SURFACE_CAPS ", "
-#endif
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-OFF* */
static const char gst_vaapiencode_mpeg2_sink_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
-#else
- GST_VAAPI_SURFACE_CAPS ", "
-#endif
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-OFF* */
static const char gst_vaapiencode_vp8_sink_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
-#else
- GST_VAAPI_SURFACE_CAPS ", "
-#endif
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
#include "gstvaapivideocontext.h"
#include "gstvaapivideometa.h"
#include "gstvaapivideobufferpool.h"
-#if GST_CHECK_VERSION(1,1,0)
#include <gst/allocators/allocators.h>
-#endif
/* Default debug category is from the subclass */
#define GST_CAT_DEFAULT (plugin->debug_category)
gst_vaapi_display_unref (display);
}
-#if GST_CHECK_VERSION(1,1,0)
static void
plugin_set_context (GstElement * element, GstContext * context)
{
if (gst_vaapi_video_context_get_display (context, &display))
plugin_set_display (plugin, display);
}
-#else
-static void
-plugin_set_context (GstVideoContext * context, const gchar * type,
- const GValue * value)
-{
- GstVaapiPluginBase *const plugin = GST_VAAPI_PLUGIN_BASE (context);
- GstVaapiDisplay *display = NULL;
-
- gst_vaapi_set_display (type, value, &display);
- plugin_set_display (plugin, display);
-}
-
-static void
-video_context_interface_init (GstVideoContextInterface * iface)
-{
- iface->set_context = plugin_set_context;
-}
-
-#define GstVideoContextClass GstVideoContextInterface
-#endif
void
gst_vaapi_plugin_base_init_interfaces (GType g_define_type_id)
{
-#if !GST_CHECK_VERSION(1,1,0)
- G_IMPLEMENT_INTERFACE (GST_TYPE_VIDEO_CONTEXT, video_context_interface_init);
-#endif
}
static gboolean
return TRUE;
}
-#if GST_CHECK_VERSION(1,1,0)
static gboolean
is_dma_buffer (GstBuffer * buf)
{
GST_ERROR ("failed to create VA surface proxy from wrapped VA surface");
return FALSE;
}
-#endif
void
gst_vaapi_plugin_base_class_init (GstVaapiPluginBaseClass * klass)
klass->has_interface = default_has_interface;
klass->display_changed = default_display_changed;
-#if GST_CHECK_VERSION(1,1,0)
GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
element_class->set_context = GST_DEBUG_FUNCPTR (plugin_set_context);
-#endif
}
void
gboolean need_pool, update_pool;
gboolean has_video_meta = FALSE;
gboolean has_video_alignment = FALSE;
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
gboolean has_texture_upload_meta = FALSE;
guint idx;
#endif
has_video_meta = gst_query_find_allocation_meta (query,
GST_VIDEO_META_API_TYPE, NULL);
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
has_texture_upload_meta = gst_query_find_allocation_meta (query,
GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx) &&
(feature == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META);
}
/* GstVideoGLTextureUploadMeta (OpenGL) */
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
if (has_texture_upload_meta) {
config = gst_buffer_pool_get_config (pool);
gst_buffer_pool_config_add_option (config,
&outbuf, NULL) != GST_FLOW_OK)
goto error_create_buffer;
-#if GST_CHECK_VERSION(1,1,0)
if (is_dma_buffer (inbuf)) {
if (!plugin_bind_dma_to_vaapi_buffer (plugin, inbuf, outbuf))
goto error_bind_dma_buffer;
goto done;
}
-#endif
if (!gst_video_frame_map (&src_frame, &plugin->sinkpad_info, inbuf,
GST_MAP_READ))
return TRUE;
}
-void
-gst_vaapi_set_display (const gchar * type,
- const GValue * value, GstVaapiDisplay ** display_ptr)
-{
- GstVaapiDisplay *display = NULL;
-
- if (!strcmp (type, "vaapi-display")) {
- g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
- display = gst_vaapi_display_new_with_display (g_value_get_pointer (value));
- } else if (!strcmp (type, "gst-vaapi-display")) {
- g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
- display = gst_vaapi_display_ref (g_value_get_pointer (value));
- }
-#if USE_DRM
- else if (!strcmp (type, "drm-device")) {
- gint device;
- g_return_if_fail (G_VALUE_HOLDS_INT (value));
- device = g_value_get_int (value);
- display = gst_vaapi_display_drm_new_with_device (device);
- } else if (!strcmp (type, "drm-device-path")) {
- const gchar *device_path;
- g_return_if_fail (G_VALUE_HOLDS_STRING (value));
- device_path = g_value_get_string (value);
- display = gst_vaapi_display_drm_new (device_path);
- }
-#endif
-#if USE_X11
- else if (!strcmp (type, "x11-display-name")) {
- g_return_if_fail (G_VALUE_HOLDS_STRING (value));
-#if USE_GLX
- display = gst_vaapi_display_glx_new (g_value_get_string (value));
-#endif
- if (!display)
- display = gst_vaapi_display_x11_new (g_value_get_string (value));
- } else if (!strcmp (type, "x11-display")) {
- g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
-#if USE_GLX
- display =
- gst_vaapi_display_glx_new_with_display (g_value_get_pointer (value));
-#endif
- if (!display)
- display =
- gst_vaapi_display_x11_new_with_display (g_value_get_pointer (value));
- }
-#endif
-#if USE_WAYLAND
- else if (!strcmp (type, "wl-display")) {
- struct wl_display *wl_display;
- g_return_if_fail (G_VALUE_HOLDS_POINTER (value));
- wl_display = g_value_get_pointer (value);
- display = gst_vaapi_display_wayland_new_with_display (wl_display);
- } else if (!strcmp (type, "wl-display-name")) {
- const gchar *display_name;
- g_return_if_fail (G_VALUE_HOLDS_STRING (value));
- display_name = g_value_get_string (value);
- display = gst_vaapi_display_wayland_new (display_name);
- }
-#endif
-
- if (display) {
- gst_vaapi_display_replace (display_ptr, display);
- gst_vaapi_display_unref (display);
- }
-}
-
gboolean
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display)
{
-#if GST_CHECK_VERSION(1,1,0)
const gchar *type = NULL;
GstContext *context;
gst_context_unref (context);
return TRUE;
-#else
- GstVaapiDisplayType display_type;
- const gchar **types;
- const gchar *type;
- gint i;
- gboolean res = FALSE;
-
- if (GST_QUERY_TYPE (query) != GST_QUERY_CUSTOM)
- return FALSE;
-
- if (!display)
- return FALSE;
-
- types = gst_video_context_query_get_supported_types (query);
-
- if (!types)
- return FALSE;
-
- display_type = gst_vaapi_display_get_display_type (display);
- for (i = 0; types[i] && !res; i++) {
- type = types[i];
-
- res = TRUE;
- if (!strcmp (type, "gst-vaapi-display")) {
- gst_video_context_query_set_pointer (query, type, display);
- } else if (!strcmp (type, "vaapi-display")) {
- VADisplay vadpy = gst_vaapi_display_get_display (display);
- gst_video_context_query_set_pointer (query, type, vadpy);
- } else {
- switch (display_type) {
-#if USE_DRM
- case GST_VAAPI_DISPLAY_TYPE_DRM:{
- GstVaapiDisplayDRM *const drm_dpy = GST_VAAPI_DISPLAY_DRM (display);
- if (!strcmp (type, "drm-device-path"))
- gst_video_context_query_set_string (query, type,
- gst_vaapi_display_drm_get_device_path (drm_dpy));
-#if 0
- /* XXX: gst_video_context_query_set_int() does not exist yet */
- else if (!strcmp (type, "drm-device"))
- gst_video_context_query_set_int (query, type,
- gst_vaapi_display_drm_get_device (drm_dpy));
-#endif
- else
- res = FALSE;
- break;
- }
-#endif
-#if USE_X11
- case GST_VAAPI_DISPLAY_TYPE_X11:{
- GstVaapiDisplayX11 *const xvadpy = GST_VAAPI_DISPLAY_X11 (display);
- Display *const x11dpy = gst_vaapi_display_x11_get_display (xvadpy);
- if (!strcmp (type, "x11-display"))
- gst_video_context_query_set_pointer (query, type, x11dpy);
- else if (!strcmp (type, "x11-display-name"))
- gst_video_context_query_set_string (query, type,
- DisplayString (x11dpy));
- else
- res = FALSE;
- break;
- }
-#endif
-#if USE_WAYLAND
- case GST_VAAPI_DISPLAY_TYPE_WAYLAND:{
- GstVaapiDisplayWayland *const wlvadpy =
- GST_VAAPI_DISPLAY_WAYLAND (display);
- struct wl_display *const wldpy =
- gst_vaapi_display_wayland_get_display (wlvadpy);
- if (!strcmp (type, "wl-display"))
- gst_video_context_query_set_pointer (query, type, wldpy);
- else
- res = FALSE;
- break;
- }
-#endif
- default:
- res = FALSE;
- break;
- }
- }
- }
- return res;
-#endif /* !GST_CHECK_VERSION(1,1,0) */
}
gboolean
if (!caps)
return NULL;
-#if GST_CHECK_VERSION(1,1,0)
GstCapsFeatures *const features =
gst_caps_features_new (features_string, NULL);
if (!features) {
return NULL;
}
gst_caps_set_features (caps, 0, features);
-#endif
return caps;
}
static GstCaps *
new_gl_texture_upload_meta_caps (void)
{
-#if GST_CHECK_VERSION(1,1,0)
return gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }"));
-#else
- return gst_caps_new_empty ();
-#endif
}
GstVaapiCapsFeature
GstVideoFormat * out_format_ptr)
{
GstVaapiCapsFeature feature = GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY;
-#if GST_CHECK_VERSION(1,1,0)
guint i, num_structures;
GstCaps *caps = NULL;
GstCaps *gl_texture_upload_caps = NULL;
}
if (out_format_ptr) {
-#if GST_CHECK_VERSION(1,1,0)
if (feature == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META) {
GstStructure *structure;
gchar *format_str;
} while (0);
if (!out_format)
goto cleanup;
-#endif
}
*out_format_ptr = out_format;
}
gst_caps_replace (&vaapi_caps, NULL);
gst_caps_replace (&caps, NULL);
gst_caps_replace (&out_caps, NULL);
-#endif
return feature;
}
const gchar *str;
switch (feature) {
-#if GST_CHECK_VERSION(1,1,0)
case GST_VAAPI_CAPS_FEATURE_SYSTEM_MEMORY:
str = GST_CAPS_FEATURE_MEMORY_SYSTEM_MEMORY;
break;
case GST_VAAPI_CAPS_FEATURE_VAAPI_SURFACE:
str = GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE;
break;
-#endif
default:
str = NULL;
break;
if (num_structures < 1)
return FALSE;
-#if GST_CHECK_VERSION(1,1,0)
for (i = 0; i < num_structures && !found_caps; i++) {
GstCapsFeatures *const features = gst_caps_get_features (caps, i);
found_caps = gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE);
}
-#else
- for (i = 0; i < num_structures && !found_caps; i++) {
- GstStructure *const structure = gst_caps_get_structure (caps, i);
- GstCaps *test_caps;
- GstVideoInfo vi;
-
- test_caps = gst_caps_new_full (gst_structure_copy (structure), NULL);
- if (!test_caps)
- continue;
-
- found_caps = gst_video_info_from_caps (&vi, test_caps) &&
- GST_VIDEO_INFO_FORMAT (&vi) == GST_VIDEO_FORMAT_ENCODED;
- gst_caps_unref (test_caps);
- }
-#endif
return found_caps;
}
gboolean
gst_vaapi_ensure_display (gpointer element, GstVaapiDisplayType type);
-G_GNUC_INTERNAL
-void
-gst_vaapi_set_display (const gchar * type,
- const GValue * value, GstVaapiDisplay ** display_ptr);
-
G_GNUC_INTERNAL
gboolean
gst_vaapi_reply_to_query (GstQuery * query, GstVaapiDisplay * display);
GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapipostproc);
#define GST_CAT_DEFAULT gst_debug_vaapipostproc
-#if GST_CHECK_VERSION(1,1,0)
# define GST_VAAPIPOSTPROC_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
-#else
-# define GST_VAAPIPOSTPROC_SURFACE_CAPS \
- GST_VAAPI_SURFACE_CAPS
-#endif
/* Default templates */
/* *INDENT-OFF* */
static const char gst_vaapipostproc_src_caps_str[] =
GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ", "
GST_CAPS_INTERLACED_FALSE "; "
-#endif
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-ON* */
num_structures = gst_caps_get_size (caps);
for (i = 0; i < num_structures; i++) {
-#if GST_CHECK_VERSION(1,1,0)
GstCapsFeatures *const features = gst_caps_get_features (caps, i);
if (gst_caps_features_contains (features,
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META))
continue;
-#endif
GstStructure *const structure = gst_caps_get_structure (caps, i);
if (!structure)
GstVideoInfo vi;
GstVideoFormat out_format;
GstCaps *out_caps;
-#if GST_CHECK_VERSION(1,1,0)
GstVaapiCapsFeature feature;
const gchar *feature_str;
-#endif
guint width, height;
/* Generate the sink pad caps, that could be fixated afterwards */
find_best_size (postproc, &vi, &width, &height);
// Update format from user-specified parameters
-#if GST_CHECK_VERSION(1,1,0)
/* XXX: this is a workaround until auto-plugging is fixed when
* format=ENCODED + memory:VASurface caps feature are provided.
* use the downstream negotiated video format as the output format
feature =
gst_vaapi_find_preferred_caps_feature (GST_BASE_TRANSFORM_SRC_PAD (trans),
out_format, &out_format);
-#else
- out_format = GST_VIDEO_FORMAT_ENCODED;
-#endif
gst_video_info_change_format (&vi, out_format, width, height);
-#if GST_CHECK_VERSION(1,1,0)
out_caps = gst_video_info_to_caps (&vi);
if (!out_caps)
return NULL;
gst_caps_set_features (out_caps, 0,
gst_caps_features_new (feature_str, NULL));
}
-#else
- /* XXX: gst_video_info_to_caps() from GStreamer 0.10 does not
- reconstruct suitable caps for "encoded" video formats */
- out_caps = gst_caps_from_string (GST_VAAPI_SURFACE_CAPS_NAME);
- if (!out_caps)
- return NULL;
-
- gst_caps_set_simple (out_caps,
- "type", G_TYPE_STRING, "vaapi",
- "opengl", G_TYPE_BOOLEAN, USE_GLX,
- "width", G_TYPE_INT, GST_VIDEO_INFO_WIDTH (&vi),
- "height", G_TYPE_INT, GST_VIDEO_INFO_HEIGHT (&vi),
- "framerate", GST_TYPE_FRACTION, GST_VIDEO_INFO_FPS_N (&vi),
- GST_VIDEO_INFO_FPS_D (&vi),
- "pixel-aspect-ratio", GST_TYPE_FRACTION, GST_VIDEO_INFO_PAR_N (&vi),
- GST_VIDEO_INFO_PAR_D (&vi), NULL);
-
- gst_caps_set_interlaced (out_caps, &vi);
-#endif
return out_caps;
}
/* Default template */
/* *INDENT-OFF* */
static const char gst_vaapisink_sink_caps_str[] =
-#if GST_CHECK_VERSION(1,1,0)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ";"
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL);
-#else
- GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) "; "
- GST_VAAPI_SURFACE_CAPS;
-#endif
/* *INDENT-ON* */
static GstStaticPadTemplate gst_vaapisink_sink_factory =
GstVaapiSink *const sink = GST_VAAPISINK_CAST (base_sink);
GstCaps *out_caps, *yuv_caps;
-#if GST_CHECK_VERSION(1,1,0)
out_caps = gst_static_pad_template_get_caps (&gst_vaapisink_sink_factory);
-#else
- out_caps = gst_caps_from_string (GST_VAAPI_SURFACE_CAPS);
-#endif
if (!out_caps)
return NULL;
#include "gstcompat.h"
#include "gstvaapivideobuffer.h"
-#if USE_X11 && !GST_CHECK_VERSION(1,1,0)
-# include "gstvaapivideoconverter_x11.h"
-#endif
-#if USE_GLX && !GST_CHECK_VERSION(1,1,0)
-# include "gstvaapivideoconverter_glx.h"
-#endif
-#if GST_CHECK_VERSION(1,1,0)
static inline GstBuffer *
gst_surface_buffer_new (void)
{
return gst_buffer_new ();
}
-#else
-#include <gst/video/gstsurfacemeta.h>
-
-#define GST_VAAPI_SURFACE_META_CAST(obj) \
- ((GstVaapiSurfaceMeta *) (obj))
-
-typedef struct _GstVaapiSurfaceMeta GstVaapiSurfaceMeta;
-struct _GstVaapiSurfaceMeta
-{
- GstSurfaceMeta base;
- GstBuffer *buffer;
-};
-
-#define GST_VAAPI_SURFACE_META_INFO \
- gst_vaapi_surface_meta_get_info ()
-
-static const GstMetaInfo *
-gst_vaapi_surface_meta_get_info (void);
-
-typedef GstSurfaceConverter *(*GstSurfaceConverterCreateFunc) (GstSurfaceMeta *
- meta, const gchar * type, GValue * dest);
-
-#if USE_X11
-static GstSurfaceConverter *
-gst_vaapi_surface_create_converter_x11 (GstSurfaceMeta * base_meta,
- const gchar * type, GValue * dest)
-{
- GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
-
- return gst_vaapi_video_converter_x11_new (meta->buffer, type, dest);
-}
-
-#undef gst_vaapi_video_converter_x11_new
-#define gst_vaapi_video_converter_x11_new \
- gst_vaapi_surface_create_converter_x11
-#endif
-
-#if USE_GLX
-static GstSurfaceConverter *
-gst_vaapi_surface_create_converter_glx (GstSurfaceMeta * base_meta,
- const gchar * type, GValue * dest)
-{
- GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
-
- return gst_vaapi_video_converter_glx_new (meta->buffer, type, dest);
-}
-
-#undef gst_vaapi_video_converter_glx_new
-#define gst_vaapi_video_converter_glx_new \
- gst_vaapi_surface_create_converter_glx
-#endif
-
-static GstSurfaceConverter *
-gst_vaapi_surface_create_converter (GstSurfaceMeta * base_meta,
- const gchar * type, GValue * dest)
-{
- GstVaapiSurfaceMeta *const meta = GST_VAAPI_SURFACE_META_CAST (base_meta);
- GstVaapiVideoMeta *const vmeta =
- gst_buffer_get_vaapi_video_meta (meta->buffer);
- GstSurfaceConverterCreateFunc func;
-
- if (G_UNLIKELY (!vmeta))
- return NULL;
-
- func = (GstSurfaceConverterCreateFunc)
- gst_vaapi_video_meta_get_surface_converter (vmeta);
-
- return func ? func (base_meta, type, dest) : NULL;
-}
-
-static gboolean
-gst_vaapi_surface_meta_init (GstVaapiSurfaceMeta * meta, gpointer params,
- GstBuffer * buffer)
-{
- meta->base.create_converter = gst_vaapi_surface_create_converter;
- meta->buffer = buffer;
- return TRUE;
-}
-
-static void
-gst_vaapi_surface_meta_free (GstVaapiSurfaceMeta * meta, GstBuffer * buffer)
-{
-}
-
-static gboolean
-gst_vaapi_surface_meta_transform (GstBuffer * dst_buffer, GstMeta * meta,
- GstBuffer * src_buffer, GQuark type, gpointer data)
-{
- GstVaapiVideoMeta *const src_vmeta =
- gst_buffer_get_vaapi_video_meta (src_buffer);
-
- if (GST_META_TRANSFORM_IS_COPY (type)) {
- GstVaapiSurfaceMeta *const dst_smeta =
- GST_VAAPI_SURFACE_META_CAST (gst_buffer_add_meta (dst_buffer,
- GST_VAAPI_SURFACE_META_INFO, NULL));
-
- /* Note: avoid meta lookups in gst_vaapi_surface_create_converter()
- by directly calling the GstVaapiVideoMeta::surface_converter hook */
- dst_smeta->base.create_converter = (GstSurfaceConverterCreateFunc)
- gst_vaapi_video_meta_get_surface_converter (src_vmeta);
- return TRUE;
- }
- return FALSE;
-}
-
-const GstMetaInfo *
-gst_vaapi_surface_meta_get_info (void)
-{
- static gsize g_meta_info;
-
- if (g_once_init_enter (&g_meta_info)) {
- gsize meta_info =
- GPOINTER_TO_SIZE (gst_meta_register (GST_SURFACE_META_API_TYPE,
- "GstVaapiSurfaceMeta", sizeof (GstVaapiSurfaceMeta),
- (GstMetaInitFunction) gst_vaapi_surface_meta_init,
- (GstMetaFreeFunction) gst_vaapi_surface_meta_free,
- (GstMetaTransformFunction) gst_vaapi_surface_meta_transform));
- g_once_init_leave (&g_meta_info, meta_info);
- }
- return GSIZE_TO_POINTER (g_meta_info);
-}
-
-static GstBuffer *
-gst_surface_buffer_new (void)
-{
- GstBuffer *const buffer = gst_buffer_new ();
-
- if (buffer)
- gst_buffer_add_meta (buffer, GST_VAAPI_SURFACE_META_INFO, NULL);
- return buffer;
-}
-
-#endif
static GFunc
get_surface_converter (GstVaapiDisplay * display)
GFunc func;
switch (gst_vaapi_display_get_class_type (display)) {
-#if USE_X11 && !GST_CHECK_VERSION(1,1,0)
- case GST_VAAPI_DISPLAY_TYPE_X11:
- func = (GFunc) gst_vaapi_video_converter_x11_new;
- break;
-#endif
-#if USE_GLX && !GST_CHECK_VERSION(1,1,0)
- case GST_VAAPI_DISPLAY_TYPE_GLX:
- func = (GFunc) gst_vaapi_video_converter_glx_new;
- break;
-#endif
default:
func = NULL;
break;
#include "gstvaapivideobufferpool.h"
#include "gstvaapivideobuffer.h"
#include "gstvaapivideomemory.h"
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
#include "gstvaapivideometa_texture.h"
#endif
}
}
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
if (priv->has_texture_upload_meta)
gst_buffer_add_texture_upload_meta (buffer);
#endif
#include "gstcompat.h"
#include "gstvaapivideocontext.h"
-#if GST_CHECK_VERSION(1,1,0)
-
GST_DEBUG_CATEGORY_STATIC (GST_CAT_CONTEXT);
#define GST_VAAPI_TYPE_DISPLAY \
msg = gst_message_new_have_context (GST_OBJECT_CAST (element), context);
gst_element_post_message (GST_ELEMENT_CAST (element), msg);
}
-
-#endif
#include <gst/vaapi/gstvaapidisplay.h>
-#if GST_CHECK_VERSION(1,1,0)
-
#define GST_VAAPI_DISPLAY_CONTEXT_TYPE_NAME "gst.vaapi.Display"
/* Fake GstVideoContext symbols */
gst_vaapi_video_context_propagate (GstElement * element,
GstVaapiDisplay * display);
-#else
-#include <gst/video/videocontext.h>
-
-static inline void
-gst_vaapi_video_context_prepare (GstVideoContext * context,
- const gchar ** types)
-{
- gst_video_context_prepare (context, types);
-}
-
-static inline void
-gst_vaapi_video_context_propagate (GstVideoContext * context,
- GstVaapiDisplay * display)
-{
-}
-
-#endif
-
#endif /* GST_VAAPI_VIDEO_CONTEXT_H */
+++ /dev/null
-/*
- * gstvaapivideoconverter_glx.h - Gstreamer/VA video converter
- *
- * Copyright (C) 2011-2013 Intel Corporation
- * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
- * Copyright (C) 2011 Collabora Ltd.
- * Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef GST_VAAPI_VIDEO_CONVERTER_GLX_H
-#define GST_VAAPI_VIDEO_CONVERTER_GLX_H
-
-#include <gst/video/gstsurfaceconverter.h>
-#include "gstvaapivideobuffer.h"
-
-G_BEGIN_DECLS
-
-#define GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX \
- (gst_vaapi_video_converter_glx_get_type ())
-#define GST_VAAPI_VIDEO_CONVERTER_GLX(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX, \
- GstVaapiVideoConverterGLX))
-#define GST_VAAPI_VIDEO_CONVERTER_GLX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX, \
- GstVaapiVideoConverterGLXClass))
-#define GST_VAAPI_IS_VIDEO_CONVERTER_GLX(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX))
-#define GST_VAAPI_IS_VIDEO_CONVERTER_GLX_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX))
-#define GST_VAAPI_VIDEO_CONVERTER_GLX_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_GLX, \
- GstVaapiVideoConverterGLXClass))
-
-typedef struct _GstVaapiVideoConverterGLX GstVaapiVideoConverterGLX;
-typedef struct _GstVaapiVideoConverterGLXPrivate
- GstVaapiVideoConverterGLXPrivate;
-typedef struct _GstVaapiVideoConverterGLXClass GstVaapiVideoConverterGLXClass;
-
-/**
- * GstVaapiVideoConverterGLX:
- *
- * Converter to transform VA buffers into GL textures.
- */
-struct _GstVaapiVideoConverterGLX
-{
- /*< private >*/
- GObject parent_instance;
-
- GstVaapiVideoConverterGLXPrivate *priv;
-};
-
-/**
- * GstVaapiVideoConverterGLXClass:
- *
- * Converter class to transform VA buffers into GL textures.
- */
-struct _GstVaapiVideoConverterGLXClass
-{
- /*< private >*/
- GObjectClass parent_class;
-};
-
-G_GNUC_INTERNAL
-GType
-gst_vaapi_video_converter_glx_get_type (void) G_GNUC_CONST;
-
-G_GNUC_INTERNAL
-GstSurfaceConverter *
-gst_vaapi_video_converter_glx_new (GstBuffer * buffer, const gchar * type,
- GValue * dest);
-
-G_END_DECLS
-
-#endif /* GST_VAAPI_VIDEO_CONVERTER_GLX_H */
+++ /dev/null
-/*
- * gstvaapivideoconverter_x11.h - VA video converter to X11 pixmap
- *
- * Copyright (C) 2013 Intel Corporation
- * Author: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public License
- * as published by the Free Software Foundation; either version 2.1
- * of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301 USA
- */
-
-#ifndef GST_VAAPI_VIDEO_CONVERTER_X11_H
-#define GST_VAAPI_VIDEO_CONVERTER_X11_H
-
-#include <gst/video/gstsurfaceconverter.h>
-#include "gstvaapivideobuffer.h"
-
-G_BEGIN_DECLS
-
-#define GST_VAAPI_TYPE_VIDEO_CONVERTER_X11 \
- (gst_vaapi_video_converter_x11_get_type ())
-#define GST_VAAPI_VIDEO_CONVERTER_X11(obj) \
- (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_X11, \
- GstVaapiVideoConverterX11))
-#define GST_VAAPI_VIDEO_CONVERTER_X11_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_CAST ((klass), GST_VAAPI_TYPE_VIDEO_CONVERTER_X11, \
- GstVaapiVideoConverterX11Class))
-#define GST_VAAPI_IS_VIDEO_CONVERTER_X11(obj) \
- (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_X11))
-#define GST_VAAPI_IS_VIDEO_CONVERTER_X11_CLASS(klass) \
- (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_VAAPI_TYPE_VIDEO_CONVERTER_X11))
-#define GST_VAAPI_VIDEO_CONVERTER_X11_GET_CLASS(obj) \
- (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_VAAPI_TYPE_VIDEO_CONVERTER_X11, \
- GstVaapiVideoConverterX11Class))
-
-typedef struct _GstVaapiVideoConverterX11 GstVaapiVideoConverterX11;
-typedef struct _GstVaapiVideoConverterX11Private
- GstVaapiVideoConverterX11Private;
-typedef struct _GstVaapiVideoConverterX11Class GstVaapiVideoConverterX11Class;
-
-/**
- * GstVaapiVideoConverterX11:
- *
- * Converter to transform VA buffers into GL textures.
- */
-struct _GstVaapiVideoConverterX11
-{
- /*< private >*/
- GObject parent_instance;
-
- GstVaapiVideoConverterX11Private *priv;
-};
-
-/**
- * GstVaapiVideoConverterX11Class:
- *
- * Converter class to transform VA buffers into GL textures.
- */
-struct _GstVaapiVideoConverterX11Class
-{
- /*< private >*/
- GObjectClass parent_class;
-};
-
-G_GNUC_INTERNAL
-GType
-gst_vaapi_video_converter_x11_get_type (void) G_GNUC_CONST;
-
-G_GNUC_INTERNAL
-GstSurfaceConverter *
-gst_vaapi_video_converter_x11_new (GstBuffer * buffer, const gchar * type,
- GValue * dest);
-
-G_END_DECLS
-
-#endif /* GST_VAAPI_VIDEO_CONVERTER_X11_H */
#include <gst/vaapi/gstvaapidisplay.h>
#include <gst/vaapi/gstvaapivideopool.h>
#include "gstvaapivideometa.h"
-#if GST_CHECK_VERSION(1,1,0)
#include <gst/allocators/allocators.h>
-#endif
G_BEGIN_DECLS
#define GST_VAAPI_VIDEO_MEMORY_NAME "GstVaapiVideoMemory"
-#if GST_CHECK_VERSION(1,1,0)
#define GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE "memory:VASurface"
-#endif
#define GST_VAAPI_VIDEO_MEMORY_FLAG_IS_SET(mem, flag) \
GST_MEMORY_FLAG_IS_SET (mem, flag)
#define DEFAULT_FORMAT GST_VIDEO_FORMAT_RGBA
-#if GST_CHECK_VERSION(1,1,0) && (USE_GLX || USE_EGL)
+#if (USE_GLX || USE_EGL)
struct _GstVaapiVideoMetaTexture
{
GstVaapiTexture *texture;