[FFmpeg-cvslog] DNxHD: More verbose error messages

Vittorio Giovara git at videolan.org
Thu Jan 29 20:44:41 CET 2015


ffmpeg | branch: master | Vittorio Giovara <vittorio.giovara at gmail.com> | Tue Jan 27 20:56:18 2015 +0000| [41e03e284ee7b0d4caa3a5d28681ad46e3105d65] | committer: Vittorio Giovara

DNxHD: More verbose error messages

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=41e03e284ee7b0d4caa3a5d28681ad46e3105d65
---

 libavcodec/dnxhddec.c |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c
index ca67990..4f714d8 100644
--- a/libavcodec/dnxhddec.c
+++ b/libavcodec/dnxhddec.c
@@ -110,8 +110,11 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
     static const uint8_t header_prefix444[] = { 0x00, 0x00, 0x02, 0x80, 0x02 };
     int i, cid, ret;
 
-    if (buf_size < 0x280)
+    if (buf_size < 0x280) {
+        av_log(ctx->avctx, AV_LOG_ERROR, "buffer too small (%d < 640).\n",
+               buf_size);
         return AVERROR_INVALIDDATA;
+    }
 
     if (memcmp(buf, header_prefix, 5) && memcmp(buf, header_prefix444, 5)) {
         av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n");
@@ -168,7 +171,8 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
         return ret;
 
     if (buf_size < ctx->cid_table->coding_unit_size) {
-        av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n");
+        av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size (%d < %d).\n",
+               buf_size, ctx->cid_table->coding_unit_size);
         return AVERROR_INVALIDDATA;
     }
 
@@ -192,7 +196,9 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
         ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
         av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
         if (buf_size < ctx->mb_scan_index[i] + 0x280) {
-            av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
+            av_log(ctx->avctx, AV_LOG_ERROR,
+                   "invalid mb scan index (%d < %d).\n",
+                   buf_size, ctx->mb_scan_index[i] + 0x280);
             return AVERROR_INVALIDDATA;
         }
     }



More information about the ffmpeg-cvslog mailing list