audioconvert: add a function for getting the name of a single channel.

This commit is contained in:
Anton Khirnov 2012-05-28 08:39:10 +02:00
parent 406b257de9
commit 5df320e167
2 changed files with 18 additions and 0 deletions

View File

@ -202,3 +202,14 @@ int av_get_channel_layout_channel_index(uint64_t channel_layout,
channel_layout &= channel - 1;
return av_get_channel_layout_nb_channels(channel_layout);
}
const char *av_get_channel_name(uint64_t channel)
{
int i;
if (av_get_channel_layout_nb_channels(channel) != 1)
return NULL;
for (i = 0; i < 64; i++)
if ((1ULL<<i) & channel)
return get_channel_name(i);
return NULL;
}

View File

@ -155,6 +155,13 @@ uint64_t av_get_default_channel_layout(int nb_channels);
int av_get_channel_layout_channel_index(uint64_t channel_layout,
uint64_t channel);
/**
* Get the name of a given channel.
*
* @return channel name on success, NULL on error.
*/
const char *av_get_channel_name(uint64_t channel);
/**
* @}
*/