audioconvert: add av_get_channel_description().

This commit is contained in:
Nicolas George 2012-07-30 00:33:38 +02:00
parent cc55470472
commit 33449b1776
2 changed files with 19 additions and 0 deletions

View File

@ -219,6 +219,17 @@ const char *av_get_channel_name(uint64_t channel)
return NULL; return NULL;
} }
const char *av_get_channel_description(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++)
if ((1ULL<<i) & channel)
return channel_names[i].description;
return NULL;
}
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index) uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
{ {
int i; int i;

View File

@ -180,6 +180,14 @@ uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
*/ */
const char *av_get_channel_name(uint64_t channel); const char *av_get_channel_name(uint64_t channel);
/**
* Get the description of a given channel.
*
* @param channel a channel layout with a single channel
* @return channel description on success, NULL on error
*/
const char *av_get_channel_description(uint64_t channel);
/** /**
* @} * @}
*/ */