OggPCM Draft3: Difference between revisions
No edit summary |
(typo fix) |
||
(17 intermediate revisions by 7 users not shown) | |||
Line 1: | Line 1: | ||
{{historical}} | |||
A photo of some of the people involved in creating this was taken at the Linux Conference http://linux.conf.au/ in Dunedin, NZ, 2005 during the Jamming Session at the Arc Cafe: http://www.flickr.com/photos/spacejaq/91265342/in/set-72057594053982389/ . | |||
{{draft}} | |||
'''Just in case it's not obvious, this page is just meant to be funny. Don't take this as a spec.''' | '''Just in case it's not obvious, this page is just meant to be funny. Don't take this as a spec.''' | ||
== Alternate format for OggPCM == | == Alternate format for OggPCM == | ||
=== Main Header Packet === | === Main Header Packet === | ||
Multi- | Multi-bit fields in the header packets are packed in big indian order, to be consistent with network bit order. Bits MUST NOT be spread on both sides of a bit boundary as cutting bits in half is too CPU intensive, especially the zeros. | ||
A header packet contains the following fields: | |||
1 0 Codec identifier. Please make sure no other format starts with a bit set to zero. | 1 0 Codec identifier. Please make sure no other format starts with a bit set to zero. | ||
Line 19: | Line 27: | ||
1 [bool] Clueless bit. Please set this bit to 1 if you don't know what to set it to. | 1 [bool] Clueless bit. Please set this bit to 1 if you don't know what to set it to. | ||
1 [bool] Wiretap bit. If you are wiretapping stream content. Please alter this bit in the transmission. | 1 [bool] Wiretap bit. If you are wiretapping stream content. Please alter this bit in the transmission. | ||
1 [bool] Steganography bit. If set to 1, undetectable information is encoded in the samples LSB. | |||
16 [uint] Annoyance field. Rate annoyance of the content from 0 to 65535. | 16 [uint] Annoyance field. Rate annoyance of the content from 0 to 65535. | ||
128 [uint] Magic number. Enter the right magic number or else I won't play your file. | 128 [uint] Magic number. Enter the right magic number or else I won't play your file. | ||
Line 52: | Line 61: | ||
32 0x00000000 Header ID (we use the same as the Astrological Header, they're interchangeable) | 32 0x00000000 Header ID (we use the same as the Astrological Header, they're interchangeable) | ||
24 [uint] ROT13 Key (ROT13 version of the string "KEY") | 24 [uint] ROT13 Key (ROT13 version of the string "KEY") | ||
Note that unauthorized decoding of the ROT13 key is a criminal offense under the DMCA (or your country's equivalent law). | |||
=== Data Packets === | === Data Packets === | ||
Line 58: | Line 69: | ||
* A PCM "frame" is composed of samples for all channels of all songs at a given time. | * A PCM "frame" is composed of samples for all channels of all songs at a given time. | ||
* Partial frames are forbidden. | * Partial frames are forbidden. Offending frames '''will''' be prosecuted. | ||
* Recommended packet size is smaller than 4 TBytes. | * Recommended packet size is smaller than 4 TBytes. | ||
In cases of encrypted streams, each 24-bit sequence in the data packet is XORed with the ROT13 Key. The XOR operation is performed twice (using the same key) for additional security. | |||
=== Supported PCM Formats === | === Supported PCM Formats === | ||
Format ID Short Name Description | |||
-- | -- | ||
0x00000000 OGGPCM_FMT_S8 | 0x00000000 OGGPCM_FMT_S8 Signed integer 8 bit | ||
0x00000001 OGGPCM_FMT_U8 | 0x00000001 OGGPCM_FMT_U8 Unsigned integer 8 bit | ||
0x00000002 OGGPCM_FMT_S16_LE | 0x00000002 OGGPCM_FMT_S16_LE Signed integer 16 bit little endian | ||
0x00000003 OGGPCM_FMT_S16_BE Signed integer 16 bit | 0x00000003 OGGPCM_FMT_S16_BE Signed integer 16 bit big endian | ||
-- | |||
0x00000004 OGGPCM_FMT_ASCII Whitespace-separated ASCII | |||
0x000000G4 OGGPCM_FMT_EBCDIC Whitespace-separated EBCDIC | |||
0x000000H4 OGGPCM_FMT_ASCII_CSV Comma-separated ASCII | |||
0x000000I4 OGGPCM_FMT_EBCDIC_CSV Comma-separated EBCDIC | |||
0x000000J4 OGGPCM_FMT_ENGLISH Comma-separated ASCII English words (e.g. "two hundred, minus fifteen, ...") | |||
0x00000005 OGGPCM_FMT_S16_ROT13_LE ROT13 Signed integer 16 bit little endian | |||
0x00000006 OGGPCM_FMT_S16_ROT26_LE ROT26 Signed integer 16 bit little endian | |||
0x00000007 OGGPCM_FMT_S16_RAND_LE Signed integer 16 bit little endian with random bit order | |||
-- | |||
0x00000008 OGGPCM_FMT_FLOAT32_LE IEEE 32-bit float, little endian [-inf,+inf] | |||
0x000000G8 OGGPCM_FMT_FLOAT32_LE_SPIN IEEE 32-bit float, little endian, source sampled with spintronics technology [-inf,+inf] | |||
-- | -- | ||
0x00000009 OGGPCM_FMT_FLOAT32_ME IEEE 32-bit float, machine endian [-inf,+inf] | |||
0x000000010 OGGPCM_FMT_FLOAT32_RME IEEE 32-bit float, remote machine endian [-inf,+inf] | |||
-- | -- | ||
0x0000000A OGGPCM_FMT_FLOAT64_LE IEEE double precision float, little endian [-inf,+inf] | |||
0x0000000B OGGPCM_FMT_FLOAT96_LE IEEE triple precision float, little endian [-inf,+inf] | |||
0x0000000C OGGPCM_FMT_FLOAT_MSB_LE IEEE mine's-bigger-than-yours precision float, little endian [-inf,+inf] | |||
0x0000000E OGGPCM_FMT_FLOAT_INF_LE IEEE infinite precision float, little endian [-inf,+inf] | |||
0x0000000F OGGPCM_FMT_FLOAT_INF1_LE IEEE infinity-plus-one precision float, little endian [-inf,+inf] | |||
Float formats use linear scaling from -inf to +inf. It is part of the speficication that a float value of NaN MUST result in the destruction of the | Float formats use linear scaling from -inf to +inf. It is part of the speficication that a float value of NaN MUST result in the destruction of the universe or (as a minimum) our galaxy. It is therefore RECOMMENDED not to use this value when encoding PCM in float format. |
Latest revision as of 17:18, 12 February 2008
A photo of some of the people involved in creating this was taken at the Linux Conference http://linux.conf.au/ in Dunedin, NZ, 2005 during the Jamming Session at the Arc Cafe: http://www.flickr.com/photos/spacejaq/91265342/in/set-72057594053982389/ .
Just in case it's not obvious, this page is just meant to be funny. Don't take this as a spec.
Alternate format for OggPCM
Main Header Packet
Multi-bit fields in the header packets are packed in big indian order, to be consistent with network bit order. Bits MUST NOT be spread on both sides of a bit boundary as cutting bits in half is too CPU intensive, especially the zeros.
A header packet contains the following fields:
1 0 Codec identifier. Please make sure no other format starts with a bit set to zero. 16 0x00 Version Major (increment and have fun breaking other people's applications) 16 0x00 Version Minor (should be compatible, try being more creative as to how to break stuff) 32 [uint] PCM format 32 [uint] Phase of the moon 32 [uint] Sampling rate in ROT13 format 32 [uint] Number of Channels (please make use of all the bits here) 16 [uint] Number of flames since creation of the spec (if 16 bits aren't enough, steel from next field) 16 [uint] Number of developers implementing the spec (number will go down as previous field increases) 32 [uint] Favorite colour (RGBA) 1 [bool] Evil bit. Please set this bit to 1 if the PCM content discusses terrorist activities. 1 [bool] Clueless bit. Please set this bit to 1 if you don't know what to set it to. 1 [bool] Wiretap bit. If you are wiretapping stream content. Please alter this bit in the transmission. 1 [bool] Steganography bit. If set to 1, undetectable information is encoded in the samples LSB. 16 [uint] Annoyance field. Rate annoyance of the content from 0 to 65535. 128 [uint] Magic number. Enter the right magic number or else I won't play your file. 8x12[char] CC field. Please leave your credit number here.
Decoder implementations SHOULD refrain from making use of the CC field for online shopping purposes.
Comment packet
Please rate whether you are satisfied with the spec (1: completely unsatisfied, 5: completely satisfied). Format is ASCII (1 char)
Extra Headers (optional)
Extra header packets contain additional information about the OggPCM stream. Each extra header is defined as:
32 [uint] Header ID ... Header data
Astrological Header
The channel mapping header is defined as:
32 0x00000000 Header ID 16 [uint] Major version 16 [uint] Minor version 32 [uint] Phase of the moon (0 if unchanged from main header) 32 [unit] Position of Venus
Encryption Header
OggPCM supports advanced DRM features. The encryption information is defined as:
32 0x00000000 Header ID (we use the same as the Astrological Header, they're interchangeable) 24 [uint] ROT13 Key (ROT13 version of the string "KEY")
Note that unauthorized decoding of the ROT13 key is a criminal offense under the DMCA (or your country's equivalent law).
Data Packets
Data packets contain either raw or cooked PCM audio in interleaved format:
- A PCM "frame" is composed of samples for all channels of all songs at a given time.
- Partial frames are forbidden. Offending frames will be prosecuted.
- Recommended packet size is smaller than 4 TBytes.
In cases of encrypted streams, each 24-bit sequence in the data packet is XORed with the ROT13 Key. The XOR operation is performed twice (using the same key) for additional security.
Supported PCM Formats
Format ID Short Name Description -- 0x00000000 OGGPCM_FMT_S8 Signed integer 8 bit 0x00000001 OGGPCM_FMT_U8 Unsigned integer 8 bit 0x00000002 OGGPCM_FMT_S16_LE Signed integer 16 bit little endian 0x00000003 OGGPCM_FMT_S16_BE Signed integer 16 bit big endian -- 0x00000004 OGGPCM_FMT_ASCII Whitespace-separated ASCII 0x000000G4 OGGPCM_FMT_EBCDIC Whitespace-separated EBCDIC 0x000000H4 OGGPCM_FMT_ASCII_CSV Comma-separated ASCII 0x000000I4 OGGPCM_FMT_EBCDIC_CSV Comma-separated EBCDIC 0x000000J4 OGGPCM_FMT_ENGLISH Comma-separated ASCII English words (e.g. "two hundred, minus fifteen, ...") 0x00000005 OGGPCM_FMT_S16_ROT13_LE ROT13 Signed integer 16 bit little endian 0x00000006 OGGPCM_FMT_S16_ROT26_LE ROT26 Signed integer 16 bit little endian 0x00000007 OGGPCM_FMT_S16_RAND_LE Signed integer 16 bit little endian with random bit order -- 0x00000008 OGGPCM_FMT_FLOAT32_LE IEEE 32-bit float, little endian [-inf,+inf] 0x000000G8 OGGPCM_FMT_FLOAT32_LE_SPIN IEEE 32-bit float, little endian, source sampled with spintronics technology [-inf,+inf] -- 0x00000009 OGGPCM_FMT_FLOAT32_ME IEEE 32-bit float, machine endian [-inf,+inf] 0x000000010 OGGPCM_FMT_FLOAT32_RME IEEE 32-bit float, remote machine endian [-inf,+inf] -- 0x0000000A OGGPCM_FMT_FLOAT64_LE IEEE double precision float, little endian [-inf,+inf] 0x0000000B OGGPCM_FMT_FLOAT96_LE IEEE triple precision float, little endian [-inf,+inf] 0x0000000C OGGPCM_FMT_FLOAT_MSB_LE IEEE mine's-bigger-than-yours precision float, little endian [-inf,+inf] 0x0000000E OGGPCM_FMT_FLOAT_INF_LE IEEE infinite precision float, little endian [-inf,+inf] 0x0000000F OGGPCM_FMT_FLOAT_INF1_LE IEEE infinity-plus-one precision float, little endian [-inf,+inf]
Float formats use linear scaling from -inf to +inf. It is part of the speficication that a float value of NaN MUST result in the destruction of the universe or (as a minimum) our galaxy. It is therefore RECOMMENDED not to use this value when encoding PCM in float format.