[FFmpeg-cvslog] avcodec/{h263,ituh263,msmpeg4,snow}dec: Use proper logcontext
Andreas Rheinhardt
git at videolan.org
Sat Mar 8 02:14:39 EET 2025
ffmpeg | branch: master | Andreas Rheinhardt <andreas.rheinhardt at outlook.com> | Wed Mar 5 00:50:49 2025 +0100| [e6d07e45e0dc878889e5452db12f32859a128d22] | committer: Andreas Rheinhardt
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 at outlook.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6d07e45e0dc878889e5452db12f32859a128d22
---
libavcodec/h263dec.c | 2 +-
libavcodec/ituh263dec.c | 2 +-
libavcodec/msmpeg4dec.c | 6 +++---
libavcodec/snowdec.c | 6 ++++--
4 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 9ccdd914ce..982a56ae05 100644
--- a/libavcodec/h263dec.c
+++ b/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);
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index 9fee33da71..d451a35da8 100644
--- a/libavcodec/ituh263dec.c
+++ b/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);
diff --git a/libavcodec/msmpeg4dec.c b/libavcodec/msmpeg4dec.c
index d42219f464..0604dc8963 100644
--- a/libavcodec/msmpeg4dec.c
+++ b/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){
diff --git a/libavcodec/snowdec.c b/libavcodec/snowdec.c
index 50dcaf8b93..d99da8a4f3 100644
--- a/libavcodec/snowdec.c
+++ b/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;
More information about the ffmpeg-cvslog
mailing list