Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/DecoderData.h
Line
Count
Source (jump to first uncovered line)
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/. */
4
5
#ifndef DECODER_DATA_H_
6
#define DECODER_DATA_H_
7
8
#include "MediaInfo.h"
9
#include "mozilla/RefPtr.h"
10
#include "mozilla/Result.h"
11
#include "mozilla/Types.h"
12
#include "mozilla/Vector.h"
13
#include "nsString.h"
14
#include "nsTArray.h"
15
#include "nsString.h"
16
#include "mp4parse.h"
17
18
namespace mozilla
19
{
20
21
class MP4Demuxer;
22
23
struct PsshInfo
24
{
25
0
  PsshInfo() {}
26
0
  PsshInfo(const PsshInfo& aOther) : uuid(aOther.uuid), data(aOther.data) {}
27
  nsTArray<uint8_t> uuid;
28
  nsTArray<uint8_t> data;
29
30
0
  bool operator==(const PsshInfo& aOther) const {
31
0
    return uuid == aOther.uuid && data == aOther.data;
32
0
  }
33
};
34
35
class CryptoFile
36
{
37
public:
38
0
  CryptoFile() : valid(false) {}
39
  CryptoFile(const CryptoFile& aCryptoFile) : valid(aCryptoFile.valid)
40
0
  {
41
0
    pssh.AppendElements(aCryptoFile.pssh);
42
0
  }
43
44
  void Update(const uint8_t* aData, size_t aLength)
45
0
  {
46
0
    valid = DoUpdate(aData, aLength).isOk();
47
0
  }
48
49
  bool valid;
50
  nsTArray<PsshInfo> pssh;
51
52
private:
53
  mozilla::Result<mozilla::Ok, nsresult> DoUpdate(const uint8_t* aData, size_t aLength);
54
};
55
56
class MP4AudioInfo : public mozilla::AudioInfo
57
{
58
public:
59
0
  MP4AudioInfo() = default;
60
61
  void Update(const Mp4parseTrackInfo* track,
62
              const Mp4parseTrackAudioInfo* audio);
63
64
  virtual bool IsValid() const override;
65
};
66
67
class MP4VideoInfo : public mozilla::VideoInfo
68
{
69
public:
70
0
  MP4VideoInfo() = default;
71
72
  void Update(const Mp4parseTrackInfo* track,
73
              const Mp4parseTrackVideoInfo* video);
74
75
  virtual bool IsValid() const override;
76
};
77
78
}
79
80
#endif