mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
plugins: add support for GstCaps features.
Move VA video buffer memory from "video/x-surface,type=vaapi" format, as expressed in caps, to the more standard use of caps features. i.e. add "memory:VASurface" feature attribute to the associated caps. https://bugzilla.gnome.org/show_bug.cgi?id=703271 Signed-off-by: Gwenole Beauchesne <gwenole.beauchesne@intel.com>
This commit is contained in:
parent
21aa850eb4
commit
8fe3bb0b14
3 changed files with 25 additions and 1 deletions
|
@ -67,7 +67,12 @@ static const char gst_vaapidecode_sink_caps_str[] =
|
||||||
;
|
;
|
||||||
|
|
||||||
static const char gst_vaapidecode_src_caps_str[] =
|
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, GST_VIDEO_FORMATS_ALL);
|
||||||
|
#else
|
||||||
GST_VAAPI_SURFACE_CAPS;
|
GST_VAAPI_SURFACE_CAPS;
|
||||||
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_vaapidecode_sink_factory =
|
static GstStaticPadTemplate gst_vaapidecode_sink_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE(
|
GST_STATIC_PAD_TEMPLATE(
|
||||||
|
@ -180,6 +185,9 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
|
||||||
}
|
}
|
||||||
gst_video_codec_state_unref(state);
|
gst_video_codec_state_unref(state);
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,1,0)
|
||||||
|
state->caps = gst_video_info_to_caps(&vis);
|
||||||
|
#else
|
||||||
/* XXX: gst_video_info_to_caps() from GStreamer 0.10 does not
|
/* XXX: gst_video_info_to_caps() from GStreamer 0.10 does not
|
||||||
reconstruct suitable caps for "encoded" video formats */
|
reconstruct suitable caps for "encoded" video formats */
|
||||||
state->caps = gst_caps_from_string(GST_VAAPI_SURFACE_CAPS_NAME);
|
state->caps = gst_caps_from_string(GST_VAAPI_SURFACE_CAPS_NAME);
|
||||||
|
@ -200,6 +208,7 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
|
||||||
gst_caps_get_structure(state->caps, 0);
|
gst_caps_get_structure(state->caps, 0);
|
||||||
gst_structure_set_interlaced(structure, TRUE);
|
gst_structure_set_interlaced(structure, TRUE);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
gst_caps_replace(&decode->srcpad_caps, state->caps);
|
gst_caps_replace(&decode->srcpad_caps, state->caps);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,10 @@ GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapisink);
|
||||||
|
|
||||||
/* Default template */
|
/* Default template */
|
||||||
static const char gst_vaapisink_sink_caps_str[] =
|
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, GST_VIDEO_FORMATS_ALL);
|
||||||
|
#else
|
||||||
#if GST_CHECK_VERSION(1,0,0)
|
#if GST_CHECK_VERSION(1,0,0)
|
||||||
GST_VIDEO_CAPS_MAKE(GST_VIDEO_FORMATS_ALL) "; "
|
GST_VIDEO_CAPS_MAKE(GST_VIDEO_FORMATS_ALL) "; "
|
||||||
#else
|
#else
|
||||||
|
@ -92,6 +96,7 @@ static const char gst_vaapisink_sink_caps_str[] =
|
||||||
"height = (int) [ 1, MAX ]; "
|
"height = (int) [ 1, MAX ]; "
|
||||||
#endif
|
#endif
|
||||||
GST_VAAPI_SURFACE_CAPS;
|
GST_VAAPI_SURFACE_CAPS;
|
||||||
|
#endif
|
||||||
|
|
||||||
static GstStaticPadTemplate gst_vaapisink_sink_factory =
|
static GstStaticPadTemplate gst_vaapisink_sink_factory =
|
||||||
GST_STATIC_PAD_TEMPLATE(
|
GST_STATIC_PAD_TEMPLATE(
|
||||||
|
@ -719,15 +724,21 @@ gst_vaapisink_get_caps_impl(GstBaseSink *base_sink)
|
||||||
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
|
GstVaapiSink * const sink = GST_VAAPISINK(base_sink);
|
||||||
GstCaps *out_caps, *yuv_caps;
|
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);
|
out_caps = gst_caps_from_string(GST_VAAPI_SURFACE_CAPS);
|
||||||
|
#endif
|
||||||
if (!out_caps)
|
if (!out_caps)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (gst_vaapisink_ensure_uploader(sink)) {
|
if (gst_vaapisink_ensure_uploader(sink)) {
|
||||||
yuv_caps = gst_vaapi_uploader_get_caps(sink->uploader);
|
yuv_caps = gst_vaapi_uploader_get_caps(sink->uploader);
|
||||||
if (yuv_caps)
|
if (yuv_caps) {
|
||||||
|
out_caps = gst_caps_make_writable(out_caps);
|
||||||
gst_caps_append(out_caps, gst_caps_copy(yuv_caps));
|
gst_caps_append(out_caps, gst_caps_copy(yuv_caps));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return out_caps;
|
return out_caps;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,6 +42,10 @@ typedef struct _GstVaapiVideoAllocatorClass GstVaapiVideoAllocatorClass;
|
||||||
|
|
||||||
#define GST_VAAPI_VIDEO_MEMORY_NAME "GstVaapiVideoMemory"
|
#define GST_VAAPI_VIDEO_MEMORY_NAME "GstVaapiVideoMemory"
|
||||||
|
|
||||||
|
#if GST_CHECK_VERSION(1,1,0)
|
||||||
|
#define GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE "memory:VASurface"
|
||||||
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GstVaapiVideoMemoryMapType:
|
* GstVaapiVideoMemoryMapType:
|
||||||
* @GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_SURFACE: map with gst_buffer_map()
|
* @GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_SURFACE: map with gst_buffer_map()
|
||||||
|
|
Loading…
Reference in a new issue