From: Víctor Manuel Jáquez Leal Date: Fri, 16 Aug 2019 17:35:58 +0000 (+0200) Subject: vaapiencode: set frame size restrictions in caps X-Git-Tag: 1.19.3~503^2~460 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6f61252f9d28080469eb19252eca8e3d1fc89283;p=platform%2Fupstream%2Fgstreamer.git vaapiencode: set frame size restrictions in caps Fixes: #12 --- diff --git a/gst/vaapi/gstvaapiencode.c b/gst/vaapi/gstvaapiencode.c index 5bcff26..6ca10e3 100644 --- a/gst/vaapi/gstvaapiencode.c +++ b/gst/vaapi/gstvaapiencode.c @@ -24,6 +24,7 @@ #include "gstcompat.h" #include #include +#include #include "gstvaapiencode.h" #include "gstvaapipluginutil.h" #include "gstvaapivideometa.h" @@ -391,6 +392,19 @@ get_profile (GstVaapiEncode * encode) return GST_VAAPI_PROFILE_UNKNOWN; } +static GstVaapiEntrypoint +get_entrypoint (GstVaapiEncode * encode, GstVaapiProfile profile) +{ + GstVaapiEncoderTune tune = GST_VAAPI_ENCODER_TUNE_NONE; + + g_object_get (encode, "tune", &tune, NULL); + if (tune == GST_VAAPI_ENCODER_TUNE_LOW_POWER) + return GST_VAAPI_ENTRYPOINT_SLICE_ENCODE_LP; + if (profile == GST_VAAPI_PROFILE_JPEG_BASELINE) + return GST_VAAPI_ENTRYPOINT_PICTURE_ENCODE; + return GST_VAAPI_ENTRYPOINT_SLICE_ENCODE; +} + static gboolean ensure_allowed_sinkpad_caps (GstVaapiEncode * encode) { @@ -398,6 +412,8 @@ ensure_allowed_sinkpad_caps (GstVaapiEncode * encode) GArray *formats = NULL; gboolean ret = FALSE; GstVaapiProfile profile; + guint i, size; + GstStructure *structure; if (encode->allowed_sinkpad_caps) return TRUE; @@ -423,6 +439,16 @@ ensure_allowed_sinkpad_caps (GstVaapiEncode * encode) out_caps = gst_caps_make_writable (out_caps); gst_caps_append (out_caps, gst_caps_copy (raw_caps)); + + size = gst_caps_get_size (out_caps); + for (i = 0; i < size; i++) { + structure = gst_caps_get_structure (out_caps, i); + if (!structure) + continue; + gst_vaapi_profile_caps_append_encoder (GST_VAAPI_PLUGIN_BASE_DISPLAY + (encode), profile, get_entrypoint (encode, profile), structure); + } + gst_caps_replace (&encode->allowed_sinkpad_caps, out_caps); GST_INFO_OBJECT (encode, "Allowed sink caps %" GST_PTR_FORMAT, encode->allowed_sinkpad_caps);