ladybird/Libraries/LibMedia/GenericTimeProvider.h
Zaggy1024 a06f87d728 LibMedia: Transmit seeks and resolve them through the pipeline
Seeking is now unified under one single method signature implemented by
all producers and transmitted through the pipeline by all sinks. By
doing it this way, we can simply instantaneously notify each node of
the pipeline that it needs to stop what it's doing and seek. For nodes
that are threaded (particularly the source providers), this causes them
to stop pushing data to their queue immediately, so that no stale data
makes it through to the output. Then, when new data does come through,
that is a clear indication that the seek has completed.

Note that track enablement is now through the pipeline as well, which
means that SuspendedStateHandler no longer has a way to suspend newly-
enabled tracks. Decoder suspension will need to be reworked to fit into
this new pipeline, sleeping/disposing and restarting entirely based on
the pull() timing in the producers.
2026-05-13 02:05:35 -05:00

28 lines
599 B
C++

/*
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include "MediaTimeProvider.h"
namespace Media {
class GenericTimeProvider final : public MediaTimeProvider {
public:
GenericTimeProvider();
virtual ~GenericTimeProvider() override;
virtual AK::Duration current_time() const override;
virtual void resume() override;
virtual void pause() override;
virtual void seek(AK::Duration) override;
private:
Optional<MonotonicTime> m_monotonic_time_on_resume;
AK::Duration m_media_time;
};
}