OpenShot Library | libopenshot 0.2.7
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 * @ref License
8 */
9
10/* LICENSE
11 *
12 * Copyright (c) 2008-2019 OpenShot Studios, LLC
13 * <http://www.openshotstudios.com/>. This file is part of
14 * OpenShot Library (libopenshot), an open-source project dedicated to
15 * delivering high quality video editing and animation solutions to the
16 * world. For more information visit <http://www.openshot.org/>.
17 *
18 * OpenShot Library (libopenshot) is free software: you can redistribute it
19 * and/or modify it under the terms of the GNU Lesser General Public License
20 * as published by the Free Software Foundation, either version 3 of the
21 * License, or (at your option) any later version.
22 *
23 * OpenShot Library (libopenshot) is distributed in the hope that it will be
24 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
25 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
26 * GNU Lesser General Public License for more details.
27 *
28 * You should have received a copy of the GNU Lesser General Public License
29 * along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
30 */
31
32#ifndef OPENSHOT_PLAYER_PRIVATE_H
33#define OPENSHOT_PLAYER_PRIVATE_H
34
35#include "../ReaderBase.h"
36#include "../RendererBase.h"
37#include "../AudioReaderSource.h"
38#include "../Qt/AudioPlaybackThread.h"
39#include "../Qt/VideoPlaybackThread.h"
40#include "../Qt/VideoCacheThread.h"
41
42namespace openshot
43{
44 /**
45 * @brief The private part of QtPlayer class, which contains an audio thread and video thread,
46 * and controls the video timing and audio synchronization code.
47 */
48 class PlayerPrivate : juce::Thread
49 {
50 std::shared_ptr<openshot::Frame> frame; /// The current frame
51 int64_t video_position; /// The current frame position.
52 int64_t audio_position; /// The current frame position.
53 openshot::ReaderBase *reader; /// The reader which powers this player
54 openshot::AudioPlaybackThread *audioPlayback; /// The audio thread
55 openshot::VideoPlaybackThread *videoPlayback; /// The video thread
56 openshot::VideoCacheThread *videoCache; /// The cache thread
57 int speed; /// The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
58 openshot::RendererBase *renderer;
59 int64_t last_video_position; /// The last frame actually displayed
60
61 /// Constructor
63 /// Destructor
64 virtual ~PlayerPrivate();
65
66 /// Start thread
67 void run();
68
69 /// Start the video/audio playback
70 bool startPlayback();
71
72 /// Stop the video/audio playback
73 void stopPlayback(int timeOutMilliseconds = -1);
74
75 /// Get the next frame (based on speed and direction)
76 std::shared_ptr<openshot::Frame> getFrame();
77
78 /// The parent class of PlayerPrivate
79 friend class QtPlayer;
80 };
81
82}
83
84#endif // OPENSHOT_PLAYER_PRIVATE_H
The audio playback thread.
The private part of QtPlayer class, which contains an audio thread and video thread,...
Definition: PlayerPrivate.h:49
This class is used to playback a video from a reader.
Definition: QtPlayer.h:48
This abstract class is the base class, used by all readers in libopenshot.
Definition: ReaderBase.h:98
This is the base class of all Renderers in libopenshot.
Definition: RendererBase.h:49
The video cache class.
The video playback class.
This namespace is the default namespace for all code in the openshot library.
Definition: Compressor.h:47