1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/mediasource/MediaSourceDecoder.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,64 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef MOZILLA_MEDIASOURCEDECODER_H_ 1.11 +#define MOZILLA_MEDIASOURCEDECODER_H_ 1.12 + 1.13 +#include "MediaCache.h" 1.14 +#include "MediaDecoder.h" 1.15 +#include "mozilla/Attributes.h" 1.16 +#include "mozilla/ReentrantMonitor.h" 1.17 +#include "nsCOMPtr.h" 1.18 +#include "nsError.h" 1.19 +#include "nsStringGlue.h" 1.20 +#include "nsTArray.h" 1.21 + 1.22 +class nsIStreamListener; 1.23 + 1.24 +namespace mozilla { 1.25 + 1.26 +class MediaResource; 1.27 +class MediaDecoderReader; 1.28 +class MediaDecoderStateMachine; 1.29 +class SubBufferDecoder; 1.30 +class MediaSourceReader; 1.31 + 1.32 +namespace dom { 1.33 + 1.34 +class HTMLMediaElement; 1.35 +class MediaSource; 1.36 + 1.37 +} // namespace dom 1.38 + 1.39 +class MediaSourceDecoder : public MediaDecoder 1.40 +{ 1.41 +public: 1.42 + MediaSourceDecoder(dom::HTMLMediaElement* aElement); 1.43 + 1.44 + virtual MediaDecoder* Clone() MOZ_OVERRIDE; 1.45 + virtual MediaDecoderStateMachine* CreateStateMachine() MOZ_OVERRIDE; 1.46 + virtual nsresult Load(nsIStreamListener**, MediaDecoder*) MOZ_OVERRIDE; 1.47 + virtual nsresult GetSeekable(dom::TimeRanges* aSeekable) MOZ_OVERRIDE; 1.48 + 1.49 + static already_AddRefed<MediaResource> CreateResource(); 1.50 + 1.51 + void AttachMediaSource(dom::MediaSource* aMediaSource); 1.52 + void DetachMediaSource(); 1.53 + 1.54 + already_AddRefed<SubBufferDecoder> CreateSubDecoder(const nsACString& aType); 1.55 + 1.56 + nsresult EnqueueDecoderInitialization(); 1.57 + 1.58 +private: 1.59 + // The owning MediaSource holds a strong reference to this decoder, and 1.60 + // calls Attach/DetachMediaSource on this decoder to set and clear 1.61 + // mMediaSource. 1.62 + dom::MediaSource* mMediaSource; 1.63 +}; 1.64 + 1.65 +} // namespace mozilla 1.66 + 1.67 +#endif /* MOZILLA_MEDIASOURCEDECODER_H_ */