|
pianod2
multisource multiuser scriptable networked music player
|
The Player class is abstract, and is implemented several different ways (ffmpeg, gstreamer, AVFoundation...). More...
#include <playerwrapper.h>


Public Member Functions | |
| PlayerWrapper (Player *) | |
| PlayerWrapper (std::unique_ptr< Player > &&) | |
| 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 | setVolume (float volume) override |
| Adjust volume in decibels. 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 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... | |
| virtual float | playRemaining (void) const override |
| Seconds left in playback, or a negative number if unknown. More... | |
| virtual RESPONSE_CODE | completionStatus (void) override |
| virtual State | currentState (void) const override |
| virtual time_t | getPauseTimeout (void) override |
| When paused, get the time at which the song will expire. More... | |
Public Member Functions inherited from Media::Player | |
| virtual | ~Player (void) |
| 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... | |
Private Attributes | |
| std::unique_ptr< Player > | inherited |
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::Player * | getPlayer (const AudioSettings &settings, const std::string &media_url, float initial_gain) |
| Get the a media player currently compiled in the code. More... | |
The Player class is abstract, and is implemented several different ways (ffmpeg, gstreamer, AVFoundation...).
Exactly what's in use is blackboxed from the sources, but that isolation also means we can't specialize them through inheritance. Losing the encapsulation would create a maintenance nightmare.
We could add some delegates, but that also means repeated implementations in each of the different player types.
So, we have this stupid wrapper. It's the least of the bad choices. It accepts a player instance, and simply forwards every request onto the player. A source that wants to customize, can wrap its player in a wrapper that's been specialized to its needs.
| Media::PlayerWrapper::PlayerWrapper | ( | Player * | player | ) |
| Media::PlayerWrapper::PlayerWrapper | ( | std::unique_ptr< Player > && | player | ) |
|
overridevirtual |
Don't play the rest of the song.
Implements Media::Player.
|
overridevirtual |
Implements Media::Player.
|
overridevirtual |
Starts thread in paused mode.
Implements Media::Player.
|
overridevirtual |
Implements Media::Player.
|
overridevirtual |
When paused, get the time at which the song will expire.
Reimplemented from Media::Player.
|
overridevirtual |
Pause playback. If already paused, do nothing.
Implements Media::Player.
|
overridevirtual |
Start playback or resume playback if paused. If already playing, continue.
Implements Media::Player.
|
overridevirtual |
Seconds from start, or a negative value if unknown.
Implements Media::Player.
|
overridevirtual |
Seconds left in playback, or a negative number if unknown.
Determine the length of track remaining to play.
Reimplemented from Media::Player.
|
overridevirtual |
Adjust volume in decibels.
Implements Media::Player.
|
overridevirtual |
Length of track in seconds, or a negative number if unknown.
Implements Media::Player.
|
private |