mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-23 01:32:14 -05:00
001df24935
This change aims to improve the speed of incremental builds.
42 lines
1.3 KiB
C++
42 lines
1.3 KiB
C++
/*
|
|
* Copyright (c) 2023, Gregory Bertilson <zaggy1024@gmail.com>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibCore/Timer.h>
|
|
#include <LibMedia/Audio/PlaybackStream.h>
|
|
#include <LibWeb/Platform/AudioCodecPlugin.h>
|
|
|
|
namespace Web::Platform {
|
|
|
|
class AudioCodecPluginAgnostic final : public AudioCodecPlugin {
|
|
public:
|
|
static ErrorOr<NonnullOwnPtr<AudioCodecPluginAgnostic>> create(NonnullRefPtr<Audio::Loader> const&);
|
|
|
|
virtual void resume_playback() override;
|
|
virtual void pause_playback() override;
|
|
virtual void set_volume(double) override;
|
|
virtual void seek(double) override;
|
|
|
|
virtual AK::Duration duration() override;
|
|
|
|
private:
|
|
explicit AudioCodecPluginAgnostic(NonnullRefPtr<Audio::Loader> loader, AK::Duration, NonnullRefPtr<Core::Timer> update_timer);
|
|
|
|
void update_timestamp();
|
|
|
|
NonnullRefPtr<Audio::Loader> m_loader;
|
|
RefPtr<Audio::PlaybackStream> m_output { nullptr };
|
|
AK::Duration m_duration { AK::Duration::zero() };
|
|
AK::Duration m_last_resume_in_media_time { AK::Duration::zero() };
|
|
AK::Duration m_last_resume_in_device_time { AK::Duration::zero() };
|
|
AK::Duration m_last_good_device_time { AK::Duration::zero() };
|
|
Core::EventLoop& m_main_thread_event_loop;
|
|
NonnullRefPtr<Core::Timer> m_update_timer;
|
|
bool m_paused { true };
|
|
};
|
|
|
|
}
|