[FFmpeg-cvslog] lavc/dnxhdenc: print valid profiles when codec parameters are invalid

Matthieu Bouron git at videolan.org
Sun Jan 27 18:48:13 CET 2013


ffmpeg | branch: master | Matthieu Bouron <matthieu.bouron at gmail.com> | Sat Jan 26 12:46:01 2013 +0100| [9d602a0b0e955ac8553b16fc1b98731d66fdde2b] | committer: Michael Niedermayer

lavc/dnxhdenc: print valid profiles when codec parameters are invalid

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/dnxhddata.c |   16 ++++++++++++++++
 libavcodec/dnxhddata.h |    1 +
 libavcodec/dnxhdenc.c  |    3 ++-
 3 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dnxhddata.c b/libavcodec/dnxhddata.c
index 71cb333..669b806 100644
--- a/libavcodec/dnxhddata.c
+++ b/libavcodec/dnxhddata.c
@@ -1064,3 +1064,19 @@ int ff_dnxhd_find_cid(AVCodecContext *avctx, int bit_depth)
     }
     return 0;
 }
+
+void ff_dnxhd_print_profiles(AVCodecContext *avctx, int loglevel)
+{
+    int i, j;
+    for (i = 0; i < FF_ARRAY_ELEMS(ff_dnxhd_cid_table); i++) {
+        const CIDEntry *cid = &ff_dnxhd_cid_table[i];
+        for (j = 0; j < FF_ARRAY_ELEMS(cid->bit_rates); j++) {
+            if (!cid->bit_rates[j])
+                break;
+
+            av_log(avctx, loglevel, "Frame size: %dx%d%c; bitrate: %dMbps; pixel format: %s; framerate: %d/%d\n",
+                   cid->width, cid->height, cid->interlaced ? 'i' : 'p', cid->bit_rates[j],
+                   cid->bit_depth == 10 ? "yuv422p10" : "yuv422p", cid->frame_rates[j].num, cid->frame_rates[j].den);
+        }
+    }
+}
diff --git a/libavcodec/dnxhddata.h b/libavcodec/dnxhddata.h
index 7055e1e..b8bcb21 100644
--- a/libavcodec/dnxhddata.h
+++ b/libavcodec/dnxhddata.h
@@ -50,6 +50,7 @@ extern av_export 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_print_profiles(AVCodecContext *avctx, int loglevel);
 
 int avpriv_dnxhd_get_frame_size(int cid);
 
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 5ad6164..51f2af0 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -266,7 +266,8 @@ static int dnxhd_encode_init(AVCodecContext *avctx)
 
     ctx->cid = ff_dnxhd_find_cid(avctx, bit_depth);
     if (!ctx->cid) {
-        av_log(avctx, AV_LOG_ERROR, "video parameters incompatible with DNxHD\n");
+        av_log(avctx, AV_LOG_ERROR, "video parameters incompatible with DNxHD. Valid DNxHD profiles:\n");
+        ff_dnxhd_print_profiles(avctx, AV_LOG_ERROR);
         return -1;
     }
     av_log(avctx, AV_LOG_DEBUG, "cid %d\n", ctx->cid);



More information about the ffmpeg-cvslog mailing list