chromium/media/audio/audio_debug_file_writer.cc

// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/40285824): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include "media/audio/audio_debug_file_writer.h"

#include <stdint.h>
#include <array>
#include <limits>
#include <memory>
#include <utility>

#include "base/containers/span.h"
#include "base/containers/span_writer.h"
#include "base/functional/bind.h"
#include "base/logging.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_span.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "media/base/audio_bus.h"
#include "media/base/audio_bus_pool.h"
#include "media/base/audio_sample_types.h"

namespace media {

namespace {

// Windows WAVE format header
// Byte order: Little-endian
// Offset Length  Content
//  0      4     "RIFF"
//  4      4     <file length - 8>
//  8      4     "WAVE"
// 12      4     "fmt "
// 16      4     <length of the fmt data> (=16)
// 20      2     <WAVE file encoding tag>
// 22      2     <channels>
// 24      4     <sample rate>
// 28      4     <bytes per second> (sample rate * block align)
// 32      2     <block align>  (channels * bits per sample / 8)
// 34      2     <bits per sample>
// 36      4     "data"
// 40      4     <sample data size(n)>
// 44     (n)    <sample data>

// We write 16 bit PCM only.
static const uint16_t kBytesPerSample =;

static const uint32_t kWavHeaderSize =;
static const uint32_t kFmtChunkSize =;
// 4 bytes for ID + 4 bytes for size.
static const uint32_t kChunkHeaderSize =;
static const uint16_t kWavFormatPcm =;

static const uint8_t kRiff[] =;
static const uint8_t kWave[] =;
static const uint8_t kFmt[] =;
static const uint8_t kData[] =;

WavHeaderBuffer;

// Writes Wave header to the specified address, there should be at least
// kWavHeaderSize bytes allocated for it.
void WriteWavHeader(WavHeaderBuffer* buf,
                    uint32_t channels,
                    uint32_t sample_rate,
                    uint64_t samples) {}

}  // namespace

AudioDebugFileWriter::~AudioDebugFileWriter() {}

void AudioDebugFileWriter::Write(const AudioBus& data) {}

AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
    const AudioParameters& params,
    base::File file) {}

AudioDebugFileWriter::AudioDebugFileWriter(
    const AudioParameters& params,
    base::File file,
    std::unique_ptr<AudioBusPool> audio_bus_pool)
    :{}

AudioDebugFileWriter::Ptr AudioDebugFileWriter::Create(
    const AudioParameters& params,
    base::File file,
    std::unique_ptr<AudioBusPool> audio_bus_pool) {}

void AudioDebugFileWriter::DoWrite(std::unique_ptr<AudioBus> data) {}

void AudioDebugFileWriter::WriteHeader() {}

}  // namespace media