mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
msdkenc: Remove static templates in format setting
The elements have supported dynamic capability query, and it is not necessary to refer the static templates. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4177>
This commit is contained in:
parent
30d3ce3a9e
commit
3cb9c34030
5 changed files with 21 additions and 92 deletions
|
@ -78,35 +78,28 @@ enum
|
|||
#define PROP_B_PYRAMID_DEFAULT MFX_B_REF_UNKNOWN
|
||||
#define PROP_P_PYRAMID_DEFAULT MFX_P_REF_DEFAULT
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-av1, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"profile = (string) main")
|
||||
);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkav1enc_set_format (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkAV1Enc *thiz = GST_MSDKAV1ENC (encoder);
|
||||
GstPad *srcpad;
|
||||
GstCaps *template_caps;
|
||||
GstCaps *allowed_caps = NULL;
|
||||
|
||||
thiz->profile = MFX_PROFILE_AV1_MAIN;
|
||||
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||
srcpad = GST_VIDEO_ENCODER_SRC_PAD (encoder);
|
||||
|
||||
allowed_caps = gst_pad_get_allowed_caps (srcpad);
|
||||
if (!allowed_caps || gst_caps_is_empty (allowed_caps)) {
|
||||
if (allowed_caps)
|
||||
gst_caps_unref (allowed_caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
template_caps = gst_static_pad_template_get_caps (&src_factory);
|
||||
template_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||
|
||||
/* If downstream has ANY caps let encoder decide profile and level */
|
||||
if (gst_caps_is_equal (allowed_caps, template_caps)) {
|
||||
|
|
|
@ -112,16 +112,6 @@ enum
|
|||
#define PROP_INTRA_REFRESH_CYCLE_DIST_DEFAULT 0
|
||||
#define PROP_DBLK_IDC_DEFAULT 0
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-h264, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"stream-format = (string) byte-stream , alignment = (string) au , "
|
||||
"profile = (string) { high, main, baseline, constrained-baseline }")
|
||||
);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static GType
|
||||
|
@ -266,14 +256,16 @@ static gboolean
|
|||
gst_msdkh264enc_set_format (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkH264Enc *thiz = GST_MSDKH264ENC (encoder);
|
||||
GstPad *srcpad;
|
||||
GstCaps *template_caps;
|
||||
GstCaps *allowed_caps = NULL;
|
||||
|
||||
thiz->profile = 0;
|
||||
thiz->level = 0;
|
||||
|
||||
template_caps = gst_static_pad_template_get_caps (&src_factory);
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||
srcpad = GST_VIDEO_ENCODER_SRC_PAD (encoder);
|
||||
template_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||
allowed_caps = gst_pad_get_allowed_caps (srcpad);
|
||||
|
||||
/* If downstream has ANY caps let encoder decide profile and level */
|
||||
if (allowed_caps == template_caps) {
|
||||
|
|
|
@ -110,42 +110,6 @@ enum
|
|||
#define PROP_INTRA_REFRESH_CYCLE_DIST_DEFAULT 0
|
||||
#define PROP_DBLK_IDC_DEFAULT 0
|
||||
|
||||
#define PROFILES "main, main-10, main-444, main-still-picture, main-10-still-picture"
|
||||
#define PRFOLIE_STR "{ " PROFILES " }"
|
||||
|
||||
#if (MFX_VERSION >= 1027)
|
||||
#undef COMMON_FORMAT
|
||||
#undef PRFOLIE_STR
|
||||
#define PROFILES_1027 PROFILES ", main-444-10, main-422-10"
|
||||
#define PRFOLIE_STR "{ " PROFILES_1027 " }"
|
||||
#endif
|
||||
|
||||
#if (MFX_VERSION >= 1031)
|
||||
#undef COMMON_FORMAT
|
||||
#undef PRFOLIE_STR
|
||||
#define PROFILES_1031 PROFILES_1027 ", main-12"
|
||||
#define PRFOLIE_STR "{ " PROFILES_1031 " }"
|
||||
#endif
|
||||
|
||||
#if (MFX_VERSION >= 1032)
|
||||
#undef COMMON_FORMAT
|
||||
#undef PRFOLIE_STR
|
||||
#define PROFILES_1032 PROFILES_1031 ", screen-extended-main, " \
|
||||
"screen-extended-main-10, screen-extended-main-444, " \
|
||||
"screen-extended-main-444-10"
|
||||
#define PRFOLIE_STR "{ " PROFILES_1032 " }"
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-h265, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"stream-format = (string) byte-stream , alignment = (string) au , "
|
||||
"profile = (string) " PRFOLIE_STR)
|
||||
);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static void
|
||||
|
@ -367,20 +331,22 @@ static gboolean
|
|||
gst_msdkh265enc_set_format (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (encoder);
|
||||
GstPad *srcpad;
|
||||
GstCaps *template_caps, *allowed_caps;
|
||||
|
||||
g_free (thiz->profile_name);
|
||||
thiz->profile_name = NULL;
|
||||
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||
srcpad = GST_VIDEO_ENCODER_SRC_PAD (encoder);
|
||||
|
||||
allowed_caps = gst_pad_get_allowed_caps (srcpad);
|
||||
if (!allowed_caps || gst_caps_is_empty (allowed_caps)) {
|
||||
if (allowed_caps)
|
||||
gst_caps_unref (allowed_caps);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
template_caps = gst_static_pad_template_get_caps (&src_factory);
|
||||
template_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||
|
||||
if (gst_caps_is_equal (allowed_caps, template_caps)) {
|
||||
GST_INFO_OBJECT (thiz,
|
||||
|
|
|
@ -63,29 +63,21 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdkmpeg2enc_debug);
|
|||
#define GST_IS_MSDKMPEG2ENC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/mpeg, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"mpegversion = (int) 2 , systemstream = (bool) false, "
|
||||
"profile = (string) { high, main, simple }")
|
||||
);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkmpeg2enc_set_format (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkMPEG2Enc *thiz = GST_MSDKMPEG2ENC (encoder);
|
||||
GstPad *srcpad;
|
||||
GstCaps *template_caps;
|
||||
GstCaps *allowed_caps = NULL;
|
||||
|
||||
thiz->profile = 0;
|
||||
|
||||
template_caps = gst_static_pad_template_get_caps (&src_factory);
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||
srcpad = GST_VIDEO_ENCODER_SRC_PAD (encoder);
|
||||
template_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||
allowed_caps = gst_pad_get_allowed_caps (srcpad);
|
||||
|
||||
/* If downstream has ANY caps let encoder decide profile and level */
|
||||
if (allowed_caps == template_caps) {
|
||||
|
|
|
@ -65,35 +65,21 @@ GST_DEBUG_CATEGORY_EXTERN (gst_msdkvp9enc_debug);
|
|||
#define GST_IS_MSDKVP9ENC_CLASS(klass) \
|
||||
(G_TYPE_CHECK_CLASS_TYPE((klass), G_TYPE_FROM_CLASS (klass)))
|
||||
|
||||
#define PROFILES "0, 1, 2"
|
||||
|
||||
#if (MFX_VERSION >= 1027)
|
||||
#define SRC_PROFILES "{ " PROFILES ", 3 }"
|
||||
#else
|
||||
#define SRC_PROFILES "{ " PROFILES " }"
|
||||
#endif
|
||||
|
||||
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
||||
GST_PAD_SRC,
|
||||
GST_PAD_ALWAYS,
|
||||
GST_STATIC_CAPS ("video/x-vp9, "
|
||||
"framerate = (fraction) [0/1, MAX], "
|
||||
"width = (int) [ 1, MAX ], height = (int) [ 1, MAX ], "
|
||||
"profile = (string) " SRC_PROFILES)
|
||||
);
|
||||
|
||||
static GstElementClass *parent_class = NULL;
|
||||
|
||||
static gboolean
|
||||
gst_msdkvp9enc_set_format (GstMsdkEnc * encoder)
|
||||
{
|
||||
GstMsdkVP9Enc *thiz = GST_MSDKVP9ENC (encoder);
|
||||
GstPad *srcpad;
|
||||
GstCaps *template_caps;
|
||||
GstCaps *allowed_caps = NULL;
|
||||
|
||||
thiz->profile = MFX_PROFILE_VP9_0;
|
||||
template_caps = gst_static_pad_template_get_caps (&src_factory);
|
||||
allowed_caps = gst_pad_get_allowed_caps (GST_VIDEO_ENCODER_SRC_PAD (encoder));
|
||||
|
||||
srcpad = GST_VIDEO_ENCODER_SRC_PAD (encoder);
|
||||
template_caps = gst_pad_get_pad_template_caps (srcpad);
|
||||
allowed_caps = gst_pad_get_allowed_caps (srcpad);
|
||||
|
||||
/* If downstream has ANY caps let encoder decide profile and level */
|
||||
if (allowed_caps == template_caps) {
|
||||
|
|
Loading…
Reference in a new issue