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