Line data Source code
1 : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim:set ts=2 sw=2 sts=2 et cindent: */
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 : #if !defined(MediaDataDecoderProxy_h_)
8 : #define MediaDataDecoderProxy_h_
9 :
10 : #include "PlatformDecoderModule.h"
11 : #include "mozilla/Atomics.h"
12 : #include "mozilla/RefPtr.h"
13 : #include "nsThreadUtils.h"
14 : #include "nscore.h"
15 :
16 : namespace mozilla {
17 :
18 0 : class MediaDataDecoderProxy : public MediaDataDecoder
19 : {
20 : public:
21 0 : explicit MediaDataDecoderProxy(already_AddRefed<AbstractThread> aProxyThread)
22 0 : : mProxyThread(aProxyThread)
23 : #if defined(DEBUG)
24 0 : , mIsShutdown(false)
25 : #endif
26 : {
27 0 : }
28 :
29 0 : explicit MediaDataDecoderProxy(
30 : already_AddRefed<MediaDataDecoder> aProxyDecoder)
31 0 : : mProxyDecoder(aProxyDecoder)
32 : #if defined(DEBUG)
33 0 : , mIsShutdown(false)
34 : #endif
35 : {
36 0 : }
37 :
38 0 : void SetProxyTarget(MediaDataDecoder* aProxyDecoder)
39 : {
40 0 : MOZ_ASSERT(aProxyDecoder);
41 0 : mProxyDecoder = aProxyDecoder;
42 0 : }
43 :
44 : RefPtr<InitPromise> Init() override;
45 : RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
46 : RefPtr<DecodePromise> Drain() override;
47 : RefPtr<FlushPromise> Flush() override;
48 : RefPtr<ShutdownPromise> Shutdown() override;
49 : const char* GetDescriptionName() const override;
50 : bool IsHardwareAccelerated(nsACString& aFailureReason) const override;
51 : void SetSeekThreshold(const media::TimeUnit& aTime) override;
52 : bool SupportDecoderRecycling() const override;
53 : ConversionRequired NeedsConversion() const override;
54 :
55 : private:
56 : RefPtr<MediaDataDecoder> mProxyDecoder;
57 : RefPtr<AbstractThread> mProxyThread;
58 :
59 : #if defined(DEBUG)
60 : Atomic<bool> mIsShutdown;
61 : #endif
62 : };
63 :
64 : } // namespace mozilla
65 :
66 : #endif // MediaDataDecoderProxy_h_
|