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

ods15 subversion at mplayerhq.hu
Tue Nov 14 18:09:09 CET 2006


Author: ods15
Date: Tue Nov 14 18:09:08 2006
New Revision: 204

Modified:
   trunk/libnut/demuxer.c

Log:
restructure header skipping to prepare for info reading in mid-stream


Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c	(original)
+++ trunk/libnut/demuxer.c	Tue Nov 14 18:09:08 2006
@@ -612,13 +612,23 @@
 	if (tmp == 'N') {
 		CHECK(get_bytes(nut->i, 7, &tmp));
 		tmp |= (uint64_t)'N' << 56;
-		if (tmp == SYNCPOINT_STARTCODE) {
-			after_sync = 1;
-			CHECK(get_syncpoint(nut));
-			CHECK(get_bytes(nut->i, 1, &tmp));
-		} else {
-			CHECK(get_header(nut->i, NULL));
-			return 3;
+		switch (tmp) {
+			case SYNCPOINT_STARTCODE:
+				after_sync = 1;
+				CHECK(get_syncpoint(nut));
+				CHECK(get_bytes(nut->i, 1, &tmp));
+				break;
+			case MAIN_STARTCODE:
+				do {
+					CHECK(get_header(nut->i, NULL));
+					CHECK(get_bytes(nut->i, 8, &tmp));
+				} while (tmp != SYNCPOINT_STARTCODE);
+				nut->i->buf_ptr -= 8;
+				return 3;
+			case INFO_STARTCODE:
+			default:
+				CHECK(get_header(nut->i, NULL));
+				return 3;
 		}
 	}
 



More information about the NUT-devel mailing list