# HG changeset patch # User jbr # Date 1186349673 0 # Node ID 9971ba9c30a38c8e250706a527437db403ee4d8e # Parent 377e9152aa9b4b8dd8c363134d9855d240c178dc add pointer to the parent context for use with av_log() diff -r 377e9152aa9b -r 9971ba9c30a3 ac3dec.c --- a/ac3dec.c Sun Aug 05 21:10:09 2007 +0000 +++ b/ac3dec.c Sun Aug 05 21:34:33 2007 +0000 @@ -196,6 +196,7 @@ /* Miscellaneous. */ GetBitContext gb; AVRandomState dith_state; //for dither generation + AVCodecContext *avctx; ///< parent context } AC3DecodeContext; /*********** BEGIN INIT HELPER FUNCTIONS ***********/ @@ -297,6 +298,7 @@ static int ac3_decode_init(AVCodecContext *avctx) { AC3DecodeContext *ctx = avctx->priv_data; + ctx->avctx = avctx; ac3_common_init(); ac3_tables_init(); @@ -615,7 +617,7 @@ 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); @@ -807,7 +809,7 @@ 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; } @@ -887,7 +889,7 @@ 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; @@ -948,7 +950,7 @@ 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); @@ -1006,7 +1008,7 @@ * * 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; }