Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / media / mp4 / SinfParser.h
blobd0a09a1d98dcefe12b421297ff94087990a32559
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 #ifndef SINF_PARSER_H_
6 #define SINF_PARSER_H_
8 #include "mozilla/ResultExtensions.h"
9 #include "Atom.h"
10 #include "AtomType.h"
11 #include "nsTArray.h"
13 namespace mozilla {
15 class Box;
17 class Sinf : public Atom {
18 public:
19 Sinf()
20 : mDefaultIVSize(0),
22 mDefaultCryptByteBlock(0),
23 mDefaultSkipByteBlock(0) {}
24 explicit Sinf(Box& aBox);
26 bool IsValid() override {
27 return !!mDefaultEncryptionType && // Should have an encryption scheme
28 (mDefaultIVSize > 0 || // and either a default IV size
29 mDefaultConstantIV.Length() > 0); // or a constant IV.
32 uint8_t mDefaultIVSize;
33 AtomType mDefaultEncryptionType;
34 uint8_t mDefaultKeyID[16];
35 uint8_t mDefaultCryptByteBlock;
36 uint8_t mDefaultSkipByteBlock;
37 CopyableTArray<uint8_t> mDefaultConstantIV;
40 class SinfParser {
41 public:
42 explicit SinfParser(Box& aBox);
44 Sinf& GetSinf() { return mSinf; }
46 private:
47 Result<Ok, nsresult> ParseSchm(Box& aBox);
48 Result<Ok, nsresult> ParseSchi(Box& aBox);
49 Result<Ok, nsresult> ParseTenc(Box& aBox);
51 Sinf mSinf;
54 } // namespace mozilla
56 #endif // SINF_PARSER_H_