Revision a828d48c tests/seek_test.c

View differences:

tests/seek_test.c
30 30
#undef printf
31 31
#undef fprintf
32 32

  
33
static char buffer[20];
34

  
35
static const char *ret_str(int v)
36
{
37
    switch (v) {
38
    case AVERROR_EOF:     return "-EOF";
39
    case AVERROR(EIO):    return "-EIO";
40
    case AVERROR(ENOMEM): return "-ENOMEM";
41
    case AVERROR(EINVAL): return "-EINVAL";
42
    default:
43
        snprintf(buffer, sizeof(buffer), "%2d", v);
44
        return buffer;
45
    }
46
}
47

  
33 48
int main(int argc, char **argv)
34 49
{
35 50
    const char *filename;
......
78 93
        memset(&pkt, 0, sizeof(pkt));
79 94
        if(ret>=0){
80 95
            ret= av_read_frame(ic, &pkt);
81
            printf("ret:%2d", ret);
96
            printf("ret:%s", ret_str(ret));
82 97
            if(ret>=0){
83 98
                st= ic->streams[pkt.stream_index];
84 99
                printf(" st:%2d dts:%f pts:%f pos:%" PRId64 " size:%d flags:%d", pkt.stream_index, pkt.dts*av_q2d(st->time_base), pkt.pts*av_q2d(st->time_base), pkt.pos, pkt.size, pkt.flags);
......
97 112
        //FIXME fully test the new seek API
98 113
        if(i&1) ret = avformat_seek_file(ic, stream_id, INT64_MIN, timestamp, timestamp, 0);
99 114
        else    ret = avformat_seek_file(ic, stream_id, timestamp, timestamp, INT64_MAX, 0);
100
        printf("ret:%2d st:%2d ts:%f flags:%d\n", ret, stream_id, timestamp*(stream_id<0 ? 1.0/AV_TIME_BASE : av_q2d(st->time_base)), i&1);
115
        printf("ret:%s st:%2d ts:%f flags:%d\n", ret_str(ret), stream_id, timestamp*(stream_id<0 ? 1.0/AV_TIME_BASE : av_q2d(st->time_base)), i&1);
101 116
    }
102 117

  
103 118
    return 0;

Also available in: Unified diff