content/media/raw/RawStructs.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial