Loading...
Searching...
No Matches
VideoCacheThread.h
Go to the documentation of this file.
// Copyright (c) 2008-2019 OpenShot Studios, LLC
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#ifndef OPENSHOT_VIDEO_CACHE_THREAD_H
#define OPENSHOT_VIDEO_CACHE_THREAD_H
#include "ReaderBase.h"
#include <AppConfig.h>
#include <juce_audio_basics/juce_audio_basics.h>
namespace openshot
{
using juce::Thread;
using juce::WaitableEvent;
class VideoCacheThread : Thread
{
protected:
std::shared_ptr<Frame> last_cached_frame;
int speed;
int last_speed;
bool is_playing;
int64_t requested_display_frame;
int64_t current_display_frame;
int64_t cached_frame_count = 0;
ReaderBase *reader;
int64_t min_frames_ahead;
int64_t max_frames_ahead;
int64_t timeline_max_frame;
bool should_pause_cache;
bool should_break;
VideoCacheThread();
~VideoCacheThread();
int64_t getBytes(int width, int height, int sample_rate, int channels, float fps);
int getSpeed() const { return speed; }
void Play();
void Seek(int64_t new_position);
void Seek(int64_t new_position, bool start_preroll);
void setSpeed(int new_speed);
void Stop();
void run();
void Reader(ReaderBase *new_reader) { reader=new_reader; Play(); };
friend class PlayerPrivate;
friend class QtPlayer;
public:
bool isReady();
};
}
#endif // OPENSHOT_VIDEO_CACHE_THREAD_H
ReaderBase.h
Header file for ReaderBase class.
openshot::PlayerPrivate
The private part of QtPlayer class, which contains an audio thread and video thread,...
Definition PlayerPrivate.h:31
openshot::QtPlayer
This class is used to playback a video from a reader.
Definition QtPlayer.h:33
openshot::ReaderBase
This abstract class is the base class, used by all readers in libopenshot.
Definition ReaderBase.h:76
openshot::VideoCacheThread
The video cache class.
Definition VideoCacheThread.h:30
openshot::VideoCacheThread::setSpeed
void setSpeed(int new_speed)
Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster,...
Definition VideoCacheThread.cpp:101
openshot::VideoCacheThread::is_playing
bool is_playing
Definition VideoCacheThread.h:35
openshot::VideoCacheThread::max_frames_ahead
int64_t max_frames_ahead
Definition VideoCacheThread.h:41
openshot::VideoCacheThread::requested_display_frame
int64_t requested_display_frame
Definition VideoCacheThread.h:36
openshot::VideoCacheThread::timeline_max_frame
int64_t timeline_max_frame
Definition VideoCacheThread.h:42
openshot::VideoCacheThread::should_break
bool should_break
Definition VideoCacheThread.h:44
openshot::VideoCacheThread::Play
void Play()
Play the video.
Definition VideoCacheThread.cpp:123
openshot::VideoCacheThread::Stop
void Stop()
Stop the audio playback.
Definition VideoCacheThread.cpp:129
openshot::VideoCacheThread::cached_frame_count
int64_t cached_frame_count
Definition VideoCacheThread.h:38
openshot::VideoCacheThread::~VideoCacheThread
~VideoCacheThread()
Destructor.
Definition VideoCacheThread.cpp:38
openshot::VideoCacheThread::last_speed
int last_speed
Definition VideoCacheThread.h:34
openshot::VideoCacheThread::isReady
bool isReady()
Is cache ready for video/audio playback.
Definition VideoCacheThread.cpp:135
openshot::VideoCacheThread::current_display_frame
int64_t current_display_frame
Definition VideoCacheThread.h:37
openshot::VideoCacheThread::VideoCacheThread
VideoCacheThread()
Constructor.
Definition VideoCacheThread.cpp:29
openshot::VideoCacheThread::Reader
void Reader(ReaderBase *new_reader)
Set the current thread's reader.
Definition VideoCacheThread.h:76
openshot::VideoCacheThread::getBytes
int64_t getBytes(int width, int height, int sample_rate, int channels, float fps)
Get the size in bytes of a frame (rough estimate)
Definition VideoCacheThread.cpp:110
openshot::VideoCacheThread::reader
ReaderBase * reader
Definition VideoCacheThread.h:39
openshot::VideoCacheThread::Seek
void Seek(int64_t new_position)
Seek the reader to a particular frame number.
Definition VideoCacheThread.cpp:43
openshot::VideoCacheThread::getSpeed
int getSpeed() const
Get Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster,...
Definition VideoCacheThread.h:55
openshot::VideoCacheThread::should_pause_cache
bool should_pause_cache
Definition VideoCacheThread.h:43
openshot::VideoCacheThread::run
void run()
Start the thread.
Definition VideoCacheThread.cpp:140
openshot::VideoCacheThread::min_frames_ahead
int64_t min_frames_ahead
Definition VideoCacheThread.h:40
openshot::VideoCacheThread::speed
int speed
Definition VideoCacheThread.h:33
openshot::VideoCacheThread::last_cached_frame
std::shared_ptr< Frame > last_cached_frame
Definition VideoCacheThread.h:32
openshot
This namespace is the default namespace for all code in the openshot library.
Definition Compressor.h:29