OpenShot Library | libopenshot  0.1.9
PlayerBase.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for PlayerBase class
4  * @author Jonathan Thomas <jonathan@openshot.org>
5  *
6  * @section LICENSE
7  *
8  * Copyright (c) 2008-2014 OpenShot Studios, LLC
9  * <http://www.openshotstudios.com/>. This file is part of
10  * OpenShot Library (libopenshot), an open-source project dedicated to
11  * delivering high quality video editing and animation solutions to the
12  * world. For more information visit <http://www.openshot.org/>.
13  *
14  * OpenShot Library (libopenshot) is free software: you can redistribute it
15  * and/or modify it under the terms of the GNU Lesser General Public License
16  * as published by the Free Software Foundation, either version 3 of the
17  * License, or (at your option) any later version.
18  *
19  * OpenShot Library (libopenshot) is distributed in the hope that it will be
20  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
21  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22  * GNU Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License
25  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef OPENSHOT_PLAYER_BASE_H
29 #define OPENSHOT_PLAYER_BASE_H
30 
31 #include <iostream>
32 #include "../include/ReaderBase.h"
33 
34 using namespace std;
35 
36 namespace openshot
37 {
38  /**
39  * @brief This enumeration determines the mode of the video player (i.e. playing, paused, etc...)
40  *
41  * A player can be in one of the following modes, which controls how it behaves.
42  */
44  {
45  PLAYBACK_PLAY, ///< Play the video normally
46  PLAYBACK_PAUSED, ///< Pause the video (holding the last displayed frame)
47  PLAYBACK_LOADING, ///< Loading the video (display a loading animation)
48  PLAYBACK_STOPPED, ///< Stop playing the video (clear cache, done with player)
49  };
50 
51  /**
52  * @brief This is the base class of all Players in libopenshot.
53  *
54  * Players are responsible for displaying images and playing back audio samples with specific
55  * frame rates and sample rates. All Players must be based on this class, and include these
56  * methods.
57  */
58  class PlayerBase
59  {
60  protected:
61  float speed;
62  float volume;
65 
66  public:
67 
68  /// Display a loading animation
69  virtual void Loading() = 0;
70 
71  /// Get the current mode
72  virtual PlaybackMode Mode() = 0;
73 
74  /// Play the video
75  virtual void Play() = 0;
76 
77  /// Pause the video
78  virtual void Pause() = 0;
79 
80  /// Get the current frame number being played
81  virtual int Position() = 0;
82 
83  /// Seek to a specific frame in the player
84  virtual void Seek(int64_t new_frame) = 0;
85 
86  /// Get the Playback speed
87  virtual float Speed() = 0;
88 
89  /// Set the Playback speed (1.0 = normal speed, <1.0 = slower, >1.0 faster)
90  virtual void Speed(float new_speed) = 0;
91 
92  /// Stop the video player and clear the cached frames
93  virtual void Stop() = 0;
94 
95  /// Get the current reader, such as a FFmpegReader
96  virtual ReaderBase* Reader() = 0;
97 
98  /// Set the current reader, such as a FFmpegReader
99  virtual void Reader(ReaderBase *new_reader) = 0;
100 
101  /// Get the Volume
102  virtual float Volume() = 0;
103 
104  /// Set the Volume (1.0 = normal volume, <1.0 = quieter, >1.0 louder)
105  virtual void Volume(float new_volume) = 0;
106 
107  };
108 
109 }
110 
111 #endif
ReaderBase * reader
Definition: PlayerBase.h:63
Loading the video (display a loading animation)
Definition: PlayerBase.h:47
Stop playing the video (clear cache, done with player)
Definition: PlayerBase.h:48
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:95
This is the base class of all Players in libopenshot.
Definition: PlayerBase.h:58
Pause the video (holding the last displayed frame)
Definition: PlayerBase.h:46
This namespace is the default namespace for all code in the openshot library.
PlaybackMode
This enumeration determines the mode of the video player (i.e. playing, paused, etc...)
Definition: PlayerBase.h:43
Play the video normally.
Definition: PlayerBase.h:45
PlaybackMode mode
Definition: PlayerBase.h:64