mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
audio-converter: small API tweaks
Pass flags in _converter_new() so that we can configure ourselves differently depending on some options. SOURCE_WRITABLE -> IN_WRITABLE because the array is called 'in'
This commit is contained in:
parent
7f49b946cc
commit
85afad72ec
3 changed files with 14 additions and 9 deletions
|
@ -338,7 +338,7 @@ do_unpack (AudioChain * chain, gsize num_samples, gpointer user_data)
|
|||
gpointer *tmp;
|
||||
gboolean src_writable;
|
||||
|
||||
src_writable = (convert->flags & GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE);
|
||||
src_writable = (convert->flags & GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE);
|
||||
|
||||
if (!chain->allow_ip || !src_writable || !convert->in_default) {
|
||||
gint i;
|
||||
|
@ -679,6 +679,7 @@ setup_allocators (GstAudioConverter * convert)
|
|||
|
||||
/**
|
||||
* gst_audio_converter_new: (skip)
|
||||
* @flags: #GstAudioConverterFlags
|
||||
* @in_info: a source #GstAudioInfo
|
||||
* @out_info: a destination #GstAudioInfo
|
||||
* @config: (transfer full): a #GstStructure with configuration options
|
||||
|
@ -692,8 +693,8 @@ setup_allocators (GstAudioConverter * convert)
|
|||
* Returns: a #GstAudioConverter or %NULL if conversion is not possible.
|
||||
*/
|
||||
GstAudioConverter *
|
||||
gst_audio_converter_new (GstAudioInfo * in_info, GstAudioInfo * out_info,
|
||||
GstStructure * config)
|
||||
gst_audio_converter_new (GstAudioConverterFlags flags, GstAudioInfo * in_info,
|
||||
GstAudioInfo * out_info, GstStructure * config)
|
||||
{
|
||||
GstAudioConverter *convert;
|
||||
AudioChain *prev;
|
||||
|
|
|
@ -59,17 +59,21 @@ typedef struct _GstAudioConverter GstAudioConverter;
|
|||
/**
|
||||
* GstAudioConverterFlags:
|
||||
* @GST_AUDIO_CONVERTER_FLAG_NONE: no flag
|
||||
* @GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE: the source is writable and can be
|
||||
* @GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE: the input sample arrays are writable and can be
|
||||
* used as temporary storage during conversion.
|
||||
* @GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE: allow arbitrary rate updates with
|
||||
* gst_audio_converter_update_config().
|
||||
*
|
||||
* Extra flags passed to gst_audio_converter_samples().
|
||||
* Extra flags passed to gst_audio_converter_new() and gst_audio_converter_samples().
|
||||
*/
|
||||
typedef enum {
|
||||
GST_AUDIO_CONVERTER_FLAG_NONE = 0,
|
||||
GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE = (1 << 0)
|
||||
GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE = (1 << 0),
|
||||
GST_AUDIO_CONVERTER_FLAG_VARIABLE_RATE = (1 << 1)
|
||||
} GstAudioConverterFlags;
|
||||
|
||||
GstAudioConverter * gst_audio_converter_new (GstAudioInfo *in_info,
|
||||
GstAudioConverter * gst_audio_converter_new (GstAudioConverterFlags flags,
|
||||
GstAudioInfo *in_info,
|
||||
GstAudioInfo *out_info,
|
||||
GstStructure *config);
|
||||
|
||||
|
|
|
@ -660,7 +660,7 @@ gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|||
if (!gst_audio_info_from_caps (&out_info, outcaps))
|
||||
goto invalid_out;
|
||||
|
||||
this->convert = gst_audio_converter_new (&in_info, &out_info,
|
||||
this->convert = gst_audio_converter_new (0, &in_info, &out_info,
|
||||
gst_structure_new ("GstAudioConverterConfig",
|
||||
GST_AUDIO_CONVERTER_OPT_DITHER_METHOD, GST_TYPE_AUDIO_DITHER_METHOD,
|
||||
this->dither,
|
||||
|
@ -734,7 +734,7 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
|||
/* and convert the samples */
|
||||
flags = 0;
|
||||
if (inbuf_writable)
|
||||
flags |= GST_AUDIO_CONVERTER_FLAG_SOURCE_WRITABLE;
|
||||
flags |= GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE;
|
||||
|
||||
if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
|
||||
gpointer in[1] = { srcmap.data };
|
||||
|
|
Loading…
Reference in a new issue