mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
qsvenc: Simplify property update helpers
Takes lock outside of helper methods, and protect property getter too Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4005>
This commit is contained in:
parent
77b3e461db
commit
2ffc594d96
5 changed files with 20 additions and 22 deletions
|
@ -316,13 +316,11 @@ gst_qsv_av1_enc_check_update_uint (GstQsvAV1Enc * self, guint * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
if (is_bitrate_param)
|
if (is_bitrate_param)
|
||||||
self->bitrate_updated = TRUE;
|
self->bitrate_updated = TRUE;
|
||||||
else
|
else
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -332,10 +330,8 @@ gst_qsv_av1_enc_check_update_enum (GstQsvAV1Enc * self, mfxU16 * old_val,
|
||||||
if (*old_val == (mfxU16) new_val)
|
if (*old_val == (mfxU16) new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = (mfxU16) new_val;
|
*old_val = (mfxU16) new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -344,6 +340,7 @@ gst_qsv_av1_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstQsvAV1Enc *self = GST_QSV_AV1_ENC (object);
|
GstQsvAV1Enc *self = GST_QSV_AV1_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QP_I:
|
case PROP_QP_I:
|
||||||
gst_qsv_av1_enc_check_update_uint (self, &self->qp_i,
|
gst_qsv_av1_enc_check_update_uint (self, &self->qp_i,
|
||||||
|
@ -377,6 +374,7 @@ gst_qsv_av1_enc_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -385,6 +383,7 @@ gst_qsv_av1_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
{
|
{
|
||||||
GstQsvAV1Enc *self = GST_QSV_AV1_ENC (object);
|
GstQsvAV1Enc *self = GST_QSV_AV1_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QP_I:
|
case PROP_QP_I:
|
||||||
g_value_set_uint (value, self->qp_i);
|
g_value_set_uint (value, self->qp_i);
|
||||||
|
@ -411,6 +410,7 @@ gst_qsv_av1_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -858,13 +858,11 @@ gst_qsv_h264_enc_check_update_uint (GstQsvH264Enc * self, guint * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
if (is_bitrate_param)
|
if (is_bitrate_param)
|
||||||
self->bitrate_updated = TRUE;
|
self->bitrate_updated = TRUE;
|
||||||
else
|
else
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -874,10 +872,8 @@ gst_qsv_h264_enc_check_update_enum (GstQsvH264Enc * self, mfxU16 * old_val,
|
||||||
if (*old_val == (mfxU16) new_val)
|
if (*old_val == (mfxU16) new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = (mfxU16) new_val;
|
*old_val = (mfxU16) new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -887,10 +883,8 @@ gst_qsv_h264_enc_check_update_boolean (GstQsvH264Enc * self, gboolean * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -899,6 +893,7 @@ gst_qsv_h264_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
|
GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CABAC:
|
case PROP_CABAC:
|
||||||
gst_qsv_h264_enc_check_update_enum (self, &self->cabac,
|
gst_qsv_h264_enc_check_update_enum (self, &self->cabac,
|
||||||
|
@ -1041,6 +1036,7 @@ gst_qsv_h264_enc_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -1049,6 +1045,7 @@ gst_qsv_h264_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
{
|
{
|
||||||
GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
|
GstQsvH264Enc *self = GST_QSV_H264_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_CABAC:
|
case PROP_CABAC:
|
||||||
g_value_set_enum (value, self->cabac);
|
g_value_set_enum (value, self->cabac);
|
||||||
|
@ -1156,6 +1153,7 @@ gst_qsv_h264_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -538,13 +538,11 @@ gst_qsv_h265_enc_check_update_uint (GstQsvH265Enc * self, guint * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
if (is_bitrate_param)
|
if (is_bitrate_param)
|
||||||
self->bitrate_updated = TRUE;
|
self->bitrate_updated = TRUE;
|
||||||
else
|
else
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -554,10 +552,8 @@ gst_qsv_h265_enc_check_update_enum (GstQsvH265Enc * self, mfxU16 * old_val,
|
||||||
if (*old_val == (mfxU16) new_val)
|
if (*old_val == (mfxU16) new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = (mfxU16) new_val;
|
*old_val = (mfxU16) new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -567,10 +563,8 @@ gst_qsv_h265_enc_check_update_boolean (GstQsvH265Enc * self, gboolean * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -579,6 +573,7 @@ gst_qsv_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
|
GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_MIN_QP_I:
|
case PROP_MIN_QP_I:
|
||||||
gst_qsv_h265_enc_check_update_uint (self, &self->min_qp_i,
|
gst_qsv_h265_enc_check_update_uint (self, &self->min_qp_i,
|
||||||
|
@ -664,6 +659,7 @@ gst_qsv_h265_enc_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -672,6 +668,7 @@ gst_qsv_h265_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
{
|
{
|
||||||
GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
|
GstQsvH265Enc *self = GST_QSV_H265_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_MIN_QP_I:
|
case PROP_MIN_QP_I:
|
||||||
g_value_set_uint (value, self->min_qp_i);
|
g_value_set_uint (value, self->min_qp_i);
|
||||||
|
@ -737,6 +734,7 @@ gst_qsv_h265_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -216,10 +216,8 @@ gst_qsv_jpeg_enc_check_update_uint (GstQsvJpegEnc * self, guint * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -228,6 +226,7 @@ gst_qsv_jpeg_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
|
GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QUALITY:
|
case PROP_QUALITY:
|
||||||
gst_qsv_jpeg_enc_check_update_uint (self, &self->quality,
|
gst_qsv_jpeg_enc_check_update_uint (self, &self->quality,
|
||||||
|
@ -237,6 +236,7 @@ gst_qsv_jpeg_enc_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -245,6 +245,7 @@ gst_qsv_jpeg_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
{
|
{
|
||||||
GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
|
GstQsvJpegEnc *self = GST_QSV_JPEG_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QUALITY:
|
case PROP_QUALITY:
|
||||||
g_value_set_uint (value, self->quality);
|
g_value_set_uint (value, self->quality);
|
||||||
|
@ -253,6 +254,7 @@ gst_qsv_jpeg_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|
|
@ -341,13 +341,11 @@ gst_qsv_vp9_enc_check_update_uint (GstQsvVP9Enc * self, guint * old_val,
|
||||||
if (*old_val == new_val)
|
if (*old_val == new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = new_val;
|
*old_val = new_val;
|
||||||
if (is_bitrate_param)
|
if (is_bitrate_param)
|
||||||
self->bitrate_updated = TRUE;
|
self->bitrate_updated = TRUE;
|
||||||
else
|
else
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -357,10 +355,8 @@ gst_qsv_vp9_enc_check_update_enum (GstQsvVP9Enc * self, mfxU16 * old_val,
|
||||||
if (*old_val == (mfxU16) new_val)
|
if (*old_val == (mfxU16) new_val)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_mutex_lock (&self->prop_lock);
|
|
||||||
*old_val = (mfxU16) new_val;
|
*old_val = (mfxU16) new_val;
|
||||||
self->property_updated = TRUE;
|
self->property_updated = TRUE;
|
||||||
g_mutex_unlock (&self->prop_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -369,6 +365,7 @@ gst_qsv_vp9_enc_set_property (GObject * object, guint prop_id,
|
||||||
{
|
{
|
||||||
GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
|
GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QP_I:
|
case PROP_QP_I:
|
||||||
gst_qsv_vp9_enc_check_update_uint (self, &self->qp_i,
|
gst_qsv_vp9_enc_check_update_uint (self, &self->qp_i,
|
||||||
|
@ -406,6 +403,7 @@ gst_qsv_vp9_enc_set_property (GObject * object, guint prop_id,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -414,6 +412,7 @@ gst_qsv_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
{
|
{
|
||||||
GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
|
GstQsvVP9Enc *self = GST_QSV_VP9_ENC (object);
|
||||||
|
|
||||||
|
g_mutex_lock (&self->prop_lock);
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_QP_I:
|
case PROP_QP_I:
|
||||||
g_value_set_uint (value, self->qp_i);
|
g_value_set_uint (value, self->qp_i);
|
||||||
|
@ -443,6 +442,7 @@ gst_qsv_vp9_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
g_mutex_unlock (&self->prop_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstCaps *
|
static GstCaps *
|
||||||
|
|
Loading…
Reference in a new issue