1 /**
2  * @file
3  * @brief Source file for PlayerBase class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @ref License
7  */
8 
9 /* LICENSE
10  *
11  * Copyright (c) 2008-2019 OpenShot Studios, LLC
12  * <http://www.openshotstudios.com/>. This file is part of
13  * OpenShot Library (libopenshot), an open-source project dedicated to
14  * delivering high quality video editing and animation solutions to the
15  * world. For more information visit <http://www.openshot.org/>.
16  *
17  * OpenShot Library (libopenshot) is free software: you can redistribute it
18  * and/or modify it under the terms of the GNU Lesser General Public License
19  * as published by the Free Software Foundation, either version 3 of the
20  * License, or (at your option) any later version.
21  *
22  * OpenShot Library (libopenshot) is distributed in the hope that it will be
23  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
24  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25  * GNU Lesser General Public License for more details.
26  *
27  * You should have received a copy of the GNU Lesser General Public License
28  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
29  */
30 
31 #include "PlayerBase.h"
32 
33 using namespace openshot;
34 
35 // Display a loading animation
Loading()36 void PlayerBase::Loading() {
37 	mode = PLAYBACK_LOADING;
38 }
39 
40 // Play the video
Play()41 void PlayerBase::Play() {
42 	mode = PLAYBACK_PLAY;
43 }
44 
45 // Pause the video
Pause()46 void PlayerBase::Pause() {
47 	mode = PLAYBACK_PAUSED;
48 }
49 
50 // Get the Playback speed
Speed()51 float PlayerBase::Speed() {
52 	return speed;
53 }
54 
55 // Set the Playback speed multiplier (1.0 = normal speed, <1.0 = slower, >1.0 faster)
Speed(float new_speed)56 void PlayerBase::Speed(float new_speed) {
57 	speed = new_speed;
58 }
59 
60 // Stop the video player and clear the cached frames
Stop()61 void PlayerBase::Stop() {
62 	mode = PLAYBACK_STOPPED;
63 }
64 
65 // Get the current reader, such as a FFmpegReader
Reader()66 openshot::ReaderBase* PlayerBase::Reader() {
67 	return reader;
68 }
69 
70 // Set the current reader, such as a FFmpegReader
Reader(openshot::ReaderBase * new_reader)71 void PlayerBase::Reader(openshot::ReaderBase *new_reader) {
72 	reader = new_reader;
73 }
74 
75 // Get the Volume
Volume()76 float PlayerBase::Volume() {
77 	return volume;
78 }
79 
80 // Set the Volume multiplier (1.0 = normal volume, <1.0 = quieter, >1.0 louder)
Volume(float new_volume)81 void PlayerBase::Volume(float new_volume) {
82 	volume = new_volume;
83 }
84