LibMedia: Move ResumingStateHandler::resume() out-of-line
This commit is contained in:
parent
21e8ece013
commit
2f1c90caae
3 changed files with 28 additions and 11 deletions
|
|
@ -11,6 +11,7 @@ set(SOURCES
|
|||
IncrementallyPopulatedStream.cpp
|
||||
PlaybackManager.cpp
|
||||
PlaybackStates/PlaybackStateHandler.cpp
|
||||
PlaybackStates/ResumingStateHandler.cpp
|
||||
Providers/AudioDataProvider.cpp
|
||||
Providers/GenericTimeProvider.cpp
|
||||
Providers/VideoDataProvider.cpp
|
||||
|
|
|
|||
23
Libraries/LibMedia/PlaybackStates/ResumingStateHandler.cpp
Normal file
23
Libraries/LibMedia/PlaybackStates/ResumingStateHandler.cpp
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include "ResumingStateHandler.h"
|
||||
|
||||
#include <LibMedia/PlaybackManager.h>
|
||||
#include <LibMedia/PlaybackStates/PausedStateHandler.h>
|
||||
#include <LibMedia/PlaybackStates/PlayingStateHandler.h>
|
||||
|
||||
namespace Media {
|
||||
|
||||
void ResumingStateHandler::resume()
|
||||
{
|
||||
if (m_playing)
|
||||
manager().replace_state_handler<PlayingStateHandler>();
|
||||
else
|
||||
manager().replace_state_handler<PausedStateHandler>();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +1,12 @@
|
|||
/*
|
||||
* Copyright (c) 2025, Gregory Bertilson <zaggy1024@gmail.com>
|
||||
* Copyright (c) 2025, Gregory Bertilson <gregory@ladybird.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibMedia/PlaybackManager.h>
|
||||
#include <LibMedia/PlaybackStates/Forward.h>
|
||||
#include <LibMedia/PlaybackStates/PausedStateHandler.h>
|
||||
|
||||
namespace Media {
|
||||
|
||||
|
|
@ -21,14 +19,6 @@ public:
|
|||
}
|
||||
virtual ~ResumingStateHandler() override = default;
|
||||
|
||||
void resume()
|
||||
{
|
||||
if (m_playing)
|
||||
manager().replace_state_handler<PlayingStateHandler>();
|
||||
else
|
||||
manager().replace_state_handler<PausedStateHandler>();
|
||||
}
|
||||
|
||||
virtual void on_enter() override { }
|
||||
virtual void on_exit() override { }
|
||||
|
||||
|
|
@ -46,6 +36,9 @@ public:
|
|||
return m_playing;
|
||||
}
|
||||
|
||||
protected:
|
||||
void resume();
|
||||
|
||||
private:
|
||||
bool m_playing { false };
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue