audio: add flag for unpositioned layout

Check if thr layout is explicitly unpositioned and set a flag in the
audio info structure.
This commit is contained in:
Wim Taymans 2012-01-02 15:01:58 +01:00
parent 73c4a4ffc6
commit ed6fd4eb2f
2 changed files with 10 additions and 1 deletions

View file

@ -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;

View file

@ -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)