tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

DummyMediaDataDecoder.h (1949B)


      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(DummyMediaDataDecoder_h_)
      8 #  define DummyMediaDataDecoder_h_
      9 
     10 #  include "MediaInfo.h"
     11 #  include "PlatformDecoderModule.h"
     12 #  include "ReorderQueue.h"
     13 #  include "mozilla/UniquePtr.h"
     14 
     15 namespace mozilla {
     16 
     17 class MediaRawData;
     18 
     19 class DummyDataCreator {
     20 public:
     21  virtual ~DummyDataCreator();
     22  virtual already_AddRefed<MediaData> Create(MediaRawData* aSample) = 0;
     23 };
     24 
     25 DDLoggedTypeDeclNameAndBase(DummyMediaDataDecoder, MediaDataDecoder);
     26 
     27 // Decoder that uses a passed in object's Create function to create Null
     28 // MediaData objects.
     29 class DummyMediaDataDecoder
     30    : public MediaDataDecoder,
     31      public DecoderDoctorLifeLogger<DummyMediaDataDecoder> {
     32 public:
     33  NS_INLINE_DECL_THREADSAFE_REFCOUNTING(DummyMediaDataDecoder, final);
     34 
     35  DummyMediaDataDecoder(UniquePtr<DummyDataCreator>&& aCreator,
     36                        const nsACString& aDescription,
     37                        const CreateDecoderParams& aParams);
     38 
     39  RefPtr<InitPromise> Init() override;
     40 
     41  RefPtr<ShutdownPromise> Shutdown() override;
     42 
     43  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
     44 
     45  RefPtr<DecodePromise> Drain() override;
     46 
     47  RefPtr<FlushPromise> Flush() override;
     48 
     49  nsCString GetDescriptionName() const override;
     50 
     51  nsCString GetCodecName() const override;
     52 
     53  ConversionRequired NeedsConversion() const override;
     54 
     55 protected:
     56  ~DummyMediaDataDecoder() = default;
     57 
     58  UniquePtr<DummyDataCreator> mCreator;
     59  const bool mIsH264;
     60  uint32_t mMaxRefFrames;
     61  ReorderQueue mReorderQueue;
     62  TrackInfo::TrackType mType;
     63  nsCString mDescription;
     64 };
     65 
     66 }  // namespace mozilla
     67 
     68 #endif  // !defined(DummyMediaDataDecoder_h_)