Skip to content

acl/core/compressed_database.h

#include "acl/core/compressed_database.h"

The compressed database type.

compressed_database

class compressed_database final

An instance of a compressed database. The compressed data immediately follows this instance in memory. The total size of the buffer can be queried with get_size(). A compressed database can either contain all the data inline within its buffer in one blob or it can be split into smaller chunks that can be streamed in and out.

compressed_database::get_size

uint32_t get_size() const

Returns the size in bytes of the compressed database. Includes the compressed_database instance size and the size of the inline bulk data (if present).

compressed_database::get_total_size

uint32_t get_total_size() const

Returns the total size in bytes of the compressed database. Includes non-inline bulk data.

compressed_database::get_bulk_data_size

uint32_t get_bulk_data_size(quality_tier tier) const

Returns the size in bytes of the bulk data for the specified tier (medium or low).

compressed_database::has_bulk_data

bool has_bulk_data(quality_tier tier) const

Returns whether or not the specified quality tier contains bulk data.

compressed_database::get_hash

uint32_t get_hash() const

Returns the hash for the compressed database. This is only used for sanity checking in case of memory corruption.

compressed_database::get_bulk_data_hash

uint32_t get_bulk_data_hash(quality_tier tier) const

Returns the hash of the bulk data for the specified tier (medium or low). This is only used for sanity checking in case of memory corruption.

compressed_database::get_tag

buffer_tag32 get_tag() const

Returns the binary tag for the compressed database. This uniquely identifies the buffer as a proper compressed_database object.

compressed_database::get_version

compressed_tracks_version16 get_version() const

Returns the binary format version.

compressed_database::get_num_chunks

uint32_t get_num_chunks(quality_tier tier) const

Returns the number of chunks contained in this database for the specified tier (medium or low).

compressed_database::get_max_chunk_size

uint32_t get_max_chunk_size() const

Returns the maximum size in bytes of each chunk.

compressed_database::get_num_clips

uint32_t get_num_clips() const

Returns the number of clips contained in this database.

compressed_database::get_num_segments

uint32_t get_num_segments() const

Returns the number of segments contained in this database (for all clips).

compressed_database::is_bulk_data_inline

bool is_bulk_data_inline() const

Returns whether or not the bulk data is stored inline in this compressed database.

compressed_database::get_bulk_data

const uint8_t* get_bulk_data(quality_tier tier) const

Returns a pointer to the bulk data for the specified tier (medium or low) when it is inline, nullptr otherwise.

compressed_database::contains

bool contains(const compressed_tracks& tracks) const

Returns true if the compressed database contains the provided compressed tracks instance.

compressed_database::is_valid

error_result is_valid(bool check_hash) const

Returns true if the compressed database is valid and usable. This mainly validates some invariants as well as ensuring that the memory has not been corrupted.

Parameters

  • check_hash: If true, the compressed tracks hash will also be compared.

make_compressed_database

const compressed_database* make_compressed_database(
    const void* buffer,
    error_result* out_error_result = nullptr)

compressed_database* make_compressed_database(
    void* buffer,
    error_result* out_error_result = nullptr)

Create a compressed_database instance in place from a raw memory buffer. If the buffer does not contain a valid compressed_database instance, nullptr is returned along with an optional error result.

k_database_bulk_data_alignment

uint32_t k_database_bulk_data_alignment = alignof(acl_impl::database_chunk_header);

The alignment in bytes of the bulk data of a compressed database.