[NUT-devel] [nut]: r187 - in trunk/libnut: muxer.c priv.h

ods15 subversion at mplayerhq.hu
Mon Nov 6 09:48:21 CET 2006


Author: ods15
Date: Mon Nov  6 09:48:21 2006
New Revision: 187

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

Log:
slight change in header repetition method


Modified: trunk/libnut/muxer.c
==============================================================================
--- trunk/libnut/muxer.c	(original)
+++ trunk/libnut/muxer.c	Mon Nov  6 09:48:21 2006
@@ -270,6 +270,7 @@
 static void put_headers(nut_context_t * nut) {
 	int i;
 	nut->last_headers = bctello(nut->o);
+	nut->headers_written++;
 
 	put_main_header(nut);
 	for (i = 0; i < nut->stream_count; i++) put_stream_header(nut, i);
@@ -456,12 +457,10 @@
 }
 
 static void check_header_repetition(nut_context_t * nut) {
-	if (bctello(nut->o) > (1 << 23)) {
-		int i = 23; // ### magic value for header repetition
-		if (bctello(nut->o) > (1 << 25)) {
-			for (i = 26; bctello(nut->o) > (1 << i); i++);
-			i--;
-		}
+	if (bctello(nut->o) >= (1 << 23)) {
+		int i; // ### magic value for header repetition
+		for (i = 24; bctello(nut->o) >= (1 << i); i++);
+		i--;
 		if (nut->last_headers < (1 << i)) {
 			put_headers(nut);
 		}
@@ -575,6 +574,7 @@
 	nut->syncpoints.pts = NULL;
 	nut->syncpoints.eor = NULL;
 	nut->last_syncpoint = 0;
+	nut->headers_written = 0;
 
 	for (nut->stream_count = 0; s[nut->stream_count].type >= 0; nut->stream_count++);
 
@@ -658,7 +658,7 @@
 	int total = 0;
 	if (!nut) return;
 
-	if (nut->last_headers < (1<<23)) put_headers(nut); // force 3rd copy of main headers
+	while (nut->headers_written < 2) put_headers(nut); // force 3rd copy of main headers
 	put_headers(nut);
 	if (nut->mopts.write_index) put_index(nut);
 

Modified: trunk/libnut/priv.h
==============================================================================
--- trunk/libnut/priv.h	(original)
+++ trunk/libnut/priv.h	Mon Nov  6 09:48:21 2006
@@ -159,6 +159,7 @@
 
 	off_t last_syncpoint; // for checking corruption and putting syncpoints, also for back_ptr
 	off_t last_headers; // for header repetition and state for demuxer
+	int headers_written; // for muxer header repetition
 
 	off_t before_seek; // position before any seek mess
 	off_t seek_status;



More information about the NUT-devel mailing list