Revision 873d117e

View differences:

libavformat/oggdec.c
581 581
    int64_t pts = AV_NOPTS_VALUE;
582 582
    int i;
583 583
    url_fseek(bc, *pos_arg, SEEK_SET);
584
    while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
585
        if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
586
            ogg->streams[i].codec && i == stream_index) {
587
            pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
588
            // FIXME: this is the position of the packet after the one with above
589
            // pts.
590
            *pos_arg = url_ftell(bc);
591
            break;
584
    ogg_reset(ogg);
585

  
586
    while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
587
        if (i == stream_index) {
588
            pts = ogg_calc_pts(s, i, NULL);
592 589
        }
590
        if (pts != AV_NOPTS_VALUE)
591
            break;
593 592
    }
594 593
    ogg_reset(ogg);
595 594
    return pts;
tests/ref/seek/lavf.ogg.ref
1 1
ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    125 size:  1364
2 2
ret: 0         st:-1 flags:0  ts:-1.000000
3 3
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
4
ret: 0         st:-1 flags:1  ts: 1.894167
5
ret:-EIO
4
ret:-1         st:-1 flags:1  ts: 1.894167
6 5
ret: 0         st: 0 flags:0  ts: 0.788345
7 6
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  11410 size:  1365
8 7
ret: 0         st: 0 flags:1  ts:-0.317506
9 8
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
10
ret: 0         st:-1 flags:0  ts: 2.576668
11
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
12
ret: 0         st:-1 flags:1  ts: 1.470835
13
ret:-EIO
9
ret:-1         st:-1 flags:0  ts: 2.576668
10
ret:-1         st:-1 flags:1  ts: 1.470835
14 11
ret: 0         st: 0 flags:0  ts: 0.365011
15 12
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   7191 size:  1370
16 13
ret: 0         st: 0 flags:1  ts:-0.740839
17 14
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
18
ret: 0         st:-1 flags:0  ts: 2.153336
19
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
20
ret: 0         st:-1 flags:1  ts: 1.047503
21
ret:-EIO
15
ret:-1         st:-1 flags:0  ts: 2.153336
16
ret:-1         st:-1 flags:1  ts: 1.047503
22 17
ret: 0         st: 0 flags:0  ts:-0.058322
23 18
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
24
ret: 0         st: 0 flags:1  ts: 2.835828
25
ret:-EIO
26
ret: 0         st:-1 flags:0  ts: 1.730004
27
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
19
ret:-1         st: 0 flags:1  ts: 2.835828
20
ret:-1         st:-1 flags:0  ts: 1.730004
28 21
ret: 0         st:-1 flags:1  ts: 0.624171
29 22
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   5768 size:  1390
30 23
ret: 0         st: 0 flags:0  ts:-0.481655
31 24
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
32
ret: 0         st: 0 flags:1  ts: 2.412494
33
ret:-EIO
34
ret: 0         st:-1 flags:0  ts: 1.306672
35
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
25
ret:-1         st: 0 flags:1  ts: 2.412494
26
ret:-1         st:-1 flags:0  ts: 1.306672
36 27
ret: 0         st:-1 flags:1  ts: 0.200839
37 28
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
38 29
ret: 0         st: 0 flags:0  ts:-0.904989
39 30
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
40
ret: 0         st: 0 flags:1  ts: 1.989184
41
ret:-EIO
42
ret: 0         st:-1 flags:0  ts: 0.883340
43
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
31
ret:-1         st: 0 flags:1  ts: 1.989184
32
ret:-1         st:-1 flags:0  ts: 0.883340
44 33
ret: 0         st:-1 flags:1  ts:-0.222493
45 34
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
46
ret: 0         st: 0 flags:0  ts: 2.671678
47
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
48
ret: 0         st: 0 flags:1  ts: 1.565850
49
ret:-EIO
35
ret:-1         st: 0 flags:0  ts: 2.671678
36
ret:-1         st: 0 flags:1  ts: 1.565850
50 37
ret: 0         st:-1 flags:0  ts: 0.460008
51 38
ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   8594 size:  1381
52 39
ret: 0         st:-1 flags:1  ts:-0.645825

Also available in: Unified diff