[FFmpeg-cvslog] qsvenc: print warnings from encode/init

Anton Khirnov git at videolan.org
Sun Mar 12 18:03:39 EET 2017


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Thu Jul 14 12:56:35 2016 +0200| [8e07c22e508b349d145b9f142aa3ee8b3ce1d3a4] | committer: Anton Khirnov

qsvenc: print warnings from encode/init

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

 libavcodec/qsv.c          | 10 ++++++++++
 libavcodec/qsv_internal.h |  3 +++
 libavcodec/qsvenc.c       |  6 ++++++
 3 files changed, 19 insertions(+)

diff --git a/libavcodec/qsv.c b/libavcodec/qsv.c
index 14f16bc..9119586 100644
--- a/libavcodec/qsv.c
+++ b/libavcodec/qsv.c
@@ -117,6 +117,16 @@ int ff_qsv_print_error(void *log_ctx, mfxStatus err,
     return ret;
 }
 
+int ff_qsv_print_warning(void *log_ctx, mfxStatus err,
+                         const char *warning_string)
+{
+    const char *desc;
+    int ret;
+    ret = ff_qsv_map_error(err, &desc);
+    av_log(log_ctx, AV_LOG_WARNING, "%s: %s (%d)\n", warning_string, desc, err);
+    return ret;
+}
+
 int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc)
 {
     switch (format) {
diff --git a/libavcodec/qsv_internal.h b/libavcodec/qsv_internal.h
index 03b2f65..41f4c3d 100644
--- a/libavcodec/qsv_internal.h
+++ b/libavcodec/qsv_internal.h
@@ -62,6 +62,9 @@ int ff_qsv_map_error(mfxStatus mfx_err, const char **desc);
 int ff_qsv_print_error(void *log_ctx, mfxStatus err,
                        const char *error_string);
 
+int ff_qsv_print_warning(void *log_ctx, mfxStatus err,
+                         const char *warning_string);
+
 int ff_qsv_codec_id_to_mfx(enum AVCodecID codec_id);
 
 int ff_qsv_map_pixfmt(enum AVPixelFormat format, uint32_t *fourcc);
diff --git a/libavcodec/qsvenc.c b/libavcodec/qsvenc.c
index 4697e1d..ba07db6 100644
--- a/libavcodec/qsvenc.c
+++ b/libavcodec/qsvenc.c
@@ -794,6 +794,9 @@ int ff_qsv_enc_init(AVCodecContext *avctx, QSVEncContext *q)
     if (ret < 0)
         return ff_qsv_print_error(avctx, ret,
                                   "Error initializing the encoder");
+    else if (ret > 0)
+        ff_qsv_print_warning(avctx, ret,
+                             "Warning in encoder initialization");
 
     ret = qsv_retrieve_enc_params(avctx, q);
     if (ret < 0) {
@@ -974,6 +977,9 @@ static int encode_frame(AVCodecContext *avctx, QSVEncContext *q,
             av_usleep(1);
     } while (ret == MFX_WRN_DEVICE_BUSY || ret == MFX_WRN_IN_EXECUTION);
 
+    if (ret > 0)
+        ff_qsv_print_warning(avctx, ret, "Warning during encoding");
+
     if (ret < 0) {
         av_packet_unref(&new_pkt);
         av_freep(&bs);



More information about the ffmpeg-cvslog mailing list