/src/mozilla-central/dom/media/platforms/agnostic/NullDecoderModule.cpp
Line | Count | Source (jump to first uncovered line) |
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 | | #include "DummyMediaDataDecoder.h" |
8 | | |
9 | | namespace mozilla { |
10 | | |
11 | | class NullVideoDataCreator : public DummyDataCreator |
12 | | { |
13 | | public: |
14 | 0 | NullVideoDataCreator() { } |
15 | | |
16 | | already_AddRefed<MediaData> Create(MediaRawData* aSample) override |
17 | 0 | { |
18 | 0 | // Create a dummy VideoData with no image. This gives us something to |
19 | 0 | // send to media streams if necessary. |
20 | 0 | RefPtr<VideoData> v(new VideoData(aSample->mOffset, |
21 | 0 | aSample->mTime, |
22 | 0 | aSample->mDuration, |
23 | 0 | aSample->mKeyframe, |
24 | 0 | aSample->mTimecode, |
25 | 0 | gfx::IntSize(), |
26 | 0 | 0)); |
27 | 0 | return v.forget(); |
28 | 0 | } |
29 | | }; |
30 | | |
31 | | class NullDecoderModule : public PlatformDecoderModule |
32 | | { |
33 | | public: |
34 | | |
35 | | // Decode thread. |
36 | | already_AddRefed<MediaDataDecoder> CreateVideoDecoder( |
37 | | const CreateDecoderParams& aParams) override |
38 | 0 | { |
39 | 0 | UniquePtr<DummyDataCreator> creator = MakeUnique<NullVideoDataCreator>(); |
40 | 0 | RefPtr<MediaDataDecoder> decoder = new DummyMediaDataDecoder( |
41 | 0 | std::move(creator), NS_LITERAL_CSTRING("null media data decoder"), aParams); |
42 | 0 | return decoder.forget(); |
43 | 0 | } |
44 | | |
45 | | // Decode thread. |
46 | | already_AddRefed<MediaDataDecoder> CreateAudioDecoder( |
47 | | const CreateDecoderParams& aParams) override |
48 | 0 | { |
49 | 0 | MOZ_ASSERT(false, "Audio decoders are unsupported."); |
50 | 0 | return nullptr; |
51 | 0 | } |
52 | | |
53 | | bool SupportsMimeType(const nsACString& aMimeType, |
54 | | DecoderDoctorDiagnostics* aDiagnostics) const override |
55 | 0 | { |
56 | 0 | return true; |
57 | 0 | } |
58 | | }; |
59 | | |
60 | | already_AddRefed<PlatformDecoderModule> |
61 | | CreateNullDecoderModule() |
62 | 0 | { |
63 | 0 | RefPtr<PlatformDecoderModule> pdm = new NullDecoderModule(); |
64 | 0 | return pdm.forget(); |
65 | 0 | } |
66 | | |
67 | | } // namespace mozilla |