msdkh265enc: enable low power mode
Low power mode is disabled by default, set the value of low-power to true to enable this mode.
This commit is contained in:
parent
60501f128c
commit
920062cafc
@ -42,6 +42,13 @@
|
|||||||
GST_DEBUG_CATEGORY_EXTERN (gst_msdkh265enc_debug);
|
GST_DEBUG_CATEGORY_EXTERN (gst_msdkh265enc_debug);
|
||||||
#define GST_CAT_DEFAULT gst_msdkh265enc_debug
|
#define GST_CAT_DEFAULT gst_msdkh265enc_debug
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
PROP_LOW_POWER = GST_MSDKENC_PROP_MAX,
|
||||||
|
};
|
||||||
|
|
||||||
|
#define PROP_LOWPOWER_DEFAULT FALSE
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
||||||
GST_PAD_SINK,
|
GST_PAD_SINK,
|
||||||
GST_PAD_ALWAYS,
|
GST_PAD_ALWAYS,
|
||||||
@ -114,6 +121,9 @@ gst_msdkh265enc_configure (GstMsdkEnc * encoder)
|
|||||||
/* Enable Extended coding options */
|
/* Enable Extended coding options */
|
||||||
gst_msdkenc_ensure_extended_coding_options (encoder);
|
gst_msdkenc_ensure_extended_coding_options (encoder);
|
||||||
|
|
||||||
|
encoder->param.mfx.LowPower =
|
||||||
|
(h265enc->lowpower ? MFX_CODINGOPTION_ON : MFX_CODINGOPTION_OFF);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,8 +197,20 @@ gst_msdkh265enc_set_property (GObject * object, guint prop_id,
|
|||||||
{
|
{
|
||||||
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
||||||
|
|
||||||
if (!gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
if (gst_msdkenc_set_common_property (object, prop_id, value, pspec))
|
||||||
GST_WARNING_OBJECT (thiz, "Failed to set common encode property");
|
return;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (thiz);
|
||||||
|
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_LOW_POWER:
|
||||||
|
thiz->lowpower = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
GST_OBJECT_UNLOCK (thiz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -197,8 +219,19 @@ gst_msdkh265enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||||||
{
|
{
|
||||||
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
GstMsdkH265Enc *thiz = GST_MSDKH265ENC (object);
|
||||||
|
|
||||||
if (!gst_msdkenc_get_common_property (object, prop_id, value, pspec))
|
if (gst_msdkenc_get_common_property (object, prop_id, value, pspec))
|
||||||
GST_WARNING_OBJECT (thiz, "Failed to get common encode property");
|
return;
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (thiz);
|
||||||
|
switch (prop_id) {
|
||||||
|
case PROP_LOW_POWER:
|
||||||
|
g_value_set_boolean (value, thiz->lowpower);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
GST_OBJECT_UNLOCK (thiz);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -221,6 +254,10 @@ gst_msdkh265enc_class_init (GstMsdkH265EncClass * klass)
|
|||||||
|
|
||||||
gst_msdkenc_install_common_properties (encoder_class);
|
gst_msdkenc_install_common_properties (encoder_class);
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_LOW_POWER,
|
||||||
|
g_param_spec_boolean ("low-power", "Low power", "Enable low power mode",
|
||||||
|
PROP_LOWPOWER_DEFAULT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
gst_element_class_set_static_metadata (element_class,
|
gst_element_class_set_static_metadata (element_class,
|
||||||
"Intel MSDK H265 encoder",
|
"Intel MSDK H265 encoder",
|
||||||
"Codec/Encoder/Video",
|
"Codec/Encoder/Video",
|
||||||
@ -234,4 +271,5 @@ gst_msdkh265enc_class_init (GstMsdkH265EncClass * klass)
|
|||||||
static void
|
static void
|
||||||
gst_msdkh265enc_init (GstMsdkH265Enc * thiz)
|
gst_msdkh265enc_init (GstMsdkH265Enc * thiz)
|
||||||
{
|
{
|
||||||
|
thiz->lowpower = PROP_LOWPOWER_DEFAULT;
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,8 @@ typedef struct _GstMsdkH265EncClass GstMsdkH265EncClass;
|
|||||||
struct _GstMsdkH265Enc
|
struct _GstMsdkH265Enc
|
||||||
{
|
{
|
||||||
GstMsdkEnc base;
|
GstMsdkEnc base;
|
||||||
|
|
||||||
|
gboolean lowpower;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstMsdkH265EncClass
|
struct _GstMsdkH265EncClass
|
||||||
|
Loading…
x
Reference in New Issue
Block a user