* FLAC common code
* Copyright (c) 2009 Justin Ruggles
*
- * 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
*/
}
int ff_flac_decode_frame_header(AVCodecContext *avctx, GetBitContext *gb,
- FLACFrameInfo *fi)
+ FLACFrameInfo *fi, int log_level_offset)
{
int bs_code, sr_code, bps_code;
/* frame sync code */
if ((get_bits(gb, 15) & 0x7FFF) != 0x7FFC) {
- av_log(avctx, AV_LOG_ERROR, "invalid sync code\n");
+ av_log(avctx, AV_LOG_ERROR + log_level_offset, "invalid sync code\n");
return -1;
}
} else if (fi->ch_mode <= FLAC_CHMODE_MID_SIDE) {
fi->channels = 2;
} else {
- av_log(avctx, AV_LOG_ERROR, "invalid channel mode: %d\n", fi->ch_mode);
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "invalid channel mode: %d\n", fi->ch_mode);
return -1;
}
/* bits per sample */
bps_code = get_bits(gb, 3);
if (bps_code == 3 || bps_code == 7) {
- av_log(avctx, AV_LOG_ERROR, "invalid sample size code (%d)\n",
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "invalid sample size code (%d)\n",
bps_code);
return -1;
}
/* reserved bit */
if (get_bits1(gb)) {
- av_log(avctx, AV_LOG_ERROR, "broken stream, invalid padding\n");
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "broken stream, invalid padding\n");
return -1;
}
/* sample or frame count */
fi->frame_or_sample_num = get_utf8(gb);
if (fi->frame_or_sample_num < 0) {
- av_log(avctx, AV_LOG_ERROR, "sample/frame number invalid; utf8 fscked\n");
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "sample/frame number invalid; utf8 fscked\n");
return -1;
}
/* blocksize */
if (bs_code == 0) {
- av_log(avctx, AV_LOG_ERROR, "reserved blocksize code: 0\n");
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "reserved blocksize code: 0\n");
return -1;
} else if (bs_code == 6) {
fi->blocksize = get_bits(gb, 8) + 1;
} else if (sr_code == 14) {
fi->samplerate = get_bits(gb, 16) * 10;
} else {
- av_log(avctx, AV_LOG_ERROR, "illegal sample rate code %d\n",
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "illegal sample rate code %d\n",
sr_code);
return -1;
}
skip_bits(gb, 8);
if (av_crc(av_crc_get_table(AV_CRC_8_ATM), 0, gb->buffer,
get_bits_count(gb)/8)) {
- av_log(avctx, AV_LOG_ERROR, "header crc mismatch\n");
+ av_log(avctx, AV_LOG_ERROR + log_level_offset,
+ "header crc mismatch\n");
return -1;
}