Adapter to feed a ffmpeg stream to an audio output.
More...
#include <ffmpegplayer.h>
|
| static LavAdapter * | getOutput (const AudioSettings &settings, const AVCodecContext *context, const AVStream *stream) |
| | Choose an output, then get an adapter for libav and set it up to match the output's format. More...
|
| |
|
| | LavAdapter (const AVCodecContext *codec, const AVStream *stream, const AVSampleFormat output_format) |
| | Adapt whatever output for input from ffmpeg. More...
|
| |
| virtual bool | playFrame (AVFrame *frame)=0 |
| |
| bool | playFilteredPackets (const bool eof_return_value=true) |
| | Read all the resulting frames coming out of the filter stack, and push them to the outputter. More...
|
| |
| void | flush () |
| | Play any frames buffered in the filter. More...
|
| |
|
| AVFilterContext * | pushFilter (AVFilterContext *prior_filter, const char *name, const char *optionformat=nullptr,...) |
| | Add a filter to the filter stack. More...
|
| |
Adapter to feed a ffmpeg stream to an audio output.
◆ LavAdapter()
| Audio::LavAdapter::LavAdapter |
( |
const AVCodecContext * |
codec, |
|
|
const AVStream * |
stream, |
|
|
const AVSampleFormat |
output_format |
|
) |
| |
|
protected |
Adapt whatever output for input from ffmpeg.
- Parameters
-
| codec | The ffmpeg codec context. |
| stream | The stream from whence audio will arrive. |
| output_format | The format required by the outputter. |
◆ ~LavAdapter()
| Audio::LavAdapter::~LavAdapter |
( |
| ) |
|
|
virtual |
◆ flush()
| void Audio::LavAdapter::flush |
( |
| ) |
|
|
protected |
Play any frames buffered in the filter.
This must be invoked by subclasses during their destruction, as their specializations are gone by the time this class's destructor is called.
◆ getOutput()
| LavAdapter * Audio::LavAdapter::getOutput |
( |
const AudioSettings & |
settings, |
|
|
const AVCodecContext * |
codec, |
|
|
const AVStream * |
stream |
|
) |
| |
|
static |
Choose an output, then get an adapter for libav and set it up to match the output's format.
- Parameters
-
| settings | Where to send the audio output. |
| codec | Audio format details. |
| stream | The stream from which audio will arrive. |
- Returns
- A ready-to-go output stack.
- Exceptions
-
| AudioException | or a derivative if a suitable output was not located, opening/setting up the device failed, or the adapter setup failed. |
◆ play()
| bool Audio::LavAdapter::play |
( |
AVFrame * |
frame | ) |
|
Play a frame from a ffmpeg decoder.
This involves passing it through the filter stack to adjust volume and format in accordance with the output's needs.
- Parameters
-
| frame | The audio frame to play. |
- Returns
- True on success, false on error.
◆ playFilteredPackets()
| bool Audio::LavAdapter::playFilteredPackets |
( |
const bool |
eof_return_value = true | ) |
|
|
protected |
Read all the resulting frames coming out of the filter stack, and push them to the outputter.
- Parameters
-
| eof_return_value | Value to return if EOF is encountered. |
- Returns
- On error, false. On eof, up to caller. Otherwise true.
◆ playFrame()
| virtual bool Audio::LavAdapter::playFrame |
( |
AVFrame * |
frame | ) |
|
|
protectedpure virtual |
◆ pushFilter()
| AVFilterContext * Audio::LavAdapter::pushFilter |
( |
AVFilterContext * |
prior_filter, |
|
|
const char * |
name, |
|
|
const char * |
options_format = nullptr, |
|
|
|
... |
|
) |
| |
|
private |
Add a filter to the filter stack.
- Parameters
-
| prior_filter | The prior filter, or nullptr if it is the first. (used to wire the filters into sequence). |
| name | The ffmpeg name of the filter. |
| options_format | A printf-style format string (and values to follow) to create an options string for the filter. |
- Returns
- The new filter.
- Exceptions
-
◆ setVolume()
| void Audio::LavAdapter::setVolume |
( |
float |
level | ) |
|
◆ adapter_mutex
| std::mutex Audio::LavAdapter::adapter_mutex |
|
private |
◆ buffer_filter
| AVFilterContext* Audio::LavAdapter::buffer_filter = nullptr |
|
private |
◆ endpoint_filter
| AVFilterContext* Audio::LavAdapter::endpoint_filter = nullptr |
|
private |
◆ filter_stack
◆ format_filter
| AVFilterContext* Audio::LavAdapter::format_filter = nullptr |
|
private |
◆ output_frame
| std::unique_ptr<AVFrame, FrameDeleter> Audio::LavAdapter::output_frame = nullptr |
|
private |
◆ volume_filter
| AVFilterContext* Audio::LavAdapter::volume_filter = nullptr |
|
private |
The documentation for this class was generated from the following files: