[0.11] gst-plugins-base: audio: add flag for unpositioned layout

Wim Taymans wtay at kemper.freedesktop.org
Mon Jan 2 06:05:12 PST 2012


Module: gst-plugins-base
Branch: 0.11
Commit: ed6fd4eb2f2efc3ec576528f14ba530448b5abfd
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=ed6fd4eb2f2efc3ec576528f14ba530448b5abfd

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Mon Jan  2 15:01:58 2012 +0100

audio: add flag for unpositioned layout

Check if thr layout is explicitly unpositioned and set a flag in the
audio info structure.

---

 gst-libs/gst/audio/audio.c |    5 +++++
 gst-libs/gst/audio/audio.h |    6 +++++-
 2 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/gst-libs/gst/audio/audio.c b/gst-libs/gst/audio/audio.c
index 2f43b5f..ac32a88 100644
--- a/gst-libs/gst/audio/audio.c
+++ b/gst-libs/gst/audio/audio.c
@@ -412,6 +412,11 @@ gst_audio_info_from_caps (GstAudioInfo * info, const GstCaps * caps)
     for (i = 0; i < max_pos; i++) {
       pos_val_entry = gst_value_array_get_value (pos_val_arr, i);
       info->position[i] = g_value_get_enum (pos_val_entry);
+
+      /* the unpositioned flag is set as soon as one of the channels has an
+       * explicit NONE positioning */
+      if (info->position[i] == GST_AUDIO_CHANNEL_POSITION_NONE)
+        info->flags |= GST_AUDIO_FLAG_UNPOSITIONED;
     }
   } else {
     info->flags |= GST_AUDIO_FLAG_DEFAULT_POSITIONS;
diff --git a/gst-libs/gst/audio/audio.h b/gst-libs/gst/audio/audio.h
index 60421ad..fd47f63 100644
--- a/gst-libs/gst/audio/audio.h
+++ b/gst-libs/gst/audio/audio.h
@@ -257,12 +257,15 @@ void           gst_audio_format_fill_silence     (const GstAudioFormatInfo *info
  * @GST_AUDIO_FLAG_NONE: no valid flag
  * @GST_AUDIO_FLAG_DEFAULT_POSITIONS: position array
  *     contains the default layout for the number of channels.
+ * @GST_AUDIO_FLAG_UNPOSITIONED: the position array explicitly
+ *     contains unpositioned channels.
  *
  * Extra audio flags
  */
 typedef enum {
   GST_AUDIO_FLAG_NONE              = 0,
-  GST_AUDIO_FLAG_DEFAULT_POSITIONS = (1 << 0)
+  GST_AUDIO_FLAG_DEFAULT_POSITIONS = (1 << 0),
+  GST_AUDIO_FLAG_UNPOSITIONED      = (1 << 1)
 } GstAudioFlags;
 
 /**
@@ -312,6 +315,7 @@ GType gst_audio_info_get_type        (void);
 
 #define GST_AUDIO_INFO_FLAGS(info)           ((info)->flags)
 #define GST_AUDIO_INFO_HAS_DEFAULT_POSITIONS(info) ((info)->flags & GST_AUDIO_FLAG_DEFAULT_POSITIONS)
+#define GST_AUDIO_INFO_IS_UNPOSITIONED(info) ((info)->flags & GST_AUDIO_FLAG_UNPOSITIONED)
 
 #define GST_AUDIO_INFO_RATE(info)            ((info)->rate)
 #define GST_AUDIO_INFO_CHANNELS(info)        ((info)->channels)



More information about the gstreamer-commits mailing list