1 #ifndef __OGGSTREAMS_H 2 #define __OGGSTREAMS_H 3 4 /* 5 * Taken from http://tobias.everwicked.com/packfmt.htm 6 * 7 8 First packet (header) 9 --------------------- 10 11 pos | content | description 12 -------+-------------------------+---------------------------------- 13 0x0000 | 0x01 | indicates 'header packet' 14 -------+-------------------------+---------------------------------- 15 0x0001 | stream_header | the size is indicated in the 16 | | size member 17 18 19 Second packet (comment) 20 ----------------------- 21 22 pos | content | description 23 -------+-------------------------+---------------------------------- 24 0x0000 | 0x03 | indicates 'comment packet' 25 -------+-------------------------+---------------------------------- 26 0x0001 | data | see vorbis doc on www.xiph.org 27 28 Data packets 29 ------------ 30 31 pos | content | description 32 ---------+-------------------------+---------------------------------- 33 0x0000 | Bit0 0 | indicates data packet 34 | Bit1 Bit 2 of lenbytes | 35 | Bit2 unused | 36 | Bit3 keyframe | 37 | Bit4 unused | 38 | Bit5 unused | 39 | Bit6 Bit 0 of lenbytes | 40 | Bit7 Bit 1 of lenbytes | 41 ---------+-------------------------+---------------------------------- 42 0x0001 | LowByte | Length of this packet in samples 43 | ... | (frames for video, samples for 44 | HighByte | audio, 1ms units for text) 45 ---------+-------------------------+---------------------------------- 46 0x0001+ | data | packet contents 47 lenbytes | | 48 49 * 50 * 51 */ 52 53 //// OggDS headers 54 // Header for the new header format 55 typedef struct stream_header_video 56 { 57 ogg_int32_t width; 58 ogg_int32_t height; 59 } stream_header_video; 60 61 typedef struct stream_header_audio 62 { 63 ogg_int16_t channels; 64 ogg_int16_t blockalign; 65 ogg_int32_t avgbytespersec; 66 } stream_header_audio; 67 68 typedef struct stream_header 69 { 70 char streamtype[8]; 71 char subtype[4]; 72 73 ogg_int32_t size; // size of the structure 74 75 ogg_int64_t time_unit; // in reference time 76 ogg_int64_t samples_per_unit; 77 ogg_int32_t default_len; // in media time 78 79 ogg_int32_t buffersize; 80 ogg_int16_t bits_per_sample; 81 82 union 83 { 84 // Video specific 85 stream_header_video video; 86 // Audio specific 87 stream_header_audio audio; 88 } sh; 89 90 ogg_int16_t padding; 91 92 } stream_header; 93 94 typedef struct old_stream_header 95 { 96 char streamtype[8]; 97 char subtype[4]; 98 99 ogg_int32_t size; // size of the structure 100 101 ogg_int64_t time_unit; // in reference time 102 ogg_int64_t samples_per_unit; 103 ogg_int32_t default_len; // in media time 104 105 ogg_int32_t buffersize; 106 ogg_int16_t bits_per_sample; 107 108 ogg_int16_t padding; 109 110 union 111 { 112 // Video specific 113 stream_header_video video; 114 // Audio specific 115 stream_header_audio audio; 116 } sh; 117 118 } old_stream_header; 119 120 /// Some defines from OggDS 121 #define PACKET_TYPE_HEADER 0x01 122 #define PACKET_TYPE_COMMENT 0x03 123 #define PACKET_TYPE_BITS 0x07 124 #define PACKET_LEN_BITS01 0xc0 125 #define PACKET_LEN_BITS2 0x02 126 #define PACKET_IS_SYNCPOINT 0x08 127 128 #endif /* __OGGSTREAMS_H */ 129