|
pianod2
multisource multiuser scriptable networked music player
|
ffmpeg audio player More...
#include <ffmpegplayer.h>


Public Member Functions | |
| LavPlayer (const AudioSettings &AudioSettings, const std::string &media_url, float audio_gain=0) | |
| Play a media file or URL using ffmpeg. More... | |
Public Member Functions inherited from Media::ThreadedPlayer | |
| ThreadedPlayer (void) | |
| virtual | ~ThreadedPlayer (void) |
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... | |
Public Member Functions inherited from Audio::LibavMediaReader | |
| LibavMediaReader (const std::string &media_url, int timeout=15) | |
| Base abstract class for reading a media file or URL using ffmpeg. More... | |
| virtual | ~LibavMediaReader (void) |
Private Member Functions | |
| bool | playPacket (AVFrame *frame, AVCodecContext *codec, AVPacket *packet) |
| RESPONSE_CODE | playStream (AVFormatContext *format, AVCodecContext *codec, const int audio_stream) |
| virtual void | setGain (float gain) 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... | |
| virtual RESPONSE_CODE | playerThread (void) override |
| virtual void | pausing (void) override |
| Called when the playback thread is pausing. More... | |
| virtual void | resuming (void) override |
| Called when the playback thread is resuming playback. More... | |
Private Attributes | |
| AudioSettings | audio |
| Output settings. More... | |
| float | gain = 0 |
| Replay gain from track. More... | |
| volatile float | duration = -1 |
| Length of song, in seconds. More... | |
| volatile float | playpoint = 0 |
| Current point in song, in seconds. More... | |
| volatile Media::Player::State | state = Initializing |
| std::unique_ptr< Audio::LavAdapter > | output |
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... | |
Protected Member Functions inherited from Media::ThreadedPlayer | |
| bool | checkForPauseOrQuit (void) |
Protected Member Functions inherited from Audio::LibavMediaReader | |
| int | initializeStream (std::unique_ptr< AVCodecContext, CodecDeleter > &codec_context) |
| Prepare a ffmpeg source for playing its audio stream. More... | |
| void | processReplayGain (AVReplayGain *gain, int size) |
| Process a replaygain packet by extracting the track gain, or if not found then then the album gain. More... | |
Protected Attributes inherited from Audio::LibavMediaReader | |
| const std::string | url |
| Media URL or filename. More... | |
| bool | is_network = false |
| True if media is network streaming. More... | |
| AVFormatContext * | transport = nullptr |
ffmpeg audio player
| Audio::LavPlayer::LavPlayer | ( | const AudioSettings & | AudioSettings, |
| const std::string & | media_url, | ||
| float | audio_gain = 0 |
||
| ) |
Play a media file or URL using ffmpeg.
| AudioSettings | Describe the output device. |
| media_url | The filename or URL of the media. |
| audio_gain | Gain to apply when playing file, in decibels. If ReplayGain is encountered during playback, that is preferred over this value. |
|
overrideprivatevirtual |
Implements Media::Player.
|
overrideprivatevirtual |
Called when the playback thread is pausing.
Reimplemented from Media::ThreadedPlayer.
|
overrideprivatevirtual |
|
private |
Decode and play an audio frame from ffmpeg.
| frame | One frame from the media stream. |
| codec | The codec state for decoding the stream. |
| packet | A packet from the stream, undecoded. |


|
overrideprivatevirtual |
Seconds from start, or a negative value if unknown.
Implements Media::Player.
|
private |
Play a media stream from ffmpeg.
| format | The multiplexed media thing. |
| codec | The codec context for the audio stream. |
| audio_stream | The index of the audio stream. |


|
overrideprivatevirtual |
Called when the playback thread is resuming playback.
Reimplemented from Media::ThreadedPlayer.
|
overrideprivatevirtual |
|
overrideprivatevirtual |
Adjust volume in decibels.
Implements Media::Player.
|
overrideprivatevirtual |
Length of track in seconds, or a negative number if unknown.
Implements Media::Player.
|
private |
Output settings.
|
private |
Length of song, in seconds.
|
private |
Replay gain from track.
|
private |
|
private |
Current point in song, in seconds.
|
private |