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 #if !defined(BlankDecoderModule_h_) 7 # define BlankDecoderModule_h_ 8 9 # include "DummyMediaDataDecoder.h" 10 # include "PlatformDecoderModule.h" 11 12 namespace mozilla { 13 14 namespace layers { 15 class ImageContainer; 16 } 17 18 class MediaData; 19 class MediaRawData; 20 21 class BlankVideoDataCreator : public DummyDataCreator { 22 public: 23 BlankVideoDataCreator(uint32_t aFrameWidth, uint32_t aFrameHeight, 24 layers::ImageContainer* aImageContainer); 25 26 already_AddRefed<MediaData> Create(MediaRawData* aSample) override; 27 28 private: 29 VideoInfo mInfo; 30 gfx::IntRect mPicture; 31 uint32_t mFrameWidth; 32 uint32_t mFrameHeight; 33 RefPtr<layers::ImageContainer> mImageContainer; 34 }; 35 36 class BlankAudioDataCreator : public DummyDataCreator { 37 public: 38 BlankAudioDataCreator(uint32_t aChannelCount, uint32_t aSampleRate); 39 40 already_AddRefed<MediaData> Create(MediaRawData* aSample) override; 41 42 private: 43 int64_t mFrameSum; 44 uint32_t mChannelCount; 45 uint32_t mSampleRate; 46 }; 47 48 class BlankDecoderModule : public PlatformDecoderModule { 49 template <typename T, typename... Args> 50 friend already_AddRefed<T> MakeAndAddRef(Args&&...); 51 52 public: 53 static already_AddRefed<PlatformDecoderModule> Create(); 54 55 already_AddRefed<MediaDataDecoder> CreateVideoDecoder( 56 const CreateDecoderParams& aParams) override; 57 58 already_AddRefed<MediaDataDecoder> CreateAudioDecoder( 59 const CreateDecoderParams& aParams) override; 60 61 bool SupportsMimeType(const nsACString& aMimeType, 62 DecoderDoctorDiagnostics* aDiagnostics) const override; 63 }; 64 65 } // namespace mozilla 66 67 #endif /* BlankDecoderModule_h_ */ 68