From patchwork Mon Mar 27 07:51:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?Q2zDqW1lbnQgQsWTc2No?= X-Patchwork-Id: 3116 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp51792vss; Mon, 27 Mar 2017 00:52:34 -0700 (PDT) X-Received: by 10.223.139.83 with SMTP id v19mr17986725wra.142.1490601154142; Mon, 27 Mar 2017 00:52:34 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b64si13207156wmg.75.2017.03.27.00.52.33; Mon, 27 Mar 2017 00:52:34 -0700 (PDT) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id ADAC4688371; Mon, 27 Mar 2017 10:51:56 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from golem.pkh.me (LStLambert-657-1-117-164.w92-154.abo.wanadoo.fr [92.154.28.164]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 7F7A5688355 for ; Mon, 27 Mar 2017 10:51:50 +0300 (EEST) Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id a07738a9; Mon, 27 Mar 2017 07:52:04 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Mar 2017 09:51:56 +0200 Message-Id: <20170327075203.7499-3-u@pkh.me> X-Mailer: git-send-email 2.12.0 In-Reply-To: <20170327075203.7499-1-u@pkh.me> References: <20170327075203.7499-1-u@pkh.me> Subject: [FFmpeg-devel] [PATCH 03/10] lavc: fix usages of av_get_codec_tag_string() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavcodec/dds.c | 12 ++++-------- libavcodec/mjpegdec.c | 8 +++----- libavcodec/mmaldec.c | 15 ++++++--------- libavcodec/sheervideo.c | 4 +--- libavcodec/utils.c | 9 +++------ 5 files changed, 17 insertions(+), 31 deletions(-) diff --git a/libavcodec/dds.c b/libavcodec/dds.c index fa0f34d7e7..1cb04bc363 100644 --- a/libavcodec/dds.c +++ b/libavcodec/dds.c @@ -117,7 +117,6 @@ static int parse_pixel_format(AVCodecContext *avctx) { DDSContext *ctx = avctx->priv_data; GetByteContext *gbc = &ctx->gbc; - char buf[32]; uint32_t flags, fourcc, gimp_tag; enum DDSDXGIFormat dxgi; int size, bpp, r, g, b, a; @@ -161,13 +160,10 @@ static int parse_pixel_format(AVCodecContext *avctx) bytestream2_skip(gbc, 4); // caps4 bytestream2_skip(gbc, 4); // reserved2 - av_get_codec_tag_string(buf, sizeof(buf), fourcc); av_log(avctx, AV_LOG_VERBOSE, "fourcc %s bpp %d " - "r 0x%x g 0x%x b 0x%x a 0x%x\n", buf, bpp, r, g, b, a); - if (gimp_tag) { - av_get_codec_tag_string(buf, sizeof(buf), gimp_tag); - av_log(avctx, AV_LOG_VERBOSE, "and GIMP-DDS tag %s\n", buf); - } + "r 0x%x g 0x%x b 0x%x a 0x%x\n", av_4cc2str(fourcc), bpp, r, g, b, a); + if (gimp_tag) + av_log(avctx, AV_LOG_VERBOSE, "and GIMP-DDS tag %s\n", av_4cc2str(gimp_tag)); if (ctx->compressed) avctx->pix_fmt = AV_PIX_FMT_RGBA; @@ -344,7 +340,7 @@ static int parse_pixel_format(AVCodecContext *avctx) } break; default: - av_log(avctx, AV_LOG_ERROR, "Unsupported %s fourcc.\n", buf); + av_log(avctx, AV_LOG_ERROR, "Unsupported %s fourcc.\n", av_4cc2str(fourcc)); return AVERROR_INVALIDDATA; } } else if (ctx->paletted) { diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index f26e8a3f9a..3d049c1840 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -1649,11 +1649,9 @@ static int mjpeg_decode_app(MJpegDecodeContext *s) id = get_bits_long(&s->gb, 32); len -= 6; - if (s->avctx->debug & FF_DEBUG_STARTCODE) { - char id_str[32]; - av_get_codec_tag_string(id_str, sizeof(id_str), av_bswap32(id)); - av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", id_str, id, len); - } + if (s->avctx->debug & FF_DEBUG_STARTCODE) + av_log(s->avctx, AV_LOG_DEBUG, "APPx (%s / %8X) len=%d\n", + av_4cc2str(av_bswap32(id)), id, len); /* Buggy AVID, it puts EOI only at every 10th frame. */ /* Also, this fourcc is used by non-avid files too, it holds some diff --git a/libavcodec/mmaldec.c b/libavcodec/mmaldec.c index 284f26d6fe..227f7f3b96 100644 --- a/libavcodec/mmaldec.c +++ b/libavcodec/mmaldec.c @@ -228,9 +228,8 @@ static void control_port_cb(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buffer) status = *(uint32_t *)buffer->data; av_log(avctx, AV_LOG_ERROR, "MMAL error %d on control port\n", (int)status); } else { - char s[20]; - av_get_codec_tag_string(s, sizeof(s), buffer->cmd); - av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on control port\n", s); + av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on control port\n", + av_4cc2str(buffer->cmd)); } mmal_buffer_header_release(buffer); @@ -352,7 +351,6 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) MMAL_STATUS_T status; MMAL_ES_FORMAT_T *format_in; MMAL_COMPONENT_T *decoder; - char tmp[32]; int ret = 0; bcm_host_init(); @@ -399,8 +397,8 @@ static av_cold int ffmmal_init_decoder(AVCodecContext *avctx) format_in->es->video.par.den = avctx->sample_aspect_ratio.den; format_in->flags = MMAL_ES_FORMAT_FLAG_FRAMED; - av_get_codec_tag_string(tmp, sizeof(tmp), format_in->encoding); - av_log(avctx, AV_LOG_DEBUG, "Using MMAL %s encoding.\n", tmp); + av_log(avctx, AV_LOG_DEBUG, "Using MMAL %s encoding.\n", + av_4cc2str(format_in->encoding)); #if HAVE_MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS if (mmal_port_parameter_set_uint32(decoder->input[0], MMAL_PARAMETER_VIDEO_MAX_NUM_CALLBACKS, @@ -742,9 +740,8 @@ static int ffmmal_read_frame(AVCodecContext *avctx, AVFrame *frame, int *got_fra mmal_buffer_header_release(buffer); continue; } else if (buffer->cmd) { - char s[20]; - av_get_codec_tag_string(s, sizeof(s), buffer->cmd); - av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", s); + av_log(avctx, AV_LOG_WARNING, "Unknown MMAL event %s on output port\n", + av_4cc2str(buffer->cmd)); goto done; } else if (buffer->length == 0) { // Unused output buffer that got drained after format change. diff --git a/libavcodec/sheervideo.c b/libavcodec/sheervideo.c index 9d2da7ffb4..4c8d4eb0b3 100644 --- a/libavcodec/sheervideo.c +++ b/libavcodec/sheervideo.c @@ -2879,7 +2879,6 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *p = data; GetBitContext gb; unsigned format; - char format_str[32]; int ret; if (avpkt->size <= 20) @@ -2891,8 +2890,7 @@ static int decode_frame(AVCodecContext *avctx, s->alt = 0; format = AV_RL32(avpkt->data + 16); - av_get_codec_tag_string(format_str, sizeof(format_str), format); - av_log(avctx, AV_LOG_DEBUG, "format: %s\n", format_str); + av_log(avctx, AV_LOG_DEBUG, "format: %s\n", av_4cc2str(format)); switch (format) { case MKTAG(' ', 'R', 'G', 'B'): avctx->pix_fmt = AV_PIX_FMT_RGB0; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 365ee26056..64fc197252 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3256,12 +3256,9 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) ", %d reference frame%s", enc->refs, enc->refs > 1 ? "s" : ""); - if (enc->codec_tag) { - char tag_buf[32]; - av_get_codec_tag_string(tag_buf, sizeof(tag_buf), enc->codec_tag); - snprintf(buf + strlen(buf), buf_size - strlen(buf), - " (%s / 0x%04X)", tag_buf, enc->codec_tag); - } + if (enc->codec_tag) + snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s / 0x%04X)", + av_4cc2str(enc->codec_tag), enc->codec_tag); switch (enc->codec_type) { case AVMEDIA_TYPE_VIDEO: