liblives
2.4.1-svn
|
class "player". More...
#include <liblives.hpp>
Public Member Functions | |
bool | isValid () const |
Returns whether the player is valid or not. More... | |
bool | isPlaying () const |
bool | isRecording () const |
void | setSepWin (bool setting) const |
Set playback in a detached window. More... | |
bool | sepWin () const |
void | setFullScreen (bool setting) const |
Set playback fullscreen. More... | |
bool | fullScreen () const |
void | setFS (bool setting) const |
Combines the functionality of setSepWin() and setFullScreen(). More... | |
bool | play () const |
Commence playback of video and audio with the currently selected clip. More... | |
bool | stop () const |
Stop playback. More... | |
bool | setForegroundClip (clip c) const |
Set the foreground clip for the player. More... | |
clip | foregroundClip () const |
Returns the current foreground clip of the player. More... | |
bool | setBackgroundClip (clip c) const |
Set the background clip for the player. More... | |
clip | backgroundClip () const |
Returns the current background clip of the player. More... | |
double | setPlaybackStartTime (double time) const |
Set the current playback start time in seconds (this is also the insertion point in multitrack mode). More... | |
int | setVideoPlaybackFrame (int frame, bool background=false) const |
Set the video playback frame. More... | |
double | videoPlaybackTime (bool background=false) const |
Return the current clip playback time. More... | |
double | setAudioPlaybackTime (double time) const |
Set the audio playback time. More... | |
double | audioPlaybackTime () const |
Return the current clip audio playback time in seconds. More... | |
double | elapsedTime () const |
Return the elapsed time, i.e. More... | |
double | setCurrentFPS (double fps) const |
Set the current playback framerate in frames per second. More... | |
double | currentFPS () const |
Return the current playback framerate in frames per second of the player. More... | |
int | currentAudioRate () const |
Return the current audio rate of the player. More... | |
lives_loop_mode_t | setLoopMode (lives_loop_mode_t mode) const |
Set the loop mode for the player. More... | |
lives_loop_mode_t | loopMode () const |
Return the loop mode of the player. More... | |
bool | setPingPong (bool setting) const |
Set ping pong mode. More... | |
bool | pingPong () const |
Return ping pong mode. More... | |
bool | resyncFPS () const |
Resets the clip::playbackFPS() for the current foreground clip, so it is equal to the clip::FPS(). More... | |
bool | operator== (const player &other) const |
Protected Member Functions | |
player (livesApp *lives=NULL) | |
double lives::player::audioPlaybackTime | ( | ) | const |
Return the current clip audio playback time in seconds.
If livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT, then this returns the current playback time for audio in the current foregroundClip(). If livesApp::mode() is LIVES_INTERFACE_MODE_MULTITRACK, then this returns the current player time in the multitrack timeline (equivalent to multitrack::currentTime()). This function works with livesApp::status() of LIVES_STATUS_READY and LIVES_STATUS_PLAYING. If isValid() is false, 0. is returned. If prefs::audioSource() is not LIVES_AUDIO_SOURCE_INTERNAL the value returned is not defined.
clip lives::player::backgroundClip | ( | ) | const |
Returns the current background clip of the player.
If isActive() is false, returns an invalid clip. If the livesApp::mode() is not LIVES_INTERFACE_MODE_CLIPEDIT, returns an invalid clip.
int lives::player::currentAudioRate | ( | ) | const |
Return the current audio rate of the player.
If isValid() is false, returns 0. If livesApp::status is neither LIVES_STATUS_READY nor LIVES_STATUS_PLAYING, returns 0. Otherwise, this is equivalent to foregroundClip::playbackAudioRate(). Note this is not necessarily the same as the soundcard audio rate which can be obtained via prefs::audioPlayerRate().
double lives::player::currentFPS | ( | ) | const |
Return the current playback framerate in frames per second of the player.
If isValid() is false, returns 0. If livesApp::status is neither LIVES_STATUS_READY nor LIVES_STATUS_PLAYING, returns 0. Otherwise, this is equivalent to foregroundClip::playbackFPS().
double lives::player::elapsedTime | ( | ) | const |
Return the elapsed time, i.e.
total time in seconds since playback began. If livesApp::status() is not LIVES_STATUS_PLAYING, 0. is returned.
clip lives::player::foregroundClip | ( | ) | const |
Returns the current foreground clip of the player.
If isActive() is false, returns an invalid clip. If the livesApp::mode() is not LIVES_INTERFACE_MODE_CLIPEDIT, returns an invalid clip.
bool lives::player::fullScreen | ( | ) | const |
bool lives::player::isPlaying | ( | ) | const |
bool lives::player::isRecording | ( | ) | const |
bool lives::player::isValid | ( | ) | const |
Returns whether the player is valid or not.
A valid player belongs to a valid livesApp, and the livesApp::status() is not LIVES_STATUS_NOTREADY.
lives_loop_mode_t lives::player::loopMode | ( | ) | const |
Return the loop mode of the player.
If isValid() is false, returns LIVES_LOOP_MODE_NONE.
|
inline |
bool lives::player::pingPong | ( | ) | const |
Return ping pong mode.
If pingPong is true then rather than looping forward, video and audio will "bounce" forwards and backwards off their end points, provided the mode() is LIVES_INTERFACE_MODE_CLIPEDIT. If mode() is LIVES_INTERFACE_MODE_MULTITRACK, then the value is ignored. If the player is invalid, false is returned.
bool lives::player::play | ( | ) | const |
Commence playback of video and audio with the currently selected clip.
Only has an effect when livesApp::status() is LIVES_STATUS_READY.
bool lives::player::resyncFPS | ( | ) | const |
Resets the clip::playbackFPS() for the current foreground clip, so it is equal to the clip::FPS().
Resets the clip::playbackAudioRate so it is equal to the clip::audioRate(). If possible equalizes the audioPlaybackTime() with the playbackTime() so video and audio are in sync. Only works if isPlaying() is true.
bool lives::player::sepWin | ( | ) | const |
double lives::player::setAudioPlaybackTime | ( | double | time | ) | const |
Set the audio playback time.
Only works if livesApp::status() is LIVES_STATUS_PLAYING and livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT and prefs::isRealtimeAudioPlayer() is true for prefs::audioPlayer(). Does not work if prefs::audioSource() is LIVES_AUDIO_SOURCE_INTERNAL and player::recording() is true. If the time parameter is < 0. or > clip::audioLength() nothing happens. The time is actually set to the nearest video frame start to the requested time.
time | the new time to set to |
bool lives::player::setBackgroundClip | ( | clip | c | ) | const |
Set the background clip for the player.
Equivalent to clip::setIsBackground() except that it only functions when livesApp::status() is LIVES_STATUS_PLAYING and the livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT. Only works if there is one or more transition effects active. If the clip is invalid, or isActive() is false, nothing happens and false is returned.
double lives::player::setCurrentFPS | ( | double | fps | ) | const |
Set the current playback framerate in frames per second.
Only works if livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT and livesApp::status() is LIVES_STATUS_PLAYING. Allowed values range from -prefsmaxFPS() to +prefsmaxFPS(). If prefs::audioFollowsFPSChanges() is true, then the audio playback rate will change proportionally. If isPlaying() is false, nothing happens and 0. is returned. Note, the setting only applies to the current clip; if the clip being played is switched then currentFPS() may change.
fps | the framerate to set |
bool lives::player::setForegroundClip | ( | clip | c | ) | const |
Set the foreground clip for the player.
Equivalent to clip::switchTo() except that it only functions when livesApp::status() is LIVES_STATUS_PLAYING and the livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT. If the clip is invalid, or isActive() is false, nothing happens and false is returned.
c | the clip to set as foreground. |
void lives::player::setFS | ( | bool | setting | ) | const |
Combines the functionality of setSepWin() and setFullScreen().
If the livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT and prefs::sepWinSticky() is true, the window appears straight away, but it will only fill the screen when isPlaying() is true; otherwise it appears only when isPlaying() is true.
setting | the value to set to |
void lives::player::setFullScreen | ( | bool | setting | ) | const |
Set playback fullscreen.
Use of setFS() is recommended instead.
setting | the value to set to |
lives_loop_mode_t lives::player::setLoopMode | ( | lives_loop_mode_t | mode | ) | const |
Set the loop mode for the player.
The value is a bitmap, however LIVES_LOOP_MODE_FIT_AUDIO only has meaning when livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT. If isValid() is false, nothing happens.
mode | the desired loop mode |
bool lives::player::setPingPong | ( | bool | setting | ) | const |
Set ping pong mode.
If pingPong is true then rather than looping forward, video and audio will "bounce" forwards and backwards off their end points, provided the mode() is LIVES_INTERFACE_MODE_CLIPEDIT. If mode() is LIVES_INTERFACE_MODE_MULTITRACK, then the value is ignored.
setting | the desired value |
double lives::player::setPlaybackStartTime | ( | double | time | ) | const |
Set the current playback start time in seconds (this is also the insertion point in multitrack mode).
Only works if the livesApp::status() is LIVES_STATUS_READY. If livesApp::mode() is LIVES_INTERFACE_MODE_CLIP_EDITOR, the start time may not be set beyond the end of the current clip (video and audio). The outcome of setting playback beyond the end of video but not of audio and vice-versa depends on the value of loopMode(). If livesApp::mode() is LIVES_INTERFACE_MODE_MULITRACK, setting the current time may cause the timeline to stretch visually (i.e zoom out). The miminum value is 0.0 in every mode. Values < 0. will be ignored. If isValid() is false, nothing happens and 0. is returned.
time | the time in seconds to set playback start time to. |
void lives::player::setSepWin | ( | bool | setting | ) | const |
Set playback in a detached window.
If the livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT and prefs::sepWinSticky() is true, the window appears straight away; otherwise it appears only when isPlaying() is true.
setting | the value to set to |
int lives::player::setVideoPlaybackFrame | ( | int | frame, |
bool | background = false |
||
) | const |
Set the video playback frame.
Only works if livesApp::status() is LIVES_STATUS_PLAYING and livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT. If the frame parameter is < 1 or > foregroundClip().frames() nothing happens. If background is true, the function sets the frame for backgroundClip(). If background is false and prefs::audioFollowsFPSChanges() is true, then the audio playback will sync to the new video position.
frame | the new frame to set to |
background | if true sets the frame for the background clip (if any) |
bool lives::player::stop | ( | ) | const |
Stop playback.
If livesApp::status() is not LIVES_STATUS_PLAYING, nothing happens.
double lives::player::videoPlaybackTime | ( | bool | background = false | ) | const |
Return the current clip playback time.
If livesApp::mode() is LIVES_INTERFACE_MODE_CLIPEDIT, then this returns the current playback time for video in the current foregroundClip(), or the current backgroundClip() if background is true: if there is no background clip, 0. is returned. If livesApp::mode() is LIVES_INTERFACE_MODE_MULTITRACK, then this returns the current player time in the multitrack timeline, (equivalent to multitrack::currentTime()), and the background parameter is ignored. This function works if livesApp::status() is LIVES_STATUS_READY or LIVES_STATUS_PLAYING. If isValid() is false, 0. is returned.
background | if true returns the playback time for the background clip. |