avcpp 3.1.0
Wrapper for the FFmpeg that simplify usage from C++ projects.
Loading...
Searching...
No Matches
filtergraph.h
Go to the documentation of this file.
1#pragma once
2
9
10#include <map>
11#include <memory>
12
13#include "avcpp/ffmpeg.h"
14#include "avcpp/averror.h"
15
16#include "filtercontext.h"
17#include "buffersink.h"
18#include "buffersrc.h"
19
20#if AVCPP_HAS_AVFILTER
21
22namespace av {
23
35class FilterGraph : FFWrapperPtr<AVFilterGraph>
36{
37 friend class FilterInOut;
38
39public:
47 FilterGraph(decltype(nullptr));
49
50 FilterGraph(const FilterGraph&) = delete;
51 void operator=(const FilterGraph&) = delete;
52
53 // Context getters/setters
59 bool isValid();
60 //void setScaleSwsOptions(const std::string& opts);
66 int filtersCount() const;
72 void setAutoConvert(unsigned flags);
73
74 // Public API
75
84 FilterContext filter(const std::string& name, OptionalErrorCode ec = throws());
93 FilterContext filter(unsigned idx, OptionalErrorCode ec = throws());
94
106 FilterContext allocFilter(const Filter &filter, const std::string &name, OptionalErrorCode ec = throws());
118 const std::string& filterName,
119 const std::string& filterArgs,
120 OptionalErrorCode ec = throws());
121
133 void parse(const std::string &graphDescription,
134 FilterContext &srcFilterCtx,
135 FilterContext &sinkFilterCtx,
136 OptionalErrorCode ec = throws());
137
145 void parse(const std::string &graphDescription, OptionalErrorCode ec = throws());
146
155 void config(OptionalErrorCode ec = throws());
156
165 std::string dump(bool doPrint = true, const std::string& options = std::string());
166
183
184
185private:
186
187private:
188
189 BufferSrcFilterContext m_bufferSrc;
190 bool m_bufferSrcSearchDone = false;
191 BufferSinkFilterContext m_bufferSink;
192 bool m_bufferSinkSearchDone = false;
193
194 bool m_configured = false;
195};
196
197} // namespace av
198
199#endif // if AVCPP_HAS_AVFILTER
Error codes, error categories and the OptionalErrorCode convention.
Buffersink filter: frames leave the graph here.
Buffersrc filter: frames enter the graph here.
Exit point of a filter graph.
Definition buffersink.h:34
Entry point of a filter graph.
Definition buffersrc.h:31
One filter instance inside a graph.
Definition filtercontext.h:30
FilterContext filter(const std::string &name, OptionalErrorCode ec=throws())
Filter instance by name.
int filtersCount() const
Number of filters in the graph.
FilterGraph()
Create an empty graph.
FilterContext filter(unsigned idx, OptionalErrorCode ec=throws())
Filter instance by position.
std::string dump(bool doPrint=true, const std::string &options=std::string())
Describe the graph.
BufferSinkFilterContext bufferSinkFilter(OptionalErrorCode ec=throws())
The sink endpoint the graph was parsed with.
void parse(const std::string &graphDescription, FilterContext &srcFilterCtx, FilterContext &sinkFilterCtx, OptionalErrorCode ec=throws())
Build the graph from a textual description with explicit endpoints.
BufferSrcFilterContext bufferSrcFilter(OptionalErrorCode ec=throws())
The source endpoint the graph was parsed with.
void parse(const std::string &graphDescription, OptionalErrorCode ec=throws())
Build the graph from a textual description.
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.
FilterGraph(decltype(nullptr))
Create an empty graph from a nullptr tag; the graph starts empty.
void config(OptionalErrorCode ec=throws())
Negotiate formats and allocate the graph.
bool isValid()
Whether the graph has an FFmpeg context.
void setAutoConvert(unsigned flags)
Enable automatic format conversion between linked filters.
A filter descriptor: the static description of one filter.
Definition filter.h:48
Carries the caller's choice between exceptions and error codes.
Definition averror.h:96
FFmpeg types re-exported for the public API and small value wrappers.
Source and sink filter contexts.
Root namespace of the library.
Definition audioresampler.h:19