Browse Source

avcodec/{h263,ituh263,msmpeg4,snow}dec: Use proper logcontext

The logging functions here can be reached by codecs without
private class, so that the log callback will receive a non-NULL
object whose AVClass pointer is NULL. Although the default log
callback handles this gracefully, it is probably an API violation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Andreas Rheinhardt 1 week ago
parent
commit
e6d07e45e0
4 changed files with 9 additions and 7 deletions
  1. 1 1
      libavcodec/h263dec.c
  2. 1 1
      libavcodec/ituh263dec.c
  3. 3 3
      libavcodec/msmpeg4dec.c
  4. 4 2
      libavcodec/snowdec.c

+ 1 - 1
libavcodec/h263dec.c

@@ -242,7 +242,7 @@ static int decode_slice(MpegEncContext *s)
 
             s->mv_dir  = MV_DIR_FORWARD;
             s->mv_type = MV_TYPE_16X16;
-            ff_dlog(s, "%d %06X\n",
+            ff_dlog(s->avctx, "%d %06X\n",
                     get_bits_count(&s->gb), show_bits(&s->gb, 24));
 
             ff_tlog(NULL, "Decoding MB at %dx%d\n", s->mb_x, s->mb_y);

+ 1 - 1
libavcodec/ituh263dec.c

@@ -1264,7 +1264,7 @@ int ff_h263_decode_picture_header(MpegEncContext *s)
                 s->avctx->framerate.den  = 1000 + get_bits1(&s->gb);
                 s->avctx->framerate.den *= get_bits(&s->gb, 7);
                 if(s->avctx->framerate.den == 0){
-                    av_log(s, AV_LOG_ERROR, "zero framerate\n");
+                    av_log(s->avctx, AV_LOG_ERROR, "zero framerate\n");
                     return -1;
                 }
                 gcd= av_gcd(s->avctx->framerate.den, s->avctx->framerate.num);

+ 3 - 3
libavcodec/msmpeg4dec.c

@@ -77,7 +77,7 @@ static int msmpeg4v2_decode_motion(MpegEncContext * s, int pred, int f_code)
     int code, val, sign, shift;
 
     code = get_vlc2(&s->gb, ff_h263_mv_vlc, H263_MV_VLC_BITS, 2);
-    ff_dlog(s, "MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
+    ff_dlog(s->avctx, "MV code %d at %d %d pred: %d\n", code, s->mb_x,s->mb_y, pred);
     if (code < 0)
         return 0xffff;
 
@@ -267,14 +267,14 @@ static int msmpeg4v34_decode_mb(MpegEncContext *s, int16_t block[6][64])
         s->mv[0][0][1] = my;
         *mb_type_ptr = MB_TYPE_FORWARD_MV | MB_TYPE_16x16;
     } else {
-        ff_dlog(s, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
+        ff_dlog(s->avctx, "I at %d %d %d %06X\n", s->mb_x, s->mb_y,
                 ((cbp & 3) ? 1 : 0) +((cbp & 0x3C)? 2 : 0),
                 show_bits(&s->gb, 24));
         s->ac_pred = get_bits1(&s->gb);
         *mb_type_ptr = MB_TYPE_INTRA;
         if(s->inter_intra_pred){
             s->h263_aic_dir= get_vlc2(&s->gb, ff_inter_intra_vlc, INTER_INTRA_VLC_BITS, 1);
-            ff_dlog(s, "%d%d %d %d/",
+            ff_dlog(s->avctx, "%d%d %d %d/",
                     s->ac_pred, s->h263_aic_dir, s->mb_x, s->mb_y);
         }
         if(s->per_mb_rl_table && cbp){

+ 4 - 2
libavcodec/snowdec.c

@@ -481,14 +481,16 @@ static int decode_header(SnowContext *s){
             }else if(s->chroma_h_shift == 2 && s->chroma_v_shift==2){
                 s->avctx->pix_fmt= AV_PIX_FMT_YUV410P;
             } else {
-                av_log(s, AV_LOG_ERROR, "unsupported color subsample mode %d %d\n", s->chroma_h_shift, s->chroma_v_shift);
+                av_log(s->avctx, AV_LOG_ERROR,
+                       "unsupported color subsample mode %d %d\n",
+                       s->chroma_h_shift, s->chroma_v_shift);
                 s->chroma_h_shift = s->chroma_v_shift = 1;
                 s->avctx->pix_fmt= AV_PIX_FMT_YUV420P;
                 return AVERROR_INVALIDDATA;
             }
             s->nb_planes = 3;
         } else {
-            av_log(s, AV_LOG_ERROR, "unsupported color space\n");
+            av_log(s->avctx, AV_LOG_ERROR, "unsupported color space\n");
             s->chroma_h_shift = s->chroma_v_shift = 1;
             s->avctx->pix_fmt= AV_PIX_FMT_YUV420P;
             return AVERROR_INVALIDDATA;