apps/camogm2/ogmstreams.h

Go to the documentation of this file.
00001 #ifndef __OGGSTREAMS_H
00002 #define __OGGSTREAMS_H
00003 
00004 /*
00005  * Taken from http://tobias.everwicked.com/packfmt.htm
00006  *
00007  
00008  First packet (header)
00009  ---------------------
00010  
00011  pos    | content                 | description
00012  -------+-------------------------+----------------------------------
00013  0x0000 | 0x01                    | indicates 'header packet'
00014  -------+-------------------------+----------------------------------
00015  0x0001 | stream_header           | the size is indicated in the
00016  |                         | size member
00017  
00018  
00019  Second packet (comment)
00020  -----------------------
00021  
00022  pos    | content                 | description
00023  -------+-------------------------+----------------------------------
00024  0x0000 | 0x03                    | indicates 'comment packet'
00025  -------+-------------------------+----------------------------------
00026  0x0001 | data                    | see vorbis doc on www.xiph.org
00027  
00028  Data packets
00029  ------------
00030  
00031  pos      | content                 | description
00032  ---------+-------------------------+----------------------------------
00033  0x0000   | Bit0  0                 | indicates data packet
00034  | Bit1  Bit 2 of lenbytes |
00035  | Bit2  unused            |
00036  | Bit3  keyframe          |
00037  | Bit4  unused            |
00038  | Bit5  unused            |
00039  | Bit6  Bit 0 of lenbytes |
00040  | Bit7  Bit 1 of lenbytes |
00041  ---------+-------------------------+----------------------------------
00042  0x0001   | LowByte                 | Length of this packet in samples
00043  | ...                     | (frames for video, samples for
00044  | HighByte                | audio, 1ms units for text)
00045  ---------+-------------------------+----------------------------------
00046  0x0001+  | data                    | packet contents
00047  lenbytes |                         |
00048  
00049  *
00050  *
00051  */
00052 
00054 // Header for the new header format
00055 typedef struct stream_header_video {
00056         ogg_int32_t     width;
00057         ogg_int32_t     height;
00058 } stream_header_video;
00059 
00060 typedef struct stream_header_audio {
00061         ogg_int16_t     channels;
00062         ogg_int16_t     blockalign;
00063         ogg_int32_t     avgbytespersec;
00064 } stream_header_audio;
00065 
00066 typedef struct stream_header {
00067         char            streamtype[8]; // "audio"
00068         char            subtype[4];             // "0001" - i.e. PCM
00069 
00070         ogg_int32_t     size;           // size of the structure
00071 
00072         ogg_int64_t     time_unit;      // in reference time
00073         ogg_int64_t     samples_per_unit;
00074         ogg_int32_t     default_len;    // in media time
00075 
00076         ogg_int32_t     buffersize;
00077 //      ogg_int16_t     bits_per_sample;
00078         ogg_int32_t     bits_per_sample;
00079 
00080         union {
00081                 // Video specific
00082                 stream_header_video video;
00083                 // Audio specific
00084                 stream_header_audio audio;
00085         } sh;
00086 
00087 //      ogg_int16_t     padding;
00088         ogg_int32_t     padding;
00089 
00090 } stream_header;
00091 
00092 typedef struct old_stream_header {
00093         char            streamtype[8];
00094         char            subtype[4];
00095 
00096         ogg_int32_t     size;           // size of the structure
00097 
00098         ogg_int64_t     time_unit;      // in reference time
00099         ogg_int64_t     samples_per_unit;
00100         ogg_int32_t     default_len;    // in media time
00101 
00102         ogg_int32_t     buffersize;
00103         ogg_int16_t     bits_per_sample;
00104 
00105         ogg_int16_t     padding;
00106 
00107         union {
00108                 // Video specific
00109                 stream_header_video video;
00110                 // Audio specific
00111                 stream_header_audio audio;
00112         } sh;
00113 
00114 } old_stream_header;
00115 
00117 #define PACKET_TYPE_HEADER       0x01
00118 #define PACKET_TYPE_COMMENT      0x03
00119 #define PACKET_TYPE_BITS         0x07
00120 #define PACKET_LEN_BITS01        0xc0
00121 #define PACKET_LEN_BITS2         0x02
00122 #define PACKET_IS_SYNCPOINT      0x08
00123 
00124 #endif                                                  /* __OGGSTREAMS_H */

Generated on Fri Nov 28 00:06:21 2008 for elphel by  doxygen 1.5.1