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(EMEDecoderModule_h_)
8 : #define EMEDecoderModule_h_
9 :
10 : #include "MediaDataDecoderProxy.h"
11 : #include "PlatformDecoderModule.h"
12 : #include "PlatformDecoderModule.h"
13 : #include "SamplesWaitingForKey.h"
14 :
15 : namespace mozilla {
16 :
17 : class CDMProxy;
18 : class PDMFactory;
19 :
20 : class EMEDecoderModule : public PlatformDecoderModule
21 : {
22 : public:
23 : EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM);
24 :
25 : protected:
26 : // Decode thread.
27 : already_AddRefed<MediaDataDecoder>
28 : CreateVideoDecoder(const CreateDecoderParams& aParams) override;
29 :
30 : // Decode thread.
31 : already_AddRefed<MediaDataDecoder>
32 : CreateAudioDecoder(const CreateDecoderParams& aParams) override;
33 :
34 : bool
35 : SupportsMimeType(const nsACString &aMimeType,
36 : DecoderDoctorDiagnostics *aDiagnostics) const override;
37 :
38 : private:
39 : virtual ~EMEDecoderModule();
40 : RefPtr<CDMProxy> mProxy;
41 : // Will be null if CDM has decoding capability.
42 : RefPtr<PDMFactory> mPDM;
43 : };
44 :
45 0 : class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy
46 : {
47 : public:
48 : EMEMediaDataDecoderProxy(
49 : already_AddRefed<AbstractThread> aProxyThread, CDMProxy* aProxy,
50 : const CreateDecoderParams& aParams);
51 : EMEMediaDataDecoderProxy(const CreateDecoderParams& aParams,
52 : already_AddRefed<MediaDataDecoder> aProxyDecoder,
53 : CDMProxy* aProxy);
54 :
55 : RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
56 : RefPtr<FlushPromise> Flush() override;
57 : RefPtr<ShutdownPromise> Shutdown() override;
58 :
59 : private:
60 : RefPtr<TaskQueue> mTaskQueue;
61 : RefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
62 : MozPromiseRequestHolder<SamplesWaitingForKey::WaitForKeyPromise> mKeyRequest;
63 : MozPromiseHolder<DecodePromise> mDecodePromise;
64 : MozPromiseRequestHolder<DecodePromise> mDecodeRequest;
65 : RefPtr<CDMProxy> mProxy;
66 : };
67 :
68 : } // namespace mozilla
69 :
70 : #endif // EMEDecoderModule_h_
|