]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/libopenh264enc.c
libopenh264: Log debug messages to a non-null context
[ffmpeg] / libavcodec / libopenh264enc.c
index 150b5f2f6d9cc6d868e7e85e3e6bad2962425926..459a0ef2290786d04128dca51fc3f853876c6f09 100644 (file)
@@ -69,14 +69,12 @@ static av_cold int svc_encode_init(AVCodecContext *avctx)
     SVCContext *s = avctx->priv_data;
     SEncParamExt param = { 0 };
     int err = AVERROR_UNKNOWN;
-    av_unused OpenH264Version libver;
-    (void)g_strCodecVer; // Avoid warnings due to unused static members from codec_ver.h
 
     // Mingw GCC < 4.7 on x86_32 uses an incorrect/buggy ABI for the WelsGetCodecVersion
     // function (for functions returning larger structs), thus skip the check in those
     // configurations.
 #if !defined(_WIN32) || !defined(__GNUC__) || !ARCH_X86_32 || AV_GCC_VERSION_AT_LEAST(4, 7)
-    libver = WelsGetCodecVersion();
+    OpenH264Version libver = WelsGetCodecVersion();
     if (memcmp(&libver, &g_stCodecVersion, sizeof(libver))) {
         av_log(avctx, AV_LOG_ERROR, "Incorrect library version loaded\n");
         return AVERROR(EINVAL);
@@ -182,7 +180,7 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
         return 0;
     }
     first_layer = 0;
-    // Normal frames are returned with one single layers, while IDR
+    // Normal frames are returned with one single layer, while IDR
     // frames have two layers, where the first layer contains the SPS/PPS.
     // If using global headers, don't include the SPS/PPS in the returned
     // packet - thus, only return one layer.
@@ -194,7 +192,7 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
             layer_size[layer] += fbi.sLayerInfo[layer].pNalLengthInByte[i];
         size += layer_size[layer];
     }
-    av_log(NULL, AV_LOG_DEBUG, "%d slices\n", fbi.sLayerInfo[fbi.iLayerNum - 1].iNalCount);
+    av_log(avctx, AV_LOG_DEBUG, "%d slices\n", fbi.sLayerInfo[fbi.iLayerNum - 1].iNalCount);
 
     if ((ret = ff_alloc_packet(avpkt, size))) {
         av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
@@ -214,6 +212,7 @@ static int svc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
 
 AVCodec ff_libopenh264_encoder = {
     .name           = "libopenh264",
+    .long_name      = NULL_IF_CONFIG_SMALL("OpenH264 H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10"),
     .type           = AVMEDIA_TYPE_VIDEO,
     .id             = AV_CODEC_ID_H264,
     .priv_data_size = sizeof(SVCContext),
@@ -223,6 +222,5 @@ AVCodec ff_libopenh264_encoder = {
     .capabilities   = CODEC_CAP_AUTO_THREADS,
     .pix_fmts       = (const enum PixelFormat[]){ AV_PIX_FMT_YUV420P,
                                                   AV_PIX_FMT_NONE },
-    .long_name      = NULL_IF_CONFIG_SMALL("OpenH264"),
     .priv_class     = &class,
 };