* @convert: a #GstAudioConverter
* @in_rate: input rate
* @out_rate: output rate
- * @config: (transfer full): a #GstStructure
+ * @config: (transfer full) (allow-none): a #GstStructure or %NULL
*
- * Set @config as extra configuration for @convert.
+ * Set @in_rate, @out_rate and @config as extra configuration for @convert.
*
* in_rate and @out_rate specify the new sample rates of input and output
* formats. A value of 0 leaves the sample rate unchanged.
*
+ * @config can be %NULL, in which case, the current configuration is not
+ * changed.
+ *
* If the parameters in @config can not be set exactly, this function returns
* %FALSE and will try to update as much state as possible. The new state can
* then be retrieved and refined with gst_audio_converter_get_config().
* Look at the #GST_AUDIO_CONVERTER_OPT_* fields to check valid configuration
* option and values.
*
- * Returns: %TRUE when @config could be set.
+ * Returns: %TRUE when the new parameters could be set
*/
gboolean
gst_audio_converter_update_config (GstAudioConverter * convert,
gint in_rate, gint out_rate, GstStructure * config)
{
g_return_val_if_fail (convert != NULL, FALSE);
- g_return_val_if_fail (config != NULL, FALSE);
g_return_val_if_fail ((in_rate == 0 && out_rate == 0) ||
convert->flags & GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE, FALSE);
convert->in.rate = in_rate;
convert->out.rate = out_rate;
- gst_structure_foreach (config, copy_config, convert);
- gst_structure_free (config);
+ if (config) {
+ gst_structure_foreach (config, copy_config, convert);
+ gst_structure_free (config);
+ }
return TRUE;
}