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
12 12
13API changes, most recent first:13API changes, most recent first:
14 14
152012-xx-xx - xxxxxxx - lavu 51.26.0 - audioconvert.h
16 Add av_get_default_channel_layout()
17
152012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h182012-03-06 - 4d851f8 - lavu 51.25.0 - cpu.h
16 Add av_set_cpu_flags_mask().19 Add av_set_cpu_flags_mask().
17 20
libavcodec/ac3enc.c+1−1
@@ -2074,7 +2074,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels, · 2073 unmodified lines
2074 return AVERROR(EINVAL);2074 return AVERROR(EINVAL);
2075 ch_layout = *channel_layout;2075 ch_layout = *channel_layout;
2076 if (!ch_layout)2076 if (!ch_layout)
2077 ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);2077 ch_layout = av_get_default_channel_layout(channels);
2078 2078
2079 s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY);2079 s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY);
2080 s->channels = channels;2080 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
153 x &= x-1; // unset lowest set bit153 x &= x-1; // unset lowest set bit
154 return count;154 return count;
155}155}
156
157uint64_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
124 */124 */
125int av_get_channel_layout_nb_channels(uint64_t channel_layout);125int av_get_channel_layout_nb_channels(uint64_t channel_layout);
126 126
127/**
128 * Return default channel layout for a given number of channels.
129 */
130uint64_t av_get_default_channel_layout(int nb_channels);
131
127/**132/**
128 * @}133 * @}
129 */134 */
libavutil/avutil.h+1−1
@@ -152,7 +152,7 @@ · 151 unmodified lines
152 */152 */
153 153
154#define LIBAVUTIL_VERSION_MAJOR 51154#define LIBAVUTIL_VERSION_MAJOR 51
155#define LIBAVUTIL_VERSION_MINOR 25155#define LIBAVUTIL_VERSION_MINOR 26
156#define LIBAVUTIL_VERSION_MICRO 0156#define LIBAVUTIL_VERSION_MICRO 0
157 157
158#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \158#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