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
192192 default: return 0;
193193 }
194194 }
195+
196+int 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
143143 */
144144 uint64_t av_get_default_channel_layout(int nb_channels);
145145
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+ */
155+int av_get_channel_layout_channel_index(uint64_t channel_layout,
156+ uint64_t channel);
157+
146158 /**
147159 * @}
148160 */

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