Quoting Hendrik Leppkes (2016-03-03 15:26:16)
> On Fri, Feb 26, 2016 at 5:38 AM, Vittorio Giovara
> <[email protected]> wrote:
> > From: Michael Niedermayer <[email protected]>
> >
> > Reviewed-by: Derek Buitenhuis <[email protected]>
> > Signed-off-by: Michael Niedermayer <[email protected]>
> > ---
> >  libavcodec/eatqi.c | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c
> > index d3b2a97..8fd5cdb 100644
> > --- a/libavcodec/eatqi.c
> > +++ b/libavcodec/eatqi.c
> > @@ -37,6 +37,7 @@
> >  #include "mpeg12.h"
> >
> >  typedef struct TqiContext {
> > +    AVCodecContext *avctx;
> >      GetBitContext gb;
> >      BlockDSPContext bdsp;
> >      BswapDSPContext bsdsp;
> > @@ -79,8 +80,11 @@ static int tqi_decode_mb(TqiContext *t, int16_t 
> > (*block)[64])
> >                                                t->intra_matrix,
> >                                                
> > t->intra_scantable.permutated,
> >                                                t->last_dc, block[n], n, 1);
> > -        if (ret < 0)
> > +        if (ret < 0) {
> > +            av_log(t->avctx, AV_LOG_ERROR, "ac-tex damaged at %d %d\n",
> > +                   t->mb_x, t->mb_y);
> >              return -1;
> > +        }
> >      }
> >
> >      return 0;
> > @@ -127,6 +131,8 @@ static int tqi_decode_frame(AVCodecContext *avctx,
> >      AVFrame *frame = data;
> >      int ret, w, h;
> >
> > +    t->avctx = avctx;
> > +
> >      w = AV_RL16(&buf[0]);
> >      h = AV_RL16(&buf[2]);
> >      tqi_calculate_qtable(t, buf[4]);
> > --
> > 2.7.0
> >
> 
> Wouldn't the more common approach be to pass avctx to tqi_decode_mb
> and then resolve TqiContext from there using avctx->priv_data?

Both approaches are commonly used.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to