From c454dfcff90f0ed39c7b0d4e85664986a8b4476c Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Fri, 11 Dec 2015 17:29:11 +0100 Subject: Use ISO C printf conversion specifiers where appropriate --- libavformat/mov.c | 25 ++++++++++++++----------- libavformat/mov_chan.c | 5 +++-- libavformat/mpegtsenc.c | 2 +- libavformat/nsvdec.c | 22 ++++++++++++++-------- libavformat/rtpenc.c | 3 ++- 5 files changed, 34 insertions(+), 23 deletions(-) (limited to 'libavformat') diff --git a/libavformat/mov.c b/libavformat/mov.c index 0d7ce3da1a..5a46f9440a 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -517,7 +517,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (ret < 0) return ret; dref->volume[volume_len] = 0; - av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %d\n", dref->volume, volume_len); + av_log(c->fc, AV_LOG_DEBUG, "volume %s, len %"PRIu16"\n", + dref->volume, volume_len); avio_skip(pb, 12); @@ -527,14 +528,15 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (ret < 0) return ret; dref->filename[len] = 0; - av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %d\n", dref->filename, len); + av_log(c->fc, AV_LOG_DEBUG, "filename %s, len %"PRIu16"\n", + dref->filename, len); avio_skip(pb, 16); /* read next level up_from_alias/down_to_target */ dref->nlvl_from = avio_rb16(pb); dref->nlvl_to = avio_rb16(pb); - av_log(c->fc, AV_LOG_DEBUG, "nlvl from %d, nlvl to %d\n", + av_log(c->fc, AV_LOG_DEBUG, "nlvl from %"PRId16", nlvl to %"PRId16"\n", dref->nlvl_from, dref->nlvl_to); avio_skip(pb, 16); @@ -544,7 +546,8 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) return AVERROR_EOF; type = avio_rb16(pb); len = avio_rb16(pb); - av_log(c->fc, AV_LOG_DEBUG, "type %d, len %d\n", type, len); + av_log(c->fc, AV_LOG_DEBUG, "type %"PRId16", len %"PRIu16"\n", + type, len); if (len&1) len += 1; if (type == 2) { // absolute path @@ -594,7 +597,7 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom) avio_skip(pb, len); } } else { - av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x08%x size %d\n", + av_log(c->fc, AV_LOG_DEBUG, "Unknown dref type 0x08%"PRIx32" size %"PRIu32"\n", dref->type, size); entries--; i--; @@ -1535,7 +1538,7 @@ static void mov_parse_stsd_audio(MOVContext *c, AVIOContext *pb, st->codecpar->sample_rate = ((avio_rb32(pb) >> 16)); // Read QT version 1 fields. In version 0 these do not exist. - av_log(c->fc, AV_LOG_TRACE, "version =%d, isom =%d\n", version, c->isom); + av_log(c->fc, AV_LOG_TRACE, "version =%"PRIu16", isom =%d\n", version, c->isom); if (!c->isom) { if (version == 1) { sc->samples_per_frame = avio_rb32(pb); @@ -1832,7 +1835,7 @@ 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" format=0x%08x codec_type=%d\n", + "size=%"PRId64" format=0x%08"PRIx32" codec_type=%d\n", size, format, st->codecpar->codec_type); if (st->codecpar->codec_type==AVMEDIA_TYPE_VIDEO) { @@ -2575,14 +2578,14 @@ static int mov_read_trak(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (mov_open_dref(c->fc, &sc->pb, c->fc->filename, dref) < 0) av_log(c->fc, AV_LOG_ERROR, "stream %d, error opening alias: path='%s', dir='%s', " - "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d\n", + "filename='%s', volume='%s', nlvl_from=%"PRId16", nlvl_to=%"PRId16"\n", st->index, dref->path, dref->dir, dref->filename, dref->volume, dref->nlvl_from, dref->nlvl_to); } else { av_log(c->fc, AV_LOG_WARNING, "Skipped opening external track: " "stream %d, alias: path='%s', dir='%s', " - "filename='%s', volume='%s', nlvl_from=%d, nlvl_to=%d." + "filename='%s', volume='%s', nlvl_from=%"PRId16", nlvl_to=%"PRId16"." "Set enable_drefs to allow this.\n", st->index, dref->path, dref->dir, dref->filename, dref->volume, dref->nlvl_from, dref->nlvl_to); @@ -3231,8 +3234,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) a.size = avio_rb32(pb); a.type = avio_rl32(pb); } - av_log(c->fc, AV_LOG_TRACE, "type: %08x '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", - a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); + av_log(c->fc, AV_LOG_TRACE, "type: %08"PRIx32" '%.4s' parent:'%.4s' sz: %"PRId64" %"PRId64" %"PRId64"\n", + a.type, (char*)&a.type, (char*)&atom.type, a.size, total_size, atom.size); total_size += 8; if (a.size == 1) { /* 64 bit extended size */ a.size = avio_rb64(pb) - 8; diff --git a/libavformat/mov_chan.c b/libavformat/mov_chan.c index 19f657ad7c..1b05cdff4e 100644 --- a/libavformat/mov_chan.c +++ b/libavformat/mov_chan.c @@ -556,8 +556,9 @@ int ff_mov_read_chan(AVFormatContext *s, AVIOContext *pb, AVStream *st, bitmap = avio_rb32(pb); num_descr = avio_rb32(pb); - av_log(s, AV_LOG_TRACE, "chan: layout=%u bitmap=%u num_descr=%u\n", - layout_tag, bitmap, num_descr); + av_log(s, AV_LOG_TRACE, + "chan: layout=%"PRIu32" bitmap=%"PRIu32" num_descr=%"PRIu32"\n", + layout_tag, bitmap, num_descr); if (size < 12ULL + num_descr * 20ULL) return 0; diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index a52e684c6f..12c406fd51 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1083,7 +1083,7 @@ static int mpegts_write_packet_internal(AVFormatContext *s, AVPacket *pkt) do { p = avpriv_find_start_code(p, buf_end, &state); - av_log(s, AV_LOG_TRACE, "nal %d\n", state & 0x1f); + av_log(s, AV_LOG_TRACE, "nal %"PRIu32"\n", state & 0x1f); } while (p < buf_end && (state & 0x1f) != 9 && (state & 0x1f) != 5 && (state & 0x1f) != 1); diff --git a/libavformat/nsvdec.c b/libavformat/nsvdec.c index dc81cb64a2..c91d2a15dd 100644 --- a/libavformat/nsvdec.c +++ b/libavformat/nsvdec.c @@ -229,7 +229,7 @@ static int nsv_resync(AVFormatContext *s) v <<= 8; v |= avio_r8(pb); if (i < 8) { - av_log(s, AV_LOG_TRACE, "NSV resync: [%d] = %02x\n", i, v & 0x0FF); + av_log(s, AV_LOG_TRACE, "NSV resync: [%d] = %02"PRIx32"\n", i, v & 0x0FF); } if ((v & 0x0000ffff) == 0xefbe) { /* BEEF */ @@ -398,7 +398,8 @@ static int nsv_parse_NSVs_header(AVFormatContext *s) nsv->avsync = avio_rl16(pb); nsv->framerate = framerate; - av_log(s, AV_LOG_TRACE, "NSV NSVs vsize %dx%d\n", vwidth, vheight); + av_log(s, AV_LOG_TRACE, "NSV NSVs vsize %"PRIu16"x%"PRIu16"\n", + vwidth, vheight); /* XXX change to ap != NULL ? */ if (s->nb_streams == 0) { /* streams not yet published, let's do that */ @@ -543,7 +544,8 @@ null_chunk_retry: asize = avio_rl16(pb); vsize = (vsize << 4) | (auxcount >> 4); auxcount &= 0x0f; - av_log(s, AV_LOG_TRACE, "NSV CHUNK %d aux, %u bytes video, %d bytes audio\n", auxcount, vsize, asize); + av_log(s, AV_LOG_TRACE, "NSV CHUNK %"PRIu8" aux, %"PRIu32" bytes video, %"PRIu16" bytes audio\n", + auxcount, vsize, asize); /* skip aux stuff */ for (i = 0; i < auxcount; i++) { uint32_t av_unused auxtag; @@ -574,7 +576,8 @@ null_chunk_retry: pkt->dts = nst->frame_offset; pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a sync frame */ for (i = 0; i < FFMIN(8, vsize); i++) - av_log(s, AV_LOG_TRACE, "NSV video: [%d] = %02x\n", i, pkt->data[i]); + av_log(s, AV_LOG_TRACE, "NSV video: [%d] = %02"PRIx8"\n", + i, pkt->data[i]); } if(st[NSV_ST_VIDEO]) ((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset++; @@ -594,11 +597,12 @@ null_chunk_retry: if (!channels || !samplerate) return AVERROR_INVALIDDATA; asize-=4; - av_log(s, AV_LOG_TRACE, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); + av_log(s, AV_LOG_TRACE, "NSV RAWAUDIO: bps %"PRIu8", nchan %"PRIu8", srate %"PRIu16"\n", + bps, channels, samplerate); if (fill_header) { st[NSV_ST_AUDIO]->need_parsing = AVSTREAM_PARSE_NONE; /* we know everything */ if (bps != 16) { - av_log(s, AV_LOG_TRACE, "NSV AUDIO bit/sample != 16 (%d)!!!\n", bps); + av_log(s, AV_LOG_TRACE, "NSV AUDIO bit/sample != 16 (%"PRIu8")!!!\n", bps); } bps /= channels; // ??? if (bps == 8) @@ -607,7 +611,8 @@ null_chunk_retry: channels = 1; st[NSV_ST_AUDIO]->codecpar->channels = channels; st[NSV_ST_AUDIO]->codecpar->sample_rate = samplerate; - av_log(s, AV_LOG_TRACE, "NSV RAWAUDIO: bps %d, nchan %d, srate %d\n", bps, channels, samplerate); + av_log(s, AV_LOG_TRACE, "NSV RAWAUDIO: bps %"PRIu8", nchan %"PRIu8", srate %"PRIu16"\n", + bps, channels, samplerate); } } av_get_packet(pb, pkt, asize); @@ -618,7 +623,8 @@ null_chunk_retry: pkt->dts = (((NSVStream*)st[NSV_ST_VIDEO]->priv_data)->frame_offset-1); pkt->dts *= (int64_t)1000 * nsv->framerate.den; pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num; - av_log(s, AV_LOG_TRACE, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts); + av_log(s, AV_LOG_TRACE, "NSV AUDIO: sync:%"PRId16", dts:%"PRId64, + nsv->avsync, pkt->dts); } nst->frame_offset++; } diff --git a/libavformat/rtpenc.c b/libavformat/rtpenc.c index f43be2fe87..28c309ea18 100644 --- a/libavformat/rtpenc.c +++ b/libavformat/rtpenc.c @@ -259,7 +259,8 @@ static void rtcp_send_sr(AVFormatContext *s1, int64_t ntp_time, int bye) RTPMuxContext *s = s1->priv_data; uint32_t rtp_ts; - av_log(s1, AV_LOG_TRACE, "RTCP: %02x %"PRIx64" %x\n", s->payload_type, ntp_time, s->timestamp); + av_log(s1, AV_LOG_TRACE, "RTCP: %02x %"PRIx64" %"PRIx32"\n", + s->payload_type, ntp_time, s->timestamp); s->last_rtcp_ntp_time = ntp_time; rtp_ts = av_rescale_q(ntp_time - s->first_rtcp_ntp_time, (AVRational){1, 1000000}, -- cgit v1.2.3