#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "media/audio/flac_audio_handler.h"
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include "base/check.h"
#include "base/check_op.h"
#include "base/logging.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_fifo.h"
#include "media/base/audio_timestamp_helper.h"
#include "media/base/limits.h"
#include "third_party/flac/include/FLAC/ordinals.h"
#include "third_party/flac/include/FLAC/stream_decoder.h"
namespace media {
FlacAudioHandler::FlacAudioHandler(std::string_view data)
: … { … }
FlacAudioHandler::~FlacAudioHandler() = default;
bool FlacAudioHandler::Initialize() { … }
int FlacAudioHandler::GetNumChannels() const { … }
int FlacAudioHandler::GetSampleRate() const { … }
base::TimeDelta FlacAudioHandler::GetDuration() const { … }
bool FlacAudioHandler::AtEnd() const { … }
bool FlacAudioHandler::CopyTo(AudioBus* bus, size_t* frames_written) { … }
void FlacAudioHandler::Reset() { … }
FLAC__StreamDecoderReadStatus FlacAudioHandler::ReadCallback(
const FLAC__StreamDecoder* decoder,
FLAC__byte buffer[],
size_t* bytes,
void* client_data) { … }
FLAC__StreamDecoderWriteStatus FlacAudioHandler::WriteCallback(
const FLAC__StreamDecoder* decoder,
const FLAC__Frame* frame,
const FLAC__int32* const buffer[],
void* client_data) { … }
void FlacAudioHandler::MetaCallback(const FLAC__StreamDecoder* decoder,
const FLAC__StreamMetadata* metadata,
void* client_data) { … }
void FlacAudioHandler::ErrorCallback(const FLAC__StreamDecoder* decoder,
FLAC__StreamDecoderErrorStatus status,
void* client_data) { … }
FLAC__StreamDecoderReadStatus FlacAudioHandler::ReadCallbackInternal(
FLAC__byte buffer[],
size_t* bytes) { … }
FLAC__StreamDecoderWriteStatus FlacAudioHandler::WriteCallbackInternal(
const FLAC__Frame* frame,
const FLAC__int32* const buffer[]) { … }
void FlacAudioHandler::MetaCallbackInternal(
const FLAC__StreamMetadata* metadata) { … }
void FlacAudioHandler::ErrorCallbackInternal() { … }
bool FlacAudioHandler::AreParamsValid() const { … }
}