Skip to content

Truly independent web browser

919 B
Raw Blame
/*
 * Copyright (c) 2026-present, the Ladybird developers.
 *
 * SPDX-License-Identifier: BSD-2-Clause
 */

#include <LibMedia/Containers/Matroska/Document.h>
#include <LibMedia/Containers/Matroska/TrackBlockContext.h>
#include <LibMedia/Containers/Matroska/Utilities.h>

namespace Media::Matroska {

TrackBlockContext TrackBlockContext::from_track_entry(TrackEntry const& entry)
{
    return {
        .timestamp_scale = entry.timestamp_scale(),
        .codec_delay = entry.codec_delay(),
        .seek_pre_roll = entry.seek_pre_roll(),
        .timestamp_offset = entry.timestamp_offset(),
        .default_duration = entry.default_duration(),
        // Invalid initialization data leaves the durations unknown here, and fails when decoding.
        .packet_duration_parser = Codecs::AudioPacketDurationParser::create(codec_id_from_matroska_track_entry(entry), entry.codec_private_data()).value_or({}),
    };
}

}