AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
FilterGraph.hpp
Go to the documentation of this file.
1 #ifndef _AV_TRANSCODER_FILTER_FILTER_GRAPH_HPP_
2 #define _AV_TRANSCODER_FILTER_FILTER_GRAPH_HPP_
3 
8 
9 #include <vector>
10 
11 struct AVFilterGraph;
12 
13 namespace avtranscoder
14 {
15 
16 /**
17  * @brief Manager of filters.
18  * @warning Currently, the class manages only filters which has one input and one output.
19  * @note See 'complex graph' definition in ffmpeg documentation.
20  **/
21 class AvExport FilterGraph
22 {
23 private:
24  FilterGraph(const FilterGraph& otherFilterGraph);
25  FilterGraph& operator=(const FilterGraph& otherFilterGraph);
26 
27 public:
28  FilterGraph(const ICodec& codec);
29  ~FilterGraph();
30 
31  /**
32  * @brief Add a filter.
33  * @param filterName: the method gets the filter definition from this name.
34  * @param filterArgs: options to initialize the filter with. This must be a ':'-separated list of options in the
35  * 'key=value' form.
36  * @param instanceName: name of the instance filter in the graph (if empty, same as filterName).
37  * @return the filter added
38  * @throw runtime exception if the filter is not found
39  * @warning The filter will be added to the filter graph when calling process method.
40  * @see process
41  */
42  Filter& addFilter(const std::string& filterName, const std::string& filterOptions = "",
43  const std::string& instanceName = "");
44 
45  /**
46  * @brief Pull filtered data from the filter graph, and put result to the given frame.
47  * @param frame: both input and output data of the method.
48  * @note Do nothing if there was no filter added.
49  */
50  void process(Frame& frame);
51 
52 private:
53  /**
54  * @return If at least one filter has been added to the filter graph
55  */
56  bool hasFilters() const { return !_filters.empty(); }
57 
58  /**
59  * @brief Initialize the graph of filters to process.
60  * @see pushFilterToGraph
61  * @see pushInBuffer
62  * @see pushOutBuffer
63  */
64  void init(const Frame& frame);
65 
66  /**
67  * @brief Push the given Filter to the graph.
68  */
69  void pushFilter(Filter& filter);
70 
71  ///@{
72  /// @brief Push the input and output buffer at the beginning and the end of the graph.
73  void pushInBuffer(const Frame& frame);
74  void pushOutBuffer(const Frame& frame);
75  //@}
76 
77 private:
78  AVFilterGraph* _graph; ///< The graph which holds the filters.
79  std::vector<Filter*> _filters; ///< List of filters to process.
80  const ICodec& _codec; ///< Codec of the stream on which the filters will be applied.
81 
82  /**
83  * @brief Is the FilterGraph initialized.
84  * @see init
85  */
86  bool _isInit;
87 };
88 }
89 
90 #endif
Describe a filter and its options.
Definition: Filter.hpp:15
bool _isInit
Is the FilterGraph initialized.
Definition: FilterGraph.hpp:86
std::vector< Filter * > _filters
List of filters to process.
Definition: FilterGraph.hpp:79
This class describes decoded (raw) audio or video data.
Definition: Frame.hpp:16
Manager of filters.
Definition: FilterGraph.hpp:21
const ICodec & _codec
Codec of the stream on which the filters will be applied.
Definition: FilterGraph.hpp:80
AVFilterGraph * _graph
The graph which holds the filters.
Definition: FilterGraph.hpp:78
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy