v-comment.html 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <HTML><HEAD><TITLE>xiph.org: Ogg Vorbis documentation</TITLE>
  2. <BODY bgcolor="#ffffff" text="#202020" link="#006666" vlink="#000000">
  3. <nobr><img src="white-ogg.png"><img src="vorbisword2.png"></nobr><p>
  4. <h1><font color=#000070>
  5. Ogg Vorbis comment field specification
  6. </font></h1>
  7. <em>Last update to this document: June 16, 2000</em><p>
  8. The text comment header is the second (of three) header packets that
  9. begin a Vorbis bitstream. It is meant for short, text comments,
  10. not arbitrary metadata; arbitrary metadata belongs in a
  11. metadata stream (usually an XML stream type).<p>
  12. <h2>Comment use rationale</h2>
  13. The comment field is meant to be used much like someone jotting a
  14. quick note on the bottom of a CDR. It should be a little information to
  15. remember the disc by and explain it to others; a short, to-the-point
  16. text note that need not only be a couple words, but isn't going to be
  17. more than a short paragraph. The essentials, in other words, whatever
  18. they turn out to be, eg:
  19. <blockquote>
  20. "Honest Bob and the Factory-to-Dealer-Incentives, _I'm Still Around_,
  21. opening for Moxy Fruvous, 1997"
  22. </blockquote>
  23. <h2>Structure</h2>
  24. The comment header logically is a list of eight-bit-clean vectors; the
  25. number of vectors is bounded to 2^32-1 and the length of each vector
  26. is limited to 2^32-1 bytes. The vector length is encoded; the vector
  27. is not null terminated. In addition to the vector list, there is a
  28. single vector for vendor name (also 8 bit clean, length encoded in 32
  29. bits). Libvorbis currently sets the vendor string to "Xiphophorus
  30. libVorbis I 20000508".<p>
  31. The comment vectors are structured similarly to a UNIX environment.
  32. That is, comment fields consist of a field name and a field value and
  33. look like:
  34. <pre>
  35. comment[0]="ARTIST=me";
  36. comment[1]="TITLE=the sound of vorbis";
  37. </pre>
  38. <h2>Content vector format</h2>
  39. <ul>
  40. <li>A case-insensitive field name that may consist of ASCII 0x20 through
  41. 0x7D, 0x3D ('=') excluded. ASCII 0x41 through 0x5A inclusive (A-Z) is
  42. to be considered equivalent to ASCII 0x61 through 0x7A inclusive
  43. (a-z).
  44. <li>The field name is immediately followed by ASCII 0x3D ('='); this
  45. equals sign is used to terminate the field name.
  46. <li>0x3D is followed by 8 bit clean UTF-8 field contents to the end of
  47. the field.
  48. </ul>
  49. <h3>Field names</h3>
  50. Below is a proposed, minimal list of standard filed names with a
  51. description of intended use. No single or group of field names is
  52. mandatory; a comment header may contain one, all or none of the names
  53. in this list.
  54. <dl>
  55. <dt>TITLE<dd>Track name
  56. <dt>VERSION<dd>The version field may be used to differentiate multiple version of the same track title in a single collection.
  57. <dt>ALBUM<dd>The collection name to which this track belongs
  58. <dt>ARTIST<dd>Track performer
  59. <dt>ORGANIZATION<dd>Name of the organization producing the track (ie,
  60. the 'record label')
  61. <dt>DESCRIPTION<dd>A short text description of the contents
  62. <dt>GENRE<dd>A short text indication of music genre
  63. <dt>DATE<dd>Date the track was recorded
  64. <dt>LOCATION<dd>Location where track was recorded
  65. <dt>COPYRIGHT<dd>Copyright information
  66. </dl>
  67. <h3>Implications</h3>
  68. <ul>
  69. <li>
  70. Field names should not be 'internationalized'; this is a
  71. concession to simplicity not an attempt to exclude the majority of
  72. the world that doesn't speak English. Field *contents*, however,
  73. are represented in UTF-8 to allow easy representation of any language.
  74. <li>
  75. We have the length of the entirety of the field and restrictions on
  76. the field name so that the field name is bounded in a known way. Thus
  77. we also have the length of the field contents.
  78. <li>
  79. Individual 'vendors' may use non-standard field names within
  80. reason. The proper use of comment fields should be clear through
  81. context at this point. Abuse will be discouraged.
  82. <li>
  83. There is no vendor-specific prefix to 'nonstandard' field names.
  84. Vendors should make some effort to avoid arbitrarily polluting the
  85. common namespace.
  86. <li>
  87. Field names are not required to be unique (occur once) within a
  88. comment header. As an example, assume a track was recorded by three
  89. well know artists; the following is permissible:
  90. <pre>
  91. ARTIST=Dizzy Gillespie
  92. ARTIST=Sonny Rollins
  93. ARTIST=Sonny Stitt
  94. </pre>
  95. </ul>
  96. <h2>Encoding</h2>
  97. The comment header comprises the entirety of the second bitstream
  98. header packet. Unlike the first bitstream header packet, it is not
  99. generally the only packet on the second page and may not be restricted
  100. to within the second bitstream page. The length of the comment header
  101. packet is [practically] unbounded. The comment header packet is not
  102. optional; it must be present in the bitstream even if it is
  103. effectively empty.<p>
  104. The comment header is encoded as follows (as per Ogg's standard
  105. bitstream mapping which renders least-significant-bit of the word to be
  106. coded into the least significant available bit of the current
  107. bitstream octet first):
  108. <ol>
  109. <li>
  110. Vendor string length (32 bit unsigned quantity specifying number of octets)
  111. <li>
  112. Vendor string ([vendor string length] octets coded from beginning of string to end of string, not null terminated)
  113. <li>Number of comment fields (32 bit unsigned quantity specifying number of fields)
  114. <li>Comment field 0 length (if [Number of comment fields]>0; 32 bit unsigned quantity specifying number of octets)
  115. <li>
  116. Comment field 0 ([Comment field 0 length] octets coded from beginning of string to end of string, not null terminated)
  117. <li>Comment field 1 length (if [Number of comment fields]>1...)...
  118. </ol>
  119. This is actually somewhat easier to describe in code; implementation of the above can be found in vorbis/lib/info.c:_vorbis_pack_comment(),_vorbis_unpack_comment()
  120. <hr>
  121. <a href="http://www.xiph.org/">
  122. <img src="white-xifish.png" align=left border=0>
  123. </a>
  124. <font size=-2 color=#505050>
  125. Ogg is a <a href="http://www.xiph.org">Xiphophorus</a> effort to
  126. protect essential tenets of Internet multimedia from corporate
  127. hostage-taking; Open Source is the net's greatest tool to keep
  128. everyone honest. See <a href="http://www.xiph.org/about.html">About
  129. Xiphophorus</a> for details.
  130. <p>
  131. Ogg Vorbis is the first Ogg audio CODEC. Anyone may
  132. freely use and distribute the Ogg and Vorbis specification,
  133. whether in a private, public or corporate capacity. However,
  134. Xiphophorus and the Ogg project (xiph.org) reserve the right to set
  135. the Ogg/Vorbis specification and certify specification compliance.<p>
  136. Xiphophorus's Vorbis software CODEC implementation is distributed
  137. under the Lesser/Library GNU Public License. This does not restrict
  138. third parties from distributing independent implementations of Vorbis
  139. software under other licenses.<p>
  140. OggSquish, Vorbis, Xiphophorus and their logos are trademarks (tm) of
  141. <a href="http://www.xiph.org/">Xiphophorus</a>. These pages are
  142. copyright (C) 1994-2000 Xiphophorus. All rights reserved.<p>
  143. </body>