OpenShot Library | libopenshot  0.1.9
VideoCacheThread.h
Go to the documentation of this file.
1 /**
2  * @file
3  * @brief Source file for VideoCacheThread 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_VIDEO_CACHE_THREAD_H
29 #define OPENSHOT_VIDEO_CACHE_THREAD_H
30 
31 #include "../../include/OpenMPUtilities.h"
32 #include "../../include/ReaderBase.h"
33 #include "../../include/RendererBase.h"
34 
35 namespace openshot
36 {
37  using juce::Thread;
38  using juce::WaitableEvent;
39 
40  /**
41  * @brief The video cache class.
42  */
43  class VideoCacheThread : Thread
44  {
45  std::shared_ptr<Frame> frame;
46  int speed;
47  bool is_playing;
48  int64_t position;
49  int64_t current_display_frame;
50  ReaderBase *reader;
51  int max_frames;
52 
53  /// Constructor
55  /// Destructor
57 
58  /// Get the currently playing frame number (if any)
59  int64_t getCurrentFramePosition();
60 
61  /// Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
62  int getSpeed() const { return speed; }
63 
64  /// Play the video
65  void Play();
66 
67  /// Seek the reader to a particular frame number
68  void Seek(int64_t new_position);
69 
70  /// Set the currently displaying frame number
71  void setCurrentFramePosition(int64_t current_frame_number);
72 
73  /// Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
74  void setSpeed(int new_speed) { speed = new_speed; }
75 
76  /// Stop the audio playback
77  void Stop();
78 
79  /// Start the thread
80  void run();
81 
82  /// Set the current thread's reader
83  void Reader(ReaderBase *new_reader) { reader=new_reader; Play(); };
84 
85  /// Parent class of VideoCacheThread
86  friend class PlayerPrivate;
87  friend class QtPlayer;
88  };
89 
90 }
91 
92 #endif // OPENSHOT_VIDEO_CACHE_THREAD_H
The video cache class.
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:95
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.