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

syncmail at mplayerhq.hu syncmail at mplayerhq.hu
Sat Mar 11 19:16:18 CET 2006


Author: ods15
Date: Sat Mar 11 19:16:18 2006
New Revision: 96

Log:
sync to spec, unlimited stuffing not allowed when in "raw" (not tmp buffer) mode

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

Modified: trunk/libnut/demuxer.c
==============================================================================
--- trunk/libnut/demuxer.c (original)
+++ trunk/libnut/demuxer.c Sat Mar 11 19:16:18 2006
@@ -120,15 +120,23 @@
 static int get_v(input_buffer_t * bc, uint64_t * val) {
 	int i, len;
 	*val = 0;
+
 	do {
 		len = ready_read_buf(bc, 16);
-		for (i = 0; i < len; i++) {
-			uint8_t tmp= *(bc->buf_ptr++);
-			*val = (*val << 7) | (tmp & 0x7F);
-			if (!(tmp & 0x80)) return 0;
-		}
+		for (i = 0; i < len; i++) if (*bc->buf_ptr++ != 0x80) break;
+
+		if (i == len) { if (len >= 16 && !bc->is_mem) return -ERR_VLC_TOO_LONG; }
+		else { bc->buf_ptr--; break; }
 	} while (len >= 16);
-	return buf_eof(bc);
+
+	len = ready_read_buf(bc, 16);
+	for (i = 0; i < len; i++) {
+		uint8_t tmp= *(bc->buf_ptr++);
+		*val = (*val << 7) | (tmp & 0x7F);
+		if (!(tmp & 0x80)) return 0;
+	}
+	if (len >= 16) return -ERR_VLC_TOO_LONG;
+	else return buf_eof(bc);
 }
 
 static int get_s(input_buffer_t * bc, int64_t * val) {

Modified: trunk/libnut/priv.h
==============================================================================
--- trunk/libnut/priv.h (original)
+++ trunk/libnut/priv.h Sat Mar 11 19:16:18 2006
@@ -35,17 +35,18 @@
 
 enum errors {
 	ERR_GENERAL_ERROR = 1,
-	ERR_BAD_VERSION = 2,
-	ERR_NOT_FRAME_NOT_N = 3,
-	ERR_BAD_CHECKSUM = 4,
-	ERR_MAX_DISTANCE = 5,
-	ERR_NO_HEADERS = 6,
-	ERR_NOT_SEEKABLE = 7,
-	ERR_OUT_OF_ORDER = 8,
-	ERR_MAX_PTS_DISTANCE = 9,
-	ERR_BAD_STREAM_ORDER = 11,
-	ERR_NOSTREAM_STARTCODE = 12,
-	ERR_BAD_EOF = 13,
+	ERR_BAD_VERSION,
+	ERR_NOT_FRAME_NOT_N,
+	ERR_BAD_CHECKSUM,
+	ERR_MAX_DISTANCE,
+	ERR_NO_HEADERS,
+	ERR_NOT_SEEKABLE,
+	ERR_OUT_OF_ORDER,
+	ERR_MAX_PTS_DISTANCE,
+	ERR_VLC_TOO_LONG,
+	ERR_BAD_STREAM_ORDER,
+	ERR_NOSTREAM_STARTCODE,
+	ERR_BAD_EOF,
 };
 
 typedef struct {




More information about the NUT-devel mailing list