Print "NOPTS" when AV_NOPTS_VALUE is encountered during seek regression tests.

This makes the output nicely aligned even in for those cases, and might
also avoid some issues with printf implementations that can not handle well
very large float values (e.g. msvcrt without MinGW wrapper IIRC).

Originally committed as revision 20334 to svn://svn.ffmpeg.org/ffmpeg/trunk
release/0.6
Reimar Döffinger 15 years ago
parent 711e69a730
commit 2bc70a7681
  1. 614
      tests/seek.regression.ref
  2. 21
      tests/seek_test.c

File diff suppressed because it is too large Load Diff

@ -22,6 +22,7 @@
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "libavutil/common.h"
#include "libavformat/avformat.h"
@ -45,6 +46,17 @@ static const char *ret_str(int v)
}
}
static void ts_str(char buffer[60], int64_t ts, AVRational base)
{
double tsval;
if (ts == AV_NOPTS_VALUE) {
strcpy(buffer, " NOPTS ");
return;
}
tsval = ts * av_q2d(base);
snprintf(buffer, 60, "%9f", tsval);
}
int main(int argc, char **argv)
{
const char *filename;
@ -89,13 +101,17 @@ int main(int argc, char **argv)
for(i=0; ; i++){
AVPacket pkt;
AVStream *av_uninit(st);
char ts_buf[60];
memset(&pkt, 0, sizeof(pkt));
if(ret>=0){
ret= av_read_frame(ic, &pkt);
if(ret>=0){
char dts_buf[60];
st= ic->streams[pkt.stream_index];
printf("ret:%-10s st:%2d flags:%d dts:%9f pts:%9f pos:%7" PRId64 " size:%6d", ret_str(ret), pkt.stream_index, pkt.flags, pkt.dts*av_q2d(st->time_base), pkt.pts*av_q2d(st->time_base), pkt.pos, pkt.size);
ts_str(dts_buf, pkt.dts, st->time_base);
ts_str(ts_buf, pkt.pts, st->time_base);
printf("ret:%-10s st:%2d flags:%d dts:%s pts:%s pos:%7" PRId64 " size:%6d", ret_str(ret), pkt.stream_index, pkt.flags, dts_buf, ts_buf, pkt.pos, pkt.size);
} else
printf("ret:%s", ret_str(ret)); // necessary to avoid trailing whitespace
printf("\n");
@ -112,7 +128,8 @@ int main(int argc, char **argv)
//FIXME fully test the new seek API
if(i&1) ret = avformat_seek_file(ic, stream_id, INT64_MIN, timestamp, timestamp, 0);
else ret = avformat_seek_file(ic, stream_id, timestamp, timestamp, INT64_MAX, 0);
printf("ret:%-10s st:%2d flags:%d ts:%9f\n", ret_str(ret), stream_id, i&1, timestamp*(stream_id<0 ? 1.0/AV_TIME_BASE : av_q2d(st->time_base)));
ts_str(ts_buf, timestamp, stream_id < 0 ? AV_TIME_BASE_Q : st->time_base);
printf("ret:%-10s st:%2d flags:%d ts:%s\n", ret_str(ret), stream_id, i&1, ts_buf);
}
return 0;

Loading…
Cancel
Save