[MPlayer-dev-eng] NUT cleanup

Oded Shimon ods15 at ods15.dyndns.org
Mon Sep 5 20:43:47 CEST 2005


On Mon, Sep 05, 2005 at 07:11:19PM +0300, Oded Shimon wrote:
> BTW, I'm now making a BIG patch for mpcf.txt to fix everything mentioned in 
> this thread. I don't expect it to be all committed at once, but it'll give 
> a nice summary of all withstanding issues.

ok, like I promised, BIG patch, everything mentioned on this list. It 
includes:

1. removing average_bitrate
2. adding other_stream_header, for subtitles and metadata
3. adding last_pts to index
4. index_ptr - a VLC to say the total length of all index packets
5. end_startcode - new startcode to be written immedeately before the 
   index_ptr (from 'xxd /dev/random')
6. specify how to write "multiple" indexes
7. change forward_ptr behavior, starts right after forward_ptr, ends before 
   checksum
8. explain stream_id <-> stream_class limitation better.
9. time_base_nom must also be non zero if i'm not mistaken?
10. remove (old?) sample_rate_mul stuff.
11. say that all frames must be strictly monotone, dts >= prev_dts.
12. specify what exactly the checksum covers.
13. specify that stream classes which have multiple streams must have an 
    info packet..

Things mentioned in this thread that are left:
1. remove stream_id ?
2. change num/denom - i'll do this in a seperate patch - actually, it's 
   more than just a rename - it means time_base changes meaning - currently 
   it's the number of ticks in a second (which is bad definition imo), 
   changing it will make it into "length of a tick in seconds".
3. remove channel_count ?
4. rename fourcc ?
5. remove mncf.txt
6. rename ALL 'timestamp' in the file to 'pts' - Should I make a patch for 
   this?

- ods15
-------------- next part --------------
--- ../main/DOCS/tech/mpcf.txt	2005-06-19 12:17:44.000000000 +0300
+++ mpcf.txt	2005-09-05 21:25:46.000000000 +0300
@@ -156,7 +156,6 @@
 	stream_id				v
 	stream_class				v
 	fourcc					vb
-	average_bitrate				v
 	time_base_nom				v
 	time_base_denom				v
 	msb_timestamp_shift			v
@@ -183,6 +182,11 @@
 	reserved_bytes
 	checksum				u(32)
 
+other_stream_header:
+	stream_header
+	reserved_bytes
+	checksum				u(32)
+
 		Basic Packets:
  
 frame:
@@ -204,6 +208,7 @@
 	index_startcode				f(64)
 	packet header
 	stream_id				v
+	last_pts				v
 	index_length				v
 	for(i=0; i<index_length; i++){
 		index_timestamp			v
@@ -240,13 +245,15 @@
 
 file:
 	file_id_string
-	while(!eof && next_code != index_startcode){
+	while(next_code != end_startcode && next_code != index_startcode){
 		main_header
 		for(i=0; i<stream_count; i++){
 			if(next_packet==video_stream_header)
 				video_stream_header
-			else
+			else if(next_packet==audio_stream_header)
 				audio_stream_header
+			else
+				other_stream_header
 		}
 		while(next_code != main_startcode){
 			if(next_code == info_startcode)
@@ -258,16 +265,19 @@
 			}
 		}
 	}
-	index
-                
+	while(next_code != end_startcode){
+		index
+	}
+	end_startcode				f(64)
+	index_ptr				v
 
 
 			Tag description:
 
 forward_ptr
-	size of the packet (exactly the distance from the first byte of the
-	startcode of the current packet to the first byte of the following
-	packet
+	size of the packet data (exactly the distance from the first byte
+	after the forward_ptr to the first byte of the checksum of the
+	packet or next packet if there is no checksum)
 
 file_id_string
 	"nut/multimedia container\0"
@@ -292,6 +302,8 @@
 	0xDD672F23E64EULL + (((uint64_t)('N'<<8) + 'X')<<48)
 info_startcode
 	0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)
+end_startcode
+	0xE8154EDB2A7CULL + (((uint64_t)('N'<<8) + 'E')<<48)
 
 version
 	NUT version. The current value is 2.
@@ -313,12 +325,8 @@
 	SHOULD be set to <=32768 or at least <=65536 unless there is a very
 	good reason to set it higher
 
-stream_id[FIXME]
+stream_id
 	Stream identifier
-	Note: streams with a lower relative class MUST have a lower relative id
-	so a stream with class 0 MUST always have an id which is lower than any
-	stream with class > 0
-	stream_id MUST be < stream_count
 
 stream_class
 	0	video
@@ -327,6 +335,8 @@
 	3	metadata
 	Note: the remaining values are reserved and MUST NOT be used
 	     a demuxer MUST ignore streams with reserved classes
+	Note: stream_class MUST be bigger or equal to the stream_class of
+	the previous stream.
 
 fourcc
 	identification for the codec
@@ -337,7 +347,7 @@
 time_base_nom / time_base_denom = time_base
 	the number of timer ticks per second, this MUST be equal to the fps
 	if the fixed_fps is 1
-	time_base_denom MUST NOT be 0
+	time_base_denom and time_base_nom MUST NOT be 0
 	time_base_nom and time_base_denom MUST be relatively prime
 	time_base_nom MUST be < 2^31
 	examples:
@@ -345,17 +355,10 @@
 		30	30		1
 		29.97	30000		1001
 		23.976	24000		1001
-		sample_rate	sample_rate_mul	time_base_nom	time_base_denom
-		44100		1		44100		1
-		44100		64		11025		16 
-		48000		1024		375		8  
-
-		Note: the advantage to using a large sample_rate_mul is that
-		the timestamps need fewer bits
 
 global_time_base_nom / global_time_base_denom = global_time_base
 	the number of timer ticks per second
-	global_time_base_denom MUST NOT be 0
+	global_time_base_nom and global_time_base_denom MUST NOT be 0
 	global_time_base_nom and global_time_base_denom MUST be relatively prime
 	global_time_base_nom MUST be < 2^31
 
@@ -453,9 +456,9 @@
 	stream, into which the current pts is inserted and the element with
 	the smallest value is removed, this is then the current dts
 	this buffer is initalized with decode_delay -1 elements
-	all frames with dts == timestamp must be monotone, that means a frame
-	which occures later in the stream must have a larger or equal dts
-	than an earlier frame
+	all frames must be monotone, that means a frame which occures later
+	in the stream must have a larger or equal dts than an earlier
+	frame.
 	FIXME rename timestamp* to pts* ?
 
 width/height
@@ -478,6 +481,12 @@
 
 checksum
 	adler32 checksum
+	checksum is calculated for the area pointed to by forward_ptr 
+	(first byte after the forward_ptr until last byte before the 
+	checksum)
+
+last_pts
+	The timestamp of the last frame
 
 index_timestamp
 	value of the timestamp of a keyframe relative to the last keyframe
@@ -490,6 +499,11 @@
 	2 consecutive index entries if they are more than max_index_distance
 	apart
 
+index_ptr
+	length in bytes from the first bytes of the first index startcode
+	to the first byte of the index_ptr. If there is no index, index_ptr
+	MUST be zero.
+
 id
 	the id of the type/name pair, so it's more compact
 	0 means end
@@ -582,6 +596,8 @@
 
 		Index
 Note: with realtime streaming, there is no end, so no index there either
+An index SHOULD be written for every stream. Indexes MUST be placed at end
+of file. Indexes MAY be repeated for a stream.
 
 		Info packets
 the info_packet can be repeated, and can also contain different names & values
@@ -592,6 +608,9 @@
 streaming info packets will normally be transmitted when they apply for
 example, the current song title & artist of the currently shown music video
 
+If more than one stream of a given stream class is present, each one MUST
+have info tags specifying disposition, and if applicable, language.
+
 		Unknown packets
 MUST be ignored by the demuxer
 


More information about the MPlayer-dev-eng mailing list