pianod2
multisource multiuser scriptable networked music player
Public Types | Public Member Functions | Static Public Member Functions | List of all members
Media::Player Class Referenceabstract

Base class for playing audio from some source. More...

#include <mediaplayer.h>

Inheritance diagram for Media::Player:
Inheritance graph
[legend]

Public Types

enum  State {
  DoesNotExist , Initializing , Cueing , Playing ,
  Done
}
 

Public Member Functions

virtual ~Player (void)
 
virtual void pause (void)=0
 Pause playback. If already paused, do nothing. More...
 
virtual void abort (void)=0
 Don't play the rest of the song. More...
 
virtual void setVolume (float volume)=0
 Adjust volume in decibels. More...
 
virtual void cue (void)=0
 Starts thread in paused mode. More...
 
virtual void play (void)=0
 Start playback or resume playback if paused. If already playing, continue. More...
 
virtual float trackDuration (void) const =0
 Length of track in seconds, or a negative number if unknown. More...
 
virtual float playPoint (void) const =0
 Seconds from start, or a negative value if unknown. More...
 
virtual float playRemaining (void) const
 Seconds left in playback, or a negative number if unknown. More...
 
virtual RESPONSE_CODE completionStatus (void)=0
 
virtual State currentState (void) const =0
 
bool ready (void) const
 Indicate if player has finished initializing. More...
 
bool playbackComplete (void) const
 Indicate if playback is complete and ready for cleanup. More...
 
virtual time_t getPauseTimeout (void)
 When paused, get the time at which the song will expire. More...
 

Static Public Member Functions

static Media::PlayergetPlayer (const AudioSettings &settings, const std::string &media_url, float initial_gain)
 Get the a media player currently compiled in the code. More...
 

Detailed Description

Base class for playing audio from some source.

Use as follows:

Member Enumeration Documentation

◆ State

Enumerator
DoesNotExist 

Player doesn't exist.

Initializing 

Player has been created but isn't doing anything yet.

Cueing 

Player has been created and is ready to go, but not playing.

Playing 

Player is playing.

Done 

Playback has completed or been aborted.

Constructor & Destructor Documentation

◆ ~Player()

Media::Player::~Player ( void  )
virtual

Member Function Documentation

◆ abort()

virtual void Media::Player::abort ( void  )
pure virtual

Don't play the rest of the song.

Implemented in Media::PlayerWrapper, Audio::AVFoundationPlayer, Audio::GstreamerPlayer, and Media::ThreadedPlayer.

Here is the caller graph for this function:

◆ completionStatus()

virtual RESPONSE_CODE Media::Player::completionStatus ( void  )
pure virtual

Implemented in Media::PlayerWrapper, Media::ThreadedPlayer, Audio::AVFoundationPlayer, and Audio::GstreamerPlayer.

Here is the caller graph for this function:

◆ cue()

virtual void Media::Player::cue ( void  )
pure virtual

Starts thread in paused mode.

Implemented in Media::PlayerWrapper, Media::ThreadedPlayer, Audio::AVFoundationPlayer, and Audio::GstreamerPlayer.

Here is the caller graph for this function:

◆ currentState()

Media::Player::State ToneGenerator::Player::currentState ( void  ) const
pure virtual

Implemented in ToneGenerator::Player, Media::PlayerWrapper, Audio::AVFoundationPlayer, Audio::GstreamerPlayer, and Audio::LavPlayer.

Here is the caller graph for this function:

◆ getPauseTimeout()

time_t Media::Player::getPauseTimeout ( void  )
virtual

When paused, get the time at which the song will expire.

Reimplemented in Media::PlayerWrapper.

◆ getPlayer()

Media::Player * Media::Player::getPlayer ( const AudioSettings settings,
const std::string &  media_url,
float  initial_gain 
)
static

Get the a media player currently compiled in the code.

Parameters
settingsDescribe the output device.
media_urlA URL indicating the media to play.
initial_gainA suggested gain for the media to play. This may be superceded if the media stream contains its own gain value.
Returns
A media player.
Exceptions
AudioExceptionor a derived exception in the event of media problems, output device problems, etc.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ pause()

virtual void Media::Player::pause ( void  )
pure virtual

Pause playback. If already paused, do nothing.

Implemented in Media::PlayerWrapper, Media::ThreadedPlayer, Audio::AVFoundationPlayer, and Audio::GstreamerPlayer.

Here is the caller graph for this function:

◆ play()

virtual void Media::Player::play ( void  )
pure virtual

Start playback or resume playback if paused. If already playing, continue.

Implemented in Media::PlayerWrapper, Media::ThreadedPlayer, Audio::AVFoundationPlayer, and Audio::GstreamerPlayer.

Here is the caller graph for this function:

◆ playbackComplete()

bool Media::Player::playbackComplete ( void  ) const
inline

Indicate if playback is complete and ready for cleanup.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ playPoint()

float ToneGenerator::Player::playPoint ( void  ) const
pure virtual

Seconds from start, or a negative value if unknown.

Implemented in ToneGenerator::Player, Media::PlayerWrapper, Audio::AVFoundationPlayer, Audio::GstreamerPlayer, and Audio::LavPlayer.

Here is the caller graph for this function:

◆ playRemaining()

float Media::Player::playRemaining ( void  ) const
virtual

Seconds left in playback, or a negative number if unknown.

Determine the length of track remaining to play.

Returns
The length in seconds, floating point, or a negative number if the value could not be ascertained.
Note
Although it "shouldn't" happen, return value may also be negative if actual playpoint exceeds expected duration, which can happen if ID3 data is wrong, encoding is wrong, etc.

Reimplemented in Media::PlayerWrapper.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ready()

bool Media::Player::ready ( void  ) const
inline

Indicate if player has finished initializing.

See also
State
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setVolume()

void ToneGenerator::Player::setVolume ( float  volume)
pure virtual

Adjust volume in decibels.

Implemented in ToneGenerator::Player, Media::PlayerWrapper, Audio::AVFoundationPlayer, Audio::GstreamerPlayer, and Audio::LavPlayer.

Here is the caller graph for this function:

◆ trackDuration()

float ToneGenerator::Player::trackDuration ( void  ) const
pure virtual

Length of track in seconds, or a negative number if unknown.

Implemented in ToneGenerator::Player, Media::PlayerWrapper, Audio::AVFoundationPlayer, Audio::GstreamerPlayer, and Audio::LavPlayer.

Here is the caller graph for this function:

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