audio-resampler: improve non-interleaved flags
authorWim Taymans <wtaymans@redhat.com>
Fri, 4 Mar 2016 16:15:44 +0000 (17:15 +0100)
committerWim Taymans <wtaymans@redhat.com>
Mon, 28 Mar 2016 11:25:55 +0000 (13:25 +0200)
Make it possible to have different interleaving on input and output
because we can quite trivially do that.

gst-libs/gst/audio/audio-converter.c
gst-libs/gst/audio/audio-resampler.c
gst-libs/gst/audio/audio-resampler.h

index 6359337..1f0b450 100644 (file)
@@ -681,8 +681,10 @@ chain_resample (GstAudioConverter * convert, AudioChain * prev)
     method = GET_OPT_RESAMPLER_METHOD (convert);
 
     flags = 0;
-    if (convert->current_layout == GST_AUDIO_LAYOUT_NON_INTERLEAVED)
-      flags |= GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED;
+    if (convert->current_layout == GST_AUDIO_LAYOUT_NON_INTERLEAVED) {
+      flags |= GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN;
+      flags |= GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT;
+    }
     if (variable_rate)
       flags |= GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE;
 
index 3182456..815cb08 100644 (file)
@@ -1504,7 +1504,7 @@ gst_audio_resampler_new (GstAudioResamplerMethod method,
   resampler->sbuf = g_malloc0 (sizeof (gpointer) * channels);
 
   non_interleaved =
-      (resampler->flags & GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED);
+      (resampler->flags & GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT);
 
   /* we resample each channel separately */
   resampler->blocks = resampler->channels;
index 13ea256..1664e68 100644 (file)
@@ -178,9 +178,12 @@ typedef enum {
 /**
  * GstAudioResamplerFlags:
  * @GST_AUDIO_RESAMPLER_FLAG_NONE: no flags
- * @GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED: samples are non-interleaved. an array
- *    of blocks of samples, one for each channel, should be passed to the resample
- *    function.
+ * @GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN: input samples are non-interleaved.
+ *    an array of blocks of samples, one for each channel, should be passed to the
+ *    resample function.
+ * @GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT: output samples are non-interleaved.
+ *    an array of blocks of samples, one for each channel, should be passed to the
+ *    resample function.
  * @GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE: optimize for dynamic updates of the sample
  *    rates with gst_audio_resampler_update(). This will select an interpolating filter
  *    when #GST_AUDIO_RESAMPLER_FILTER_MODE_AUTO is configured.
@@ -189,8 +192,9 @@ typedef enum {
  */
 typedef enum {
   GST_AUDIO_RESAMPLER_FLAG_NONE                 = (0),
-  GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED      = (1 << 0),
-  GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE        = (1 << 1),
+  GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_IN   = (1 << 0),
+  GST_AUDIO_RESAMPLER_FLAG_NON_INTERLEAVED_OUT  = (1 << 1),
+  GST_AUDIO_RESAMPLER_FLAG_VARIABLE_RATE        = (1 << 2),
 } GstAudioResamplerFlags;
 
 #define GST_AUDIO_RESAMPLER_QUALITY_MIN 0