2013-11-06 23:17:35 -06:00
|
|
|
/**
|
|
|
|
|
* @file
|
|
|
|
|
* @brief Source file for PlayerBase class
|
|
|
|
|
* @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
*
|
2019-06-09 08:31:04 -04:00
|
|
|
* @ref License
|
|
|
|
|
*/
|
|
|
|
|
|
2021-10-16 01:26:26 -04:00
|
|
|
// Copyright (c) 2008-2019 OpenShot Studios, LLC
|
|
|
|
|
//
|
|
|
|
|
// SPDX-License-Identifier: LGPL-3.0-or-later
|
2013-11-06 23:17:35 -06:00
|
|
|
|
2020-10-18 07:43:37 -04:00
|
|
|
#include "PlayerBase.h"
|
2013-11-06 23:17:35 -06:00
|
|
|
|
|
|
|
|
using namespace openshot;
|
|
|
|
|
|
|
|
|
|
// Display a loading animation
|
|
|
|
|
void PlayerBase::Loading() {
|
|
|
|
|
mode = PLAYBACK_LOADING;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Play the video
|
|
|
|
|
void PlayerBase::Play() {
|
|
|
|
|
mode = PLAYBACK_PLAY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Pause the video
|
|
|
|
|
void PlayerBase::Pause() {
|
|
|
|
|
mode = PLAYBACK_PAUSED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the Playback speed
|
|
|
|
|
float PlayerBase::Speed() {
|
|
|
|
|
return speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the Playback speed multiplier (1.0 = normal speed, <1.0 = slower, >1.0 faster)
|
|
|
|
|
void PlayerBase::Speed(float new_speed) {
|
|
|
|
|
speed = new_speed;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Stop the video player and clear the cached frames
|
|
|
|
|
void PlayerBase::Stop() {
|
|
|
|
|
mode = PLAYBACK_STOPPED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the current reader, such as a FFmpegReader
|
2019-09-21 00:14:32 -04:00
|
|
|
openshot::ReaderBase* PlayerBase::Reader() {
|
2013-11-06 23:17:35 -06:00
|
|
|
return reader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the current reader, such as a FFmpegReader
|
2019-09-21 00:14:32 -04:00
|
|
|
void PlayerBase::Reader(openshot::ReaderBase *new_reader) {
|
2013-11-06 23:17:35 -06:00
|
|
|
reader = new_reader;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Get the Volume
|
|
|
|
|
float PlayerBase::Volume() {
|
|
|
|
|
return volume;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Set the Volume multiplier (1.0 = normal volume, <1.0 = quieter, >1.0 louder)
|
|
|
|
|
void PlayerBase::Volume(float new_volume) {
|
|
|
|
|
volume = new_volume;
|
|
|
|
|
}
|