[NUT-devel] info packets/frames

Oded Shimon ods15 at ods15.dyndns.org
Wed Feb 15 11:01:07 CET 2006


On Wed, Feb 15, 2006 at 10:34:04AM +0200, Oded Shimon wrote:
> TotalTime is unecessary thanks to max_pts in index
> no more null termination of info packets
> stream_id coded sperately
> seperate to 4 basic types for extendibility, now we can add new fields 
> without breaking old demuxers
> 
> more:
> maybe use null terminated strings instead of vb?

never mind...

> The reason I gave 'NULL' as an option for type for basic codes, maybe those 
> 1 or 2 vlc's can take on a different meaning with some other type...
> 
> Also I consider collapsing rational and float into a single code, with 
> different types. They decode the same, being 2 vlc's...

what about this?...



time changed to rational, not integer/msecs. float fixed..


Also, any objections to this cleanup patch?..

- ods15
-------------- next part --------------
Index: DOCS/tech/mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.105
diff -u -r1.105 mpcf.txt
--- DOCS/tech/mpcf.txt	13 Feb 2006 07:29:11 -0000	1.105
+++ DOCS/tech/mpcf.txt	15 Feb 2006 10:00:12 -0000
@@ -98,6 +98,7 @@
         data[i]                         u(8)
     }
     [Note: strings MUST be encoded in UTF-8]
+    [Note: strings MUST NOT be encoded with their terminating NUL]
 
 vb  (variable length binary data or string)
     length                              v
@@ -275,21 +276,28 @@
     checksum                            u(32)
 
 info_frame: (optional)
-    for(;;){
+    info_stream_id                      v
+    items                               v
+    for(i=0; i<items; i++){
         id                              v
-        if(id==0) break
-        name= info_table[id][0]
-        type= info_table[id][1]
-        if(type==NULL)
-            type                        vb
-        if(name==NULL)
-            name                        vb
-        if(type=="v")
-            value                       v
-        else if(type=="s")
+        code= id&3
+        name= info_table[code][id>>2][0]
+        type= info_table[code][id>>2][1]
+        if(type==NULL) type             vb
+        if(name==NULL) name             vb
+        if(code==0) {
             value                       s
-        else
+        } else if(code==1) {
+            nom                         s
+            denom                       v
+            value= nom/denom
+        } else if(code==2) {
+            mantissa                    s
+            exponent                    s
+            value= mantissa*pow(2,exp)
+        } else {
             value                       vb
+        }
     }
     reserved_bytes
     checksum                            u(32)
@@ -613,9 +621,12 @@
     EOF, as index_ptr will always be 12 bytes before the end of file if
     there is an index at all.
 
+info_stream_id
+    Which stream this info packet reffers to, plus one. Zero menas global
+    to file.
+
 id
     the ID of the type/name pair, so it is more compact
-    0 means end
 
 type
     for example: "UTF8" -> string or "JPEG" -> JPEG image
@@ -624,8 +635,6 @@
 
 info packet types
     the name of the info entry, valid names are
-    "StreamId"
-        the stream(s) to which the info packet applies
     "Author"
     "Description"
     "Copyright"
@@ -644,8 +653,8 @@
         (ISO 8601 format, see http://www.cl.cam.ac.uk/~mgk25/iso-time.html)
         Note: do not forget the timezone
     "Keywords"
-    "TotalTime"
-        total length of the stream in msecs
+    "TrackTime"
+        length of a track/chapter in seconds
     "Language"
         ISO 639 and ISO 3166 for language/country code
         something like "eng" (US english), can be 0 if unknown
@@ -666,23 +675,34 @@
 stuffing
     0x80 can be placed in front of any type v entry for stuffing purposes
 
-info_table[][2]={
-    {NULL            ,  NULL }, // end
-    {NULL            ,  NULL },
-    {NULL            , "UTF8"},
-    {NULL            , "v"},
-    {NULL            , "s"},
-    {"StreamId"      , "v"},
-    {"Author"        , "UTF8"},
-    {"Title"         , "UTF8"},
-    {"Language"      , "UTF8"},
-    {"Description"   , "UTF8"},
-    {"Copyright"     , "UTF8"},
-    {"Encoder"       , "UTF8"},
-    {"Keyword"       , "UTF8"},
-    {"Cover"         , "JPEG"},
-    {"Cover"         , "PNG"},
-    {"Disposition"   , "UTF8"},
+info_table[4][][2]={
+    {
+        {NULL            , NULL},
+        {NULL            , "i"}, // integer
+    },
+    {
+        {NULL            , NULL},
+        {NULL            , "r"}, // rational
+        {"TrackTime"     , "r"},
+    },
+    {
+        {NULL            , NULL},
+        {NULL            , "f"}, // float
+    },
+    {
+        {NULL            ,  NULL },
+        {NULL            , "UTF8"},
+        {"Author"        , "UTF8"},
+        {"Title"         , "UTF8"},
+        {"Language"      , "UTF8"},
+        {"Description"   , "UTF8"},
+        {"Copyright"     , "UTF8"},
+        {"Encoder"       , "UTF8"},
+        {"Keyword"       , "UTF8"},
+        {"Cover"         , "JPEG"},
+        {"Cover"         , "PNG"},
+        {"Disposition"   , "UTF8"},
+    }
 };
 
 
-------------- next part --------------
Index: DOCS/tech/mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.105
diff -u -r1.105 mpcf.txt
--- DOCS/tech/mpcf.txt	13 Feb 2006 07:29:11 -0000	1.105
+++ DOCS/tech/mpcf.txt	15 Feb 2006 07:54:39 -0000
@@ -111,9 +111,6 @@
 Common elements:
 ----------------
 
-packet header:
-    forward ptr                         v
-
 reserved_bytes:
     for(i=0; i<forward_ptr - length_of_non_reserved; i++)
         reserved                        u(8)
@@ -126,7 +123,7 @@
 
 main header:
     main_startcode                      f(64)
-    packet header
+    forward_ptr                         v
     version                             v
     stream_count                        v
     max_distance                        v
@@ -170,7 +167,7 @@
 
 stream_header:
     stream_startcode                    f(64)
-    packet_header
+    forward_ptr                         v
     stream_id                           v
     stream_class                        v
     fourcc                              vb
@@ -231,7 +228,7 @@
 
 index:
     index_startcode                     f(64)
-    packet header
+    forward_ptr                         v
     max_pts                             v
     syncpoints                          v
     for(i=0; i<syncpoints; i++){
@@ -296,7 +293,7 @@
 
 info_packet: (optional)
     info_startcode                      f(64)
-    packet header
+    forward_ptr                         v
     info_frame
 
 syncpoint:
@@ -456,6 +453,7 @@
     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
+    decode_delay MUST NOT be set higher than necessary for a codec.
 
 fixed_fps
     1 indicates that the fps is fixed
@@ -562,6 +560,7 @@
     checksum is calculated for the area pointed to by forward_ptr not
     including the checksum itself (from first byte after the
     forward_ptr until last byte before the checksum).
+    In the case of info frames, covers area from begginning of frame.
 
 syncpoint_checksum
     crc32 checksum
@@ -729,12 +728,6 @@
 Info frames can be used to describe the file or some part of it (chapters)
 
 
-Unknown packets:
-----------------
-
-MUST be ignored by the demuxer
-
-
 demuxer (non-normative):
 ------------------------
 


More information about the NUT-devel mailing list