History

audioconvert: add a function for getting channel's index in layout

Anton Khirnov committed 14 years ago

Commit 406b2571 parent 3596de52 files · +22 −0Browse files

Unified · Split

2 files
  1. libavutil/audioconvert.c +10 −0
  2. libavutil/audioconvert.h +12 −0
libavutil/audioconvert.c+10−0
@@ -192,3 +192,13 @@ uint64_t av_get_default_channel_layout(int nb_channels) · 191 unmodified lines
192 default: return 0;192 default: return 0;
193 }193 }
194}194}
195
196int av_get_channel_layout_channel_index(uint64_t channel_layout,
197 uint64_t channel)
198{
199 if (!(channel_layout & channel) ||
200 av_get_channel_layout_nb_channels(channel) != 1)
201 return AVERROR(EINVAL);
202 channel_layout &= channel - 1;
203 return av_get_channel_layout_nb_channels(channel_layout);
204}
libavutil/audioconvert.h+12−0
@@ -143,6 +143,18 @@ int av_get_channel_layout_nb_channels(uint64_t channel_layout); · 142 unmodified lines
143 */143 */
144uint64_t av_get_default_channel_layout(int nb_channels);144uint64_t av_get_default_channel_layout(int nb_channels);
145 145
146/**
147 * Get the index of a channel in channel_layout.
148 *
149 * @param channel a channel layout describing exactly one channel which must be
150 * present in channel_layout.
151 *
152 * @return index of channel in channel_layout on success, a negative AVERROR
153 * on error.
154 */
155int av_get_channel_layout_channel_index(uint64_t channel_layout,
156 uint64_t channel);
157
146/**158/**
147 * @}159 * @}
148 */160 */

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