mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
audioconvert: Fixed changing mix-matrix at runtime
Setting the property again after it had already been set ran g_value_unset() but did not initialize it again to g_value_copy() failed afterwards. Removed the unset as cleanup is done implicitely from g_value_copy(). Changing the mix-matrix property did not trigger reconfiguration of the caps, this has been added. If the matrix is set to an empty matrix, instead of copying this the matrix is simply disabled by setting mix_matrix_is_set (formerly mix_matrix_was_set) to FALSE so the mix-matrix is ignored from now on.
This commit is contained in:
parent
c363747251
commit
33acf73334
2 changed files with 9 additions and 10 deletions
|
@ -328,7 +328,7 @@ remove_channels_from_structure (GstCapsFeatures * features, GstStructure * s,
|
|||
|
||||
/* Only remove the channels and channel-mask for non-NONE layouts,
|
||||
* or if a mix matrix was manually specified */
|
||||
if (this->mix_matrix_was_set ||
|
||||
if (this->mix_matrix_is_set ||
|
||||
!gst_structure_get (s, "channel-mask", GST_TYPE_BITMASK, &mask, NULL) ||
|
||||
(mask != 0 || (gst_structure_get_int (s, "channels", &channels)
|
||||
&& channels == 1))) {
|
||||
|
@ -763,7 +763,7 @@ gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|||
GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD,
|
||||
GST_TYPE_AUDIO_NOISE_SHAPING_METHOD, this->ns, NULL);
|
||||
|
||||
if (this->mix_matrix_was_set)
|
||||
if (this->mix_matrix_is_set)
|
||||
gst_structure_set_value (config, GST_AUDIO_CONVERTER_OPT_MIX_MATRIX,
|
||||
&this->mix_matrix);
|
||||
|
||||
|
@ -976,17 +976,16 @@ gst_audio_convert_set_property (GObject * object, guint prop_id,
|
|||
break;
|
||||
case PROP_MIX_MATRIX:
|
||||
if (!gst_value_array_get_size (value)) {
|
||||
g_value_copy (value, &this->mix_matrix);
|
||||
this->mix_matrix_was_set = TRUE;
|
||||
this->mix_matrix_is_set = FALSE;
|
||||
} else {
|
||||
const GValue *first_row = gst_value_array_get_value (value, 0);
|
||||
|
||||
if (gst_value_array_get_size (first_row)) {
|
||||
if (gst_value_array_get_size (&this->mix_matrix))
|
||||
g_value_unset (&this->mix_matrix);
|
||||
|
||||
g_value_copy (value, &this->mix_matrix);
|
||||
this->mix_matrix_was_set = TRUE;
|
||||
this->mix_matrix_is_set = TRUE;
|
||||
|
||||
/* issue a reconfigure upstream */
|
||||
gst_base_transform_reconfigure_sink (GST_BASE_TRANSFORM (this));
|
||||
} else {
|
||||
g_warning ("Empty mix matrix's first row");
|
||||
}
|
||||
|
@ -1012,7 +1011,7 @@ gst_audio_convert_get_property (GObject * object, guint prop_id,
|
|||
g_value_set_enum (value, this->ns);
|
||||
break;
|
||||
case PROP_MIX_MATRIX:
|
||||
if (this->mix_matrix_was_set)
|
||||
if (this->mix_matrix_is_set)
|
||||
g_value_copy (&this->mix_matrix, value);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -48,7 +48,7 @@ struct _GstAudioConvert
|
|||
GstAudioDitherMethod dither;
|
||||
GstAudioNoiseShapingMethod ns;
|
||||
GValue mix_matrix;
|
||||
gboolean mix_matrix_was_set;
|
||||
gboolean mix_matrix_is_set;
|
||||
|
||||
GstAudioInfo in_info;
|
||||
GstAudioInfo out_info;
|
||||
|
|
Loading…
Reference in a new issue