Files
palemoon27/dom/media/platforms/apple/AppleATDecoder.h
T
roytam1 81a1b46bb3 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1261900: [webm] Use block duration if known. r=kinetik (0455c4de93)
- Bug 1261900: [MSE] P2. Prevent assertion if first media segment contains no usable frames. r=gerald (a1cdf83be3)
- Bug 1261900: P3. Re-add MediaDataDemuxer::GetEvictionOffset() API. r=gerald (fc45da3ca8)
- Bug 1261900: [MSE] P4. Only evict no longer used data from resource. r=gerald (d3e3c59f4c)
- Bug 1261900: [MSE/webm] P5. Re-add WebMTrackDemuxer::GetEvictionOffset. r=gerald (ee8fd8e5dc)
- Bug 1261900: [MSE/webm] P6. Don't unnecessarily calculate the next keyframe time. r=kinetik (aa9345d6eb)
- Bug 1261900: [webm] P9. Prevent null deref when webm logs are turned on. r=kinetik (dfe061a463)
- Bug 1261900 - Allow WebMDemuxer to resume demuxing even after encountering EOS. r=jya (65bd6409fd)
- Bug 1274445: [webm] P1. Track separately audio track from video track. r=kinetik (35f04cd778)
- Bug 1274445: P2. Don't unnecessarily reset the decoder context. r=kamidphish (eaa0d94c25)
- Bug 1275807 - Remove remaining use of FlushableTaskQueue. r=cpearce. (d0834f0a03)
- Bug 1272225. Part 3 - remove use of FlushableTaskQueue. r=jya. (ed25bc636f)
- Bug 1274205 - remove use of FlushableTaskQueue. r=bechen. (9f340e7a97)
- Bug 1274214 - remove use of FlushableTaskQueue. r=kaku. (1c90ec8e7f)
- Bug 1266644 - Remove unused codes. r=jesup r=pehrsons (ffb303f3ee)
- Bug 1266647 - Clean NotifyQueuedTrackChange to only notify when command is track create and track end. r=jesup r=pehrsons (2ed23f22f0)
2024-10-08 23:53:21 +08:00

76 lines
2.4 KiB
C++

/* -*- 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/. */
#ifndef mozilla_AppleATDecoder_h
#define mozilla_AppleATDecoder_h
#include <AudioToolbox/AudioToolbox.h>
#include "PlatformDecoderModule.h"
#include "mozilla/ReentrantMonitor.h"
#include "mozilla/Vector.h"
#include "nsIThread.h"
#include "AudioConverter.h"
namespace mozilla {
class TaskQueue;
class MediaDataDecoderCallback;
class AppleATDecoder : public MediaDataDecoder {
public:
AppleATDecoder(const AudioInfo& aConfig,
TaskQueue* aTaskQueue,
MediaDataDecoderCallback* aCallback);
virtual ~AppleATDecoder();
RefPtr<InitPromise> Init() override;
nsresult Input(MediaRawData* aSample) override;
nsresult Flush() override;
nsresult Drain() override;
nsresult Shutdown() override;
const char* GetDescriptionName() const override
{
return "apple CoreMedia decoder";
}
// Callbacks also need access to the config.
const AudioInfo& mConfig;
// Use to extract magic cookie for HE-AAC detection.
nsTArray<uint8_t> mMagicCookie;
// Will be set to true should an error occurred while attempting to retrieve
// the magic cookie property.
bool mFileStreamError;
private:
const RefPtr<TaskQueue> mTaskQueue;
MediaDataDecoderCallback* mCallback;
AudioConverterRef mConverter;
AudioStreamBasicDescription mOutputFormat;
UInt32 mFormatID;
AudioFileStreamID mStream;
nsTArray<RefPtr<MediaRawData>> mQueuedSamples;
UniquePtr<AudioConfig::ChannelLayout> mChannelLayout;
UniquePtr<AudioConverter> mAudioConverter;
Atomic<bool> mIsFlushing;
void ProcessFlush();
void SubmitSample(MediaRawData* aSample);
nsresult DecodeSample(MediaRawData* aSample);
nsresult GetInputAudioDescription(AudioStreamBasicDescription& aDesc,
const nsTArray<uint8_t>& aExtraData);
// Setup AudioConverter once all information required has been gathered.
// Will return NS_ERROR_NOT_INITIALIZED if more data is required.
nsresult SetupDecoder(MediaRawData* aSample);
nsresult GetImplicitAACMagicCookie(const MediaRawData* aSample);
nsresult SetupChannelLayout();
};
} // namespace mozilla
#endif // mozilla_AppleATDecoder_h