History

audioconvert: add a function for extracting the channel with the given index

Anton Khirnov committed 14 years ago

Commit 59d58b31 parent 5df320e2 files · +19 −0Browse files

Unified · Split

2 files
  1. libavutil/audioconvert.c +14 −0
  2. libavutil/audioconvert.h +5 −0
libavutil/audioconvert.c+14−0
@@ -213,3 +213,17 @@ const char *av_get_channel_name(uint64_t channel) · 212 unmodified lines
213 return get_channel_name(i);213 return get_channel_name(i);
214 return NULL;214 return NULL;
215}215}
216
217uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index)
218{
219 int i;
220
221 if (av_get_channel_layout_nb_channels(channel_layout) <= index)
222 return 0;
223
224 for (i = 0; i < 64; i++) {
225 if ((1ULL << i) & channel_layout && !index--)
226 return 1ULL << i;
227 }
228 return 0;
229}
libavutil/audioconvert.h+5−0
@@ -155,6 +155,11 @@ uint64_t av_get_default_channel_layout(int nb_channels); · 154 unmodified lines
155int av_get_channel_layout_channel_index(uint64_t channel_layout,155int av_get_channel_layout_channel_index(uint64_t channel_layout,
156 uint64_t channel);156 uint64_t channel);
157 157
158/**
159 * Get the channel with the given index in channel_layout.
160 */
161uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index);
162
158/**163/**
159 * Get the name of a given channel.164 * Get the name of a given channel.
160 *165 *

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t