Line data Source code
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 "MediaData.h"
9 : #include "MediaInfo.h"
10 : #include "mozilla/Types.h"
11 : #include "mozilla/Vector.h"
12 : #include "mozilla/RefPtr.h"
13 : #include "nsString.h"
14 : #include "nsTArray.h"
15 : #include "nsString.h"
16 :
17 : namespace stagefright
18 : {
19 : class MetaData;
20 : }
21 :
22 : extern "C" {
23 : typedef struct mp4parse_track_info mp4parse_track_info;
24 : typedef struct mp4parse_track_audio_info mp4parse_track_audio_info;
25 : typedef struct mp4parse_track_video_info mp4parse_track_video_info;
26 : }
27 :
28 : namespace mp4_demuxer
29 : {
30 :
31 : class MP4Demuxer;
32 :
33 0 : struct PsshInfo
34 : {
35 0 : PsshInfo() {}
36 0 : PsshInfo(const PsshInfo& aOther) : uuid(aOther.uuid), data(aOther.data) {}
37 : nsTArray<uint8_t> uuid;
38 : nsTArray<uint8_t> data;
39 :
40 0 : bool operator==(const PsshInfo& aOther) const {
41 0 : return uuid == aOther.uuid && data == aOther.data;
42 : }
43 : };
44 :
45 0 : class CryptoFile
46 : {
47 : public:
48 0 : CryptoFile() : valid(false) {}
49 : CryptoFile(const CryptoFile& aCryptoFile) : valid(aCryptoFile.valid)
50 : {
51 : pssh.AppendElements(aCryptoFile.pssh);
52 : }
53 :
54 0 : void Update(const uint8_t* aData, size_t aLength)
55 : {
56 0 : valid = DoUpdate(aData, aLength);
57 0 : }
58 :
59 : bool valid;
60 : nsTArray<PsshInfo> pssh;
61 :
62 : private:
63 : bool DoUpdate(const uint8_t* aData, size_t aLength);
64 : };
65 :
66 0 : class MP4AudioInfo : public mozilla::AudioInfo
67 : {
68 : public:
69 0 : MP4AudioInfo() = default;
70 :
71 : void Update(const stagefright::MetaData* aMetaData,
72 : const char* aMimeType);
73 :
74 : void Update(const mp4parse_track_info* track,
75 : const mp4parse_track_audio_info* audio);
76 :
77 : virtual bool IsValid() const override;
78 : };
79 :
80 0 : class MP4VideoInfo : public mozilla::VideoInfo
81 : {
82 : public:
83 0 : MP4VideoInfo() = default;
84 :
85 : void Update(const stagefright::MetaData* aMetaData,
86 : const char* aMimeType);
87 :
88 : void Update(const mp4parse_track_info* track,
89 : const mp4parse_track_video_info* video);
90 :
91 : virtual bool IsValid() const override;
92 : };
93 :
94 : }
95 :
96 : #endif
|