[NUT-devel] info packets/frames
Oded Shimon
ods15 at ods15.dyndns.org
Sat Feb 18 09:02:48 CET 2006
On Thu, Feb 16, 2006 at 01:29:32AM -0500, Rich Felker wrote:
> On Thu, Feb 16, 2006 at 08:01:38AM +0200, Oded Shimon wrote:
> > Main difference in this patch is "type" is only for binary data. I couldn't
> > decide an elegant way to design the table to accomodate this though...
>
> Design of the table is an _implementation_ issue.
I meant the design just here in the spec, you said it yourself, it is
misleading that the int types have a "type".
> > +info_table[4][][2]={
> > + {
> > + {NULL , "i"}, // integer
> > + },
> > + {
> > + {NULL , "r"}, // rational
> > + {"TrackTime" , "r"},
> > + },
> > + {
> > + {NULL , "f"}, // float
> > + },
>
> IMO this part is silly/misleading, since "i", "r", and "f" are not
> "types".
exactly what I meant....
> > + {
> > + {NULL , NULL },
> > + {NULL , "UTF8"},
> > + {"Author" , "UTF8"},
> > + {"Description" , "UTF8"},
> > + {"Copyright" , "UTF8"},
> > + {"Encoder" , "UTF8"},
> > + {"Title" , "UTF8"},
> > + {"Cover" , "JPEG"},
> > + {"Cover" , "PNG"},
> > + {"Source" , "UTF8"},
> > + {"CaptureDevice" , "UTF8"},
> > + {"CreationTime" , "UTF8"},
> > + {"Keywords" , "UTF8"},
> > + {"Language" , "UTF8"},
> > + {"Disposition" , "UTF8"},
> > + }
> > };
> > + Note: No future entries will have NULL as a value.
>
> Two comments:
>
> 1. Is it really necessary to have entry 1 ({NULL, "UTF8"}) ? It would
> be simpler if type were always coded when a custom name is.
I think it is worth it...
> 2. Maybe this is stupid/pedantic, but the correct name is UTF-8, not
> UTF8. Is it worth wasting a byte to correct this?
It's not wasting a byte because we have entry 1...
I still have one major issue left with info packets - chapters... We need
to decide a sane way to do them and say so in the spec... But that's after
we all agree on this patch. Does anyone have objections left...
- ods15
-------------- next part --------------
Index: DOCS/tech/mpcf.txt
===================================================================
RCS file: /cvsroot/mplayer/main/DOCS/tech/mpcf.txt,v
retrieving revision 1.107
diff -u -r1.107 mpcf.txt
--- DOCS/tech/mpcf.txt 17 Feb 2006 20:05:25 -0000 1.107
+++ DOCS/tech/mpcf.txt 18 Feb 2006 07:55:32 -0000
@@ -98,6 +98,8 @@
data[i] u(8)
}
[Note: strings MUST be encoded in UTF-8]
+ [Note: the character NUL (U+0000) is not legal within
+ or at the end of a string]
vb (variable length binary data or string)
length v
@@ -262,21 +264,29 @@
checksum u(32)
info_frame: (optional)
- for(;;){
+ info_stream_mask 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
+ index= id>>2
+ name= info_table[code][index][0]
+ 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 {
+ if(index) type= info_table[code][index][1]
+ else type vb
value vb
+ }
}
reserved_bytes
checksum u(32)
@@ -609,19 +619,20 @@
Info tags:
----------
+info_stream_mask
+ Bit mask saying which which stream(s) this info packet reffers to.
+ Zero means info packet reffers to whole 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
+ for example: "UTF-8" -> string or "JPEG" -> JPEG image
Note: nonstandard fields should be prefixed by "X-"
Note: MUST be less than 6 byte long (might be increased to 64 later)
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"
@@ -640,8 +651,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
@@ -662,24 +673,36 @@
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 }, // integer
+ },
+ {
+ {NULL , NULL }, // rational
+ {"TrackTime" , NULL },
+ },
+ {
+ {NULL , NULL }, // float
+ },
+ {
+ {NULL , NULL },
+ {NULL , "UTF-8"},
+ {"Author" , "UTF-8"},
+ {"Description" , "UTF-8"},
+ {"Copyright" , "UTF-8"},
+ {"Encoder" , "UTF-8"},
+ {"Title" , "UTF-8"},
+ {"Cover" , "JPEG"},
+ {"Cover" , "PNG"},
+ {"Source" , "UTF-8"},
+ {"CaptureDevice" , "UTF-8"},
+ {"CreationTime" , "UTF-8"},
+ {"Keywords" , "UTF-8"},
+ {"Language" , "UTF-8"},
+ {"Disposition" , "UTF-8"},
+ }
};
+ Note: No future entries will have NULL as a value.
Structure:
More information about the NUT-devel
mailing list