|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
|
2 /* vim: set ts=8 sts=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 |
|
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
6 |
|
7 #include "BufferDecoder.h" |
|
8 |
|
9 #include "nsISupports.h" |
|
10 #include "MediaResource.h" |
|
11 |
|
12 namespace mozilla { |
|
13 |
|
14 #ifdef PR_LOGGING |
|
15 extern PRLogModuleInfo* gMediaDecoderLog; |
|
16 #endif |
|
17 |
|
18 NS_IMPL_ISUPPORTS0(BufferDecoder) |
|
19 |
|
20 BufferDecoder::BufferDecoder(MediaResource* aResource) |
|
21 : mReentrantMonitor("BufferDecoder") |
|
22 , mResource(aResource) |
|
23 { |
|
24 MOZ_ASSERT(NS_IsMainThread()); |
|
25 MOZ_COUNT_CTOR(BufferDecoder); |
|
26 #ifdef PR_LOGGING |
|
27 if (!gMediaDecoderLog) { |
|
28 gMediaDecoderLog = PR_NewLogModule("MediaDecoder"); |
|
29 } |
|
30 #endif |
|
31 } |
|
32 |
|
33 BufferDecoder::~BufferDecoder() |
|
34 { |
|
35 // The dtor may run on any thread, we cannot be sure. |
|
36 MOZ_COUNT_DTOR(BufferDecoder); |
|
37 } |
|
38 |
|
39 void |
|
40 BufferDecoder::BeginDecoding(nsIThread* aDecodeThread) |
|
41 { |
|
42 MOZ_ASSERT(!mDecodeThread && aDecodeThread); |
|
43 mDecodeThread = aDecodeThread; |
|
44 } |
|
45 |
|
46 ReentrantMonitor& |
|
47 BufferDecoder::GetReentrantMonitor() |
|
48 { |
|
49 return mReentrantMonitor; |
|
50 } |
|
51 |
|
52 bool |
|
53 BufferDecoder::IsShutdown() const |
|
54 { |
|
55 // BufferDecoder cannot be shut down. |
|
56 return false; |
|
57 } |
|
58 |
|
59 bool |
|
60 BufferDecoder::OnStateMachineThread() const |
|
61 { |
|
62 // BufferDecoder doesn't have the concept of a state machine. |
|
63 return true; |
|
64 } |
|
65 |
|
66 bool |
|
67 BufferDecoder::OnDecodeThread() const |
|
68 { |
|
69 MOZ_ASSERT(mDecodeThread, "Forgot to call BeginDecoding?"); |
|
70 return IsCurrentThread(mDecodeThread); |
|
71 } |
|
72 |
|
73 MediaResource* |
|
74 BufferDecoder::GetResource() const |
|
75 { |
|
76 return mResource; |
|
77 } |
|
78 |
|
79 void |
|
80 BufferDecoder::NotifyBytesConsumed(int64_t aBytes, int64_t aOffset) |
|
81 { |
|
82 // ignore |
|
83 } |
|
84 |
|
85 void |
|
86 BufferDecoder::NotifyDecodedFrames(uint32_t aParsed, uint32_t aDecoded) |
|
87 { |
|
88 // ignore |
|
89 } |
|
90 |
|
91 int64_t |
|
92 BufferDecoder::GetEndMediaTime() const |
|
93 { |
|
94 // unknown |
|
95 return -1; |
|
96 } |
|
97 |
|
98 int64_t |
|
99 BufferDecoder::GetMediaDuration() |
|
100 { |
|
101 // unknown |
|
102 return -1; |
|
103 } |
|
104 |
|
105 void |
|
106 BufferDecoder::SetMediaDuration(int64_t aDuration) |
|
107 { |
|
108 // ignore |
|
109 } |
|
110 |
|
111 void |
|
112 BufferDecoder::UpdateEstimatedMediaDuration(int64_t aDuration) |
|
113 { |
|
114 // ignore |
|
115 } |
|
116 |
|
117 void |
|
118 BufferDecoder::SetMediaSeekable(bool aMediaSeekable) |
|
119 { |
|
120 // ignore |
|
121 } |
|
122 |
|
123 void |
|
124 BufferDecoder::SetTransportSeekable(bool aTransportSeekable) |
|
125 { |
|
126 // ignore |
|
127 } |
|
128 |
|
129 VideoFrameContainer* |
|
130 BufferDecoder::GetVideoFrameContainer() |
|
131 { |
|
132 // no video frame |
|
133 return nullptr; |
|
134 } |
|
135 |
|
136 layers::ImageContainer* |
|
137 BufferDecoder::GetImageContainer() |
|
138 { |
|
139 // no image container |
|
140 return nullptr; |
|
141 } |
|
142 |
|
143 bool |
|
144 BufferDecoder::IsTransportSeekable() |
|
145 { |
|
146 return false; |
|
147 } |
|
148 |
|
149 bool |
|
150 BufferDecoder::IsMediaSeekable() |
|
151 { |
|
152 return false; |
|
153 } |
|
154 |
|
155 void |
|
156 BufferDecoder::MetadataLoaded(int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) |
|
157 { |
|
158 // ignore |
|
159 } |
|
160 |
|
161 void |
|
162 BufferDecoder::QueueMetadata(int64_t aTime, int aChannels, int aRate, bool aHasAudio, bool aHasVideo, MetadataTags* aTags) |
|
163 { |
|
164 // ignore |
|
165 } |
|
166 |
|
167 void |
|
168 BufferDecoder::SetMediaEndTime(int64_t aTime) |
|
169 { |
|
170 // ignore |
|
171 } |
|
172 |
|
173 void |
|
174 BufferDecoder::UpdatePlaybackPosition(int64_t aTime) |
|
175 { |
|
176 // ignore |
|
177 } |
|
178 |
|
179 void |
|
180 BufferDecoder::OnReadMetadataCompleted() |
|
181 { |
|
182 // ignore |
|
183 } |
|
184 |
|
185 void |
|
186 BufferDecoder::NotifyWaitingForResourcesStatusChanged() |
|
187 { |
|
188 // ignore |
|
189 } |
|
190 |
|
191 MediaDecoderOwner* |
|
192 BufferDecoder::GetOwner() |
|
193 { |
|
194 // unknown |
|
195 return nullptr; |
|
196 } |
|
197 |
|
198 } // namespace mozilla |