From patchwork Mon Mar 27 07:52:02 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: 3122 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.44.195 with SMTP id s186csp51993vss; Mon, 27 Mar 2017 00:53:29 -0700 (PDT) X-Received: by 10.28.151.7 with SMTP id z7mr8001391wmd.53.1490601209218; Mon, 27 Mar 2017 00:53:29 -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 7si13560782wrs.18.2017.03.27.00.53.28; Mon, 27 Mar 2017 00:53:29 -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 5F1346883CE; Mon, 27 Mar 2017 10:52:02 +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 6173568836C for ; Mon, 27 Mar 2017 10:51:58 +0300 (EEST) Received: from localhost (golem.pkh.me [local]) by golem.pkh.me (OpenSMTPD) with ESMTPA id 1c2d11a6; Mon, 27 Mar 2017 07:52:08 +0000 (UTC) From: =?UTF-8?q?Cl=C3=A9ment=20B=C5=93sch?= To: ffmpeg-devel@ffmpeg.org Date: Mon, 27 Mar 2017 09:52:02 +0200 Message-Id: <20170327075203.7499-9-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 09/10] lavf: use av_4cc2str() where appropriate 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" --- libavformat/avidec.c | 10 +++------- libavformat/cafdec.c | 6 ++---- libavformat/dxa.c | 6 ++++-- libavformat/iff.c | 4 ++-- libavformat/mlvdec.c | 3 ++- libavformat/mov.c | 5 ++--- libavformat/rmdec.c | 9 ++------- libavformat/wc3movie.c | 10 ++++------ libavformat/westwood_vqa.c | 5 ++--- 9 files changed, 23 insertions(+), 35 deletions(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 31d58052e1..94a4c7041e 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -117,13 +117,9 @@ static const AVMetadataConv avi_metadata_conv[] = { static int avi_load_index(AVFormatContext *s); static int guess_ni_flag(AVFormatContext *s); -#define print_tag(str, tag, size) \ - av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%c%c%c%c size=0x%x\n", \ - avio_tell(pb), str, tag & 0xff, \ - (tag >> 8) & 0xff, \ - (tag >> 16) & 0xff, \ - (tag >> 24) & 0xff, \ - size) +#define print_tag(str, tag, size) \ + av_log(NULL, AV_LOG_TRACE, "pos:%"PRIX64" %s: tag=%s size=0x%x\n", \ + avio_tell(pb), str, av_4cc2str(tag), size) \ static inline int get_duration(AVIStream *ast, int len) { diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index fc85fd9799..679759a241 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -298,11 +298,9 @@ static int read_header(AVFormatContext *s) break; default: -#define _(x) ((x) >= ' ' ? (x) : ' ') av_log(s, AV_LOG_WARNING, - "skipping CAF chunk: %08"PRIX32" (%c%c%c%c), size %"PRId64"\n", - tag, _(tag>>24), _((tag>>16)&0xFF), _((tag>>8)&0xFF), _(tag&0xFF), size); -#undef _ + "skipping CAF chunk: %08"PRIX32" (%s), size %"PRId64"\n", + tag, av_4cc2str(av_bswap32(tag)), size); case MKBETAG('f','r','e','e'): if (size < 0) return AVERROR_INVALIDDATA; diff --git a/libavformat/dxa.c b/libavformat/dxa.c index 162838c135..23b4b52492 100644 --- a/libavformat/dxa.c +++ b/libavformat/dxa.c @@ -171,11 +171,13 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) } avio_seek(s->pb, c->vidpos, SEEK_SET); while(!avio_feof(s->pb) && c->frames){ + uint32_t tag; if ((ret = avio_read(s->pb, buf, 4)) != 4) { av_log(s, AV_LOG_ERROR, "failed reading chunk type\n"); return ret < 0 ? ret : AVERROR_INVALIDDATA; } - switch(AV_RL32(buf)){ + tag = AV_RL32(buf); + switch (tag) { case MKTAG('N', 'U', 'L', 'L'): if(av_new_packet(pkt, 4 + pal_size) < 0) return AVERROR(ENOMEM); @@ -217,7 +219,7 @@ static int dxa_read_packet(AVFormatContext *s, AVPacket *pkt) c->readvid = 0; return 0; default: - av_log(s, AV_LOG_ERROR, "Unknown tag %c%c%c%c\n", buf[0], buf[1], buf[2], buf[3]); + av_log(s, AV_LOG_ERROR, "Unknown tag %s\n", av_4cc2str(tag)); return AVERROR_INVALIDDATA; } } diff --git a/libavformat/iff.c b/libavformat/iff.c index 29fb7bf139..33d46aef3c 100644 --- a/libavformat/iff.c +++ b/libavformat/iff.c @@ -296,8 +296,8 @@ static int parse_dsd_prop(AVFormatContext *s, AVStream *st, uint64_t eof) st->codecpar->codec_tag = tag = avio_rl32(pb); st->codecpar->codec_id = ff_codec_get_id(dsd_codec_tags, tag); if (!st->codecpar->codec_id) { - av_log(s, AV_LOG_ERROR, "'%c%c%c%c' compression is not supported\n", - tag&0xFF, (tag>>8)&0xFF, (tag>>16)&0xFF, (tag>>24)&0xFF); + av_log(s, AV_LOG_ERROR, "'%s' compression is not supported\n", + av_4cc2str(tag)); return AVERROR_PATCHWELCOME; } break; diff --git a/libavformat/mlvdec.c b/libavformat/mlvdec.c index 90c3779e44..b6fbfaa920 100644 --- a/libavformat/mlvdec.c +++ b/libavformat/mlvdec.c @@ -242,7 +242,8 @@ static int scan_file(AVFormatContext *avctx, AVStream *vst, AVStream *ast, int f } else if (type == MKTAG('N','U','L','L')) { } else if (type == MKTAG('M','L','V','I')) { /* occurs when MLV and Mnn files are concatenated */ } else { - av_log(avctx, AV_LOG_INFO, "unsupported tag %c%c%c%c, size %u\n", type&0xFF, (type>>8)&0xFF, (type>>16)&0xFF, (type>>24)&0xFF, size); + av_log(avctx, AV_LOG_INFO, "unsupported tag %s, size %u\n", + av_4cc2str(type), size); } avio_skip(pb, size); } diff --git a/libavformat/mov.c b/libavformat/mov.c index 2fce5a6835..e2474a10da 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2284,9 +2284,8 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) id = mov_codec_id(st, format); av_log(c->fc, AV_LOG_TRACE, - "size=%"PRId64" 4CC= %c%c%c%c/0x%08x codec_type=%d\n", size, - (format >> 0) & 0xff, (format >> 8) & 0xff, (format >> 16) & 0xff, - (format >> 24) & 0xff, format, st->codecpar->codec_type); + "size=%"PRId64" 4CC=%s/0x%08x codec_type=%d\n", size, + av_4cc2str(format), format, st->codecpar->codec_type); if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) { st->codecpar->codec_id = id; diff --git a/libavformat/rmdec.c b/libavformat/rmdec.c index e6a1fe8842..56f2f63752 100644 --- a/libavformat/rmdec.c +++ b/libavformat/rmdec.c @@ -564,13 +564,8 @@ static int rm_read_header(AVFormatContext *s) tag = avio_rl32(pb); tag_size = avio_rb32(pb); avio_rb16(pb); - av_log(s, AV_LOG_TRACE, "tag=%c%c%c%c (%08x) size=%d\n", - (tag ) & 0xff, - (tag >> 8) & 0xff, - (tag >> 16) & 0xff, - (tag >> 24) & 0xff, - tag, - tag_size); + av_log(s, AV_LOG_TRACE, "tag=%s size=%d\n", + av_4cc2str(tag), tag_size); if (tag_size < 10 && tag != MKTAG('D', 'A', 'T', 'A')) goto fail; switch(tag) { diff --git a/libavformat/wc3movie.c b/libavformat/wc3movie.c index d8fc18eb5f..e298f26608 100644 --- a/libavformat/wc3movie.c +++ b/libavformat/wc3movie.c @@ -150,9 +150,8 @@ static int wc3_read_header(AVFormatContext *s) break; default: - av_log(s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", - (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24), - (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24)); + av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n", + av_4cc2str(fourcc_tag)); return AVERROR_INVALIDDATA; } @@ -274,9 +273,8 @@ static int wc3_read_packet(AVFormatContext *s, break; default: - av_log (s, AV_LOG_ERROR, " unrecognized WC3 chunk: %c%c%c%c (0x%02X%02X%02X%02X)\n", - (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24), - (uint8_t)fourcc_tag, (uint8_t)(fourcc_tag >> 8), (uint8_t)(fourcc_tag >> 16), (uint8_t)(fourcc_tag >> 24)); + av_log(s, AV_LOG_ERROR, "unrecognized WC3 chunk: %s\n", + av_4cc2str(fourcc_tag)); ret = AVERROR_INVALIDDATA; packet_read = 1; break; diff --git a/libavformat/westwood_vqa.c b/libavformat/westwood_vqa.c index 3635c6ab36..b1ff65c0d5 100644 --- a/libavformat/westwood_vqa.c +++ b/libavformat/westwood_vqa.c @@ -144,9 +144,8 @@ static int wsvqa_read_header(AVFormatContext *s) break; default: - av_log (s, AV_LOG_ERROR, " note: unknown chunk seen (%c%c%c%c)\n", - scratch[0], scratch[1], - scratch[2], scratch[3]); + av_log(s, AV_LOG_ERROR, " note: unknown chunk seen (%s)\n", + av_4cc2str(chunk_tag)); break; }