Use ISO C printf conversion specifiers where appropriate

This commit is contained in:
Diego Biurrun 2015-12-11 17:29:11 +01:00
parent fbe425c8d2
commit c454dfcff9
10 changed files with 48 additions and 35 deletions

View File

@ -182,7 +182,7 @@ static int build_table(VLC *vlc, int table_nb_bits, int nb_codes,
n = codes[i].bits;
code = codes[i].code;
symbol = codes[i].symbol;
ff_dlog(NULL, "i=%d n=%d code=0x%x\n", i, n, code);
ff_dlog(NULL, "i=%d n=%d code=0x%"PRIx32"\n", i, n, code);
if (n <= table_nb_bits) {
/* no need to add another table */
j = code >> (32 - table_nb_bits);

View File

@ -122,7 +122,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
if (memcmp(buf, header_prefix, 5) && memcmp(buf, header_prefix444, 5)) {
av_log(ctx->avctx, AV_LOG_ERROR,
"unknown header 0x%02X 0x%02X 0x%02X 0x%02X 0x%02X\n",
"unknown header 0x%02"PRIX8" 0x%02"PRIX8" 0x%02"PRIX8" 0x%02"PRIX8" 0x%02"PRIX8"\n",
buf[0], buf[1], buf[2], buf[3], buf[4]);
return AVERROR_INVALIDDATA;
}
@ -131,7 +131,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
frame->interlaced_frame = 1;
frame->top_field_first = first_field ^ ctx->cur_field;
av_log(ctx->avctx, AV_LOG_DEBUG,
"interlaced %d, cur field %d\n", buf[5] & 3, ctx->cur_field);
"interlaced %"PRId8", cur field %d\n", buf[5] & 3, ctx->cur_field);
}
ctx->mbaff = buf[0x6] & 32;
@ -157,7 +157,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
ctx->avctx->pix_fmt = AV_PIX_FMT_YUV422P;
ctx->decode_dct_block = dnxhd_decode_dct_block_8;
} else {
av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%d).\n",
av_log(ctx->avctx, AV_LOG_ERROR, "invalid bit depth value (%"PRId8").\n",
buf[0x21]);
return AVERROR_INVALIDDATA;
}
@ -208,10 +208,10 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame,
for (i = 0; i < ctx->mb_height; i++) {
ctx->mb_scan_index[i] = AV_RB32(buf + 0x170 + (i << 2));
ff_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
ff_dlog(ctx->avctx, "mb scan index %"PRIu32"\n", ctx->mb_scan_index[i]);
if (buf_size < ctx->mb_scan_index[i] + 0x280) {
av_log(ctx->avctx, AV_LOG_ERROR,
"invalid mb scan index (%d < %d).\n",
"invalid mb scan index (%d < %"PRIu32").\n",
buf_size, ctx->mb_scan_index[i] + 0x280);
return AVERROR_INVALIDDATA;
}

View File

@ -270,7 +270,7 @@ static int dv_decode_video_segment(AVCodecContext *avctx, void *arg)
}
if (mb->pos >= 64 && mb->pos < 127)
av_log(avctx, AV_LOG_ERROR,
"AC EOB marker is absent pos=%d\n", mb->pos);
"AC EOB marker is absent pos=%"PRIu8"\n", mb->pos);
block += 64;
mb++;
}

View File

@ -247,7 +247,8 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
alpha[1] = buf[pos + 1] >> 4;
alpha[0] = buf[pos + 1] & 0x0f;
pos += 2;
ff_dlog(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
ff_dlog(NULL, "alpha=%"PRIx8"%"PRIx8"%"PRIx8"%"PRIx8"\n",
alpha[0], alpha[1], alpha[2], alpha[3]);
break;
case 0x05:
case 0x85:
@ -267,7 +268,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
goto fail;
offset1 = AV_RB16(buf + pos);
offset2 = AV_RB16(buf + pos + 2);
ff_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
ff_dlog(NULL, "offset1=0x%04"PRIx64" offset2=0x%04"PRIx64"\n", offset1, offset2);
pos += 4;
break;
case 0x86:
@ -275,7 +276,7 @@ static int decode_dvd_subtitles(DVDSubContext *ctx, AVSubtitle *sub_header,
goto fail;
offset1 = AV_RB32(buf + pos);
offset2 = AV_RB32(buf + pos + 4);
ff_dlog(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
ff_dlog(NULL, "offset1=0x%04"PRIx64" offset2=0x%04"PRIx64"\n", offset1, offset2);
pos += 8;
break;
@ -515,7 +516,7 @@ static int dvdsub_decode(AVCodecContext *avctx,
goto no_subtitle;
#if defined(DEBUG)
ff_dlog(NULL, "start=%d ms end =%d ms\n",
ff_dlog(NULL, "start=%"PRIu32" ms end =%"PRIu32" ms\n",
sub->start_display_time,
sub->end_display_time);
ppm_save("/tmp/a.ppm", sub->rects[0]->data[0],

View File

@ -393,7 +393,8 @@ static int dxv_decode(AVCodecContext *avctx, void *data,
ctx->tex_funct = ctx->texdsp.dxt1_block;
ctx->tex_step = 8;
} else {
av_log(avctx, AV_LOG_ERROR, "Unsupported header (0x%08X)\n.", tag);
av_log(avctx, AV_LOG_ERROR,
"Unsupported header (0x%08"PRIX32")\n.", tag);
return AVERROR_INVALIDDATA;
}
ctx->tex_rat = 1;

View File

@ -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;

View File

@ -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;

View File

@ -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);

View File

@ -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++;
}

View File

@ -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},