Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
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/. */
7 #ifndef MOZILLA_MEDIASOURCEDECODER_H_
8 #define MOZILLA_MEDIASOURCEDECODER_H_
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"
19 class nsIStreamListener;
21 namespace mozilla {
23 class MediaResource;
24 class MediaDecoderReader;
25 class MediaDecoderStateMachine;
26 class SubBufferDecoder;
27 class MediaSourceReader;
29 namespace dom {
31 class HTMLMediaElement;
32 class MediaSource;
34 } // namespace dom
36 class MediaSourceDecoder : public MediaDecoder
37 {
38 public:
39 MediaSourceDecoder(dom::HTMLMediaElement* aElement);
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;
46 static already_AddRefed<MediaResource> CreateResource();
48 void AttachMediaSource(dom::MediaSource* aMediaSource);
49 void DetachMediaSource();
51 already_AddRefed<SubBufferDecoder> CreateSubDecoder(const nsACString& aType);
53 nsresult EnqueueDecoderInitialization();
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 };
62 } // namespace mozilla
64 #endif /* MOZILLA_MEDIASOURCEDECODER_H_ */