17 #pragma GCC diagnostic push
18 #pragma GCC diagnostic ignored "-Wdocumentation"
19 #pragma GCC diagnostic ignored "-Wshadow"
21 #pragma GCC diagnostic pop
32 const char *
what =
nullptr,
const char *what2 =
nullptr);
47 void add (GstElement *element);
53 bool asynchronously =
false)
const;
58 void push (GstElement *item);
60 const std::string &overrides =
"");
81 void push (GstElement *item);
94 const std::string
url;
109 static gboolean
on_bus_message (GstBus *bus, GstMessage *message, gpointer instance);
137 virtual void pause (
void)
override;
138 virtual void abort (
void)
override;
139 virtual void cue (
void)
override;
140 virtual void play (
void)
override;
144 virtual void setVolume (
float volume)
override;
147 virtual float playPoint (
void)
const override;
151 const std::string &media_url,
152 float initial_audio_gain);
170 virtual bool play (
void *buffer,
unsigned numberOfBytes)
override;
Class to abstract away details of audio output system is in use.
Exception for audio output problems.
Definition: audiooutput.h:47
virtual const char * what() const noexcept override
Definition: audiooutput.h:53
Exception for gstreamer audio output problems.
Definition: gstreamplayer.h:29
GstreamerAudioException(const char *func, const char *error, const char *what=nullptr, const char *what2=nullptr)
Definition: gstreamplayer.cpp:29
Class for gstreamer pipelines that need sources wired to downstream elements dynamically when autoplu...
Definition: gstreamplayer.h:71
void push(GstElement *item)
Push an output element into the filter graph.
Definition: gstreamplayer.cpp:221
gulong signal_handler_id
Definition: gstreamplayer.h:73
GstreamerDoublePipeline()=default
virtual ~GstreamerDoublePipeline()=default
void connectOutput(GstPad *pad)
Handle the pad added signal by connecting the decoder to the output chain.
Definition: gstreamplayer.cpp:239
static void on_pad_added(GstElement *, GstPad *pad, gpointer instance)
Callback function for pad-added signal.
Definition: gstreamplayer.cpp:232
void pushSource(GstElement *item)
Wire an element to the end of the source pipeline/filter graph.
Definition: gstreamplayer.cpp:206
GstElement * input_pipeline_last
Last item pushed on the stream.
Definition: gstreamplayer.h:72
Audio output class utilizing gstreamer for output.
Definition: gstreamplayer.h:159
GstreamerOutput(const AudioSettings &settings, const AudioFormat &format)
Definition: gstreamplayer.cpp:485
AudioSettings audio
Output settings.
Definition: gstreamplayer.h:161
GstElement * format_converter
Convert audio to required format for output.
Definition: gstreamplayer.h:164
GstElement * application_source
Element for application to push data into.
Definition: gstreamplayer.h:163
virtual bool play(void *buffer, unsigned numberOfBytes) override
Play output.
Definition: gstreamplayer.cpp:520
GstElement * output_device
Send audio to somewhere.
Definition: gstreamplayer.h:165
Play media or a stream using gstreamer.
Definition: gstreamplayer.h:127
virtual void setVolume(float volume) override
Adjust volume in decibels.
Definition: gstreamplayer.cpp:416
GstreamerPlayer(const AudioSettings &audio_settings, const std::string &media_url, float initial_audio_gain)
Play a media file or URL using gstreamer.
Definition: gstreamplayer.cpp:390
GstElement * format_converter
Convert audio to required format for output.
Definition: gstreamplayer.h:133
virtual void abort(void) override
Don't play the rest of the song.
Definition: gstreamplayer.cpp:454
GstElement * volume_filter
Make volume adjustments.
Definition: gstreamplayer.h:132
virtual void cue(void) override
Starts thread in paused mode.
Definition: gstreamplayer.cpp:450
virtual RESPONSE_CODE completionStatus(void) override
Definition: gstreamplayer.cpp:472
virtual float trackDuration(void) const override
Length of track in seconds, or a negative number if unknown.
Definition: gstreamplayer.cpp:420
virtual void pause(void) override
Pause playback. If already paused, do nothing.
Definition: gstreamplayer.cpp:442
virtual float playPoint(void) const override
Seconds from start, or a negative value if unknown.
Definition: gstreamplayer.cpp:431
GstElement * output_device
Send audio to somewhere.
Definition: gstreamplayer.h:134
virtual void play(void) override
Start playback or resume playback if paused. If already playing, continue.
Definition: gstreamplayer.cpp:446
virtual ~GstreamerPlayer()
Definition: gstreamplayer.cpp:411
GstElement * replay_gainer
Apply replay gain as necessary.
Definition: gstreamplayer.h:131
AudioSettings audio
Output settings.
Definition: gstreamplayer.h:129
virtual State currentState(void) const override
Definition: gstreamplayer.cpp:458
Base class for gstreamer pipelines, both readers and outputs.
Definition: gstreamplayer.h:107
static gboolean on_bus_message(GstBus *bus, GstMessage *message, gpointer instance)
Definition: gstreamplayer.cpp:313
bool notificationReceived(GstMessage *message)
Handle an event notification from the stream.
Definition: gstreamplayer.cpp:318
virtual bool notification(GstMessage *message)
Definition: gstreamplayer.cpp:371
GstreamerReaderWithBus(const std::string &media_url, int timeout)
Definition: gstreamplayer.cpp:299
virtual ~GstreamerReaderWithBus()
Definition: gstreamplayer.cpp:310
Base class for gstreamer pipelines.
Definition: gstreamplayer.h:41
GstElement * createElement(const char *name, const std::string &overrides="")
Create a gstreamer element and add it to the pipeline/bin, unwired.
Definition: gstreamplayer.cpp:170
std::recursive_mutex state_mutex
Definition: gstreamplayer.h:50
void throwAsyncException(const GstreamerAudioException &exception)
Definition: gstreamplayer.h:54
GstElement * chain_start
First item pushed on the stream after setup.
Definition: gstreamplayer.h:44
GstreamerSimplePipeline()
Definition: gstreamplayer.cpp:51
GstElement * pipeline_last
Last item pushed on the stream.
Definition: gstreamplayer.h:45
GstState currentPipelineState() const
Query the pipeline's current state.
Definition: gstreamplayer.cpp:84
void add(GstElement *element)
Definition: gstreamplayer.cpp:156
void setPipelineState(GstState state)
Set the pipeline's state.
Definition: gstreamplayer.cpp:110
void push(GstElement *item)
Wire an item to the pipeline/filter graph.
Definition: gstreamplayer.cpp:143
void throwDeferredException(const GstreamerAudioException &exception, bool asynchronously=false) const
"Throw" an exception from an asyncrhonous player thread.
Definition: gstreamplayer.cpp:69
GstElement * pipeline
Filter graph for elements.
Definition: gstreamplayer.h:43
virtual ~GstreamerSimplePipeline()
Definition: gstreamplayer.cpp:60
std::unique_ptr< GstreamerAudioException > pipeline_exception
Asynchronous exception.
Definition: gstreamplayer.h:51
Base audio output class (abstract).
Definition: audiooutput.h:65
Essential data structures and support.
enum server_status_t RESPONSE_CODE
Classes dealing with audio output drivers and decoding/playing audio files.
Definition: audiooutput.cpp:48
Audio output device & driver parameters.
Definition: fundamentals.h:52