Ring Daemon 16.0.0
|
Provides access to libavfilter. More...
#include <media_filter.h>
Public Member Functions | |
int | feedInput (AVFrame *frame, const std::string &inputName) |
Give the specified source filter an input frame. | |
void | flush () |
Flush filter to indicate EOF. | |
std::string | getFilterDesc () const |
Returns the current filter graph string. | |
const MediaStream & | getInputParams (const std::string &inputName) const |
Returns a MediaStream object describing the input specified by @inputName. | |
MediaStream | getOutputParams () const |
Returns a MediaStream struct describing the frames that will be output. | |
int | initialize (const std::string &filterDesc, const std::vector< MediaStream > &msps) |
Initializes the filter graph with one or more inputs and one output. | |
MediaFilter () | |
std::unique_ptr< MediaFrame > | readOutput () |
Pull a frame from the filter graph. | |
~MediaFilter () | |
Provides access to libavfilter.
Can be used for filters with unlimited number of inputs. Multiple outputs are not supported. They add complexity for little gain.
For information on how to write a filter graph description, see: https://ffmpeg.org/ffmpeg-filters.html http://trac.ffmpeg.org/wiki/FilteringGuide
It is required to name each filter graph input. These names are used to feed the correct input. It is the same name that will be passed as second argument to feedInput(AVFrame*, std::string).
Examples:
Definition at line 61 of file media_filter.h.
jami::MediaFilter::MediaFilter | ( | ) |
Definition at line 36 of file media_filter.cpp.
jami::MediaFilter::~MediaFilter | ( | ) |
Definition at line 38 of file media_filter.cpp.
Give the specified source filter an input frame.
Caller is responsible for freeing the frame.
NOTE Will fail if @inputName is not found in the graph.
Definition at line 155 of file media_filter.cpp.
References jami::emitSignal().
void jami::MediaFilter::flush | ( | ) |
Flush filter to indicate EOF.
Definition at line 222 of file media_filter.cpp.
References jami::emitSignal(), jami::libav_utils::getError(), and JAMI_ERR.
std::string jami::MediaFilter::getFilterDesc | ( | ) | const |
Returns the current filter graph string.
Definition at line 44 of file media_filter.cpp.
const MediaStream & jami::MediaFilter::getInputParams | ( | const std::string & | inputName | ) | const |
Returns a MediaStream object describing the input specified by @inputName.
Definition at line 111 of file media_filter.cpp.
References jami::emitSignal().
MediaStream jami::MediaFilter::getOutputParams | ( | ) | const |
Returns a MediaStream struct describing the frames that will be output.
When called in an invalid state, the returned format will be invalid (less than 0).
Definition at line 120 of file media_filter.cpp.
References jami::emitSignal().
int jami::MediaFilter::initialize | ( | const std::string & | filterDesc, |
const std::vector< MediaStream > & | msps | ||
) |
Initializes the filter graph with one or more inputs and one output.
Returns a negative code on error.
Definition at line 50 of file media_filter.cpp.
References jami::emitSignal(), and JAMI_DBG.
std::unique_ptr< MediaFrame > jami::MediaFilter::readOutput | ( | ) |
Pull a frame from the filter graph.
Caller owns the frame reference.
Returns AVERROR(EAGAIN) if filter graph requires more input.
NOTE Frame reference belongs to the caller
Definition at line 188 of file media_filter.cpp.
References jami::emitSignal(), and JAMI_WARN.