mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-06-26 09:50:39 +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
|
@ -338,7 +338,7 @@ do_unpack (AudioChain * chain, gsize num_samples, gpointer user_data)
|
||||||
gpointer *tmp;
|
gpointer *tmp;
|
||||||
gboolean src_writable;
|
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) {
|
if (!chain->allow_ip || !src_writable || !convert->in_default) {
|
||||||
gint i;
|
gint i;
|
||||||
|
@ -679,6 +679,7 @@ setup_allocators (GstAudioConverter * convert)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_audio_converter_new: (skip)
|
* gst_audio_converter_new: (skip)
|
||||||
|
* @flags: #GstAudioConverterFlags
|
||||||
* @in_info: a source #GstAudioInfo
|
* @in_info: a source #GstAudioInfo
|
||||||
* @out_info: a destination #GstAudioInfo
|
* @out_info: a destination #GstAudioInfo
|
||||||
* @config: (transfer full): a #GstStructure with configuration options
|
* @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.
|
* Returns: a #GstAudioConverter or %NULL if conversion is not possible.
|
||||||
*/
|
*/
|
||||||
GstAudioConverter *
|
GstAudioConverter *
|
||||||
gst_audio_converter_new (GstAudioInfo * in_info, GstAudioInfo * out_info,
|
gst_audio_converter_new (GstAudioConverterFlags flags, GstAudioInfo * in_info,
|
||||||
GstStructure * config)
|
GstAudioInfo * out_info, GstStructure * config)
|
||||||
{
|
{
|
||||||
GstAudioConverter *convert;
|
GstAudioConverter *convert;
|
||||||
AudioChain *prev;
|
AudioChain *prev;
|
||||||
|
|
|
@ -59,17 +59,21 @@ typedef struct _GstAudioConverter GstAudioConverter;
|
||||||
/**
|
/**
|
||||||
* GstAudioConverterFlags:
|
* GstAudioConverterFlags:
|
||||||
* @GST_AUDIO_CONVERTER_FLAG_NONE: no flag
|
* @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.
|
* 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 {
|
typedef enum {
|
||||||
GST_AUDIO_CONVERTER_FLAG_NONE = 0,
|
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;
|
} GstAudioConverterFlags;
|
||||||
|
|
||||||
GstAudioConverter * gst_audio_converter_new (GstAudioInfo *in_info,
|
GstAudioConverter * gst_audio_converter_new (GstAudioConverterFlags flags,
|
||||||
|
GstAudioInfo *in_info,
|
||||||
GstAudioInfo *out_info,
|
GstAudioInfo *out_info,
|
||||||
GstStructure *config);
|
GstStructure *config);
|
||||||
|
|
||||||
|
|
|
@ -660,7 +660,7 @@ gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
||||||
if (!gst_audio_info_from_caps (&out_info, outcaps))
|
if (!gst_audio_info_from_caps (&out_info, outcaps))
|
||||||
goto invalid_out;
|
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_structure_new ("GstAudioConverterConfig",
|
||||||
GST_AUDIO_CONVERTER_OPT_DITHER_METHOD, GST_TYPE_AUDIO_DITHER_METHOD,
|
GST_AUDIO_CONVERTER_OPT_DITHER_METHOD, GST_TYPE_AUDIO_DITHER_METHOD,
|
||||||
this->dither,
|
this->dither,
|
||||||
|
@ -734,7 +734,7 @@ gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
||||||
/* and convert the samples */
|
/* and convert the samples */
|
||||||
flags = 0;
|
flags = 0;
|
||||||
if (inbuf_writable)
|
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)) {
|
if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
|
||||||
gpointer in[1] = { srcmap.data };
|
gpointer in[1] = { srcmap.data };
|
||||||
|
|
Loading…
Reference in a new issue