comparison utils.c @ 881:91dcb9da9be6 libavformat

use PRIxN, %zd, %td formats where needed
author mru
date Mon, 12 Dec 2005 01:56:46 +0000
parents 8ff4e8ef8124
children 7a7a6eda769d
comparison
equal deleted inserted replaced
880:21a5cb38dd5e 881:91dcb9da9be6
1272 1272
1273 if (stream_index < 0) 1273 if (stream_index < 0)
1274 return -1; 1274 return -1;
1275 1275
1276 #ifdef DEBUG_SEEK 1276 #ifdef DEBUG_SEEK
1277 av_log(s, AV_LOG_DEBUG, "read_seek: %d %lld\n", stream_index, target_ts); 1277 av_log(s, AV_LOG_DEBUG, "read_seek: %d %"PRId64"\n", stream_index, target_ts);
1278 #endif 1278 #endif
1279 1279
1280 ts_max= 1280 ts_max=
1281 ts_min= AV_NOPTS_VALUE; 1281 ts_min= AV_NOPTS_VALUE;
1282 pos_limit= -1; //gcc falsely says it may be uninitalized 1282 pos_limit= -1; //gcc falsely says it may be uninitalized
1291 1291
1292 if(e->timestamp <= target_ts || e->pos == e->min_distance){ 1292 if(e->timestamp <= target_ts || e->pos == e->min_distance){
1293 pos_min= e->pos; 1293 pos_min= e->pos;
1294 ts_min= e->timestamp; 1294 ts_min= e->timestamp;
1295 #ifdef DEBUG_SEEK 1295 #ifdef DEBUG_SEEK
1296 av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%llx dts_min=%lld\n", 1296 av_log(s, AV_LOG_DEBUG, "using cached pos_min=0x%"PRIx64" dts_min=%"PRId64"\n",
1297 pos_min,ts_min); 1297 pos_min,ts_min);
1298 #endif 1298 #endif
1299 }else{ 1299 }else{
1300 assert(index==0); 1300 assert(index==0);
1301 } 1301 }
1307 assert(e->timestamp >= target_ts); 1307 assert(e->timestamp >= target_ts);
1308 pos_max= e->pos; 1308 pos_max= e->pos;
1309 ts_max= e->timestamp; 1309 ts_max= e->timestamp;
1310 pos_limit= pos_max - e->min_distance; 1310 pos_limit= pos_max - e->min_distance;
1311 #ifdef DEBUG_SEEK 1311 #ifdef DEBUG_SEEK
1312 av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%llx pos_limit=0x%llx dts_max=%lld\n", 1312 av_log(s, AV_LOG_DEBUG, "using cached pos_max=0x%"PRIx64" pos_limit=0x%"PRIx64" dts_max=%"PRId64"\n",
1313 pos_max,pos_limit, ts_max); 1313 pos_max,pos_limit, ts_max);
1314 #endif 1314 #endif
1315 } 1315 }
1316 } 1316 }
1317 1317
1348 } 1348 }
1349 1349
1350 no_change=0; 1350 no_change=0;
1351 while (pos_min < pos_limit) { 1351 while (pos_min < pos_limit) {
1352 #ifdef DEBUG_SEEK 1352 #ifdef DEBUG_SEEK
1353 av_log(s, AV_LOG_DEBUG, "pos_min=0x%llx pos_max=0x%llx dts_min=%lld dts_max=%lld\n", 1353 av_log(s, AV_LOG_DEBUG, "pos_min=0x%"PRIx64" pos_max=0x%"PRIx64" dts_min=%"PRId64" dts_max=%"PRId64"\n",
1354 pos_min, pos_max, 1354 pos_min, pos_max,
1355 ts_min, ts_max); 1355 ts_min, ts_max);
1356 #endif 1356 #endif
1357 assert(pos_limit <= pos_max); 1357 assert(pos_limit <= pos_max);
1358 1358
1378 if(pos == pos_max) 1378 if(pos == pos_max)
1379 no_change++; 1379 no_change++;
1380 else 1380 else
1381 no_change=0; 1381 no_change=0;
1382 #ifdef DEBUG_SEEK 1382 #ifdef DEBUG_SEEK
1383 av_log(s, AV_LOG_DEBUG, "%Ld %Ld %Ld / %Ld %Ld %Ld target:%Ld limit:%Ld start:%Ld noc:%d\n", pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, start_pos, no_change); 1383 av_log(s, AV_LOG_DEBUG, "%"PRId64" %"PRId64" %"PRId64" / %"PRId64" %"PRId64" %"PRId64" target:%"PRId64" limit:%"PRId64" start:%"PRId64" noc:%d\n", pos_min, pos, pos_max, ts_min, ts, ts_max, target_ts, pos_limit, start_pos, no_change);
1384 #endif 1384 #endif
1385 assert(ts != AV_NOPTS_VALUE); 1385 assert(ts != AV_NOPTS_VALUE);
1386 if (target_ts <= ts) { 1386 if (target_ts <= ts) {
1387 pos_limit = start_pos - 1; 1387 pos_limit = start_pos - 1;
1388 pos_max = pos; 1388 pos_max = pos;
1399 #ifdef DEBUG_SEEK 1399 #ifdef DEBUG_SEEK
1400 pos_min = pos; 1400 pos_min = pos;
1401 ts_min = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX); 1401 ts_min = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX);
1402 pos_min++; 1402 pos_min++;
1403 ts_max = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX); 1403 ts_max = avif->read_timestamp(s, stream_index, &pos_min, INT64_MAX);
1404 av_log(s, AV_LOG_DEBUG, "pos=0x%llx %lld<=%lld<=%lld\n", 1404 av_log(s, AV_LOG_DEBUG, "pos=0x%"PRIx64" %"PRId64"<=%"PRId64"<=%"PRId64"\n",
1405 pos, ts_min, target_ts, ts_max); 1405 pos, ts_min, target_ts, ts_max);
1406 #endif 1406 #endif
1407 /* do the seek */ 1407 /* do the seek */
1408 url_fseek(&s->pb, pos, SEEK_SET); 1408 url_fseek(&s->pb, pos, SEEK_SET);
1409 1409
2322 }else 2322 }else
2323 pkt->dts= pkt->pts; 2323 pkt->dts= pkt->pts;
2324 } 2324 }
2325 2325
2326 if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){ 2326 if(st->cur_dts && st->cur_dts != AV_NOPTS_VALUE && st->cur_dts >= pkt->dts){
2327 av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %Ld >= %Ld\n", st->cur_dts, pkt->dts); 2327 av_log(NULL, AV_LOG_ERROR, "error, non monotone timestamps %"PRId64" >= %"PRId64"\n", st->cur_dts, pkt->dts);
2328 return -1; 2328 return -1;
2329 } 2329 }
2330 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){ 2330 if(pkt->dts != AV_NOPTS_VALUE && pkt->pts != AV_NOPTS_VALUE && pkt->pts < pkt->dts){
2331 av_log(NULL, AV_LOG_ERROR, "error, pts < dts\n"); 2331 av_log(NULL, AV_LOG_ERROR, "error, pts < dts\n");
2332 return -1; 2332 return -1;