[NUT-devel] [nut]: r276 - trunk/libnut/demuxer.c

ods15 subversion at mplayerhq.hu
Fri Jan 26 18:44:31 CET 2007


Author: ods15
Date: Fri Jan 26 18:44:31 2007
New Revision: 276

Modified:
   trunk/libnut/demuxer.c

Log:
Improovements to linear_search_seek, not to bail out completely if an error is found


Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c	(original)
+++ trunk/libnut/demuxer.c	Fri Jan 26 18:44:31 2007
@@ -1273,7 +1273,7 @@
 		nut->last_syncpoint = 0; // last_key is invalid
 		seek_buf(nut->i, s.pos, SEEK_SET); // go back to syncpoint. This will not need a seek.
 		nut->seek_status = s.pos << 1;
-		if (s.pos > start + 15) goto err_out; // error condition, we didn't get the syncpoint we wanted
+		ERROR(s.pos < start || s.pos > start + 15, 0); // error condition, we didn't get the syncpoint we wanted
 	}
 
 	if (stopper) {
@@ -1288,6 +1288,7 @@
 		if (stopper_syncpoint > bctello(nut->i)) stopper_syncpoint = 0; // don't premature
 	}
 
+#define CHECK_break(expr) { if ((err = (expr))) { if (end && err != NUT_ERR_EAGAIN) break; else goto err_out; } }
 	if (!(nut->seek_status & 1)) while (bctello(nut->i) < end || !end) {
 		int saw_syncpoint;
 		nut_packet_t pd;
@@ -1295,7 +1296,7 @@
 		buf_before = bctello(nut->i);
 		err = get_packet(nut, &pd, &saw_syncpoint); // we're counting on syncpoint cache!! for the good_key later, and stopper_syncpoint
 		if (err == -1) continue;
-		CHECK(err);
+		CHECK_break(err);
 
 		if (saw_syncpoint) {
 			if (stopper && !stopper_syncpoint && buf_before > stopper->pos - stopper->back_ptr + 15) {
@@ -1349,7 +1350,7 @@
 		// dts higher than requested pts
 		if (end && peek_dts(nut->sc[pd.stream].sh.decode_delay, nut->sc[pd.stream].pts_cache, pd.pts) > (int64_t)nut->sc[pd.stream].state.pts) break;
 
-		CHECK(skip_buffer(nut->i, pd.len));
+		CHECK_break(skip_buffer(nut->i, pd.len));
 		push_frame(nut, &pd);
 	}
 	if (!end) goto err_out; // forward seek
@@ -1359,7 +1360,7 @@
 		if (nut->sc[i].state.good_key && (!min_pos || nut->sc[i].state.good_key < min_pos)) min_pos = nut->sc[i].state.good_key;
 	}
 	if (!min_pos) {
-		fprintf(stderr, "BIG FAT WARNING\n");
+		fprintf(stderr, "BIG FAT WARNING (Possibly caused by `%s')", nut_error(err));
 		for (i = 0; i < nut->stream_count; i++) fprintf(stderr, "%d: %d\n", i, (int)nut->sc[i].state.good_key);
 		min_pos = nut->seek_status >> 1;
 	}
@@ -1383,6 +1384,7 @@
 		push_frame(nut, &pd);
 		CHECK(skip_buffer(nut->i, pd.len));
 	}
+	err = 0;
 
 err_out:
 	if (err != NUT_ERR_EAGAIN) { // unless EAGAIN



More information about the NUT-devel mailing list