msdkenc: Add help functions to check and update property

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4865>
This commit is contained in:
Mengkejiergeli Ba 2023-04-23 17:20:05 +08:00 committed by GStreamer Marge Bot
parent 64b4257509
commit 1308b2f6e5
2 changed files with 54 additions and 0 deletions

View file

@ -2006,6 +2006,39 @@ gst_msdkenc_init (GstMsdkEnc * thiz)
EC_PROPS_EXTBRC, G_TYPE_STRING, "off", NULL);
}
/* *INDENT-OFF* */
#define UPDATE_PROPERTY \
if (*old_val == new_val) { \
return FALSE; \
} \
*old_val = new_val; \
thiz->reconfig = TRUE; \
return TRUE; \
gboolean
gst_msdkenc_check_update_property_uint (GstMsdkEnc * thiz, guint * old_val,
guint new_val)
{
UPDATE_PROPERTY
}
gboolean
gst_msdkenc_check_update_property_int (GstMsdkEnc * thiz, gint * old_val,
gint new_val)
{
UPDATE_PROPERTY
}
gboolean
gst_msdkenc_check_update_property_bool (GstMsdkEnc * thiz, gboolean * old_val,
gboolean new_val)
{
UPDATE_PROPERTY
}
#undef UPDATE_PROPERTY
/* *INDENT-ON* */
/* gst_msdkenc_set_common_property:
*
* This is a helper function to set the common property

View file

@ -56,6 +56,15 @@ G_BEGIN_DECLS
#define MAX_EXTRA_PARAMS 8
#define check_update_property(type, obj, old_val, new_val) \
gst_msdkenc_check_update_property_##type (obj, old_val, new_val)
#define check_update_property_uint(obj, old_val, new_val) \
check_update_property (uint, obj, old_val, new_val)
#define check_update_property_int(obj, old_val, new_val) \
check_update_property (int, obj, old_val, new_val)
#define check_update_property_bool(obj, old_val, new_val) \
check_update_property (bool, obj, old_val, new_val)
typedef struct _GstMsdkEnc GstMsdkEnc;
typedef struct _GstMsdkEncClass GstMsdkEncClass;
typedef struct _MsdkEncTask MsdkEncTask;
@ -209,6 +218,18 @@ void gst_msdkenc_add_extra_param (GstMsdkEnc * thiz, mfxExtBuffer * param);
void
gst_msdkenc_install_common_properties (GstMsdkEncClass *encoder_class);
gboolean
gst_msdkenc_check_update_property_uint (GstMsdkEnc * thiz, guint * old_val,
guint new_val);
gboolean
gst_msdkenc_check_update_property_int (GstMsdkEnc * thiz, gint * old_val,
gint new_val);
gboolean
gst_msdkenc_check_update_property_bool (GstMsdkEnc * thiz, gboolean * old_val,
gboolean new_val);
gboolean
gst_msdkenc_set_common_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);