1
0
mirror of https://github.com/mpv-player/mpv synced 2025-01-31 04:02:06 +00:00

less amateurish-looking mpcf.txt patch by (Jeff >snacky ikaruga co uk<)

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15009 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
michael 2005-03-25 12:37:18 +00:00
parent 078ef11dda
commit 5a0109448e

View File

@ -31,18 +31,18 @@ Error resistant
Definitions:
MUST the specific part must be done to conform to this standard
SHOULD its recommanded to be done that way but its not strictly required
SHOULD it's recommended to be done that way, but it's not strictly required
Syntax:
Since nut heavly uses variable lenght fields the simplest way to describe it
Since nut heavily uses variable length 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
The data types have a name, used in the bitstream syntax description, a short
text description and a pseudocode (functional) definition, optional notes may
follow:
@ -50,8 +50,9 @@ 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:
The bitstream syntax elements 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
@ -87,7 +88,7 @@ b (binary data or string, to be use in vb, see below)
}
[Note: strings MUST be encoded in utf8]
vb (variable lenght binary data or string)
vb (variable length binary data or string)
length v
value b
@ -283,7 +284,7 @@ stream_starcode
frame_startcode
0xE4ADEECA4569ULL + (((uint64_t)('N'<<8) + 'K')<<48)
frame_startcodes SHOULD be placed immedeatly before a keyframe if the
frame_startcodes SHOULD be placed immediately before a keyframe if the
previous frame of the same stream was a non-keyframe, unless such
non-keyframe - keyframe transitions are very frequent
@ -293,16 +294,16 @@ info_startcode
0xAB68B596BA78ULL + (((uint64_t)('N'<<8) + 'I')<<48)
version
NUT version, the current values is 2
NUT version. The current value is 2.
max_distance
max distance of frame_startcodes, the distance may only be larger if
there is only a single frame between the 2 frame_startcodes this can
be used by the demuxer to detect damaged frame headers if the damage
results in a too long chain
results in too long of a chain
SHOULD be set to <=32768 or at least <=65536 unless there is a very
good reason to set it higher otherwise reasonable error recovery will
good reason to set it higher, otherwise reasonable error recovery will
be impossible
max_index_distance
@ -315,7 +316,7 @@ max_index_distance
stream_id[FIXME]
Stream identifier
Note: streams with a lower relative class MUST have a lower relative id
so a stream with class 0 MUST always have a id which is lower then any
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
@ -336,8 +337,8 @@ fourcc
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_nom and time_base_denom MUST be relative prime
time_base_denom MUST NOT be 0
time_base_nom and time_base_denom MUST be relatively prime
time_base_nom MUST be < 2^31
examples:
fps time_base_nom time_base_denom
@ -354,8 +355,8 @@ time_base_nom / time_base_denom = time_base
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 be relative prime
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
global_timestamp
@ -400,14 +401,14 @@ flags[frame_code]
1-> keyframe,
flags=4 can be used to mark illegal frame_code bytes
frame_code=78 must have flags=4
Note: 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
Important: depend(1) means dependancy on the container level (NUT) not
dependancy on the codec level
Important: depend(1) means dependency on the container level (NUT) not
dependency on the codec level
stream_id_plus1[frame_code]
must be <250
if its 0 then the stream_id is coded in the frame
if it is 0, then the stream_id is coded in the frame
data_size_mul[frame_code]
must be <16384
@ -422,13 +423,13 @@ data_size
data_size= data_size_lsb + data_size_msb*data_size_mul;
coded_timestamp
if coded_timestamp < (1<<msb_timestamp_shift) then its a lsb
timestamp, otherwise its a full timestamp + (1<<msb_timestamp_shift)
if coded_timestamp < (1<<msb_timestamp_shift) then it is an lsb
timestamp, otherwise it is a full timestamp + (1<<msb_timestamp_shift)
lsb timestamps are converted to full timesamps by:
mask = (1<<msb_timestamp_shift)-1;
delta= last_timestamp - mask/2
timestamp= ((timestamp_lsb-delta)&mask) + delta
a full timestamp must be used if there is no reference timestamp
a full timestamp MUST be used if there is no reference timestamp
available after the last frame_startcode with the current stream_id
lsb_timestamp
@ -448,13 +449,13 @@ lsb_timestamp
all timestamps of keyframes of a single stream MUST be monotone
dts
dts are calculated by using a decode_delay+1 sized buffer for each
dts is 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
than an earlier frame
FIXME rename timestamp* to pts* ?
width/height
@ -462,7 +463,7 @@ width/height
sample_width/sample_height (aspect ratio)
sample_width is the horizontal distance between samples
sample_width and sample_height MUST be relative prime if not zero
sample_width and sample_height MUST be relatively prime if not zero
MUST be 0 if unknown
colorspace_type
@ -479,18 +480,18 @@ checksum
adler32 checksum
index_timestamp
value of the timetamp of a keyframe relative to the last keyframe
value of the timestamp of a keyframe relative to the last keyframe
stored in this index
index_position
position in bytes of the first byte of a keyframe, relative to the
last keyframe stored in this index
there MUST be no keyframe with the same stream_id as this index between
2 consecutive index entries if they are more then max_index_distance
appart
2 consecutive index entries if they are more than max_index_distance
apart
id
the id of the type/name pair, so its more compact
the id of the type/name pair, so it's more compact
0 means end
type
@ -514,14 +515,14 @@ info packet types
"CaptureDevice" "BT878", "BT848", "webcam", ... (more exact names are fine too)
"CreationTime" "2003-01-20 20:13:15Z", ...
(ISO 8601 format, see http://www.cl.cam.ac.uk/~mgk25/iso-time.html)
Note: dont forget the timezone
Note: don't forget the timezone
"Keywords"
"TotalTime" total length of the stream in msecs
"Language" ISO 639 and ISO 3166 for language/country code
something like "eng" (US english), can be 0 if unknown
and "multi" if several languages
see http://www.loc.gov/standards/iso639-2/englangn.html
and http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.htmlthe language code
and http://www.din.de/gremien/nas/nabd/iso3166ma/codlstp1/en_listp1.html the language code
"Disposition" "original", "dub" (translated), "comment", "lyrics", "karaoke"
Note: if someone needs some others, please tell us about them, so we can
add them to the official standard (if they are sane)
@ -562,32 +563,32 @@ stream_header (id=1)
...
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 that
is the closest possition after 2^12=4096 at which the headers can be placed
headers may be repeated, but if they are, then they MUST all be repeated
together and repeated headers MUST be identical
headers MAY only repeat 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 position 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
headers MUST be placed at least at the start of the file and immediately before
the index or at the file end if there is no index
headers MUST be repeated at least twice (so they exist 3 times in a file)
a demuxer MUST not demux a stream which contains more than one stream, or which
a demuxer MUST NOT demux a stream which contains more than one stream, or which
is wrapped in a structure to facilitate more than one stream or otherwise
duplicate the role of a container. any such file is to be considered invalid
info packets which describe the whole file or individual streams/tracks must be
info packets which describe the whole file or individual streams/tracks MUST be
placed before any video/audio/... frames
Index
Note: in case of realtime streaming there is no end, so no index there either
Note: with realtime streaming, there is no end, so no index there either
Info packets
the info_packet can be repeated, it can also contain different names & values
each time but only if also the time is different
the info_packet can be repeated, and can also contain different names & values
each time, but only if 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
info packets SHOULD be placed at the start 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
@ -611,7 +612,7 @@ typedef BufferContext{
static inline uint64_t get_bytes(BufferContext *bc, int count){
uint64_t val=0;
assert(count>0 && count<9)
assert(count>0 && count<9);
for(i=0; i<count; i++){
val <<=8;
@ -624,7 +625,7 @@ static inline uint64_t get_bytes(BufferContext *bc, int count){
static inline void put_bytes(BufferContext *bc, int count, uint64_t val){
uint64_t val=0;
assert(count>0 && count<9)
assert(count>0 && count<9);
for(i=count-1; i>=0; i--){
*(bc->buf_ptr++)= val >> (8*i);