50 , threads_started(false)
71 if (
reader && threads_started) {
73 return p->audioPlayback->getError();
81 if (
reader && threads_started) {
82 return p->audioPlayback->getAudioDeviceNames();
84 return std::vector<openshot::AudioDeviceInfo>();
94 int sample_rate = 44100;
126 if (
reader && !threads_started) {
129 threads_started =
true;
152 return p->video_position;
158 if (
reader && threads_started && new_frame > 0) {
160 p->videoCache->
Seek(new_frame);
163 p->video_position = new_frame;
166 p->last_video_position = 0;
169 p->audioPlayback->Seek(new_frame);
179 if (
reader && threads_started) {
180 p->videoCache->
Stop();
181 p->audioPlayback->Stop();
187 p->video_position = 0;
188 threads_started =
false;
196 p->reader = new_reader;
197 p->videoCache->
Reader(new_reader);
198 p->audioPlayback->Reader(new_reader);
225 p->speed = new_speed;
228 p->audioPlayback->setSpeed(new_speed);
static AudioDeviceManagerSingleton * Instance()
Override with no channels and no preferred audio device.
void setSpeed(int new_speed)
Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster, -1=rewind, etc...)
float Speed()
Get the Playback speed.
void CloseAudioDevice()
Close audio device.
void Loading()
Display a loading animation.
This class is used to playback a video from a reader.
Header file for QtPlayer class.
virtual void OverrideWidget(int64_t qwidget_address)=0
Allow manual override of the QWidget that is used to display.
Header file for Video Renderer class.
Header file for FFmpegReader class.
float Volume()
Get the Volume.
QtPlayer()
Default constructor.
Loading the video (display a loading animation)
Stop playing the video (clear cache, done with player)
openshot::ReaderBase * Reader()
Get the current reader, such as a FFmpegReader.
This abstract class is the base class, used by all readers in libopenshot.
Header file for Timeline class.
This is the base class of all Players in libopenshot.
openshot::ReaderBase * reader
bool has_audio
Determines if this file has an audio stream.
This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame...
This class represents a clip (used to arrange readers on the timeline)
void Pause()
Pause the video.
void SetSource(const std::string &source)
Set the source URL/path of this player (which will create an internal Reader)
void Reader(ReaderBase *new_reader)
Set the current thread's reader.
void Stop()
Stop the audio playback.
Pause the video (holding the last displayed frame)
Header file for Clip class.
Source file for PlayerPrivate class.
void AddClip(openshot::Clip *clip)
Add an openshot::Clip to the timeline.
The private part of QtPlayer class, which contains an audio thread and video thread, and controls the video timing and audio synchronization code.
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround...
std::string GetError()
Get Error (if any)
int64_t Position()
Get the current frame number being played.
void SetQWidget(int64_t qwidget_address)
std::vector< openshot::AudioDeviceInfo > GetAudioDeviceNames()
Get Audio Devices from JUCE.
openshot::ReaderInfo info
Information about the current media file.
void Play()
Play the video.
void Seek(int64_t new_frame)
Seek to a specific frame in the player.
This namespace is the default namespace for all code in the openshot library.
void Open() override
Open the reader (and start consuming resources)
openshot::PlaybackMode Mode()
Get the current mode.
void Seek(int64_t new_position)
Seek the reader to a particular frame number.
void CloseAudioDevice()
Close audio device.
int64_t GetRendererQObject()
Get the Renderer pointer address (for Python to cast back into a QObject)
PlaybackMode
This enumeration determines the mode of the video player (i.e. playing, paused, etc...)
This is the base class of all Renderers in libopenshot.
void DisplayInfo()
Display file information in the standard output stream (stdout)
int channels
The number of audio channels used in the audio stream.
void Stop()
Stop the video player and clear the cached frames.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
virtual ~QtPlayer()
Default destructor.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
This class represents a timeline.