[NUT-devel] Patch for info packets

Oded Shimon ods15 at ods15.dyndns.org
Thu Feb 23 19:18:32 CET 2006


On Thu, Feb 23, 2006 at 12:11:25PM -0500, Rich Felker wrote:
> On Thu, Feb 23, 2006 at 12:10:13PM +0200, Oded Shimon wrote:
> > On Wed, Feb 22, 2006 at 03:15:24PM +0100, Michael Niedermayer wrote:
> > > On Tue, Feb 21, 2006 at 07:26:07PM -0500, Rich Felker wrote:
> > > > > > -    "TotalTime"
> > > > > > -        total length of the stream in msecs
> > > > > 
> > > > > hmmmmm, global info packets dont have chapter_len, index is optional and
> > > > > you remove this umm ...
> > > > 
> > > > I thought it was our intent that index would not be "optional". IIRC I
> > > > suggested defining in the spec a 'NUT stream authored for permenant
> > > > storage' or something similar, and requiring such a stream to conform
> > > > to several conditions such as: repeated headers, index present, ...
> > > > 
> > > > The idea is that a partially written, truncated, streamed, etc. NUT
> > > > file would not be a a "NUT stream authored for permenant storage" and
> > > > would not be subject to these requirements, but NUTlint would check
> > > > these things and indicate to the user that the file is not conformant
> > > > to the more restrictive requirements.
> > > > 
> > > > BTW in the case of a truncated file where the index is lost, knowing
> > > > TotalTime is not useful anyway since it will be wrong.
> > > 
> > > and the chapter lengthes? its a PITA to go and read the index to find
> > > the last chapter length
> > 
> > I'm ok with bringing back 'totaltime' or having some other solution for 
> > having the length for the last chapter...
> 
> Why not just store the length in the info???
> This is where they belong. If someone has indexed segments of the file
> as chapters, they probably want an idea of total time. If not the file
> should be treated as a pure stream and TotalTime is nonsense. In the
> trivial case where someone wants TotalTime but no chapter divisions
> they can just make one big chapter/segment.

New patch. One kink left to sort out is info frames. My suggestion for it 
is to use negative chapter id's..

Can I commit this patch?

- ods15
-------------- next part --------------
Index: DOCS/tech/mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.108
diff -u -r1.108 mpcf.txt
--- DOCS/tech/mpcf.txt	20 Feb 2006 04:49:06 -0000	1.108
+++ DOCS/tech/mpcf.txt	23 Feb 2006 18:16:21 -0000
@@ -262,21 +262,32 @@
     checksum                            u(32)
 
 info_frame: (optional)
-    for(;;){
-        id                              v
-        if(id==0) break
-        name= info_table[id][0]
-        type= info_table[id][1]
-        if(type==NULL)
+    stream_id_plus1                     v
+    chapter_id                          v
+    if (chapter_id) {
+        chapter_start                   v
+        chapter_len                     v
+    }
+    count                               v
+    for(i=0; i<count; i++){
+        name                            vb
+        value                           s
+        if (value==-1){
+            type= "UTF-8"
+            value                       vb
+        }else if (value==-2){
             type                        vb
-        if(name==NULL)
-            name                        vb
-        if(type=="v")
-            value                       v
-        else if(type=="s")
-            value                       s
-        else
             value                       vb
+        }else if (value==-3){
+            type= "signed integer"
+            value                       s
+        }else if (value<-3){
+            type= "rational"
+            value.den= -value-2
+            value.num                   s
+        }else{
+            type= "unsigned integer"
+        }
     }
     reserved_bytes
     checksum                            u(32)
@@ -609,9 +620,23 @@
 Info tags:
 ----------
 
-id
-    the ID of the type/name pair, so it is more compact
-    0 means end
+stream_id_plus1
+    Stream this info packet applies to. If zero, packet applies to whole
+    file.
+
+chapter_id
+    Id of chapter this packet applies to. If zero, packet applies to whole
+    file. Positive chapter_id's are real chapters and MUST NOT overlap.
+    Negative chapter_id indicate a sub region of file and not a real
+    chapter. chapter_id MUST be unique to the region it represents.
+
+chapter_start
+    s= chapter_start % stream_count
+    timestamp= chapter_start / stream_count
+    timestamp of start of chapter in timebase of stream 's'.
+
+chapter_len
+    Length of chapter in same timebase of chapter_start.
 
 type
     for example: "UTF8" -> string or "JPEG" -> JPEG image
@@ -620,15 +645,13 @@
 
 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"
     "Encoder"
         the name & version of the software used for encoding
     "Title"
-    "Cover"
+    "Cover" (allowed types are "PNG" and "JPEG")
         image of the (CD, DVD, VHS, ..) cover (preferably PNG or JPEG)
     "Source"
         "DVD", "VCD", "CD", "MD", "FM radio", "VHS", "TV", "LD"
@@ -640,8 +663,6 @@
         (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
     "Language"
         ISO 639 and ISO 3166 for language/country code
         something like "eng" (US english), can be 0 if unknown
@@ -664,24 +685,6 @@
 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"},
-};
 
 
 Structure:
@@ -721,8 +724,14 @@
 file as well.
 
 
-Info frames:
-------------
+Info:
+-----
+
+All info packets with the same chapter_id and stream_id are repeated info
+packets and MUST be binary identical.
+
+All info packets MUST appear after main headers at begginning of file, and
+SHOULD be repeated after all main headers unless they are very large.
 
 Info frames can be used to describe the file or some part of it (chapters)
 


More information about the NUT-devel mailing list