Browse Source

audioconvert: add av_get_default_channel_layout public function

tags/n0.9
Marton Balint 14 years ago
parent
commit
60aaf044f3
2 changed files with 13 additions and 0 deletions
  1. +8
    -0
      libavutil/audioconvert.c
  2. +5
    -0
      libavutil/audioconvert.h

+ 8
- 0
libavutil/audioconvert.c View File

@@ -131,3 +131,11 @@ int av_get_channel_layout_nb_channels(int64_t channel_layout)
x &= x-1; // unset lowest set bit
return count;
}

int av_get_default_channel_layout(int nb_channels) {
int i;
for (i = 0; channel_layout_map[i].name; i++)
if (nb_channels == channel_layout_map[i].nb_channels)
return channel_layout_map[i].layout;
return 0;
}

+ 5
- 0
libavutil/audioconvert.h View File

@@ -92,4 +92,9 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, int6
*/
int av_get_channel_layout_nb_channels(int64_t channel_layout);

/**
* Return default channel layout for a given number of channels.
*/
int av_get_default_channel_layout(int nb_channels);

#endif /* AVUTIL_AUDIOCONVERT_H */

Loading…
Cancel
Save