2014-02-05 01:29:31 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#if !defined(WMFAudioOutputSource_h_)
|
|
|
|
#define WMFAudioOutputSource_h_
|
|
|
|
|
|
|
|
#include "MFTDecoder.h"
|
2017-02-10 16:24:56 +00:00
|
|
|
#include "WMF.h"
|
2014-02-05 01:29:31 +00:00
|
|
|
#include "WMFMediaDataDecoder.h"
|
2017-02-10 16:24:56 +00:00
|
|
|
#include "mozilla/RefPtr.h"
|
2014-02-05 01:29:31 +00:00
|
|
|
|
2016-10-26 22:59:00 +00:00
|
|
|
extern const GUID CLSID_WebmMfVpxDec;
|
2015-10-06 03:52:52 +00:00
|
|
|
|
2014-02-05 01:29:31 +00:00
|
|
|
namespace mozilla {
|
|
|
|
|
2017-01-26 12:56:46 +00:00
|
|
|
class WMFAudioMFTManager : public MFTManager
|
|
|
|
{
|
2014-02-05 01:29:31 +00:00
|
|
|
public:
|
2016-12-16 07:49:53 +00:00
|
|
|
explicit WMFAudioMFTManager(const AudioInfo& aConfig);
|
2014-07-09 21:25:10 +00:00
|
|
|
~WMFAudioMFTManager();
|
2014-02-05 01:29:31 +00:00
|
|
|
|
2015-09-10 17:38:17 +00:00
|
|
|
bool Init();
|
2014-02-05 01:29:31 +00:00
|
|
|
|
2015-09-21 04:35:18 +00:00
|
|
|
HRESULT Input(MediaRawData* aSample) override;
|
2014-06-19 22:59:00 +00:00
|
|
|
|
2014-02-05 01:29:31 +00:00
|
|
|
// Note WMF's AAC decoder sometimes output negatively timestamped samples,
|
|
|
|
// presumably they're the preroll samples, and we strip them. We may return
|
|
|
|
// a null aOutput in this case.
|
2017-01-26 12:56:46 +00:00
|
|
|
HRESULT Output(int64_t aStreamOffset, RefPtr<MediaData>& aOutput) override;
|
2014-09-19 03:44:27 +00:00
|
|
|
|
2015-09-21 04:35:18 +00:00
|
|
|
void Shutdown() override;
|
2014-09-19 03:44:27 +00:00
|
|
|
|
2017-01-26 12:56:46 +00:00
|
|
|
TrackInfo::TrackType GetType() override
|
|
|
|
{
|
2015-08-11 03:50:07 +00:00
|
|
|
return TrackInfo::kAudioTrack;
|
|
|
|
}
|
|
|
|
|
2016-01-22 01:29:51 +00:00
|
|
|
const char* GetDescriptionName() const override
|
|
|
|
{
|
|
|
|
return "wmf audio decoder";
|
|
|
|
}
|
|
|
|
|
2014-02-05 01:29:31 +00:00
|
|
|
private:
|
2014-08-12 21:56:33 +00:00
|
|
|
HRESULT UpdateOutputType();
|
|
|
|
|
|
|
|
uint32_t mAudioChannels;
|
|
|
|
uint32_t mAudioRate;
|
2014-02-05 01:29:31 +00:00
|
|
|
nsTArray<BYTE> mUserData;
|
|
|
|
|
2015-07-31 15:20:11 +00:00
|
|
|
// The offset, at which playback started since the
|
2014-02-05 01:29:31 +00:00
|
|
|
// last discontinuity.
|
2015-07-31 15:20:11 +00:00
|
|
|
media::TimeUnit mAudioTimeOffset;
|
2014-02-05 01:29:31 +00:00
|
|
|
// The number of audio frames that we've played since the last
|
|
|
|
// discontinuity.
|
2017-02-10 16:24:56 +00:00
|
|
|
int64_t mAudioFrameSum = 0;
|
2014-02-05 01:29:31 +00:00
|
|
|
|
2017-01-26 12:56:46 +00:00
|
|
|
enum StreamType
|
|
|
|
{
|
2014-08-22 01:37:57 +00:00
|
|
|
Unknown,
|
|
|
|
AAC,
|
|
|
|
MP3
|
|
|
|
};
|
|
|
|
StreamType mStreamType;
|
|
|
|
|
|
|
|
const GUID& GetMFTGUID();
|
|
|
|
const GUID& GetMediaSubtypeGUID();
|
|
|
|
|
2015-07-31 15:20:11 +00:00
|
|
|
// True if we need to re-initialize mAudioTimeOffset and mAudioFrameSum
|
2014-02-05 01:29:31 +00:00
|
|
|
// from the next audio packet we decode. This happens after a seek, since
|
|
|
|
// WMF doesn't mark a stream as having a discontinuity after a seek(0).
|
2017-02-10 16:24:56 +00:00
|
|
|
bool mMustRecaptureAudioPosition = true;
|
2014-02-05 01:29:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // WMFAudioOutputSource_h_
|