Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | |
michael@0 | 5 | #if !defined(RawStructs_h_) |
michael@0 | 6 | #define RawStructs_h_ |
michael@0 | 7 | |
michael@0 | 8 | static const uint32_t RAW_ID = 0x595556; |
michael@0 | 9 | |
michael@0 | 10 | struct nsRawVideo_PRUint24 { |
michael@0 | 11 | operator uint32_t() const { return value[2] << 16 | value[1] << 8 | value[0]; } |
michael@0 | 12 | nsRawVideo_PRUint24& operator= (const uint32_t& rhs) |
michael@0 | 13 | { value[2] = (rhs & 0x00FF0000) >> 16; |
michael@0 | 14 | value[1] = (rhs & 0x0000FF00) >> 8; |
michael@0 | 15 | value[0] = (rhs & 0x000000FF); |
michael@0 | 16 | return *this; } |
michael@0 | 17 | private: |
michael@0 | 18 | uint8_t value[3]; |
michael@0 | 19 | }; |
michael@0 | 20 | |
michael@0 | 21 | struct RawPacketHeader { |
michael@0 | 22 | typedef nsRawVideo_PRUint24 PRUint24; |
michael@0 | 23 | uint8_t packetID; |
michael@0 | 24 | PRUint24 codecID; |
michael@0 | 25 | }; |
michael@0 | 26 | |
michael@0 | 27 | // This is Arc's draft from wiki.xiph.org/OggYUV |
michael@0 | 28 | struct RawVideoHeader { |
michael@0 | 29 | typedef nsRawVideo_PRUint24 PRUint24; |
michael@0 | 30 | uint8_t headerPacketID; // Header Packet ID (always 0) |
michael@0 | 31 | PRUint24 codecID; // Codec identifier (always "YUV") |
michael@0 | 32 | uint8_t majorVersion; // Version Major (breaks backwards compat) |
michael@0 | 33 | uint8_t minorVersion; // Version Minor (preserves backwards compat) |
michael@0 | 34 | uint16_t options; // Bit 1: Color (false = B/W) |
michael@0 | 35 | // Bits 2-4: Chroma Pixel Shape |
michael@0 | 36 | // Bit 5: 50% horizontal offset for Cr samples |
michael@0 | 37 | // Bit 6: 50% vertical ... |
michael@0 | 38 | // Bits 7-8: Chroma Blending |
michael@0 | 39 | // Bit 9: Packed (false = Planar) |
michael@0 | 40 | // Bit 10: Cr Staggered Horizontally |
michael@0 | 41 | // Bit 11: Cr Staggered Vertically |
michael@0 | 42 | // Bit 12: Unused (format is always little endian) |
michael@0 | 43 | // Bit 13: Interlaced (false = Progressive) |
michael@0 | 44 | // Bits 14-16: Interlace options (undefined) |
michael@0 | 45 | |
michael@0 | 46 | uint8_t alphaChannelBpp; |
michael@0 | 47 | uint8_t lumaChannelBpp; |
michael@0 | 48 | uint8_t chromaChannelBpp; |
michael@0 | 49 | uint8_t colorspace; |
michael@0 | 50 | |
michael@0 | 51 | PRUint24 frameWidth; |
michael@0 | 52 | PRUint24 frameHeight; |
michael@0 | 53 | PRUint24 aspectNumerator; |
michael@0 | 54 | PRUint24 aspectDenominator; |
michael@0 | 55 | |
michael@0 | 56 | uint32_t framerateNumerator; |
michael@0 | 57 | uint32_t framerateDenominator; |
michael@0 | 58 | }; |
michael@0 | 59 | |
michael@0 | 60 | #endif // RawStructs_h_ |