/* Miscellaneous. */
GetBitContext gb;
AVRandomState dith_state; //for dither generation
+ AVCodecContext *avctx; ///< parent context
} AC3DecodeContext;
/*********** BEGIN INIT HELPER FUNCTIONS ***********/
static int ac3_decode_init(AVCodecContext *avctx)
{
AC3DecodeContext *ctx = avctx->priv_data;
+ ctx->avctx = avctx;
ac3_common_init();
ac3_tables_init();
if (ctx->chincpl[ch]) {
if (!got_cplchan) {
if (get_transform_coeffs_ch(ctx, CPL_CH, &m)) {
- av_log(NULL, AV_LOG_ERROR, "error in decoupling channels\n");
+ av_log(ctx->avctx, AV_LOG_ERROR, "error in decoupling channels\n");
return -1;
}
uncouple_channels(ctx);
cplendf = get_bits(gb, 4);
if (3 + cplendf - cplbegf < 0) {
- av_log(NULL, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", cplendf, cplbegf);
+ av_log(ctx->avctx, AV_LOG_ERROR, "cplendf = %d < cplbegf = %d\n", cplendf, cplbegf);
return -1;
}
else {
int chbwcod = get_bits(gb, 6);
if (chbwcod > 60) {
- av_log(NULL, AV_LOG_ERROR, "chbwcod = %d > 60", chbwcod);
+ av_log(ctx->avctx, AV_LOG_ERROR, "chbwcod = %d > 60", chbwcod);
return -1;
}
ctx->endmant[ch] = chbwcod * 3 + 73;
for (ch = !ctx->cplinu; ch <= nfchans; ch++) {
ctx->deltbae[ch] = get_bits(gb, 2);
if (ctx->deltbae[ch] == DBA_RESERVED) {
- av_log(NULL, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
+ av_log(ctx->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
return -1;
}
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
* * this also uncouples channels if coupling is in use.
*/
if (get_transform_coeffs(ctx)) {
- av_log(NULL, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n");
+ av_log(ctx->avctx, AV_LOG_ERROR, "Error in routine get_transform_coeffs\n");
return -1;
}