audio-converter: small API tweaks
authorWim Taymans <wtaymans@redhat.com>
Fri, 8 Jan 2016 16:34:50 +0000 (17:34 +0100)
committerWim Taymans <wtaymans@redhat.com>
Fri, 8 Jan 2016 16:34:50 +0000 (17:34 +0100)
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'

gst-libs/gst/audio/audio-converter.c
gst-libs/gst/audio/audio-converter.h
gst/audioconvert/gstaudioconvert.c

index ccde30e..a701d75 100644 (file)
@@ -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;
index 1d6aa34..d2e7a4d 100644 (file)
@@ -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);
 
index b3714aa..a3a8fad 100644 (file)
@@ -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 };