examples/SFExamples/oggvorbiscodec/src/libvorbis/doc/xml/05-comment.xml

00001 <?xml version="1.0" standalone="no"?>
00002 <!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
00003                 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" [
00004 <!ENTITY % isolat1 SYSTEM "http://www.oasis-open.org/docbook/xml/4.2/ent/iso-lat1.ent">
00005 %isolat1;
00006 ]>
00007 
00008 <section id="vorbis-spec-comment">
00009 <sectioninfo>
00010  <releaseinfo>
00011  $Id: 05-comment.xml 10468 2005-11-28 00:58:48Z giles $
00012 </releaseinfo>
00013 </sectioninfo>
00014 <title>comment field and header specification</title>
00015 
00016 
00017 <section><title>Overview</title>
00018 
00019 <para>The Vorbis text comment header is the second (of three) header
00020 packets that begin a Vorbis bitstream. It is meant for short text
00021 comments, not arbitrary metadata; arbitrary metadata belongs in a
00022 separate logical bitstream (usually an XML stream type) that provides
00023 greater structure and machine parseability.</para>
00024 
00025 <para>The comment field is meant to be used much like someone jotting a
00026 quick note on the bottom of a CDR. It should be a little information to
00027 remember the disc by and explain it to others; a short, to-the-point
00028 text note that need not only be a couple words, but isn't going to be
00029 more than a short paragraph.  The essentials, in other words, whatever
00030 they turn out to be, eg:
00031 
00032 <blockquote>
00033 <simpara>Honest Bob and the Factory-to-Dealer-Incentives, <citetitle>I'm Still
00034 Around</citetitle>, opening for Moxy Fr&uuml;vous, 1997.</simpara>
00035 </blockquote>
00036 </para>
00037 
00038 </section>
00039 
00040 <section><title>Comment encoding</title>
00041 
00042 <section><title>Structure</title>
00043 
00044 <para>
00045 The comment header is logically a list of eight-bit-clean vectors; the
00046 number of vectors is bounded to 2^32-1 and the length of each vector
00047 is limited to 2^32-1 bytes. The vector length is encoded; the vector
00048 contents themselves are not null terminated. In addition to the vector
00049 list, there is a single vector for vendor name (also 8 bit clean,
00050 length encoded in 32 bits). For example, the 1.0 release of libvorbis 
00051 set the vendor string to "Xiph.Org libVorbis I 20020717".</para>
00052 
00053 <para>The comment header is decoded as follows:
00054 
00055 <programlisting>
00056   1) [vendor_length] = read an unsigned integer of 32 bits
00057   2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
00058   3) [user_comment_list_length] = read an unsigned integer of 32 bits
00059   4) iterate [user_comment_list_length] times {
00060        5) [length] = read an unsigned integer of 32 bits
00061        6) this iteration's user comment = read a UTF-8 vector as [length] octets
00062      }
00063   7) [framing_bit] = read a single bit as boolean
00064   8) if ( [framing_bit] unset or end-of-packet ) then ERROR
00065   9) done.
00066 </programlisting>
00067 </para>
00068 
00069 </section>
00070 
00071 <section><title>Content vector format</title>
00072 
00073 <para>
00074 The comment vectors are structured similarly to a UNIX environment variable.
00075 That is, comment fields consist of a field name and a corresponding value and
00076 look like:</para>
00077 
00078 <blockquote><programlisting>
00079 comment[0]="ARTIST=me"; 
00080 comment[1]="TITLE=the sound of Vorbis"; 
00081 </programlisting></blockquote>
00082 
00083 <para>
00084 The field name is case-insensitive and may consist of ASCII 0x20
00085 through 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive
00086 (characters A-Z) is to be considered equivalent to ASCII 0x61 through 
00087 0x7A inclusive (characters a-z).
00088 </para>
00089 
00090 <para>
00091 The field name is immediately followed by ASCII 0x3D ('=');
00092 this equals sign is used to terminate the field name.
00093 </para>
00094 
00095 <para>
00096 0x3D is followed by 8 bit clean UTF-8 encoded value of the
00097 field contents to the end of the field.
00098 </para>
00099 
00100 <section><title>Field names</title>
00101 
00102 <para>Below is a proposed, minimal list of standard field names with a
00103 description of intended use.  No single or group of field names is
00104 mandatory; a comment header may contain one, all or none of the names
00105 in this list.</para>
00106 
00107 <variablelist>
00108 <varlistentry>
00109 <term>TITLE</term>
00110 <listitem>
00111 <simpara>Track/Work name</simpara>
00112 </listitem>
00113 </varlistentry>
00114 <varlistentry>
00115  <term>VERSION</term>
00116 <listitem>
00117  <simpara>The version field may be used to
00118 differentiate multiple
00119 versions of the same track title in a single collection. (e.g. remix
00120 info)
00121 </simpara></listitem>
00122 </varlistentry>
00123 
00124 <varlistentry><term>ALBUM</term><listitem><simpara>The collection name to which this track belongs
00125 </simpara></listitem>
00126 </varlistentry>
00127 
00128 <varlistentry><term>TRACKNUMBER</term>
00129 <listitem><simpara>The track number of this piece if part of a specific larger collection or album
00130 </simpara></listitem>
00131 </varlistentry>
00132 
00133 <varlistentry><term>ARTIST</term>
00134 <listitem><simpara>The artist generally considered responsible for the work. In popular music this is usually the performing band or singer. For classical music it would be the composer. For an audio book it would be the author of the original text.
00135 </simpara></listitem>
00136 </varlistentry>
00137 
00138 <varlistentry><term>PERFORMER</term>
00139 <listitem><simpara>The artist(s) who performed the work. In classical music this would be the conductor, orchestra, soloists. In an audio book it would be the actor who did the reading. In popular music this is typically the same as the ARTIST and is omitted.
00140 </simpara></listitem>
00141 </varlistentry>
00142 
00143 <varlistentry><term>COPYRIGHT</term>
00144 <listitem><simpara>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'
00145 </simpara></listitem>
00146 </varlistentry>
00147 
00148 <varlistentry><term>LICENSE</term>
00149 <listitem><simpara>License information, eg, 'All Rights Reserved', 'Any
00150 Use Permitted', a URL to a license such as a Creative Commons license
00151 ("www.creativecommons.org/blahblah/license.html") or the EFF Open
00152 Audio License ('distributed under the terms of the Open Audio
00153 License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
00154 details'), etc.
00155 </simpara></listitem>
00156 </varlistentry>
00157 
00158 <varlistentry><term>ORGANIZATION</term>
00159 <listitem><simpara>Name of the organization producing the track (i.e.
00160 the 'record label')
00161 </simpara></listitem>
00162 </varlistentry>
00163 
00164 <varlistentry><term>DESCRIPTION</term>
00165 <listitem><simpara>A short text description of the contents
00166 </simpara></listitem>
00167 </varlistentry>
00168 
00169 <varlistentry><term>GENRE</term>
00170 <listitem><simpara>A short text indication of music genre
00171 </simpara></listitem>
00172 </varlistentry>
00173 
00174 <varlistentry><term>DATE</term>
00175 <listitem><simpara>Date the track was recorded
00176 </simpara></listitem>
00177 </varlistentry>
00178 
00179 <varlistentry><term>LOCATION</term>
00180 <listitem><simpara>Location where track was recorded
00181 </simpara></listitem>
00182 </varlistentry>
00183 
00184 <varlistentry><term>CONTACT</term>
00185 <listitem><simpara>Contact information for the creators or distributors of the track. This could be a URL, an email address, the physical address of the producing label.
00186 </simpara></listitem>
00187 </varlistentry>
00188 
00189 <varlistentry><term>ISRC</term>
00190 <listitem><simpara>International Standard Recording Code for the
00191 track; see <ulink
00192 url="http://www.ifpi.org/site-content/online/isrc_intro.html">the ISRC
00193 intro page</ulink> for more information on ISRC numbers.
00194 </simpara></listitem>
00195 </varlistentry>
00196 
00197 </variablelist>
00198 
00199 </section>
00200 
00201 <section><title>Implications</title>
00202 
00203 <para>Field names should not be 'internationalized'; this is a
00204 concession to simplicity not an attempt to exclude the majority of
00205 the world that doesn't speak English. Field <emphasis>contents</emphasis>,
00206 however, use the UTF-8 character encoding to allow easy representation 
00207 of any language.</para>
00208 
00209 <para>We have the length of the entirety of the field and restrictions on
00210 the field name so that the field name is bounded in a known way. Thus
00211 we also have the length of the field contents.</para>
00212 
00213 <para>Individual 'vendors' may use non-standard field names within
00214 reason. The proper use of comment fields should be clear through
00215 context at this point.  Abuse will be discouraged.</para>
00216 
00217 <para>There is no vendor-specific prefix to 'nonstandard' field names.
00218 Vendors should make some effort to avoid arbitrarily polluting the
00219 common namespace. We will generally collect the more useful tags
00220 here to help with standardization.</para>
00221 
00222 <para>Field names are not required to be unique (occur once) within a
00223 comment header.  As an example, assume a track was recorded by three
00224 well know artists; the following is permissible, and encouraged:
00225 
00226 <blockquote><programlisting>
00227 ARTIST=Dizzy Gillespie 
00228 ARTIST=Sonny Rollins 
00229 ARTIST=Sonny Stitt 
00230 </programlisting></blockquote>
00231 
00232 </para>
00233 
00234 </section>
00235 
00236 </section>
00237 
00238 <section><title>Encoding</title> 
00239 
00240 <para>
00241 The comment header comprises the entirety of the second bitstream
00242 header packet.  Unlike the first bitstream header packet, it is not
00243 generally the only packet on the second page and may not be restricted
00244 to within the second bitstream page.  The length of the comment header
00245 packet is (practically) unbounded.  The comment header packet is not
00246 optional; it must be present in the bitstream even if it is
00247 effectively empty.</para>
00248 
00249 <para>
00250 The comment header is encoded as follows (as per Ogg's standard
00251 bitstream mapping which renders least-significant-bit of the word to be
00252 coded into the least significant available bit of the current
00253 bitstream octet first):
00254 
00255 <orderedlist>
00256  <listitem><simpara>
00257   Vendor string length (32 bit unsigned quantity specifying number of octets)
00258  </simpara></listitem>
00259  <listitem><simpara>
00260   Vendor string ([vendor string length] octets coded from beginning of string to end of string, not null terminated)
00261  </simpara></listitem>
00262  <listitem><simpara>
00263   Number of comment fields (32 bit unsigned quantity specifying number of fields)
00264  </simpara></listitem>
00265  <listitem><simpara>
00266   Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned quantity specifying number of octets)
00267  </simpara></listitem>
00268  <listitem><simpara>
00269   Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end of string, not null terminated)
00270  </simpara></listitem>
00271  <listitem><simpara>
00272   Comment field 1 length (if [Number of comment fields]>1...)...
00273  </simpara></listitem>
00274 </orderedlist>
00275 </para>
00276 
00277 <para>
00278 This is actually somewhat easier to describe in code; implementation of the above can be found in <filename>vorbis/lib/info.c</filename>, <function>_vorbis_pack_comment()</function> and <function>_vorbis_unpack_comment()</function>.
00279 </para>
00280 
00281 </section>
00282 </section>
00283 
00284 </section>

Generated by  doxygen 1.6.2