[FFmpeg-cvslog] r22462 - in trunk: libavformat/oggdec.c tests/ref/seek/lavf.ogg.ref

conrad subversion
Thu Mar 11 08:17:57 CET 2010


Author: conrad
Date: Thu Mar 11 08:17:56 2010
New Revision: 22462

Log:
oggdec: Determine pts and filepos on a packet basis in read_timestamp

This takes into account whether the granule defines the start or end times
of packets, and sets the correct file offset of the associated page.

Modified:
   trunk/libavformat/oggdec.c
   trunk/tests/ref/seek/lavf.ogg.ref

Modified: trunk/libavformat/oggdec.c
==============================================================================
--- trunk/libavformat/oggdec.c	Thu Mar 11 08:17:53 2010	(r22461)
+++ trunk/libavformat/oggdec.c	Thu Mar 11 08:17:56 2010	(r22462)
@@ -581,15 +581,14 @@ ogg_read_timestamp (AVFormatContext * s,
     int64_t pts = AV_NOPTS_VALUE;
     int i;
     url_fseek(bc, *pos_arg, SEEK_SET);
-    while (url_ftell(bc) < pos_limit && !ogg_read_page (s, &i)) {
-        if (ogg->streams[i].granule != -1 && ogg->streams[i].granule != 0 &&
-            ogg->streams[i].codec && i == stream_index) {
-            pts = ogg_gptopts(s, i, ogg->streams[i].granule, NULL);
-            // FIXME: this is the position of the packet after the one with above
-            // pts.
-            *pos_arg = url_ftell(bc);
-            break;
+    ogg_reset(ogg);
+
+    while (url_ftell(bc) < pos_limit && !ogg_packet(s, &i, NULL, NULL, pos_arg)) {
+        if (i == stream_index) {
+            pts = ogg_calc_pts(s, i, NULL);
         }
+        if (pts != AV_NOPTS_VALUE)
+            break;
     }
     ogg_reset(ogg);
     return pts;

Modified: trunk/tests/ref/seek/lavf.ogg.ref
==============================================================================
--- trunk/tests/ref/seek/lavf.ogg.ref	Thu Mar 11 08:17:53 2010	(r22461)
+++ trunk/tests/ref/seek/lavf.ogg.ref	Thu Mar 11 08:17:56 2010	(r22462)
@@ -1,52 +1,39 @@
 ret: 0         st: 0 flags:1 dts: 0.000000 pts: 0.000000 pos:    125 size:  1364
 ret: 0         st:-1 flags:0  ts:-1.000000
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
-ret: 0         st:-1 flags:1  ts: 1.894167
-ret:-EIO
+ret:-1         st:-1 flags:1  ts: 1.894167
 ret: 0         st: 0 flags:0  ts: 0.788345
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  11410 size:  1365
 ret: 0         st: 0 flags:1  ts:-0.317506
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
-ret: 0         st:-1 flags:0  ts: 2.576668
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
-ret: 0         st:-1 flags:1  ts: 1.470835
-ret:-EIO
+ret:-1         st:-1 flags:0  ts: 2.576668
+ret:-1         st:-1 flags:1  ts: 1.470835
 ret: 0         st: 0 flags:0  ts: 0.365011
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   7191 size:  1370
 ret: 0         st: 0 flags:1  ts:-0.740839
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
-ret: 0         st:-1 flags:0  ts: 2.153336
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
-ret: 0         st:-1 flags:1  ts: 1.047503
-ret:-EIO
+ret:-1         st:-1 flags:0  ts: 2.153336
+ret:-1         st:-1 flags:1  ts: 1.047503
 ret: 0         st: 0 flags:0  ts:-0.058322
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
-ret: 0         st: 0 flags:1  ts: 2.835828
-ret:-EIO
-ret: 0         st:-1 flags:0  ts: 1.730004
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
+ret:-1         st: 0 flags:1  ts: 2.835828
+ret:-1         st:-1 flags:0  ts: 1.730004
 ret: 0         st:-1 flags:1  ts: 0.624171
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   5768 size:  1390
 ret: 0         st: 0 flags:0  ts:-0.481655
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
-ret: 0         st: 0 flags:1  ts: 2.412494
-ret:-EIO
-ret: 0         st:-1 flags:0  ts: 1.306672
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
+ret:-1         st: 0 flags:1  ts: 2.412494
+ret:-1         st:-1 flags:0  ts: 1.306672
 ret: 0         st:-1 flags:1  ts: 0.200839
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
 ret: 0         st: 0 flags:0  ts:-0.904989
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   4353 size:  1382
-ret: 0         st: 0 flags:1  ts: 1.989184
-ret:-EIO
-ret: 0         st:-1 flags:0  ts: 0.883340
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
+ret:-1         st: 0 flags:1  ts: 1.989184
+ret:-1         st:-1 flags:0  ts: 0.883340
 ret: 0         st:-1 flags:1  ts:-0.222493
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   1522 size:  1381
-ret: 0         st: 0 flags:0  ts: 2.671678
-ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:  12808 size:  1223
-ret: 0         st: 0 flags:1  ts: 1.565850
-ret:-EIO
+ret:-1         st: 0 flags:0  ts: 2.671678
+ret:-1         st: 0 flags:1  ts: 1.565850
 ret: 0         st:-1 flags:0  ts: 0.460008
 ret: 0         st: 0 flags:1 dts: NOPTS    pts: NOPTS    pos:   8594 size:  1381
 ret: 0         st:-1 flags:1  ts:-0.645825



More information about the ffmpeg-cvslog mailing list