1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/raw/RawStructs.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,60 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#if !defined(RawStructs_h_) 1.9 +#define RawStructs_h_ 1.10 + 1.11 +static const uint32_t RAW_ID = 0x595556; 1.12 + 1.13 +struct nsRawVideo_PRUint24 { 1.14 + operator uint32_t() const { return value[2] << 16 | value[1] << 8 | value[0]; } 1.15 + nsRawVideo_PRUint24& operator= (const uint32_t& rhs) 1.16 + { value[2] = (rhs & 0x00FF0000) >> 16; 1.17 + value[1] = (rhs & 0x0000FF00) >> 8; 1.18 + value[0] = (rhs & 0x000000FF); 1.19 + return *this; } 1.20 +private: 1.21 + uint8_t value[3]; 1.22 +}; 1.23 + 1.24 +struct RawPacketHeader { 1.25 + typedef nsRawVideo_PRUint24 PRUint24; 1.26 + uint8_t packetID; 1.27 + PRUint24 codecID; 1.28 +}; 1.29 + 1.30 +// This is Arc's draft from wiki.xiph.org/OggYUV 1.31 +struct RawVideoHeader { 1.32 + typedef nsRawVideo_PRUint24 PRUint24; 1.33 + uint8_t headerPacketID; // Header Packet ID (always 0) 1.34 + PRUint24 codecID; // Codec identifier (always "YUV") 1.35 + uint8_t majorVersion; // Version Major (breaks backwards compat) 1.36 + uint8_t minorVersion; // Version Minor (preserves backwards compat) 1.37 + uint16_t options; // Bit 1: Color (false = B/W) 1.38 + // Bits 2-4: Chroma Pixel Shape 1.39 + // Bit 5: 50% horizontal offset for Cr samples 1.40 + // Bit 6: 50% vertical ... 1.41 + // Bits 7-8: Chroma Blending 1.42 + // Bit 9: Packed (false = Planar) 1.43 + // Bit 10: Cr Staggered Horizontally 1.44 + // Bit 11: Cr Staggered Vertically 1.45 + // Bit 12: Unused (format is always little endian) 1.46 + // Bit 13: Interlaced (false = Progressive) 1.47 + // Bits 14-16: Interlace options (undefined) 1.48 + 1.49 + uint8_t alphaChannelBpp; 1.50 + uint8_t lumaChannelBpp; 1.51 + uint8_t chromaChannelBpp; 1.52 + uint8_t colorspace; 1.53 + 1.54 + PRUint24 frameWidth; 1.55 + PRUint24 frameHeight; 1.56 + PRUint24 aspectNumerator; 1.57 + PRUint24 aspectDenominator; 1.58 + 1.59 + uint32_t framerateNumerator; 1.60 + uint32_t framerateDenominator; 1.61 +}; 1.62 + 1.63 +#endif // RawStructs_h_