ladybird/Libraries/LibMedia/Containers/ContainerNavigator.h
Zaggy1024 9f788cb80f LibMedia: Implement CBR seeking through ContainerNavigator
This mainly acts as a proof of concept for manual seeking
implementations, which may prove useful for other formats than WAV.
2026-05-28 10:30:20 -05:00

35 lines
796 B
C++

/*
* Copyright (c) 2026-present, the Ladybird developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <AK/Optional.h>
#include <AK/Time.h>
#include <AK/Variant.h>
#include <AK/Vector.h>
#include <LibMedia/DecoderError.h>
#include <LibMedia/MediaStream.h>
#include <LibMedia/TimeRanges.h>
namespace Media {
struct SeekSkipped { };
struct SeekedPosition {
i64 byte_position;
AK::Duration timestamp;
};
using SeekResult = Variant<Empty, SeekSkipped, SeekedPosition>;
class ContainerNavigator {
public:
virtual ~ContainerNavigator() = default;
virtual DecoderErrorOr<SeekResult> seek_to_timestamp(AK::Duration) const { return Empty {}; }
virtual TimeRanges buffered_time_ranges(Vector<MediaStream::ByteRange> const& byte_ranges) const = 0;
};
}