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
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim: set ts=8 sts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef MOZILLA_MEDIASOURCEDECODER_H_ |
michael@0 | 8 | #define MOZILLA_MEDIASOURCEDECODER_H_ |
michael@0 | 9 | |
michael@0 | 10 | #include "MediaCache.h" |
michael@0 | 11 | #include "MediaDecoder.h" |
michael@0 | 12 | #include "mozilla/Attributes.h" |
michael@0 | 13 | #include "mozilla/ReentrantMonitor.h" |
michael@0 | 14 | #include "nsCOMPtr.h" |
michael@0 | 15 | #include "nsError.h" |
michael@0 | 16 | #include "nsStringGlue.h" |
michael@0 | 17 | #include "nsTArray.h" |
michael@0 | 18 | |
michael@0 | 19 | class nsIStreamListener; |
michael@0 | 20 | |
michael@0 | 21 | namespace mozilla { |
michael@0 | 22 | |
michael@0 | 23 | class MediaResource; |
michael@0 | 24 | class MediaDecoderReader; |
michael@0 | 25 | class MediaDecoderStateMachine; |
michael@0 | 26 | class SubBufferDecoder; |
michael@0 | 27 | class MediaSourceReader; |
michael@0 | 28 | |
michael@0 | 29 | namespace dom { |
michael@0 | 30 | |
michael@0 | 31 | class HTMLMediaElement; |
michael@0 | 32 | class MediaSource; |
michael@0 | 33 | |
michael@0 | 34 | } // namespace dom |
michael@0 | 35 | |
michael@0 | 36 | class MediaSourceDecoder : public MediaDecoder |
michael@0 | 37 | { |
michael@0 | 38 | public: |
michael@0 | 39 | MediaSourceDecoder(dom::HTMLMediaElement* aElement); |
michael@0 | 40 | |
michael@0 | 41 | virtual MediaDecoder* Clone() MOZ_OVERRIDE; |
michael@0 | 42 | virtual MediaDecoderStateMachine* CreateStateMachine() MOZ_OVERRIDE; |
michael@0 | 43 | virtual nsresult Load(nsIStreamListener**, MediaDecoder*) MOZ_OVERRIDE; |
michael@0 | 44 | virtual nsresult GetSeekable(dom::TimeRanges* aSeekable) MOZ_OVERRIDE; |
michael@0 | 45 | |
michael@0 | 46 | static already_AddRefed<MediaResource> CreateResource(); |
michael@0 | 47 | |
michael@0 | 48 | void AttachMediaSource(dom::MediaSource* aMediaSource); |
michael@0 | 49 | void DetachMediaSource(); |
michael@0 | 50 | |
michael@0 | 51 | already_AddRefed<SubBufferDecoder> CreateSubDecoder(const nsACString& aType); |
michael@0 | 52 | |
michael@0 | 53 | nsresult EnqueueDecoderInitialization(); |
michael@0 | 54 | |
michael@0 | 55 | private: |
michael@0 | 56 | // The owning MediaSource holds a strong reference to this decoder, and |
michael@0 | 57 | // calls Attach/DetachMediaSource on this decoder to set and clear |
michael@0 | 58 | // mMediaSource. |
michael@0 | 59 | dom::MediaSource* mMediaSource; |
michael@0 | 60 | }; |
michael@0 | 61 | |
michael@0 | 62 | } // namespace mozilla |
michael@0 | 63 | |
michael@0 | 64 | #endif /* MOZILLA_MEDIASOURCEDECODER_H_ */ |