* MPEG Audio decoder
* Copyright (c) 2001, 2002 Fabrice Bellard
*
- * This file is part of FFmpeg.
+ * This file is part of Libav.
*
- * FFmpeg is free software; you can redistribute it and/or
+ * Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
- * FFmpeg is distributed in the hope that it will be useful,
+ * Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with FFmpeg; if not, write to the Free Software
+ * License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
* MPEG Audio decoder.
*/
+#include "libavutil/audioconvert.h"
#include "avcodec.h"
#include "get_bits.h"
#include "dsputil.h"
-#include "libavformat/id3v1.h"
/*
* TODO:
scale_factor_mult[i][0] = MULLx(norm, FIXR(1.0 * 2.0), FRAC_BITS);
scale_factor_mult[i][1] = MULLx(norm, FIXR(0.7937005259 * 2.0), FRAC_BITS);
scale_factor_mult[i][2] = MULLx(norm, FIXR(0.6299605249 * 2.0), FRAC_BITS);
- dprintf(avctx, "%d: norm=%x s=%x %x %x\n",
+ av_dlog(avctx, "%d: norm=%x s=%x %x %x\n",
i, norm,
scale_factor_mult[i][0],
scale_factor_mult[i][1],
k = i & 1;
is_table_lsf[j][k ^ 1][i] = FIXR(f);
is_table_lsf[j][k][i] = FIXR(1.0);
- dprintf(avctx, "is_table_lsf %d %d: %x %x\n",
+ av_dlog(avctx, "is_table_lsf %d %d: %x %x\n",
i, j, is_table_lsf[j][0][i], is_table_lsf[j][1][i]);
}
}
else
bound = sblimit;
- dprintf(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
+ av_dlog(s->avctx, "bound=%d sblimit=%d\n", bound, sblimit);
/* sanity check */
if( bound > sblimit ) bound = sblimit;
exponent= exponents[s_index];
- dprintf(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n",
+ av_dlog(s->avctx, "region=%d n=%d x=%d y=%d exp=%d\n",
i, g->region_size[i] - j, x, y, exponent);
if(y&16){
x = y >> 5;
last_pos= pos;
code = get_vlc2(&s->gb, vlc->table, vlc->bits, 1);
- dprintf(s->avctx, "t=%d code=%d\n", g->count1table_select, code);
+ av_dlog(s->avctx, "t=%d code=%d\n", g->count1table_select, code);
g->sb_hybrid[s_index+0]=
g->sb_hybrid[s_index+1]=
g->sb_hybrid[s_index+2]=
for(gr=0;gr<nb_granules;gr++) {
for(ch=0;ch<s->nb_channels;ch++) {
- dprintf(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch);
+ av_dlog(s->avctx, "gr=%d ch=%d: side_info\n", gr, ch);
g = &s->granules[ch][gr];
g->part2_3_length = get_bits(&s->gb, 12);
g->big_values = get_bits(&s->gb, 9);
/* compute huffman coded region sizes */
region_address1 = get_bits(&s->gb, 4);
region_address2 = get_bits(&s->gb, 3);
- dprintf(s->avctx, "region1=%d region2=%d\n",
+ av_dlog(s->avctx, "region1=%d region2=%d\n",
region_address1, region_address2);
ff_init_long_region(s, g, region_address1, region_address2);
}
g->preflag = get_bits1(&s->gb);
g->scalefac_scale = get_bits1(&s->gb);
g->count1table_select = get_bits1(&s->gb);
- dprintf(s->avctx, "block_type=%d switch_point=%d\n",
+ av_dlog(s->avctx, "block_type=%d switch_point=%d\n",
g->block_type, g->switch_point);
}
}
const uint8_t *ptr = s->gb.buffer + (get_bits_count(&s->gb)>>3);
assert((get_bits_count(&s->gb) & 7) == 0);
/* now we get bits from the main_data_begin offset */
- dprintf(s->avctx, "seekback: %d\n", main_data_begin);
+ av_dlog(s->avctx, "seekback: %d\n", main_data_begin);
//av_log(NULL, AV_LOG_ERROR, "backstep:%d, lastbuf:%d\n", main_data_begin, s->last_buf_size);
memcpy(s->last_buf + s->last_buf_size, ptr, EXTRABYTES);
/* MPEG1 scale factors */
slen1 = slen_table[0][g->scalefac_compress];
slen2 = slen_table[1][g->scalefac_compress];
- dprintf(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2);
+ av_dlog(s->avctx, "slen1=%d slen2=%d\n", slen1, slen2);
if (g->block_type == 2) {
n = g->switch_point ? 17 : 18;
j = 0;
if (s->error_protection)
skip_bits(&s->gb, 16);
- dprintf(s->avctx, "frame %d:\n", s->frame_count);
+ av_dlog(s->avctx, "frame %d:\n", s->frame_count);
switch(s->layer) {
case 1:
s->avctx->frame_size = 384;
header = AV_RB32(buf);
if(ff_mpa_check_header(header) < 0){
-
- if (buf_size == ID3v1_TAG_SIZE
- && buf[0] == 'T' && buf[1] == 'A' && buf[2] == 'G') {
- *data_size = 0;
- return ID3v1_TAG_SIZE;
- }
-
av_log(avctx, AV_LOG_ERROR, "Header missing\n");
return -1;
}
}
/* update codec info */
avctx->channels = s->nb_channels;
+ avctx->channel_layout = s->nb_channels == 1 ? AV_CH_LAYOUT_MONO : AV_CH_LAYOUT_STEREO;
if (!avctx->bit_rate)
avctx->bit_rate = s->bit_rate;
avctx->sub_id = s->layer;
int i;
for (i = 0; i < s->frames; i++)
- if (s->mp3decctx[i])
- av_free(s->mp3decctx[i]);
+ av_free(s->mp3decctx[i]);
return 0;
}
#if !CONFIG_FLOAT
#if CONFIG_MP1_DECODER
-AVCodec mp1_decoder =
+AVCodec ff_mp1_decoder =
{
"mp1",
AVMEDIA_TYPE_AUDIO,
};
#endif
#if CONFIG_MP2_DECODER
-AVCodec mp2_decoder =
+AVCodec ff_mp2_decoder =
{
"mp2",
AVMEDIA_TYPE_AUDIO,
};
#endif
#if CONFIG_MP3_DECODER
-AVCodec mp3_decoder =
+AVCodec ff_mp3_decoder =
{
"mp3",
AVMEDIA_TYPE_AUDIO,
};
#endif
#if CONFIG_MP3ADU_DECODER
-AVCodec mp3adu_decoder =
+AVCodec ff_mp3adu_decoder =
{
"mp3adu",
AVMEDIA_TYPE_AUDIO,
};
#endif
#if CONFIG_MP3ON4_DECODER
-AVCodec mp3on4_decoder =
+AVCodec ff_mp3on4_decoder =
{
"mp3on4",
AVMEDIA_TYPE_AUDIO,