chromium/media/formats/mpeg/mpeg1_audio_stream_parser.cc

// Copyright 2014 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/formats/mpeg/mpeg1_audio_stream_parser.h"

#include "media/base/media_log.h"

namespace media {

namespace {

constexpr uint32_t kMPEG1StartCodeMask =;

// Maps version and layer information in the frame header
// into an index for the |kBitrateMap|.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kVersionLayerMap[4][4] =;

// Maps the bitrate index field in the header and an index
// from |kVersionLayerMap| to a frame bitrate.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kBitrateMap[16][6] =;

// Maps the sample rate index and version fields from the frame header
// to a sample rate.
// Derived from: http://mpgedit.org/mpgedit/mpeg_format/MP3Format.html
constexpr int kSampleRateMap[4][4] =;

// Offset in bytes from the end of the MP3 header to "Xing" or "Info" tags which
// indicate a frame is silent metadata frame.  Values taken from FFmpeg.
constexpr int kXingHeaderMap[2][2] =;

// Frame header field constants.
constexpr int kBitrateFree =;
constexpr int kBitrateBad =;
constexpr int kSampleRateReserved =;
constexpr int kCodecDelay =;

}  // namespace

// static
bool MPEG1AudioStreamParser::ParseHeader(MediaLog* media_log,
                                         size_t* media_log_limit,
                                         const uint8_t* data,
                                         Header* header) {}

MPEG1AudioStreamParser::MPEG1AudioStreamParser()
    :{}

MPEG1AudioStreamParser::~MPEG1AudioStreamParser() = default;

int MPEG1AudioStreamParser::ParseFrameHeader(const uint8_t* data,
                                             int size,
                                             int* frame_size,
                                             int* sample_rate,
                                             ChannelLayout* channel_layout,
                                             int* sample_count,
                                             bool* metadata_frame,
                                             std::vector<uint8_t>* extra_data) {}

}  // namespace media