GMPTypes.ipdlh (3143B)
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 5 6 include "GMPMessageUtils.h"; 7 8 using cdm::EncryptionScheme from "GMPSanitizedExports.h"; 9 using GMPBufferType from "gmp-video-codec.h"; 10 11 namespace mozilla { 12 namespace gmp { 13 14 // GMP processes are associated with a specific node ID, so all GMP requests 15 // which have the same node ID will use the same GMP process. Depending on the 16 // use case, the node ID may be represented by a string (such as when used for 17 // WebRTC) or by this structure, which is populated according to the origin 18 // initiating the request. This structure will eventually be converted to a 19 // string representing a node ID. For this structure, the process ensures the 20 // strings are unique for the combination of origin, top level origin and GMP 21 // name. 22 struct NodeIdParts { 23 nsString mOrigin; 24 nsString mTopLevelOrigin; 25 nsString mGMPName; 26 }; 27 28 // A NodeIdVariant should contain either 29 // - A string representing an already computed node ID. 30 // - A NodeIdParts representing a node ID that still needs to be computed by 31 // processing those parts. 32 // This union is used to simplify passing of node ID information. Some 33 // GMP use cases can hard code their node ID, while others need to compute 34 // the node ID later. This lets us avoid having overloads to handle 35 // the two different paths. 36 union NodeIdVariant { 37 nsCString; 38 NodeIdParts; 39 }; 40 41 struct GMPVideoEncodedFrameData { 42 uint32_t mEncodedWidth; 43 uint32_t mEncodedHeight; 44 uint64_t mTimestamp; // microseconds 45 uint64_t mDuration; // microseconds 46 uint32_t mFrameType; 47 uint32_t mSize; 48 int32_t mTemporalLayerId; 49 GMPBufferType mBufferType; 50 bool mCompleteFrame; 51 }; 52 53 struct GMPPlaneData { 54 int32_t mOffset; 55 int32_t mSize; 56 int32_t mStride; 57 }; 58 59 struct GMPVideoi420FrameData { 60 GMPPlaneData mYPlane; 61 GMPPlaneData mUPlane; 62 GMPPlaneData mVPlane; 63 int32_t mWidth; 64 int32_t mHeight; 65 uint64_t mTimestamp; // microseconds 66 uint64_t? mUpdatedTimestamp; // microseconds 67 uint64_t mDuration; // microseconds 68 }; 69 70 struct CDMInputBuffer { 71 Shmem mData; 72 uint8_t[] mKeyId; 73 uint8_t[] mIV; 74 int64_t mTimestamp; 75 int64_t mDuration; 76 uint32_t[] mClearBytes; 77 uint32_t[] mCipherBytes; 78 uint8_t mCryptByteBlock; 79 uint8_t mSkipByteBlock; 80 EncryptionScheme mEncryptionScheme; 81 }; 82 83 struct CDMVideoDecoderConfig { 84 uint32_t mCodec; 85 uint32_t mProfile; 86 uint32_t mFormat; 87 int32_t mImageWidth; 88 int32_t mImageHeight; 89 uint8_t[] mExtraData; 90 EncryptionScheme mEncryptionScheme; 91 }; 92 93 struct CDMKeyInformation { 94 uint8_t[] mKeyId; 95 uint32_t mStatus; 96 uint32_t mSystemCode; 97 }; 98 99 struct CDMVideoPlane { 100 uint32_t mPlaneOffset; 101 uint32_t mStride; 102 }; 103 104 struct CDMVideoFrame { 105 uint32_t mFormat; 106 int32_t mImageWidth; 107 int32_t mImageHeight; 108 CDMVideoPlane mYPlane; 109 CDMVideoPlane mUPlane; 110 CDMVideoPlane mVPlane; 111 int64_t mTimestamp; 112 int64_t mDuration; 113 }; 114 115 } // namespace gmp 116 } // namespace mozilla