WebAudioBufferList.h [plain text]
#pragma once
#include "PlatformAudioData.h"
#include <wtf/IteratorRange.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
struct AudioBuffer;
struct AudioBufferList;
typedef struct OpaqueCMBlockBuffer *CMBlockBufferRef;
typedef struct opaqueCMSampleBuffer *CMSampleBufferRef;
namespace WebCore {
class CAAudioStreamDescription;
class WebAudioBufferList : public PlatformAudioData {
public:
WebAudioBufferList(const CAAudioStreamDescription&);
WEBCORE_EXPORT WebAudioBufferList(const CAAudioStreamDescription&, uint32_t sampleCount);
WebAudioBufferList(const CAAudioStreamDescription&, CMSampleBufferRef);
void reset();
AudioBufferList* list() const { return m_list.get(); }
operator AudioBufferList&() const { return *m_list; }
uint32_t bufferCount() const;
AudioBuffer* buffer(uint32_t index) const;
WTF::IteratorRange<AudioBuffer*> buffers() const;
private:
Kind kind() const { return Kind::WebAudioBufferList; }
size_t m_listBufferSize { 0 };
std::unique_ptr<AudioBufferList> m_canonicalList;
std::unique_ptr<AudioBufferList> m_list;
RetainPtr<CMBlockBufferRef> m_blockBuffer;
Vector<uint8_t> m_flatBuffer;
};
}
SPECIALIZE_TYPE_TRAITS_BEGIN(WebCore::WebAudioBufferList)
static bool isType(const WebCore::PlatformAudioData& data) { return data.kind() == WebCore::PlatformAudioData::Kind::WebAudioBufferList; }
SPECIALIZE_TYPE_TRAITS_END()