[NUT-devel] [NUT] (ods15): r108 - in /trunk/libnut: demuxer.c priv.h

syncmail at mplayerhq.hu syncmail at mplayerhq.hu
Thu Mar 16 07:53:52 CET 2006


Author: ods15
Date: Thu Mar 16 07:53:52 2006
New Revision: 108

Log:
some fixes

Modified:
    trunk/libnut/demuxer.c
    trunk/libnut/priv.h

Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c (original)
+++ trunk/libnut/demuxer.c Thu Mar 16 07:53:52 2006
@@ -1014,7 +1014,6 @@
 		if (saw_syncpoint) {
 			int dont_flush = 0;
 			int header_size = bctello(nut->i) - buf_before;
-			nut->i->buf_ptr -= header_size;
 			if (stopper) {
 				if ((!stopper_syncpoint && buf_before > (stopper->pos >> 1) - (stopper->back_ptr>>1) + 15) || stopper_syncpoint == buf_before) {
 					int n = 1;
@@ -1029,6 +1028,7 @@
 					dont_flush = 1; // give it a chance, we might be able to do this in a single seek
 				}
 			}
+			nut->i->buf_ptr -= header_size;
 			if (!dont_flush) flush_buf(nut->i); // flush at every syncpoint
 			nut->i->buf_ptr += header_size;
 		}
@@ -1068,7 +1068,7 @@
 			}
 		}
 		// dts higher than requested pts
-		if (end && nut->sc[pd.stream].last_dts != -1 && nut->sc[pd.stream].last_dts > pts[pd.stream]>>1) break;
+		if (end && peek_dts(nut->sc[pd.stream].sh.decode_delay, nut->sc[pd.stream].pts_cache, pd.pts) > (int64_t)(pts[pd.stream]>>1)) break;
 
 		CHECK(skip_buffer(nut->i, pd.len));
 		push_frame(nut, &pd);

Modified: trunk/libnut/priv.h
==============================================================================
--- trunk/libnut/priv.h (original)
+++ trunk/libnut/priv.h Thu Mar 16 07:53:52 2006
@@ -180,7 +180,7 @@
 	return 0;
 }
 
-static inline int get_dts(int d, int64_t * pts_cache, int pts) {
+static inline int64_t get_dts(int d, int64_t * pts_cache, int64_t pts) {
 	while (d--) {
 		int64_t t = pts_cache[d];
 		if (t < pts) {
@@ -191,6 +191,11 @@
 	return pts;
 }
 
+static inline int64_t peek_dts(int d, int64_t * pts_cache, int64_t pts) {
+	while (d--) if (pts_cache[d] < pts) pts = pts_cache[d];
+	return pts;
+}
+
 #define bctello(bc) ((bc)->file_pos + ((bc)->buf_ptr - (bc)->buf))
 
 #define TO_PTS(prefix, pts) \




More information about the NUT-devel mailing list