32 #include "../include/Clip.h"
33 #include "../include/FFmpegReader.h"
34 #include "../include/Timeline.h"
35 #include "../include/QtPlayer.h"
36 #include "../include/Qt/PlayerPrivate.h"
37 #include "../include/Qt/VideoRenderer.h"
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>();
110 if (
reader && !threads_started) {
113 threads_started =
true;
136 return p->video_position;
142 if (
reader && threads_started && new_frame > 0) {
144 p->videoCache->Seek(new_frame);
147 p->video_position = new_frame;
150 p->last_video_position = 0;
153 p->audioPlayback->Seek(new_frame);
163 if (
reader && threads_started) {
164 p->videoCache->Stop();
165 p->audioPlayback->Stop();
171 p->video_position = 0;
172 threads_started =
false;
180 p->reader = new_reader;
181 p->videoCache->Reader(new_reader);
182 p->audioPlayback->Reader(new_reader);
209 p->speed = new_speed;
210 p->videoCache->setSpeed(new_speed);
212 p->audioPlayback->setSpeed(new_speed);
void CloseAudioDevice()
Close audio device.
static AudioDeviceManagerSingleton * Instance()
Override with no channels and no preferred audio device.
This class represents a clip (used to arrange readers on the timeline)
This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame...
This is the base class of all Players in libopenshot.
openshot::ReaderBase * reader
The private part of QtPlayer class, which contains an audio thread and video thread,...
This class is used to playback a video from a reader.
void Loading()
Display a loading animation.
void Seek(int64_t new_frame)
Seek to a specific frame in the player.
void SetSource(const std::string &source)
Set the source URL/path of this player (which will create an internal Reader)
int64_t Position()
Get the current frame number being played.
QtPlayer()
Default constructor.
void SetQWidget(int64_t qwidget_address)
std::vector< openshot::AudioDeviceInfo > GetAudioDeviceNames()
Get Audio Devices from JUCE.
std::string GetError()
Get Error (if any)
void CloseAudioDevice()
Close audio device.
float Volume()
Get the Volume.
virtual ~QtPlayer()
Default destructor.
float Speed()
Get the Playback speed.
void Play()
Play the video.
openshot::PlaybackMode Mode()
Get the current mode.
void Pause()
Pause the video.
openshot::ReaderBase * Reader()
Get the current reader, such as a FFmpegReader.
int64_t GetRendererQObject()
Get the Renderer pointer address (for Python to cast back into a QObject)
void Stop()
Stop the video player and clear the cached frames.
This abstract class is the base class, used by all readers in libopenshot.
openshot::ReaderInfo info
Information about the current media file.
void DisplayInfo()
Display file information in the standard output stream (stdout)
This is the base class of all Renderers in libopenshot.
virtual void OverrideWidget(int64_t qwidget_address)=0
Allow manual override of the QWidget that is used to display.
This class represents a timeline.
void Open()
Open the reader (and start consuming resources)
void AddClip(Clip *clip)
Add an openshot::Clip to the timeline.
This namespace is the default namespace for all code in the openshot library.
PlaybackMode
This enumeration determines the mode of the video player (i.e. playing, paused, etc....
@ PLAYBACK_LOADING
Loading the video (display a loading animation)
@ PLAYBACK_PAUSED
Pause the video (holding the last displayed frame)
@ PLAYBACK_STOPPED
Stop playing the video (clear cache, done with player)
@ PLAYBACK_PLAY
Play the video normally.
int width
The width of the video (in pixesl)
int channels
The number of audio channels used in the audio stream.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
int height
The height of the video (in pixels)
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
bool has_audio
Determines if this file has an audio stream.
int sample_rate
The number of audio samples per second (44100 is a common sample rate)