OpenShot Library | libopenshot
0.4.0
|
Go to the documentation of this file.
26 using AudioDeviceList = std::vector<std::pair<std::string, std::string>>;
37 , threads_started(false)
58 if (
reader && threads_started) {
59 return p->audioPlayback->getError();
67 if (
reader && threads_started) {
68 return p->audioPlayback->getDefaultSampleRate();
82 return p->audioPlayback->getCurrentAudioDevice();
105 int sample_rate = 44100;
137 if (
reader && !threads_started) {
140 threads_started =
true;
163 return p->video_position;
169 if (
reader && threads_started && new_frame > 0) {
171 p->videoCache->
Seek(new_frame,
true);
174 p->audioPlayback->Seek(new_frame);
187 if (
reader && threads_started) {
188 p->videoCache->
Stop();
189 p->audioPlayback->Stop();
195 p->video_position = 0;
196 threads_started =
false;
204 p->reader = new_reader;
205 p->videoCache->
Reader(new_reader);
206 p->audioPlayback->Reader(new_reader);
233 p->speed = new_speed;
236 p->audioPlayback->setSpeed(new_speed);
QtPlayer()
Default constructor.
void DisplayInfo(std::ostream *out=&std::cout)
Display file information in the standard output stream (stdout)
int sample_rate
The number of audio samples per second (44100 is a common sample rate)
This struct hold information about Audio Devices.
std::vector< std::pair< std::string, std::string > > AudioDeviceList
@ PLAYBACK_PLAY
Play the video normally.
Header file for Clip class.
void Seek(int64_t new_frame)
Seek to a specific frame in the player.
Header file for Video Renderer class.
double GetDefaultSampleRate()
Return the default audio sample rate (from the system)
int64_t GetRendererQObject()
Get the Renderer pointer address (for Python to cast back into a QObject)
This namespace is the default namespace for all code in the openshot library.
AudioDeviceList GetAudioDeviceNames()
Get Audio Devices from JUCE.
This class represents a clip (used to arrange readers on the timeline)
This class represents a fraction.
static AudioDeviceManagerSingleton * Instance()
Override with default sample rate & channels (44100, 2) and no preferred audio device.
float Speed()
Get the Playback speed.
openshot::ReaderInfo info
Information about the current media file.
openshot::PlaybackMode Mode()
Get the current mode.
void SetQWidget(int64_t qwidget_address)
Header file for Timeline class.
int64_t Position()
Get the current frame number being played.
virtual ~QtPlayer()
Default destructor.
std::string GetError()
Get Error (if any)
void Pause()
Pause the video.
AudioDeviceInfo GetCurrentAudioDevice()
Get current audio device or last attempted.
std::vector< std::pair< std::string, std::string > > AudioDeviceList
AudioDeviceList getNames()
@ PLAYBACK_STOPPED
Stop playing the video (clear cache, done with player)
The private part of QtPlayer class, which contains an audio thread and video thread,...
void Open() override
Open the reader (and start consuming resources)
void SetJson(const std::string value) override
Load JSON string into this object.
bool has_audio
Determines if this file has an audio stream.
This class represents a timeline.
void setSpeed(int new_speed)
Set Speed (The speed and direction to playback a reader (1=normal, 2=fast, 3=faster,...
void SetTimelineSource(const std::string &json)
Set the source JSON of an openshot::Timelime.
A class which probes the available audio devices.
float Volume()
Get the Volume.
void Reader(ReaderBase *new_reader)
Set the current thread's reader.
void Stop()
Stop the audio playback.
PlaybackMode
This enumeration determines the mode of the video player (i.e. playing, paused, etc....
Source file for PlayerPrivate class.
This class uses the FFmpeg libraries, to open video files and audio files, and return openshot::Frame...
void AddClip(openshot::Clip *clip)
Add an openshot::Clip to the timeline.
This class is used to playback a video from a reader.
@ PLAYBACK_LOADING
Loading the video (display a loading animation)
openshot::ReaderBase * Reader()
Get the current reader, such as a FFmpegReader.
This is the base class of all Renderers in libopenshot.
openshot::ChannelLayout channel_layout
The channel layout (mono, stereo, 5 point surround, etc...)
@ PLAYBACK_PAUSED
Pause the video (holding the last displayed frame)
void CloseAudioDevice()
Close audio device.
This is the base class of all Players in libopenshot.
openshot::Fraction fps
Frames per second, as a fraction (i.e. 24/1 = 24 fps)
void CloseAudioDevice()
Close audio device.
This abstract class is the base class, used by all readers in libopenshot.
void Play()
Play the video.
ChannelLayout
This enumeration determines the audio channel layout (such as stereo, mono, 5 point surround,...
openshot::ReaderBase * reader
Header file for Audio Device Info struct.
void Seek(int64_t new_position)
Seek the reader to a particular frame number.
void Stop()
Stop the video player and clear the cached frames.
int channels
The number of audio channels used in the audio stream.
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 FFmpegReader class.
void SetSource(const std::string &source)
Set the source URL/path of this player (which will create an internal Reader)
void Loading()
Display a loading animation.