|
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 #ifndef MOZILLA_MEDIASOURCEDECODER_H_ |
|
8 #define MOZILLA_MEDIASOURCEDECODER_H_ |
|
9 |
|
10 #include "MediaCache.h" |
|
11 #include "MediaDecoder.h" |
|
12 #include "mozilla/Attributes.h" |
|
13 #include "mozilla/ReentrantMonitor.h" |
|
14 #include "nsCOMPtr.h" |
|
15 #include "nsError.h" |
|
16 #include "nsStringGlue.h" |
|
17 #include "nsTArray.h" |
|
18 |
|
19 class nsIStreamListener; |
|
20 |
|
21 namespace mozilla { |
|
22 |
|
23 class MediaResource; |
|
24 class MediaDecoderReader; |
|
25 class MediaDecoderStateMachine; |
|
26 class SubBufferDecoder; |
|
27 class MediaSourceReader; |
|
28 |
|
29 namespace dom { |
|
30 |
|
31 class HTMLMediaElement; |
|
32 class MediaSource; |
|
33 |
|
34 } // namespace dom |
|
35 |
|
36 class MediaSourceDecoder : public MediaDecoder |
|
37 { |
|
38 public: |
|
39 MediaSourceDecoder(dom::HTMLMediaElement* aElement); |
|
40 |
|
41 virtual MediaDecoder* Clone() MOZ_OVERRIDE; |
|
42 virtual MediaDecoderStateMachine* CreateStateMachine() MOZ_OVERRIDE; |
|
43 virtual nsresult Load(nsIStreamListener**, MediaDecoder*) MOZ_OVERRIDE; |
|
44 virtual nsresult GetSeekable(dom::TimeRanges* aSeekable) MOZ_OVERRIDE; |
|
45 |
|
46 static already_AddRefed<MediaResource> CreateResource(); |
|
47 |
|
48 void AttachMediaSource(dom::MediaSource* aMediaSource); |
|
49 void DetachMediaSource(); |
|
50 |
|
51 already_AddRefed<SubBufferDecoder> CreateSubDecoder(const nsACString& aType); |
|
52 |
|
53 nsresult EnqueueDecoderInitialization(); |
|
54 |
|
55 private: |
|
56 // The owning MediaSource holds a strong reference to this decoder, and |
|
57 // calls Attach/DetachMediaSource on this decoder to set and clear |
|
58 // mMediaSource. |
|
59 dom::MediaSource* mMediaSource; |
|
60 }; |
|
61 |
|
62 } // namespace mozilla |
|
63 |
|
64 #endif /* MOZILLA_MEDIASOURCEDECODER_H_ */ |