mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibMedia: Give PlaybackManager a playback state getter
This commit is contained in:
parent
9117f661a8
commit
27ed536540
|
|
@ -228,6 +228,11 @@ bool PlaybackManager::is_playing()
|
|||
return m_handler->is_playing();
|
||||
}
|
||||
|
||||
PlaybackState PlaybackManager::state()
|
||||
{
|
||||
return m_handler->state();
|
||||
}
|
||||
|
||||
void PlaybackManager::set_volume(double volume)
|
||||
{
|
||||
if (m_audio_sink)
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@
|
|||
#include <LibMedia/Export.h>
|
||||
#include <LibMedia/Forward.h>
|
||||
#include <LibMedia/PlaybackStates/Forward.h>
|
||||
#include <LibMedia/PlaybackStates/PlaybackState.h>
|
||||
#include <LibMedia/Providers/MediaTimeProvider.h>
|
||||
#include <LibMedia/Track.h>
|
||||
#include <LibThreading/Mutex.h>
|
||||
|
|
@ -71,6 +72,7 @@ public:
|
|||
void pause();
|
||||
|
||||
bool is_playing();
|
||||
PlaybackState state();
|
||||
|
||||
void set_volume(double);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,6 +37,10 @@ public:
|
|||
{
|
||||
return false;
|
||||
}
|
||||
virtual PlaybackState state() override
|
||||
{
|
||||
return PlaybackState::Paused;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
18
Libraries/LibMedia/PlaybackStates/PlaybackState.h
Normal file
18
Libraries/LibMedia/PlaybackStates/PlaybackState.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Types.h>
|
||||
|
||||
namespace Media {
|
||||
|
||||
enum class PlaybackState : u8 {
|
||||
Playing,
|
||||
Paused,
|
||||
};
|
||||
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <LibMedia/Forward.h>
|
||||
#include <LibMedia/PlaybackStates/PlaybackState.h>
|
||||
|
||||
namespace Media {
|
||||
|
||||
|
|
@ -25,6 +26,7 @@ public:
|
|||
virtual void pause() = 0;
|
||||
|
||||
virtual bool is_playing() = 0;
|
||||
virtual PlaybackState state() = 0;
|
||||
|
||||
protected:
|
||||
PlaybackManager& manager() const { return m_manager; }
|
||||
|
|
|
|||
|
|
@ -39,6 +39,10 @@ public:
|
|||
{
|
||||
return true;
|
||||
}
|
||||
virtual PlaybackState state() override
|
||||
{
|
||||
return PlaybackState::Playing;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user