diff options
author | He Junyan <junyan.he@intel.com> | 2020-07-08 19:02:23 +0800 |
---|---|---|
committer | Víctor Manuel Jáquez Leal <vjaquez@igalia.com> | 2020-07-23 20:30:45 +0200 |
commit | adff28f8d26e7e138dacf067157965ae45bc394e (patch) | |
tree | 0a77e47836d26bef735a970fed1ac6210e5a65bb /gst | |
parent | f321c1b84df4ac5ab9a1c2e9ad7779f2e42f5eb2 (diff) |
plugin: encode: jpeg: Use the dynamically built src template caps.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer-vaapi/-/merge_requests/354>
Diffstat (limited to 'gst')
-rw-r--r-- | gst/vaapi/gstvaapiencode_jpeg.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/gst/vaapi/gstvaapiencode_jpeg.c b/gst/vaapi/gstvaapiencode_jpeg.c index 57b0a8eb..ee406a85 100644 --- a/gst/vaapi/gstvaapiencode_jpeg.c +++ b/gst/vaapi/gstvaapiencode_jpeg.c @@ -49,19 +49,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_vaapi_jpeg_encode_debug); #define GST_CODEC_CAPS \ "image/jpeg" -/* *INDENT-OFF* */ -static const char gst_vaapiencode_jpeg_src_caps_str[] = - GST_CODEC_CAPS; -/* *INDENT-ON* */ - -/* *INDENT-OFF* */ -static GstStaticPadTemplate gst_vaapiencode_jpeg_src_factory = - GST_STATIC_PAD_TEMPLATE ("src", - GST_PAD_SRC, - GST_PAD_ALWAYS, - GST_STATIC_CAPS (gst_vaapiencode_jpeg_src_caps_str)); -/* *INDENT-ON* */ - #define EXTRA_FORMATS { GST_VIDEO_FORMAT_BGRA, } /* jpeg encode */ @@ -103,6 +90,7 @@ gst_vaapiencode_jpeg_class_init (GstVaapiEncodeJpegClass * 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_jpeg_finalize; @@ -125,8 +113,10 @@ gst_vaapiencode_jpeg_class_init (GstVaapiEncodeJpegClass * klass, gpointer data) gst_caps_unref (sink_caps); /* src pad */ - gst_element_class_add_static_pad_template (element_class, - &gst_vaapiencode_jpeg_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_JPEG); g_assert (encoder_class); |