gecko/content/media/raw/nsRawStructs.h
Ehsan Akhgari 0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00

60 lines
2.2 KiB
C++

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#if !defined(nsRawStructs_h_)
#define nsRawStructs_h_
static const uint32_t RAW_ID = 0x595556;
struct nsRawVideo_PRUint24 {
operator uint32_t() const { return value[2] << 16 | value[1] << 8 | value[0]; }
nsRawVideo_PRUint24& operator= (const uint32_t& rhs)
{ value[2] = (rhs & 0x00FF0000) >> 16;
value[1] = (rhs & 0x0000FF00) >> 8;
value[0] = (rhs & 0x000000FF);
return *this; }
private:
uint8_t value[3];
};
struct nsRawPacketHeader {
typedef nsRawVideo_PRUint24 PRUint24;
uint8_t packetID;
PRUint24 codecID;
};
// This is Arc's draft from wiki.xiph.org/OggYUV
struct nsRawVideoHeader {
typedef nsRawVideo_PRUint24 PRUint24;
uint8_t headerPacketID; // Header Packet ID (always 0)
PRUint24 codecID; // Codec identifier (always "YUV")
uint8_t majorVersion; // Version Major (breaks backwards compat)
uint8_t minorVersion; // Version Minor (preserves backwards compat)
uint16_t options; // Bit 1: Color (false = B/W)
// Bits 2-4: Chroma Pixel Shape
// Bit 5: 50% horizontal offset for Cr samples
// Bit 6: 50% vertical ...
// Bits 7-8: Chroma Blending
// Bit 9: Packed (false = Planar)
// Bit 10: Cr Staggered Horizontally
// Bit 11: Cr Staggered Vertically
// Bit 12: Unused (format is always little endian)
// Bit 13: Interlaced (false = Progressive)
// Bits 14-16: Interlace options (undefined)
uint8_t alphaChannelBpp;
uint8_t lumaChannelBpp;
uint8_t chromaChannelBpp;
uint8_t colorspace;
PRUint24 frameWidth;
PRUint24 frameHeight;
PRUint24 aspectNumerator;
PRUint24 aspectDenominator;
uint32_t framerateNumerator;
uint32_t framerateDenominator;
};
#endif // nsRawStructs_h_