Shaka Player Embedded
|
#include <audio_renderer_common.h>
Public Member Functions | |
AudioRendererCommon () | |
~AudioRendererCommon () override | |
void | SetPlayer (const MediaPlayer *player) override |
void | Attach (const DecodedStream *stream) override |
void | Detach () override |
double | Volume () const override |
void | SetVolume (double volume) override |
bool | Muted () const override |
void | SetMuted (bool muted) override |
![]() | |
Renderer () | |
virtual | ~ Renderer () |
Renderer (const Renderer &)=delete | |
Renderer & | operator= (const Renderer &)=delete |
Renderer (Renderer &&)=delete | |
Renderer & | operator= (Renderer &&)=delete |
Protected Member Functions | |
void | Stop () |
Friends | |
class | AudioRendererCommonTest |
Holds common code between our AudioRenderer types. This handles time tracking, choosing the correct frames, and A/V sync. The derived class must implement the pure-virtual functions to interact with the audio device.
An audio device is something that plays from a single buffer of samples. Samples are appended to the end of the buffer and are played at a constant rate (i.e. the sample rate). We fill the buffer ahead of what is actually being played, so we need to predict which frames need to be played. This class handles the synchronization and predictions, the derived classes handle how to talk to the device.
When we are paused or seek, we need to resynchronize. This will pick the current frame based on the current time and start filling there. From that point forward, we will just append new frames sequentially. This will also handle the unlikely case of not having enough data or too much data to match the frame times.
This renderer only supports playing content the audio device natively supports. This cannot convert to a different sample format.
This type is fully thread-safe; all the pure-virtual methods are called with a lock held, so derived classes do not need to use locks.
Definition at line 56 of file audio_renderer_common.h.
shaka::media::AudioRendererCommon::AudioRendererCommon | ( | ) |
Definition at line 100 of file audio_renderer_common.cc.
|
override |
Definition at line 113 of file audio_renderer_common.cc.
|
overridevirtual |
Attaches to the given stream. This object will now pull full-frames from the given stream to play content. The stream will live as long as this object, or until a call to Detach.
stream | The stream to pull frames from. |
Implements shaka::media::Renderer.
Definition at line 133 of file audio_renderer_common.cc.
|
overridevirtual |
Detaches playback from the current stream. The current stream will no longer be used to play content.
Implements shaka::media::Renderer.
Reimplemented in shaka::media::SdlAudioRenderer::Impl.
Definition at line 141 of file audio_renderer_common.cc.
|
overridevirtual |
Implements shaka::media::AudioRenderer.
Definition at line 158 of file audio_renderer_common.cc.
|
overridevirtual |
Sets whether the audio is muted.
Implements shaka::media::AudioRenderer.
Definition at line 163 of file audio_renderer_common.cc.
|
overridevirtual |
Sets the MediaPlayer that is controlling this renderer. This will be used by the Renderer to query the current time and playback state.
player | The MediaPlayer instance controlling this object. |
Implements shaka::media::Renderer.
Definition at line 120 of file audio_renderer_common.cc.
|
overridevirtual |
Sets the volume [0, 1] to render audio at.
Implements shaka::media::AudioRenderer.
Definition at line 152 of file audio_renderer_common.cc.
|
protected |
Stops the internal thread. This needs to be called in the derived class' destructor so this doesn't try to reset the device while destroying.
Definition at line 169 of file audio_renderer_common.cc.
|
overridevirtual |
Implements shaka::media::AudioRenderer.
Definition at line 147 of file audio_renderer_common.cc.
|
friend |
Definition at line 153 of file audio_renderer_common.h.