mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-01-24 00:02:53 +00:00
audioconvert: add a function for extracting the channel with the given index
This commit is contained in:
parent
5df320e167
commit
59d58b3390
@ -213,3 +213,17 @@ const char *av_get_channel_name(uint64_t channel)
|
|||||||
return get_channel_name(i);
|
return get_channel_name(i);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (av_get_channel_layout_nb_channels(channel_layout) <= index)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
for (i = 0; i < 64; i++) {
|
||||||
|
if ((1ULL << i) & channel_layout && !index--)
|
||||||
|
return 1ULL << i;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -155,6 +155,11 @@ uint64_t av_get_default_channel_layout(int nb_channels);
|
|||||||
int av_get_channel_layout_channel_index(uint64_t channel_layout,
|
int av_get_channel_layout_channel_index(uint64_t channel_layout,
|
||||||
uint64_t channel);
|
uint64_t channel);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the channel with the given index in channel_layout.
|
||||||
|
*/
|
||||||
|
uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the name of a given channel.
|
* Get the name of a given channel.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user