v-comment.html 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-15"/>
  5. <title>Ogg Vorbis Documentation</title>
  6. <style type="text/css">
  7. body {
  8. margin: 0 18px 0 18px;
  9. padding-bottom: 30px;
  10. font-family: Verdana, Arial, Helvetica, sans-serif;
  11. color: #333333;
  12. font-size: .8em;
  13. }
  14. a {
  15. color: #3366cc;
  16. }
  17. img {
  18. border: 0;
  19. }
  20. #xiphlogo {
  21. margin: 30px 0 16px 0;
  22. }
  23. #content p {
  24. line-height: 1.4;
  25. }
  26. h1, h1 a, h2, h2 a, h3, h3 a {
  27. font-weight: bold;
  28. color: #ff9900;
  29. margin: 1.3em 0 8px 0;
  30. }
  31. h1 {
  32. font-size: 1.3em;
  33. }
  34. h2 {
  35. font-size: 1.2em;
  36. }
  37. h3 {
  38. font-size: 1.1em;
  39. }
  40. li {
  41. line-height: 1.4;
  42. }
  43. #copyright {
  44. margin-top: 30px;
  45. line-height: 1.5em;
  46. text-align: center;
  47. font-size: .8em;
  48. color: #888888;
  49. clear: both;
  50. }
  51. </style>
  52. </head>
  53. <body>
  54. <div id="xiphlogo">
  55. <a href="http://www.xiph.org/"><img src="fish_xiph_org.png" alt="Fish Logo and Xiph.org"/></a>
  56. </div>
  57. <h1>Ogg Vorbis I format specification: comment field and header specification</h1>
  58. <h1>Overview</h1>
  59. <p>The Vorbis text comment header is the second (of three) header
  60. packets that begin a Vorbis bitstream. It is meant for short, text
  61. comments, not arbitrary metadata; arbitrary metadata belongs in a
  62. separate logical bitstream (usually an XML stream type) that provides
  63. greater structure and machine parseability.</p>
  64. <p>The comment field is meant to be used much like someone jotting a
  65. quick note on the bottom of a CDR. It should be a little information to
  66. remember the disc by and explain it to others; a short, to-the-point
  67. text note that need not only be a couple words, but isn't going to be
  68. more than a short paragraph. The essentials, in other words, whatever
  69. they turn out to be, eg:</p>
  70. <blockquote><p>
  71. "Honest Bob and the Factory-to-Dealer-Incentives, _I'm Still Around_,
  72. opening for Moxy Fr&uuml;vous, 1997"
  73. </p></blockquote>
  74. <h1>Comment encoding</h1>
  75. <h2>Structure</h2>
  76. <p>The comment header logically is a list of eight-bit-clean vectors; the
  77. number of vectors is bounded to 2^32-1 and the length of each vector
  78. is limited to 2^32-1 bytes. The vector length is encoded; the vector
  79. contents themselves are not null terminated. In addition to the vector
  80. list, there is a single vector for vendor name (also 8 bit clean,
  81. length encoded in 32 bits). For example, the 1.0 release of libvorbis
  82. set the vendor string to "Xiph.Org libVorbis I 20020717".</p>
  83. <p>The comment header is decoded as follows:</p>
  84. <pre>
  85. 1) [vendor_length] = read an unsigned integer of 32 bits
  86. 2) [vendor_string] = read a UTF-8 vector as [vendor_length] octets
  87. 3) [user_comment_list_length] = read an unsigned integer of 32 bits
  88. 4) iterate [user_comment_list_length] times {
  89. 5) [length] = read an unsigned integer of 32 bits
  90. 6) this iteration's user comment = read a UTF-8 vector as [length] octets
  91. }
  92. 7) [framing_bit] = read a single bit as boolean
  93. 8) if ( [framing_bit] unset or end of packet ) then ERROR
  94. 9) done.
  95. </pre>
  96. <h2>Content vector format</h2>
  97. <p>The comment vectors are structured similarly to a UNIX environment variable.
  98. That is, comment fields consist of a field name and a corresponding value and
  99. look like:</p>
  100. <pre>
  101. comment[0]="ARTIST=me";
  102. comment[1]="TITLE=the sound of Vorbis";
  103. </pre>
  104. <ul>
  105. <li>A case-insensitive field name that may consist of ASCII 0x20 through
  106. 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive (A-Z) is
  107. to be considered equivalent to ASCII 0x61 through 0x7A inclusive
  108. (a-z).</li>
  109. <li>The field name is immediately followed by ASCII 0x3D ('=');
  110. this equals sign is used to terminate the field name.</li>
  111. <li>0x3D is followed by the 8 bit clean UTF-8 encoded value of the
  112. field contents to the end of the field.</li>
  113. </ul>
  114. <h3>Field names</h3>
  115. <p>Below is a proposed, minimal list of standard field names with a
  116. description of intended use. No single or group of field names is
  117. mandatory; a comment header may contain one, all or none of the names
  118. in this list.</p>
  119. <dl>
  120. <dt>TITLE</dt>
  121. <dd>Track/Work name</dd>
  122. <dt>VERSION</dt>
  123. <dd>The version field may be used to differentiate multiple
  124. versions of the same track title in a single collection.
  125. (e.g. remix info)</dd>
  126. <dt>ALBUM</dt>
  127. <dd>The collection name to which this track belongs</dd>
  128. <dt>TRACKNUMBER</dt>
  129. <dd>The track number of this piece if part of a specific larger collection or album</dd>
  130. <dt>ARTIST</dt>
  131. <dd>The artist generally considered responsible for the work. In popular music
  132. this is usually the performing band or singer. For classical music it would be
  133. the composer. For an audio book it would be the author of the original text.</dd>
  134. <dt>PERFORMER</dt>
  135. <dd>The artist(s) who performed the work. In classical music this would be the
  136. conductor, orchestra, soloists. In an audio book it would be the actor who did
  137. the reading. In popular music this is typically the same as the ARTIST and
  138. is omitted.</dd>
  139. <dt>COPYRIGHT</dt>
  140. <dd>Copyright attribution, e.g., '2001 Nobody's Band' or '1999 Jack Moffitt'</dd>
  141. <dt>LICENSE</dt>
  142. <dd>License information, eg, 'All Rights Reserved', 'Any
  143. Use Permitted', a URL to a license such as a Creative Commons license
  144. ("www.creativecommons.org/blahblah/license.html") or the EFF Open
  145. Audio License ('distributed under the terms of the Open Audio
  146. License. see http://www.eff.org/IP/Open_licenses/eff_oal.html for
  147. details'), etc.</dd>
  148. <dt>ORGANIZATION</dt>
  149. <dd>Name of the organization producing the track (i.e.
  150. the 'record label')</dd>
  151. <dt>DESCRIPTION</dt>
  152. <dd>A short text description of the contents</dd>
  153. <dt>GENRE</dt>
  154. <dd>A short text indication of music genre</dd>
  155. <dt>DATE</dt>
  156. <dd>Date the track was recorded</dd>
  157. <dt>LOCATION</dt>
  158. <dd>Location where track was recorded</dd>
  159. <dt>CONTACT</dt>
  160. <dd>Contact information for the creators or distributors of the track.
  161. This could be a URL, an email address, the physical address of
  162. the producing label.</dd>
  163. <dt>ISRC</dt>
  164. <dd>ISRC number for the track; see <a href="http://www.ifpi.org/isrc/">the
  165. ISRC intro page</a> for more information on ISRC numbers.</dd>
  166. </dl>
  167. <h3>Implications</h3>
  168. <ul>
  169. <li>Field names should not be 'internationalized'; this is a
  170. concession to simplicity not an attempt to exclude the majority of
  171. the world that doesn't speak English. Field <emph>contents</emph>,
  172. however, use the UTF-8 character encoding to allow easy representation
  173. of any language.</li>
  174. <li>We have the length of the entirety of the field and restrictions on
  175. the field name so that the field name is bounded in a known way. Thus
  176. we also have the length of the field contents.</li>
  177. <li>Individual 'vendors' may use non-standard field names within
  178. reason. The proper use of comment fields should be clear through
  179. context at this point. Abuse will be discouraged.</li>
  180. <li>There is no vendor-specific prefix to 'nonstandard' field names.
  181. Vendors should make some effort to avoid arbitrarily polluting the
  182. common namespace. We will generally collect the more useful tags
  183. here to help with standardization.</li>
  184. <li>Field names are not required to be unique (occur once) within a
  185. comment header. As an example, assume a track was recorded by three
  186. well know artists; the following is permissible, and encouraged:
  187. <pre>
  188. ARTIST=Dizzy Gillespie
  189. ARTIST=Sonny Rollins
  190. ARTIST=Sonny Stitt
  191. </pre></li>
  192. </ul>
  193. <h2>Encoding</h2>
  194. <p>The comment header comprises the entirety of the second bitstream
  195. header packet. Unlike the first bitstream header packet, it is not
  196. generally the only packet on the second page and may not be restricted
  197. to within the second bitstream page. The length of the comment header
  198. packet is (practically) unbounded. The comment header packet is not
  199. optional; it must be present in the bitstream even if it is
  200. effectively empty.</p>
  201. <p>The comment header is encoded as follows (as per Ogg's standard
  202. bitstream mapping which renders least-significant-bit of the word to be
  203. coded into the least significant available bit of the current
  204. bitstream octet first):</p>
  205. <ol>
  206. <li>Vendor string length (32 bit unsigned quantity specifying number of octets)</li>
  207. <li>Vendor string ([vendor string length] octets coded from beginning of string
  208. to end of string, not null terminated)</li>
  209. <li>Number of comment fields (32 bit unsigned quantity specifying number of fields)</li>
  210. <li>Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned
  211. quantity specifying number of octets)</li>
  212. <li>Comment field 0 ([Comment field 0 length] octets coded from beginning of
  213. string to end of string, not null terminated)</li>
  214. <li>Comment field 1 length (if [Number of comment fields]>1...)...</li>
  215. </ol>
  216. <p>This is actually somewhat easier to describe in code; implementation of the above
  217. can be found in vorbis/lib/info.c:_vorbis_pack_comment(),_vorbis_unpack_comment()</p>
  218. <div id="copyright">
  219. The Xiph Fish Logo is a
  220. trademark (&trade;) of Xiph.Org.<br/>
  221. These pages &copy; 1994 - 2005 Xiph.Org. All rights reserved.
  222. </div>
  223. </body>
  224. </html>