tor-browser

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

WMFAudioMFTManager.h (1999B)


      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(WMFAudioOutputSource_h_)
      8 #  define WMFAudioOutputSource_h_
      9 
     10 #  include "MFTDecoder.h"
     11 #  include "WMF.h"
     12 #  include "WMFDecoderModule.h"
     13 #  include "WMFMediaDataDecoder.h"
     14 #  include "mozilla/RefPtr.h"
     15 
     16 namespace mozilla {
     17 
     18 class WMFAudioMFTManager : public MFTManager {
     19 public:
     20  explicit WMFAudioMFTManager(const AudioInfo& aConfig);
     21  ~WMFAudioMFTManager();
     22 
     23  bool Init();
     24 
     25  HRESULT Input(MediaRawData* aSample) override;
     26 
     27  // Note WMF's AAC decoder sometimes output negatively timestamped samples,
     28  // presumably they're the preroll samples, and we strip them. We may return
     29  // a null aOutput in this case.
     30  HRESULT Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutput) override;
     31 
     32  void Shutdown() override;
     33 
     34  TrackInfo::TrackType GetType() override { return TrackInfo::kAudioTrack; }
     35 
     36  nsCString GetDescriptionName() const override {
     37    return "wmf audio decoder"_ns;
     38  }
     39 
     40  nsCString GetCodecName() const override;
     41 
     42 private:
     43  HRESULT UpdateOutputType();
     44 
     45  bool IsPartialOutput(const media::TimeUnit& aNewOutputDuration,
     46                       const bool aIsRateChangedToHigher) const;
     47 
     48  uint32_t mAudioChannels;
     49  AudioConfig::ChannelLayout::ChannelMap mChannelsMap;
     50  uint32_t mAudioRate;
     51  nsTArray<BYTE> mUserData;
     52 
     53  WMFStreamType mStreamType;
     54 
     55  const GUID& GetMediaSubtypeGUID();
     56 
     57  media::TimeUnit mLastInputTime = media::TimeUnit::Zero();
     58  media::TimeUnit mLastOutputDuration = media::TimeUnit::Zero();
     59 
     60  bool mFirstFrame = true;
     61  bool mIsADTS = false;
     62 
     63  uint64_t mTotalMediaFrames = 0;
     64  uint32_t mEncoderDelay = 0;
     65  uint32_t mRemainingEncoderDelay = 0;
     66 };
     67 
     68 }  // namespace mozilla
     69 
     70 #endif  // WMFAudioOutputSource_h_