audioconvert: add av_get_default_channel_layout public function

This commit is contained in:
Marton Balint 2011-10-02 16:28:36 +02:00
parent 2446a8cc0a
commit 60aaf044f3
2 changed files with 13 additions and 0 deletions

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

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 */