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

pull/59/head
Anton Khirnov 13 years ago
parent 406b257de9
commit 5df320e167
  1. 11
      libavutil/audioconvert.c
  2. 7
      libavutil/audioconvert.h

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

@ -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);
/**
* @}
*/

Loading…
Cancel
Save