History

avutil: Add av_get_default_channel_layout()

Also, use the new function in the AC-3 encoder.

Justin Ruggles committed 14 years ago

Commit 5cc51a51 parent 0becb075 files · +25 −2Browse files

Unified · Split

5 files
  1. doc/APIchanges +3 −0
  2. libavcodec/ac3enc.c +1 −1
  3. libavutil/audioconvert.c +15 −0
  4. libavutil/audioconvert.h +5 −0
  5. libavutil/avutil.h +1 −1
doc/APIchanges+3−0
@@ -12,6 +12,9 @@ libavutil: 2011-04-18 · 11 unmodified lines
1212
1313 API changes, most recent first:
1414
15+2012-xx-xx - xxxxxxx - lavu 51.26.0 - audioconvert.h
16+ Add av_get_default_channel_layout()
17+
1518 2012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h
1619 Add av_set_cpu_flags_mask().
1720
libavcodec/ac3enc.c+1−1
@@ -2074,7 +2074,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels, · 2073 unmodified lines
20742074 return AVERROR(EINVAL);
20752075 ch_layout = *channel_layout;
20762076 if (!ch_layout)
2077− ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);
2077+ ch_layout = av_get_default_channel_layout(channels);
20782078
20792079 s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY);
20802080 s->channels = channels;
libavutil/audioconvert.c+15−0
@@ -153,3 +153,18 @@ int av_get_channel_layout_nb_channels(uint64_t channel_layout) · 152 unmodified lines
153153 x &= x-1; // unset lowest set bit
154154 return count;
155155 }
156+
157+uint64_t av_get_default_channel_layout(int nb_channels)
158+{
159+ switch(nb_channels) {
160+ case 1: return AV_CH_LAYOUT_MONO;
161+ case 2: return AV_CH_LAYOUT_STEREO;
162+ case 3: return AV_CH_LAYOUT_SURROUND;
163+ case 4: return AV_CH_LAYOUT_QUAD;
164+ case 5: return AV_CH_LAYOUT_5POINT0;
165+ case 6: return AV_CH_LAYOUT_5POINT1;
166+ case 7: return AV_CH_LAYOUT_6POINT1;
167+ case 8: return AV_CH_LAYOUT_7POINT1;
168+ default: return 0;
169+ }
170+}
libavutil/audioconvert.h+5−0
@@ -124,6 +124,11 @@ void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint · 123 unmodified lines
124124 */
125125 int av_get_channel_layout_nb_channels(uint64_t channel_layout);
126126
127+/**
128+ * Return default channel layout for a given number of channels.
129+ */
130+uint64_t av_get_default_channel_layout(int nb_channels);
131+
127132 /**
128133 * @}
129134 */
libavutil/avutil.h+1−1
@@ -152,7 +152,7 @@ · 151 unmodified lines
152152 */
153153
154154 #define LIBAVUTIL_VERSION_MAJOR 51
155−#define LIBAVUTIL_VERSION_MINOR 25
155+#define LIBAVUTIL_VERSION_MINOR 26
156156 #define LIBAVUTIL_VERSION_MICRO 0
157157
158158 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \

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