OpenShot Library | libopenshot  0.2.2
QtPlayer.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Header file for QtPlayer class
4  * @author Duzy Chan <code@duzy.info>
5  * @author Jonathan Thomas <jonathan@openshot.org>
6  *
7  * @section LICENSE
8  *
9  * Copyright (c) 2008-2014 OpenShot Studios, LLC
10  * <http://www.openshotstudios.com/>. This file is part of
11  * OpenShot Library (libopenshot), an open-source project dedicated to
12  * delivering high quality video editing and animation solutions to the
13  * world. For more information visit <http://www.openshot.org/>.
14  *
15  * OpenShot Library (libopenshot) is free software: you can redistribute it
16  * and/or modify it under the terms of the GNU Lesser General Public License
17  * as published by the Free Software Foundation, either version 3 of the
18  * License, or (at your option) any later version.
19  *
20  * OpenShot Library (libopenshot) is distributed in the hope that it will be
21  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU Lesser General Public License for more details.
24  *
25  * You should have received a copy of the GNU Lesser General Public License
26  * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
27  */
28 
29 #ifndef OPENSHOT_QT_PLAYER_H
30 #define OPENSHOT_QT_PLAYER_H
31 
32 #include <iostream>
33 #include <vector>
34 #include "PlayerBase.h"
35 #include "Qt/PlayerPrivate.h"
36 #include "RendererBase.h"
37 
38 using namespace std;
39 
40 namespace openshot
41 {
42  /**
43  * @brief This class is used to playback a video from a reader.
44  *
45  */
46  class QtPlayer : public PlayerBase
47  {
48  PlayerPrivate *p;
49  bool threads_started;
50 
51  public:
52  /// Default constructor
53  explicit QtPlayer();
54  explicit QtPlayer(RendererBase *rb);
55 
56  /// Default destructor
57  virtual ~QtPlayer();
58 
59  /// Close audio device
60  void CloseAudioDevice();
61 
62  /// Play the video
63  void Play();
64 
65  /// Display a loading animation
66  void Loading();
67 
68  /// Get the current mode
69  PlaybackMode Mode();
70 
71  /// Pause the video
72  void Pause();
73 
74  /// Get the current frame number being played
75  int Position();
76 
77  /// Seek to a specific frame in the player
78  void Seek(int64_t new_frame);
79 
80  /// Set the source URL/path of this player (which will create an internal Reader)
81  void SetSource(const std::string &source);
82 
83  /// Set the QWidget which will be used as the display (note: QLabel works well). This does not take a
84  /// normal pointer, but rather a LONG pointer id (and it re-casts the QWidget pointer inside libopenshot).
85  /// This is required due to SIP and SWIG incompatibility in the Python bindings.
86  void SetQWidget(int64_t qwidget_address);
87 
88  /// Get the Renderer pointer address (for Python to cast back into a QObject)
89  int64_t GetRendererQObject();
90 
91  /// Get the Playback speed
92  float Speed();
93 
94  /// Set the Playback speed (1.0 = normal speed, <1.0 = slower, >1.0 faster)
95  void Speed(float new_speed);
96 
97  /// Stop the video player and clear the cached frames
98  void Stop();
99 
100  /// Set the current reader
101  void Reader(ReaderBase *new_reader);
102 
103  /// Get the current reader, such as a FFmpegReader
104  ReaderBase* Reader();
105 
106  /// Get the Volume
107  float Volume();
108 
109  /// Set the Volume (1.0 = normal volume, <1.0 = quieter, >1.0 louder)
110  void Volume(float new_volume);
111  };
112 
113 }
114 
115 #endif
This class is used to playback a video from a reader.
Definition: QtPlayer.h:46
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:96
This is the base class of all Players in libopenshot.
Definition: PlayerBase.h:58
Source file for PlayerPrivate class.
The private part of QtPlayer class, which contains an audio thread and video thread, and controls the video timing and audio synchronization code.
Definition: PlayerPrivate.h:47
This namespace is the default namespace for all code in the openshot library.
Header file for RendererBase class.
Header file for PlayerBase class.
PlaybackMode
This enumeration determines the mode of the video player (i.e. playing, paused, etc...)
Definition: PlayerBase.h:43
This is the base class of all Renderers in libopenshot.
Definition: RendererBase.h:45