Mercurial > mplayer.hg
comparison libaf/af_lavcac3enc.c @ 34652:4e7cc799cf54
lavcac3enc: make the filter buildable with shared FFmpeg
Add some local definitions and a bitrate array to make FFmpeg private headers
and symbols unneeded, allowing lavcac3enc to be built with shared FFmpeg.
This also fixes the issue that the filter code expects the FFmpeg private
definition AC3_MAX_CHANNELS to be the maximum number of "logical" channels to
be encoded into AC-3, while it actually specifies the maximum channel count in
the bitstream, which may include a coupling channel which is not an actual full
audio channel. The issue is fixed by making the local AC3_MAX_CHANNELS have the
value 6, which the FFmpeg private header also had before the addition of
coupling support in 2011.
patch by Anssi Hannula, anssi.hannula iki fi
author | diego |
---|---|
date | Sun, 19 Feb 2012 15:21:23 +0000 |
parents | f3d53cd55376 |
children | d206960484fe |
comparison
equal
deleted
inserted
replaced
34651:e4de3e6665ae | 34652:4e7cc799cf54 |
---|---|
31 #include "mp_msg.h" | 31 #include "mp_msg.h" |
32 #include "reorder_ch.h" | 32 #include "reorder_ch.h" |
33 #include "av_helpers.h" | 33 #include "av_helpers.h" |
34 | 34 |
35 #include "libavcodec/avcodec.h" | 35 #include "libavcodec/avcodec.h" |
36 #include "libavcodec/ac3.h" | |
37 #include "libavutil/intreadwrite.h" | 36 #include "libavutil/intreadwrite.h" |
37 | |
38 #define AC3_MAX_CHANNELS 6 | |
39 #define AC3_FRAME_SIZE 1536 | |
40 #define AC3_MAX_CODED_FRAME_SIZE 3840 | |
41 //#define AC3_BIT_RATES_COUNT 19 | |
42 | |
43 static const int ac3_bit_rates[] = { | |
44 32000, 40000, 48000, 56000, 64000, 80000, 96000, 112000, 128000, 160000, | |
45 192000, 224000, 256000, 320000, 384000, 448000, 512000, 576000, 640000 | |
46 }; | |
38 | 47 |
39 // Data for specific instances of this filter | 48 // Data for specific instances of this filter |
40 typedef struct af_ac3enc_s { | 49 typedef struct af_ac3enc_s { |
41 struct AVCodec *lavc_acodec; | 50 struct AVCodec *lavc_acodec; |
42 struct AVCodecContext *lavc_actx; | 51 struct AVCodecContext *lavc_actx; |
115 sscanf(arg,"%d:%d:%d", &s->add_iec61937_header, &s->bit_rate, | 124 sscanf(arg,"%d:%d:%d", &s->add_iec61937_header, &s->bit_rate, |
116 &s->min_channel_num); | 125 &s->min_channel_num); |
117 if (s->bit_rate < 1000) | 126 if (s->bit_rate < 1000) |
118 s->bit_rate *= 1000; | 127 s->bit_rate *= 1000; |
119 if (s->bit_rate) { | 128 if (s->bit_rate) { |
120 for (i = 0; i < 19; ++i) | 129 for (i = 0; i < FF_ARRAY_ELEMS(ac3_bit_rates); ++i) |
121 if (ff_ac3_bitrate_tab[i] * 1000 == s->bit_rate) | 130 if (ac3_bit_rates[i] == s->bit_rate) |
122 break; | 131 break; |
123 if (i >= 19) { | 132 if (i >= FF_ARRAY_ELEMS(ac3_bit_rates)) { |
124 mp_msg(MSGT_AFILTER, MSGL_WARN, "af_lavcac3enc unable set unsupported " | 133 mp_msg(MSGT_AFILTER, MSGL_WARN, "af_lavcac3enc unable set unsupported " |
125 "bitrate %d, use default bitrate (check manpage to see " | 134 "bitrate %d, use default bitrate (check manpage to see " |
126 "supported bitrates).\n", s->bit_rate); | 135 "supported bitrates).\n", s->bit_rate); |
127 s->bit_rate = 0; | 136 s->bit_rate = 0; |
128 } | 137 } |