mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-02 20:42:30 +00:00
audio-converter: add API to determine passthrough mode
audioconvert's passthrough status can no longer be determined strictly from input / output caps equality, as a mix-matrix can now be specified. We now call gst_base_transform_set_passthrough dynamically, based on the return from the new gst_audio_converter_is_passthrough() API, which takes the mix matrix into account.
This commit is contained in:
parent
98386927ee
commit
1edb2c4242
4 changed files with 27 additions and 0 deletions
|
@ -708,6 +708,7 @@ gst_audio_converter_update_config
|
|||
gst_audio_converter_get_config
|
||||
gst_audio_converter_reset
|
||||
gst_audio_converter_supports_inplace
|
||||
gst_audio_converter_is_passthrough
|
||||
<SUBSECTION Standard>
|
||||
gst_audio_converter_flags_get_type
|
||||
GST_TYPE_AUDIO_CONVERTER_FLAGS
|
||||
|
|
|
@ -111,6 +111,8 @@ struct _GstAudioConverter
|
|||
|
||||
gboolean in_place; /* the conversion can be done in place; returned by gst_audio_converter_supports_inplace() */
|
||||
|
||||
gboolean passthrough;
|
||||
|
||||
/* unpack */
|
||||
gboolean in_default;
|
||||
gboolean unpack_ip;
|
||||
|
@ -1373,6 +1375,7 @@ gst_audio_converter_new (GstAudioConverterFlags flags, GstAudioInfo * in_info,
|
|||
|
||||
convert->convert = converter_generic;
|
||||
convert->in_place = FALSE;
|
||||
convert->passthrough = FALSE;
|
||||
|
||||
/* optimize */
|
||||
if (convert->mix_passthrough) {
|
||||
|
@ -1383,6 +1386,7 @@ gst_audio_converter_new (GstAudioConverterFlags flags, GstAudioInfo * in_info,
|
|||
"passthrough mixing -> passthrough");
|
||||
convert->convert = converter_passthrough;
|
||||
convert->in_place = TRUE;
|
||||
convert->passthrough = TRUE;
|
||||
}
|
||||
} else {
|
||||
if (is_intermediate_format (in_info->finfo->format)) {
|
||||
|
@ -1645,3 +1649,19 @@ gst_audio_converter_supports_inplace (GstAudioConverter * convert)
|
|||
{
|
||||
return convert->in_place;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_audio_converter_is_passthrough:
|
||||
*
|
||||
* Returns whether the audio converter will operate in passthrough mode.
|
||||
* The return value would be typically input to gst_base_transform_set_passthrough()
|
||||
*
|
||||
* Returns: %TRUE when no conversion will actually occur.
|
||||
*
|
||||
* Since: 1.16
|
||||
*/
|
||||
gboolean
|
||||
gst_audio_converter_is_passthrough (GstAudioConverter * convert)
|
||||
{
|
||||
return convert->passthrough;
|
||||
}
|
||||
|
|
|
@ -159,6 +159,9 @@ gboolean gst_audio_converter_samples (GstAudioConverter * co
|
|||
GST_AUDIO_API
|
||||
gboolean gst_audio_converter_supports_inplace (GstAudioConverter *convert);
|
||||
|
||||
GST_AUDIO_API
|
||||
gboolean gst_audio_converter_is_passthrough (GstAudioConverter *convert);
|
||||
|
||||
GST_AUDIO_API
|
||||
gboolean gst_audio_converter_convert (GstAudioConverter * convert,
|
||||
GstAudioConverterFlags flags,
|
||||
|
|
|
@ -775,6 +775,9 @@ gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|||
in_place = gst_audio_converter_supports_inplace (this->convert);
|
||||
gst_base_transform_set_in_place (base, in_place);
|
||||
|
||||
gst_base_transform_set_passthrough (base,
|
||||
gst_audio_converter_is_passthrough (this->convert));
|
||||
|
||||
this->in_info = in_info;
|
||||
this->out_info = out_info;
|
||||
|
||||
|
|
Loading…
Reference in a new issue