[FFmpeg-cvslog] dnxhd: Make the encoder message friendlier

Luca Barbato git at videolan.org
Tue Feb 16 18:48:57 CET 2016


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Mon Feb  8 10:17:00 2016 +0100| [99214d42a902c8392d7887c08fdc5dc1fc2475ae] | committer: Luca Barbato

dnxhd: Make the encoder message friendlier

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

 libavcodec/dnxhddata.c |   23 +++++++++++++++++++++++
 libavcodec/dnxhddata.h |    1 +
 libavcodec/dnxhdenc.c  |    5 +++--
 3 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index 282829e..55272e9 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -1203,3 +1203,26 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
     }
     return 0;
 }
+
+void ff_dnxhd_list_cid(AVCodecContext *avctx)
+{
+    int i, j;
+
+    for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
+        const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+        av_log(avctx, AV_LOG_INFO,
+               "cid %d %ux%u %dbits %s bit rates",
+               cid->cid,
+               cid->width, cid->height,
+               cid->bit_depth,
+               cid->interlaced ? "interlaced " :
+                                 "progressive");
+        for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
+            if (!cid->bit_rates[j])
+                break;
+            av_log(avctx, AV_LOG_INFO, " %dM",
+                   cid->bit_rates[j]);
+        }
+        av_log(avctx, AV_LOG_INFO, "\n");
+    }
+}
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 66b0349..e0ab102 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -47,5 +47,6 @@ extern const CIDEntry ff_dnxhd_cid_table[];
 
 int ff_dnxhd_get_cid_table(int cid);
 int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth);
+void ff_dnxhd_list_cid(AVCodecContext *avctx);
 
 #endif /* AVCODEC_DNXHDDATA_H */
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index d2fbc16..b7786af 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -289,14 +289,15 @@ static av_cold int dnxhd_encode_init(AVCodecContext *avctx)
         break;
     default:
         av_log(avctx, AV_LOG_ERROR,
-               "pixel format is incompatible with DNxHD\n");
+               "Pixel format is incompatible with DNxHD, use yuv422p or yuv422p10.\n");
         return AVERROR(EINVAL);
     }
 
     ctx->cid = ff_dnxhd_find_cid(avctx, bit_depth);
     if (!ctx->cid) {
         av_log(avctx, AV_LOG_ERROR,
-               "video parameters incompatible with DNxHD\n");
+               "Video parameters incompatible with DNxHD, available CIDs:\n");
+        ff_dnxhd_list_cid(avctx);
         return AVERROR(EINVAL);
     }
     av_log(avctx, AV_LOG_DEBUG, "cid %d\n", ctx->cid);



More information about the ffmpeg-cvslog mailing list