chromium/media/gpu/test/video_bitstream.cc

// Copyright 2023 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/gpu/test/video_bitstream.h"

#include <optional>

#include "base/containers/contains.h"
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
#include "base/json/json_reader.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/string_util.h"

namespace media::test {

namespace {
// Suffix appended to the video file path to get the metadata file path, if no
// explicit metadata file path was specified.
constexpr const base::FilePath::CharType* kMetadataSuffix =);

// Converts the string to VideoCodecProfile. This returns std::nullopt if
// it is not supported by video_decode_accelerator(_perf)_tests.
std::optional<VideoCodecProfile> ConvertStringtoProfile(
    const std::string& profile) {}

// Loads the compressed video from |data_file_path|.
std::unique_ptr<base::MemoryMappedFile> LoadData(
    const base::FilePath& data_file_path) {}
}  // namespace

// Loads the metadata from |json_file_path|. The read values are filled into
// |metadata.|
// static
bool VideoBitstream::LoadMetadata(const base::FilePath& json_file_path,
                                  Metadata& metadata) {}

VideoBitstream::VideoBitstream(
    std::unique_ptr<base::MemoryMappedFile> memory_mapped_file,
    const Metadata& metadata)
    :{}

VideoBitstream::~VideoBitstream() = default;

VideoBitstream::Metadata::Metadata() = default;
VideoBitstream::Metadata::~Metadata() = default;
VideoBitstream::Metadata::Metadata(const Metadata&) = default;
VideoBitstream::Metadata& VideoBitstream::Metadata::operator=(const Metadata&) =
    default;

std::unique_ptr<VideoBitstream> VideoBitstream::Create(
    const base::FilePath& file_path,
    const base::FilePath& metadata_file_path) {}

base::span<const uint8_t> VideoBitstream::Data() const {}
// static
base::FilePath VideoBitstream::test_data_path_;

// static
void VideoBitstream::SetTestDataPath(const base::FilePath& test_data_path) {}

// static
base::FilePath VideoBitstream::ResolveFilePath(
    const base::FilePath& file_path) {}
}  // namespace media::test