ffmpeg | branch: master | Jun Zhao <mypopy...@gmail.com> | Sun Sep  3 23:06:21 
2023 +0800| [213cba9696c1525d5022d8c3597bddb6fab15379] | committer: Jun Zhao

lavc/videotoolboxenc: Dump the encoder

Dump the encoder, it's will help debug some case

Signed-off-by: Jun Zhao <barryjz...@tencent.com>

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

 libavcodec/videotoolboxenc.c | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index d0a00347b5..2e96990741 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1110,6 +1110,34 @@ static int vtenc_create_encoder(AVCodecContext   *avctx,
         return AVERROR_EXTERNAL;
     }
 
+    // Dump the init encoder
+    {
+        CFStringRef encoderID = NULL;
+        status = VTSessionCopyProperty(vtctx->session,
+                                       kVTCompressionPropertyKey_EncoderID,
+                                       kCFAllocatorDefault,
+                                       &encoderID);
+        if (status == noErr) {
+            CFIndex length   = CFStringGetLength(encoderID);
+            CFIndex max_size = CFStringGetMaximumSizeForEncoding(length, 
kCFStringEncodingUTF8);
+            char *name       = av_malloc(max_size);
+            if (!name) {
+                CFRelease(encoderID);
+                return AVERROR(ENOMEM);
+            }
+
+            CFStringGetCString(encoderID,
+                               name,
+                               max_size,
+                               kCFStringEncodingUTF8);
+            av_log(avctx, AV_LOG_DEBUG, "Init the encoder: %s\n", name);
+
+            av_freep(&name);
+        }
+        if (encoderID != NULL)
+            CFRelease(encoderID);
+    }
+
     if (avctx->flags & AV_CODEC_FLAG_QSCALE && !vtenc_qscale_enabled()) {
         av_log(avctx, AV_LOG_ERROR, "Error: -q:v qscale not available for 
encoder. Use -b:v bitrate instead.\n");
         return AVERROR_EXTERNAL;

_______________________________________________
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog

To unsubscribe, visit link above, or email
ffmpeg-cvslog-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to