pianod2
multisource multiuser scriptable networked music player
Public Member Functions | Private Member Functions | Private Attributes | List of all members
Audio::GstreamerPlayer Class Reference

Play media or a stream using gstreamer. More...

#include <gstreamplayer.h>

Inheritance diagram for Audio::GstreamerPlayer:
Inheritance graph
[legend]
Collaboration diagram for Audio::GstreamerPlayer:
Collaboration graph
[legend]

Public Member Functions

 GstreamerPlayer (const AudioSettings &audio_settings, const std::string &media_url, float initial_audio_gain)
 Play a media file or URL using gstreamer. More...
 
virtual ~GstreamerPlayer ()
 
- Public Member Functions inherited from Audio::GstreamerReaderWithBus
 GstreamerReaderWithBus (const std::string &media_url, int timeout)
 
virtual ~GstreamerReaderWithBus ()
 
- Public Member Functions inherited from Audio::GstreamerMediaReader
 GstreamerMediaReader (const std::string &media_url, int timeout=15)
 Base abstract class for reading a media file or URL using gstreamer. More...
 
- Public Member Functions inherited from Audio::GstreamerDoublePipeline
 GstreamerDoublePipeline ()=default
 
virtual ~GstreamerDoublePipeline ()=default
 
- Public Member Functions inherited from Audio::GstreamerSimplePipeline
 GstreamerSimplePipeline ()
 
virtual ~GstreamerSimplePipeline ()
 
- Public Member Functions inherited from Media::Player
virtual ~Player (void)
 
virtual float playRemaining (void) const
 Seconds left in playback, or a negative number if unknown. More...
 
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...
 

Private Member Functions

virtual void pause (void) override
 Pause playback. If already paused, do nothing. More...
 
virtual void abort (void) override
 Don't play the rest of the song. More...
 
virtual void cue (void) override
 Starts thread in paused mode. More...
 
virtual void play (void) override
 Start playback or resume playback if paused. If already playing, continue. More...
 
virtual RESPONSE_CODE completionStatus (void) override
 
virtual void setVolume (float volume) override
 Adjust volume in decibels. More...
 
virtual State currentState (void) const override
 
virtual float trackDuration (void) const override
 Length of track in seconds, or a negative number if unknown. More...
 
virtual float playPoint (void) const override
 Seconds from start, or a negative value if unknown. More...
 

Private Attributes

AudioSettings audio
 Output settings. More...
 
GstElement * replay_gainer = nullptr
 Apply replay gain as necessary. More...
 
GstElement * volume_filter = nullptr
 Make volume adjustments. More...
 
GstElement * format_converter = nullptr
 Convert audio to required format for output. More...
 
GstElement * output_device = nullptr
 Send audio to somewhere. More...
 

Additional Inherited Members

- Public Types inherited from Media::Player
enum  State {
  DoesNotExist , Initializing , Cueing , Playing ,
  Done
}
 
- Static Public Member Functions inherited from Media::Player
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...
 
- Protected Member Functions inherited from Audio::GstreamerReaderWithBus
virtual bool notification (GstMessage *message)
 
- Protected Member Functions inherited from Audio::GstreamerDoublePipeline
void push (GstElement *item)
 Push an output element into the filter graph. More...
 
void pushSource (GstElement *item)
 Wire an element to the end of the source pipeline/filter graph. More...
 
- Protected Member Functions inherited from Audio::GstreamerSimplePipeline
void add (GstElement *element)
 
void throwDeferredException (const GstreamerAudioException &exception, bool asynchronously=false) const
 "Throw" an exception from an asyncrhonous player thread. More...
 
void throwAsyncException (const GstreamerAudioException &exception)
 
void push (GstElement *item)
 Wire an item to the pipeline/filter graph. More...
 
GstElement * createElement (const char *name, const std::string &overrides="")
 Create a gstreamer element and add it to the pipeline/bin, unwired. More...
 
GstState currentPipelineState () const
 Query the pipeline's current state. More...
 
void setPipelineState (GstState state)
 Set the pipeline's state. More...
 
- Protected Attributes inherited from Audio::GstreamerMediaReader
const bool is_network = false
 True if media is network streaming. More...
 
const std::string url
 Media URL or filename. More...
 
- Protected Attributes inherited from Audio::GstreamerSimplePipeline
GstElement * pipeline
 Filter graph for elements. More...
 
GstElement * chain_start = nullptr
 First item pushed on the stream after setup. More...
 
GstElement * pipeline_last = nullptr
 Last item pushed on the stream. More...
 
std::recursive_mutex state_mutex
 
std::unique_ptr< GstreamerAudioExceptionpipeline_exception
 Asynchronous exception. More...
 

Detailed Description

Play media or a stream using gstreamer.

Constructor & Destructor Documentation

◆ GstreamerPlayer()

Audio::GstreamerPlayer::GstreamerPlayer ( const AudioSettings audio_settings,
const std::string &  media_url,
float  initial_audio_gain 
)

Play a media file or URL using gstreamer.

Parameters
audio_settingsDescribe the output device.
media_urlThe filename or URL of the media.
initial_audio_gainGain to apply when playing file, in decibels. If ReplayGain is encountered during playback, that is preferred over this value.
Here is the call graph for this function:

◆ ~GstreamerPlayer()

Audio::GstreamerPlayer::~GstreamerPlayer ( void  )
virtual

Member Function Documentation

◆ abort()

void Audio::GstreamerPlayer::abort ( void  )
overrideprivatevirtual

Don't play the rest of the song.

Implements Media::Player.

Here is the call graph for this function:

◆ completionStatus()

RESPONSE_CODE Audio::GstreamerPlayer::completionStatus ( void  )
overrideprivatevirtual

Implements Media::Player.

◆ cue()

void Audio::GstreamerPlayer::cue ( void  )
overrideprivatevirtual

Starts thread in paused mode.

Implements Media::Player.

Here is the call graph for this function:

◆ currentState()

Media::Player::State Audio::GstreamerPlayer::currentState ( void  ) const
overrideprivatevirtual

Implements Media::Player.

Here is the call graph for this function:

◆ pause()

void Audio::GstreamerPlayer::pause ( void  )
overrideprivatevirtual

Pause playback. If already paused, do nothing.

Implements Media::Player.

Here is the call graph for this function:

◆ play()

void Audio::GstreamerPlayer::play ( void  )
overrideprivatevirtual

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

Implements Media::Player.

Here is the call graph for this function:

◆ playPoint()

float Audio::GstreamerPlayer::playPoint ( void  ) const
overrideprivatevirtual

Seconds from start, or a negative value if unknown.

Implements Media::Player.

Here is the call graph for this function:

◆ setVolume()

void Audio::GstreamerPlayer::setVolume ( float  volume)
overrideprivatevirtual

Adjust volume in decibels.

Implements Media::Player.

◆ trackDuration()

float Audio::GstreamerPlayer::trackDuration ( void  ) const
overrideprivatevirtual

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

Implements Media::Player.

Here is the call graph for this function:

Member Data Documentation

◆ audio

AudioSettings Audio::GstreamerPlayer::audio
private

Output settings.

◆ format_converter

GstElement* Audio::GstreamerPlayer::format_converter = nullptr
private

Convert audio to required format for output.

◆ output_device

GstElement* Audio::GstreamerPlayer::output_device = nullptr
private

Send audio to somewhere.

◆ replay_gainer

GstElement* Audio::GstreamerPlayer::replay_gainer = nullptr
private

Apply replay gain as necessary.

◆ volume_filter

GstElement* Audio::GstreamerPlayer::volume_filter = nullptr
private

Make volume adjustments.


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