summaryrefslogtreecommitdiffstats
path: root/dom/media/gmp/GMPTypes.ipdlh
blob: 6cb37b60688b4a977008735edc339d2efbe34a12 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

include "GMPMessageUtils.h";

using cdm::EncryptionScheme from "GMPSanitizedExports.h";
using GMPBufferType from "gmp-video-codec.h";

namespace mozilla {
namespace gmp {

// GMP processes are associated with a specific node ID, so all GMP requests
// which have the same node ID will use the same GMP process. Depending on the
// use case, the node ID may be represented by a string (such as when used for
// WebRTC) or by this structure, which is populated according to the origin
// initiating the request. This structure will eventually be converted to a
// string representing a node ID.  For this structure, the process ensures the
// strings are unique for the combination of origin, top level origin and GMP
// name.
struct NodeIdParts {
  nsString mOrigin;
  nsString mTopLevelOrigin;
  nsString mGMPName;
};

// A NodeIdVariant should contain either
// - A string representing an already computed node ID.
// - A NodeIdParts representing a node ID that still needs to be computed by
//   processing those parts.
// This union is used to simplify passing of node ID information. Some
// GMP use cases can hard code their node ID, while others need to compute
// the node ID later. This lets us avoid having overloads to handle
// the two different paths.
union NodeIdVariant {
  nsCString;
  NodeIdParts;
};

struct GMPVideoEncodedFrameData {
  uint32_t mEncodedWidth;
  uint32_t mEncodedHeight;
  uint64_t mTimestamp;  // microseconds
  uint64_t mDuration;   // microseconds
  uint32_t mFrameType;
  uint32_t mSize;
  GMPBufferType mBufferType;
  Shmem mBuffer;
  bool mCompleteFrame;
};

struct GMPPlaneData {
  int32_t mSize;
  int32_t mStride;
  Shmem mBuffer;
};

struct GMPVideoi420FrameData {
  GMPPlaneData mYPlane;
  GMPPlaneData mUPlane;
  GMPPlaneData mVPlane;
  int32_t mWidth;
  int32_t mHeight;
  uint64_t mTimestamp;  // microseconds
  uint64_t? mUpdatedTimestamp;  // microseconds
  uint64_t mDuration;   // microseconds
};

struct CDMInputBuffer {
  Shmem mData;
  uint8_t[] mKeyId;
  uint8_t[] mIV;
  int64_t mTimestamp;
  int64_t mDuration;
  uint32_t[] mClearBytes;
  uint32_t[] mCipherBytes;
  uint8_t mCryptByteBlock;
  uint8_t mSkipByteBlock;
  EncryptionScheme mEncryptionScheme;
};

struct CDMVideoDecoderConfig {
  uint32_t mCodec;
  uint32_t mProfile;
  uint32_t mFormat;
  int32_t mImageWidth;
  int32_t mImageHeight;
  uint8_t[] mExtraData;
  EncryptionScheme mEncryptionScheme;
};

struct CDMKeyInformation {
  uint8_t[] mKeyId;
  uint32_t mStatus;
  uint32_t mSystemCode;
};

struct CDMVideoPlane {
  uint32_t mPlaneOffset;
  uint32_t mStride;
};

struct CDMVideoFrame {
  uint32_t mFormat;
  int32_t mImageWidth;
  int32_t mImageHeight;
  CDMVideoPlane mYPlane;
  CDMVideoPlane mUPlane;
  CDMVideoPlane mVPlane;
  int64_t mTimestamp;
  int64_t mDuration;
};

}  // namespace gmp
}  // namespace mozilla