[FFmpeg-cvslog] r19788 - in trunk: libavformat/mpegts.c tests/seek.regression.ref

schreter subversion
Sun Sep 6 17:59:32 CEST 2009


Author: schreter
Date: Sun Sep  6 17:59:32 2009
New Revision: 19788

Log:
disable new seeking code in mpeg-ts per #ifdef (use old read_seek by default)

Modified:
   trunk/libavformat/mpegts.c
   trunk/tests/seek.regression.ref

Modified: trunk/libavformat/mpegts.c
==============================================================================
--- trunk/libavformat/mpegts.c	Sun Sep  6 11:15:07 2009	(r19787)
+++ trunk/libavformat/mpegts.c	Sun Sep  6 17:59:32 2009	(r19788)
@@ -21,6 +21,7 @@
 
 //#define DEBUG
 //#define DEBUG_SEEK
+//#define USE_SYNCPOINT_SEARCH
 
 #include "libavutil/crc.h"
 #include "libavutil/intreadwrite.h"
@@ -1524,6 +1525,8 @@ static int64_t mpegts_get_pcr(AVFormatCo
     return timestamp;
 }
 
+#ifdef USE_SYNCPOINT_SEARCH
+
 static int read_seek2(AVFormatContext *s,
                       int stream_index,
                       int64_t min_ts,
@@ -1606,6 +1609,33 @@ static int read_seek(AVFormatContext *s,
     return ret;
 }
 
+#else
+
+static int read_seek(AVFormatContext *s, int stream_index, int64_t target_ts, int flags){
+    MpegTSContext *ts = s->priv_data;
+    uint8_t buf[TS_PACKET_SIZE];
+    int64_t pos;
+
+    if(av_seek_frame_binary(s, stream_index, target_ts, flags) < 0)
+        return -1;
+
+    pos= url_ftell(s->pb);
+
+    for(;;) {
+        url_fseek(s->pb, pos, SEEK_SET);
+        if (get_buffer(s->pb, buf, TS_PACKET_SIZE) != TS_PACKET_SIZE)
+            return -1;
+//        pid = AV_RB16(buf + 1) & 0x1fff;
+        if(buf[1] & 0x40) break;
+        pos += ts->raw_packet_size;
+    }
+    url_fseek(s->pb, pos, SEEK_SET);
+
+    return 0;
+}
+
+#endif
+
 /**************************************************************/
 /* parsing functions - called from other demuxers such as RTP */
 
@@ -1670,7 +1700,9 @@ AVInputFormat mpegts_demuxer = {
     read_seek,
     mpegts_get_pcr,
     .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
+#ifdef USE_SYNCPOINT_SEARCH
     .read_seek2 = read_seek2,
+#endif
 };
 
 AVInputFormat mpegtsraw_demuxer = {
@@ -1684,5 +1716,7 @@ AVInputFormat mpegtsraw_demuxer = {
     read_seek,
     mpegts_get_pcr,
     .flags = AVFMT_SHOW_IDS|AVFMT_TS_DISCONT,
+#ifdef USE_SYNCPOINT_SEARCH
     .read_seek2 = read_seek2,
+#endif
 };

Modified: trunk/tests/seek.regression.ref
==============================================================================
--- trunk/tests/seek.regression.ref	Sun Sep  6 11:15:07 2009	(r19787)
+++ trunk/tests/seek.regression.ref	Sun Sep  6 17:59:32 2009	(r19788)
@@ -3599,51 +3599,57 @@ ret:-1 st:-1 ts:-0.645825 flags:1
 tests/data/b-lavf.ts
 ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
 ret: 0 st:-1 ts:-1.000000 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st:-1 ts:1.894167 flags:1
-ret: 0 st: 1 dts:1.457556 pts:1.457556 pos:435596 size:409 flags:1
+ret: 0 st: 0 dts:0.780000 pts:0.820000 pos:65612 size:12623 flags:0
 ret: 0 st: 0 ts:0.788333 flags:0
-ret: 0 st: 0 dts:1.100000 pts:1.140000 pos:189504 size:12236 flags:0
-ret:-1 st: 0 ts:-0.317500 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
+ret: 0 st: 0 ts:-0.317500 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 1 ts:2.576667 flags:0
-ret:-5
+ret: 0 st: 0 dts:0.860000 pts:0.900000 pos:96068 size:13086 flags:0
 ret: 0 st: 1 ts:1.470833 flags:1
-ret: 0 st: 0 dts:1.140000 pts:1.180000 pos:203980 size:24787 flags:1
+ret: 0 st: 0 dts:0.780000 pts:0.820000 pos:65612 size:12623 flags:0
 ret: 0 st:-1 ts:0.365002 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
-ret:-1 st:-1 ts:-0.740831 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
+ret: 0 st:-1 ts:-0.740831 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 0 ts:2.153333 flags:0
-ret:-5
+ret: 0 st: 0 dts:0.820000 pts:0.860000 pos:80464 size:13388 flags:0
 ret: 0 st: 0 ts:1.047500 flags:1
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
+ret: 0 st: 0 dts:0.740000 pts:0.780000 pos:48316 size:14502 flags:0
 ret: 0 st: 1 ts:-0.058333 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 1 ts:2.835833 flags:1
-ret: 0 st: 1 dts:1.457556 pts:1.457556 pos:435596 size:409 flags:1
+ret: 0 st: 0 dts:0.900000 pts:0.940000 pos:111296 size:12781 flags:0
 ret: 0 st:-1 ts:1.730004 flags:0
-ret:-5
-ret:-1 st:-1 ts:0.624171 flags:1
+ret: 0 st: 0 dts:0.780000 pts:0.820000 pos:65612 size:12623 flags:0
+ret: 0 st:-1 ts:0.624171 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 0 ts:-0.481667 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 0 ts:2.412500 flags:1
-ret: 0 st: 1 dts:1.457556 pts:1.457556 pos:435596 size:409 flags:1
+ret: 0 st: 0 dts:0.860000 pts:0.900000 pos:96068 size:13086 flags:0
 ret: 0 st: 1 ts:1.306667 flags:0
-ret: 0 st: 0 dts:1.460000 pts:1.500000 pos:351184 size:12679 flags:0
-ret:-1 st: 1 ts:0.200844 flags:1
+ret: 0 st: 0 dts:0.740000 pts:0.780000 pos:48316 size:14502 flags:0
+ret: 0 st: 1 ts:0.200844 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st:-1 ts:-0.904994 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st:-1 ts:1.989173 flags:1
-ret: 0 st: 1 dts:1.457556 pts:1.457556 pos:435596 size:409 flags:1
+ret: 0 st: 0 dts:0.820000 pts:0.860000 pos:80464 size:13388 flags:0
 ret: 0 st: 0 ts:0.883344 flags:0
-ret: 0 st: 0 dts:1.100000 pts:1.140000 pos:189504 size:12236 flags:0
-ret:-1 st: 0 ts:-0.222489 flags:1
+ret: 0 st: 0 dts:0.740000 pts:0.780000 pos:48316 size:14502 flags:0
+ret: 0 st: 0 ts:-0.222489 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ret: 0 st: 1 ts:2.671678 flags:0
-ret:-5
+ret: 0 st: 0 dts:0.860000 pts:0.900000 pos:96068 size:13086 flags:0
 ret: 0 st: 1 ts:1.565844 flags:1
-ret: 0 st: 0 dts:1.140000 pts:1.180000 pos:203980 size:24787 flags:1
+ret: 0 st: 0 dts:0.780000 pts:0.820000 pos:65612 size:12623 flags:0
 ret: 0 st:-1 ts:0.460008 flags:0
-ret: 0 st: 0 dts:0.660000 pts:0.700000 pos:564 size:24801 flags:1
-ret:-1 st:-1 ts:-0.645825 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
+ret: 0 st:-1 ts:-0.645825 flags:1
+ret: 0 st: 0 dts:0.700000 pts:0.740000 pos:29140 size:16433 flags:0
 ----------------
 tests/data/b-lavf.ul
 ret: 0 st: 0 dts:0.000000 pts:0.000000 pos:0 size:1024 flags:1



More information about the ffmpeg-cvslog mailing list