OpenShot Library | libopenshot  0.1.9
PlayerPrivate.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Source file for PlayerPrivate 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_PLAYER_PRIVATE_H
30 #define OPENSHOT_PLAYER_PRIVATE_H
31 
32 #include "../../include/ReaderBase.h"
33 #include "../../include/RendererBase.h"
34 #include "../../include/AudioReaderSource.h"
35 #include "../../include/Qt/AudioPlaybackThread.h"
36 #include "../../include/Qt/VideoPlaybackThread.h"
37 #include "../../include/Qt/VideoCacheThread.h"
38 
39 namespace openshot
40 {
41  using juce::Thread;
42 
43  /**
44  * @brief The private part of QtPlayer class, which contains an audio thread and video thread,
45  * and controls the video timing and audio synchronization code.
46  */
47  class PlayerPrivate : Thread
48  {
49  std::shared_ptr<Frame> frame; /// The current frame
50  int64_t video_position; /// The current frame position.
51  int64_t audio_position; /// The current frame position.
52  ReaderBase *reader; /// The reader which powers this player
53  AudioPlaybackThread *audioPlayback; /// The audio thread
54  VideoPlaybackThread *videoPlayback; /// The video thread
55  VideoCacheThread *videoCache; /// The cache thread
56  int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
57  RendererBase *renderer;
58  int64_t last_video_position; /// The last frame actually displayed
59 
60  /// Constructor
62  /// Destructor
63  virtual ~PlayerPrivate();
64 
65  /// Start thread
66  void run();
67 
68  /// Start the video/audio playback
69  bool startPlayback();
70 
71  /// Stop the video/audio playback
72  void stopPlayback(int timeOutMilliseconds = -1);
73 
74  /// Get the next frame (based on speed and direction)
75  std::shared_ptr<Frame> getFrame();
76 
77  /// The parent class of PlayerPrivate
78  friend class QtPlayer;
79  };
80 
81 }
82 
83 #endif // OPENSHOT_PLAYER_PRIVATE_H
The video cache class.
This class is used to playback a video from a reader.
Definition: QtPlayer.h:46
The audio playback thread.
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:95
The video playback 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.
This is the base class of all Renderers in libopenshot.
Definition: RendererBase.h:45