A filter graph: filters, the links between them, and their configuration.
More...
#include <filtergraph.h>
|
|
| FilterGraph () |
| | Create an empty graph.
|
|
| FilterGraph (decltype(nullptr)) |
| | Create an empty graph from a nullptr tag; the graph starts empty.
|
|
| FilterGraph (const FilterGraph &)=delete |
|
void | operator= (const FilterGraph &)=delete |
| bool | isValid () |
| | Whether the graph has an FFmpeg context.
|
| int | filtersCount () const |
| | Number of filters in the graph.
|
| void | setAutoConvert (unsigned flags) |
| | Enable automatic format conversion between linked filters.
|
| FilterContext | filter (const std::string &name, OptionalErrorCode ec=throws()) |
| | Filter instance by name.
|
| FilterContext | filter (unsigned idx, OptionalErrorCode ec=throws()) |
| | Filter instance by position.
|
| FilterContext | allocFilter (const Filter &filter, const std::string &name, OptionalErrorCode ec=throws()) |
| | Add a filter without initialising it.
|
| FilterContext | createFilter (const Filter &filter, const std::string &filterName, const std::string &filterArgs, OptionalErrorCode ec=throws()) |
| | Add a filter and initialise it with its arguments.
|
| void | parse (const std::string &graphDescription, FilterContext &srcFilterCtx, FilterContext &sinkFilterCtx, OptionalErrorCode ec=throws()) |
| | Build the graph from a textual description with explicit endpoints.
|
| void | parse (const std::string &graphDescription, OptionalErrorCode ec=throws()) |
| | Build the graph from a textual description.
|
| void | config (OptionalErrorCode ec=throws()) |
| | Negotiate formats and allocate the graph.
|
| std::string | dump (bool doPrint=true, const std::string &options=std::string()) |
| | Describe the graph.
|
| BufferSrcFilterContext | bufferSrcFilter (OptionalErrorCode ec=throws()) |
| | The source endpoint the graph was parsed with.
|
| BufferSinkFilterContext | bufferSinkFilter (OptionalErrorCode ec=throws()) |
| | The sink endpoint the graph was parsed with.
|
Build it in one of two ways: parse() a textual description such as "scale=320:240,format=yuv420p", or add filters by hand with createFilter() and link() them. config() negotiates the formats and allocates the internals; nothing can be pushed before it succeeds.
The graph owns every context created through it, so contexts must not outlive the graph.
- Examples
- api2-decode-filter-encode.cpp, and api2-decode-overlay-encode.cpp.
◆ allocFilter()
Initialise the returned context with init() before linking it.
- Parameters
-
| filter | the filter descriptor to instantiate |
| name | name of the instance inside the graph |
| ec | holder for the error code |
- Returns
- the new context, or an invalid one on failure
◆ bufferSinkFilter()
- Parameters
-
| ec | holder for the error code |
- Returns
- the sink context, or an invalid one when the graph has none
◆ bufferSrcFilter()
- Parameters
-
| ec | holder for the error code |
- Returns
- the source context, or an invalid one when the graph has none
◆ config()
◆ createFilter()
- Parameters
-
| filter | the filter descriptor to instantiate |
| filterName | name of the instance inside the graph |
| filterArgs | the filter-specific argument string |
| ec | holder for the error code |
- Returns
- the new context, or an invalid one on failure
- Examples
- api2-decode-filter-encode.cpp.
◆ dump()
| std::string av::FilterGraph::dump |
( |
bool | doPrint = true, |
|
|
const std::string & | options = std::string() ) |
- Parameters
-
| doPrint | true also writes the description through the FFmpeg log |
| options | options for avfilter_graph_dump(); may be empty |
- Returns
- the textual description of the graph
◆ filter() [1/2]
- Parameters
-
| name | the instance name given when it was created |
| ec | holder for the error code |
- Returns
- the context, or an invalid one when no such filter exists
- Examples
- api2-decode-overlay-encode.cpp.
◆ filter() [2/2]
- Parameters
-
| idx | zero-based index into the graph |
| ec | holder for the error code |
- Returns
- the context, or an invalid one when the index is out of range
◆ filtersCount()
| int av::FilterGraph::filtersCount |
( |
| ) |
const |
◆ isValid()
| bool av::FilterGraph::isValid |
( |
| ) |
|
- Returns
- true when the graph can accept filters
◆ parse() [1/2]
The description names only the filters between the endpoints, for example "scale=320:240,split [s0][s1]; [s0] palettegen [p]; [s1][p] paletteuse".
- Parameters
-
| graphDescription | the filter chain |
| srcFilterCtx | the source context to start from |
| sinkFilterCtx | the sink context to end at |
| ec | holder for the error code |
- Examples
- api2-decode-filter-encode.cpp, and api2-decode-overlay-encode.cpp.
◆ parse() [2/2]
- Parameters
-
| graphDescription | the filter chain, including its buffer and buffersink endpoints |
| ec | holder for the error code |
◆ setAutoConvert()
| void av::FilterGraph::setAutoConvert |
( |
unsigned | flags | ) |
|
- Parameters
-
| flags | AVFILTER_AUTO_CONVERT_* bits |
The documentation for this class was generated from the following file: