From f4462dccd7b741f1cc738bbaeaa1fe701457c1fc Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 1 Mar 2005 00:16:44 +0000 Subject: some comments and whitespace changes by (Luca Barbato ) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14855 b3059339-0415-0410-9bf9-f77b7e298cf2 --- DOCS/tech/mpcf.txt | 158 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 101 insertions(+), 57 deletions(-) (limited to 'DOCS/tech') diff --git a/DOCS/tech/mpcf.txt b/DOCS/tech/mpcf.txt index 4c006095ce..dea9dbf77f 100644 --- a/DOCS/tech/mpcf.txt +++ b/DOCS/tech/mpcf.txt @@ -37,12 +37,37 @@ SHOULD its recommanded to be done that way but its not strictly required Syntax: +Since nut heavly uses variable lenght fields the simplest way to describe it +is using a pseudocode approach. + + Conventions: + +The data tipes have a name, used in the bitstream syntax description, a short +text description and a pseudocode (functional) definition, optional notes may +follow: + +name (text description) + functional definition + [Optional notes] + +The bitream syntax element have a tagname and a functional definition, they are +presented in a bottom up approach, again optional notes may follow and are reproduced in the tag description: + +name: (optional note) + functional definition + [Optional notes] + +The in-depth tag description follows the bitstream syntax. +The functional definition has a C like syntax. + + Type definitions: -f(x) n fixed bits in big-endian order -u(x) unsigned number encoded in x bits in MSB first order -v +f(n) (n fixed bits in big-endian order) +u(n) (unsigned number encoded in n bits in MSB first order) + +v (variable length value, unsigned) value=0 do{ more_data u(1) @@ -50,38 +75,43 @@ v value= 128*value + data }while(more_data) -s +s (variable length value, signed) temp v temp++ if(temp&1) value= -(temp>>1) else value= (temp>>1) -b (binary data or string) +b (binary data or string, to be use in vb, see below) for(i=0; i 0 @@ -281,7 +324,7 @@ stream_class 1 audio 2 subtiles 3 metadata - Note the remaining values are reserved and MUST NOT be used + Note: the remaining values are reserved and MUST NOT be used a demuxer MUST ignore streams with reserved classes fourcc @@ -305,8 +348,9 @@ time_base_nom / time_base_denom = time_base 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 + + 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 @@ -316,14 +360,15 @@ global_time_base_nom / global_time_base_denom = global_time_base global_timestamp timestamp in global_time_base units - when a global_timestamp is encountered the last_timestamp of all streams - is set to the following: + when a global_timestamp is encountered the last_timestamp of all + streams is set to the following: + ln= global_time_base_denom*time_base_nom sn= global_timestamp d1= global_time_base_nom d2= time_base_denom last_timestamp= (ln/d1*sn + ln%d1*sn/d1)/d2 - Note, this calculation MUST be done with unsigned 64 bit integers, and + Note: this calculation MUST be done with unsigned 64 bit integers, and is equivalent to (ln*sn)/(d1*d2) but this would require a 96bit integer msb_timestamp_shift @@ -331,10 +376,10 @@ msb_timestamp_shift MUST be <16 decode_delay - maximum time between input and output for a codec, used to generate dts - from pts - is 0 for streams without b frames, and 1 for streams with b frames, may - be larger for future codecs + maximum time between input and output for a codec, used to generate + dts from pts + is set to 0 for streams without b frames, and set to 1 for streams with + b frames, may be larger for future codecs fixed_fps 1 indicates that the fps is fixed @@ -348,17 +393,17 @@ frame_code different from the first byte of any startcode flags[frame_code] - the bits of the flags from MSB to LSB are KD + first of the flags from MSB to LSB are called KD if D is 1 then data_size_msb is coded, otherwise data_size_msb is 0 K is the keyframe_type 0-> no keyframe, 1-> keyframe, flags=4 can be used to mark illegal frame_code bytes frame_code=78 must have flags=4 - * frames MUST not depend(1) upon frames prior to the last + Note: frames MUST not depend(1) upon frames prior to the last frame_startcode - depend(1) means dependancy on the container level (NUT) not dependancy - on the codec level + Important: depend(1) means dependancy on the container level (NUT) not + dependancy on the codec level stream_id_plus1[frame_code] must be <250 @@ -377,8 +422,8 @@ data_size data_size= data_size_lsb + data_size_msb*data_size_mul; coded_timestamp - if coded_timestamp < (1< timestamp=0 frame lsb_timestamp=3 -> timestamp=3 @@ -405,8 +450,8 @@ lsb_timestamp dts dts are calculated by using a decode_delay+1 sized buffer for each 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 + 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 then an earlier frame @@ -487,8 +532,7 @@ value value of this name/type pair stuffing - 0x80 can be placed infront of any type v entry for stuffing - purposes + 0x80 can be placed in front of any type v entry for stuffing purposes info_table[][2]={ {NULL , NULL }, // end @@ -520,9 +564,9 @@ stream_header (id=n) headers may be repated, but if they are then they MUST all be repeated together and repeated headers MUST be identical -headers MAY only repeated at the closest possible positions after 2^x where x is -an integer and the file end, so the headers may be repeated at 4102 if thats the -closest possition after 2^12=4096 at which the headers can be placed +headers MAY only repeated at the closest possible positions after 2^x where x +is an integer and the file end, so the headers may be repeated at 4102 if that +is the closest possition after 2^12=4096 at which the headers can be placed headers MUST be placed at least at the begin of the file and immedeatly before the index or at the file end if there is no index @@ -544,9 +588,9 @@ the info_packet can be repeated, it can also contain different names & values each time but only if also the time is different Info packets can be used to describe the file or some part of it (chapters) -info packets, SHOULD be placed at the begin of the file at least -for realtime streaming info packets will normally be transmitted when they apply -for example, the current song title & artist of the currently shown music video +info packets, SHOULD be placed at the begin of the file at least for realtime +streaming info packets will normally be transmitted when they apply for +example, the current song title & artist of the currently shown music video Unknown packets MUST be ignored by the demuxer @@ -554,8 +598,8 @@ MUST be ignored by the demuxer demuxer (non-normative) in the absence of valid header at beginning, players SHOULD search for backup -headers starting at offset 2^x for each x players SHOULD end their search from a -particular offset when any startcode is found (including syncpoint) +headers starting at offset 2^x for each x players SHOULD end their search from +a particular offset when any startcode is found (including syncpoint) Sample code (GPL, & untested) -- cgit v1.2.3