Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef _ENCODING_CONSTRAINTS_H_
8 : #define _ENCODING_CONSTRAINTS_H_
9 :
10 : #include <algorithm>
11 :
12 : namespace mozilla
13 : {
14 : class EncodingConstraints
15 : {
16 : public:
17 0 : EncodingConstraints() :
18 : maxWidth(0),
19 : maxHeight(0),
20 : maxFps(0),
21 : maxFs(0),
22 : maxBr(0),
23 : maxPps(0),
24 : maxMbps(0),
25 : maxCpb(0),
26 : maxDpb(0),
27 0 : scaleDownBy(1.0)
28 0 : {}
29 :
30 0 : bool operator==(const EncodingConstraints& constraints) const
31 : {
32 : return
33 0 : maxWidth == constraints.maxWidth &&
34 0 : maxHeight == constraints.maxHeight &&
35 0 : maxFps == constraints.maxFps &&
36 0 : maxFs == constraints.maxFs &&
37 0 : maxBr == constraints.maxBr &&
38 0 : maxPps == constraints.maxPps &&
39 0 : maxMbps == constraints.maxMbps &&
40 0 : maxCpb == constraints.maxCpb &&
41 0 : maxDpb == constraints.maxDpb &&
42 0 : scaleDownBy == constraints.scaleDownBy;
43 : }
44 :
45 : /**
46 : * This returns true if the constraints affecting resolution are equal.
47 : */
48 0 : bool ResolutionEquals(const EncodingConstraints& constraints) const
49 : {
50 : return
51 0 : maxWidth == constraints.maxWidth &&
52 0 : maxHeight == constraints.maxHeight &&
53 0 : maxFs == constraints.maxFs &&
54 0 : scaleDownBy == constraints.scaleDownBy;
55 : }
56 :
57 : uint32_t maxWidth;
58 : uint32_t maxHeight;
59 : uint32_t maxFps;
60 : uint32_t maxFs;
61 : uint32_t maxBr;
62 : uint32_t maxPps;
63 : uint32_t maxMbps; // macroblocks per second
64 : uint32_t maxCpb; // coded picture buffer size
65 : uint32_t maxDpb; // decoded picture buffer size
66 : double scaleDownBy; // To preserve resolution
67 : };
68 : } // namespace mozilla
69 :
70 : #endif // _ENCODING_CONSTRAINTS_H_
|