refactor vaapi caps strings for pad templates

Refactor the main vaapi caps strings into three macros:
GST_VAAPI_MAKE_SURFACE_CAPS, GST_VAAPI_MAKE_ENC_SURFACE_CAPS and
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS.

Those are in gstvaapipluginutil.h so all the elements could use them, instead
of re-declaring them every time.

No functional changes.

Signed-off-by: Víctor Manuel Jáquez Leal <victorx.jaquez@intel.com>
This commit is contained in:
Víctor Manuel Jáquez Leal 2015-08-05 14:11:12 +02:00
parent 343739e281
commit 66f05af288
10 changed files with 27 additions and 37 deletions

View file

@ -82,10 +82,8 @@ static const char gst_vaapidecode_sink_caps_str[] =
;
static const char gst_vaapidecode_src_caps_str[] =
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_VAAPI_MAKE_SURFACE_CAPS ";"
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS ";"
GST_VIDEO_CAPS_MAKE("{ I420, YV12, NV12 }");
static GstStaticPadTemplate gst_vaapidecode_sink_factory =

View file

@ -53,10 +53,6 @@ enum
static GParamSpec *properties[PROP_LAST];
#define GST_VAAPI_DECODE_BIN_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
/* Default templates */
#define GST_CAPS_CODEC(CODEC) CODEC "; "
/* *INDENT-OFF* */
@ -82,10 +78,9 @@ static const char gst_vaapi_decode_bin_sink_caps_str[] =
/* *INDENT-OFF* */
static const char gst_vaapi_decode_bin_src_caps_str[] =
GST_VAAPI_DECODE_BIN_SURFACE_CAPS ", "
GST_VAAPI_MAKE_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }") ", "
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -42,8 +42,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_h264_encode_debug);
/* *INDENT-OFF* */
static const char gst_vaapiencode_h264_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -41,8 +41,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_h265_encode_debug);
/* *INDENT-OFF* */
static const char gst_vaapiencode_h265_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -38,8 +38,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_jpeg_encode_debug);
/* *INDENT-OFF* */
static const char gst_vaapiencode_jpeg_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -40,8 +40,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_mpeg2_encode_debug);
/* *INDENT-OFF* */
static const char gst_vaapiencode_mpeg2_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -38,8 +38,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_vp8_encode_debug);
/* *INDENT-OFF* */
static const char gst_vaapiencode_vp8_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ", "
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;

View file

@ -97,6 +97,18 @@ gst_vaapi_caps_feature_to_string (GstVaapiCapsFeature feature);
# define GST_CAPS_INTERLACED_FALSE \
"interlace-mode = (string)progressive"
#define GST_VAAPI_MAKE_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
#define GST_VAAPI_MAKE_ENC_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, NV12, I420, YV12 }")
#define GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }")
G_GNUC_INTERNAL
gboolean
gst_caps_set_interlaced (GstCaps * caps, GstVideoInfo * vip);

View file

@ -44,29 +44,21 @@
GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapipostproc);
#define GST_CAT_DEFAULT gst_debug_vaapipostproc
# define GST_VAAPIPOSTPROC_SURFACE_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE, "{ ENCODED, I420, YV12, NV12 }")
# define GST_VAAPIPOSTPROC_GLTEXUPLOAD_CAPS \
GST_VIDEO_CAPS_MAKE_WITH_FEATURES( \
GST_CAPS_FEATURE_META_GST_VIDEO_GL_TEXTURE_UPLOAD_META, "{ RGBA, BGRA }")
/* Default templates */
/* *INDENT-OFF* */
static const char gst_vaapipostproc_sink_caps_str[] =
GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
GST_VAAPI_MAKE_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_MODES "; "
GST_VAAPIPOSTPROC_GLTEXUPLOAD_CAPS "; "
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_MODES;
/* *INDENT-ON* */
/* *INDENT-OFF* */
static const char gst_vaapipostproc_src_caps_str[] =
GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
GST_VAAPI_MAKE_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_FALSE "; "
GST_VAAPIPOSTPROC_GLTEXUPLOAD_CAPS "; "
GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS "; "
GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ", "
GST_CAPS_INTERLACED_FALSE;
/* *INDENT-ON* */
@ -923,7 +915,7 @@ ensure_allowed_sinkpad_caps (GstVaapiPostproc * postproc)
return TRUE;
/* Create VA caps */
out_caps = gst_caps_from_string (GST_VAAPIPOSTPROC_SURFACE_CAPS ", "
out_caps = gst_caps_from_string (GST_VAAPI_MAKE_SURFACE_CAPS ", "
GST_CAPS_INTERLACED_MODES);
if (!out_caps) {
GST_ERROR_OBJECT (postproc, "failed to create VA sink caps");

View file

@ -57,9 +57,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_debug_vaapisink);
/* Default template */
/* *INDENT-OFF* */
static const char gst_vaapisink_sink_caps_str[] =
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE,
"{ ENCODED, NV12, I420, YV12 }") ";"
GST_VAAPI_MAKE_ENC_SURFACE_CAPS ";"
#if GST_CHECK_VERSION(1,3,1)
GST_VIDEO_CAPS_MAKE_WITH_FEATURES (
GST_CAPS_FEATURE_MEMORY_VAAPI_SURFACE ","