liblives  2.4.1-svn
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
Public Member Functions | Protected Member Functions | List of all members
lives::player Class Reference

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)
 

Detailed Description

class "player".

Represents a media player associated with a livesApp.

See Also
livesApp::getPlayer()

Member Function Documentation

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.

Returns
the current clip audio playback time.
See Also
videoPlaybackTime().
elapsedTime().
multitrack::currentTime().
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.

Returns
the current background clip.
See Also
setBackgroundClip().
foregroundClip().
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().

Returns
the current or potential audio rate in Hz.
See Also
clip::playbackAudioRate().
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().

Returns
the current or potential playback rate in frames per second.
See Also
setCurrentFPS().
clip::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.

Returns
the time in seconds since playback began.
See Also
playbackTime().
audioPlaybackTime().
multitrack::currentTime().
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.

Returns
the current foreground clip.
See Also
setForegroundClip().
backgroundClip().
bool lives::player::fullScreen ( ) const
Returns
true if playback is full screen.
See Also
setFullScreen().
bool lives::player::isPlaying ( ) const
Returns
true if the livesApp::status() is LIVES_STATUS_PLAYING.
bool lives::player::isRecording ( ) const
Returns
true if the player is set to record. Recording will only actually occur if isPlaying() is also true.
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.

Returns
true if the player is valid.
lives_loop_mode_t lives::player::loopMode ( ) const

Return the loop mode of the player.

If isValid() is false, returns LIVES_LOOP_MODE_NONE.

Returns
the current loop mode of the player
See Also
setLoopMode().
bool lives::player::operator== ( const player other) const
inline
Returns
true if the two players belong to the same livesApp.
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.

Returns
the current value.
See Also
setPingPong().
loopMode().
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.

Returns
true if playback was started.
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.

Returns
true if the method succeeded.
bool lives::player::sepWin ( ) const
Returns
true if playback is in a separate window from the main GUI.
See Also
setSepWin().
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.

Parameters
timethe new time to set to
Returns
the audio playback time, or 0. if the operation is invalid.
See Also
audioPlaybackTime()
setVideoPlaybackFrame()
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.

Returns
true if the function was successful.
See Also
backgroundClip().
setForegroundClip().
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.

Parameters
fpsthe framerate to set
Returns
the new framerate
See Also
currentFPS().
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.

Parameters
cthe clip to set as foreground.
Returns
true if the function was successful.
See Also
foregroundClip().
setBackgroundClip().
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.

Parameters
settingthe value to set to
See Also
setSepWin()
setFullScreen()
void lives::player::setFullScreen ( bool  setting) const

Set playback fullscreen.

Use of setFS() is recommended instead.

Parameters
settingthe value to set to
See Also
setFS().
fullScreen().
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.

Parameters
modethe desired loop mode
Returns
the new loop mode
See Also
loopMode().
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.

Parameters
settingthe desired value
Returns
the new value
See Also
pingPong().
loopMode().
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.

Parameters
timethe time in seconds to set playback start time to.
Returns
the new playback start time.
See Also
videoPlaybackTime().
multitrack::setCurrentTime().
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.

Parameters
settingthe value to set to
See Also
setFS().
sepWin().
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.

Parameters
framethe new frame to set to
backgroundif true sets the frame for the background clip (if any)
Returns
the video frame set to, or 0 if the operation is invalid.
See Also
videoPlaybackTime()
setPlaybackTime()
bool lives::player::stop ( ) const

Stop playback.

If livesApp::status() is not LIVES_STATUS_PLAYING, nothing happens.

Returns
true if playback was stopped.
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.

Parameters
backgroundif true returns the playback time for the background clip.
Returns
the current foreground or background clip playback time.
See Also
setVideoPlaybackFrame().
audioPlaybackTime().
elapsedTime().
multitrack::currentTime().

The documentation for this class was generated from the following files: