plugin: encode: vp8: Use the dynamically built src template caps.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>
This commit is contained in:
He Junyan 2020-07-08 19:02:45 +08:00 committed by Víctor Manuel Jáquez Leal
parent adff28f8d2
commit f3540c101c

View file

@ -49,19 +49,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_vp8_encode_debug);
#define GST_CODEC_CAPS \
"video/x-vp8"
/* *INDENT-OFF* */
static const char gst_vaapiencode_vp8_src_caps_str[] =
GST_CODEC_CAPS;
/* *INDENT-ON* */
/* *INDENT-OFF* */
static GstStaticPadTemplate gst_vaapiencode_vp8_src_factory =
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS (gst_vaapiencode_vp8_src_caps_str));
/* *INDENT-ON* */
#define EXTRA_FORMATS {}
/* vp8 encode */
@ -103,6 +90,7 @@ gst_vaapiencode_vp8_class_init (GstVaapiEncodeVP8Class * klass, gpointer data)
GstElementClass *const element_class = GST_ELEMENT_CLASS (klass);
GstVaapiEncodeClass *const encode_class = GST_VAAPIENCODE_CLASS (klass);
GstCaps *sink_caps = ((GstVaapiEncodeInitData *) data)->sink_caps;
GstCaps *src_caps = ((GstVaapiEncodeInitData *) data)->src_caps;
gpointer encoder_class;
object_class->finalize = gst_vaapiencode_vp8_finalize;
@ -125,8 +113,10 @@ gst_vaapiencode_vp8_class_init (GstVaapiEncodeVP8Class * klass, gpointer data)
gst_caps_unref (sink_caps);
/* src pad */
gst_element_class_add_static_pad_template (element_class,
&gst_vaapiencode_vp8_src_factory);
g_assert (src_caps);
gst_element_class_add_pad_template (element_class,
gst_pad_template_new ("src", GST_PAD_SRC, GST_PAD_ALWAYS, src_caps));
gst_caps_unref (src_caps);
encoder_class = g_type_class_ref (GST_TYPE_VAAPI_ENCODER_VP8);
g_assert (encoder_class);