mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +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[] =
|
||||
#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;
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate gst_vaapidecode_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE(
|
||||
|
@ -180,6 +185,9 @@ gst_vaapidecode_update_src_caps(GstVaapiDecode *decode,
|
|||
}
|
||||
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
|
||||
reconstruct suitable caps for "encoded" video formats */
|
||||
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_structure_set_interlaced(structure, TRUE);
|
||||
}
|
||||
#endif
|
||||
gst_caps_replace(&decode->srcpad_caps, state->caps);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
|
@ -84,6 +84,10 @@ GST_DEBUG_CATEGORY_STATIC(gst_debug_vaapisink);
|
|||
|
||||
/* Default template */
|
||||
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)
|
||||
GST_VIDEO_CAPS_MAKE(GST_VIDEO_FORMATS_ALL) "; "
|
||||
#else
|
||||
|
@ -92,6 +96,7 @@ static const char gst_vaapisink_sink_caps_str[] =
|
|||
"height = (int) [ 1, MAX ]; "
|
||||
#endif
|
||||
GST_VAAPI_SURFACE_CAPS;
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate gst_vaapisink_sink_factory =
|
||||
GST_STATIC_PAD_TEMPLATE(
|
||||
|
@ -719,14 +724,20 @@ gst_vaapisink_get_caps_impl(GstBaseSink *base_sink)
|
|||
GstVaapiSink * const sink = GST_VAAPISINK(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;
|
||||
|
||||
if (gst_vaapisink_ensure_uploader(sink)) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
return out_caps;
|
||||
}
|
||||
|
|
|
@ -42,6 +42,10 @@ typedef struct _GstVaapiVideoAllocatorClass GstVaapiVideoAllocatorClass;
|
|||
|
||||
#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:
|
||||
* @GST_VAAPI_VIDEO_MEMORY_MAP_TYPE_SURFACE: map with gst_buffer_map()
|
||||
|
|
Loading…
Reference in a new issue