AvTranscoder  0.9.4
C++APIforLibav/FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Filter.cpp
Go to the documentation of this file.
1 #include "Filter.hpp"
2 
3 extern "C" {
4 #include <libavfilter/avfilter.h>
5 }
6 
7 #include <stdexcept>
8 
9 namespace avtranscoder
10 {
11 
12 Filter::Filter(const std::string& name, const std::string& options, const std::string& instanceName)
13  : _filter(NULL)
14  , _context(NULL)
15  , _options(options)
16  , _instanceName(instanceName.empty() ? name : instanceName)
17 {
18  _filter = avfilter_get_by_name(name.c_str());
19  if(!_filter)
20  {
21  std::string msg("Cannot find filter ");
22  msg += name;
23  msg += ". It will not be added to the filter graph.";
24  throw std::runtime_error(msg);
25  }
26 }
27 
29 {
30  avfilter_free(_context);
31 }
32 
33 std::string Filter::getName() const
34 {
35  return _filter->name ? std::string(_filter->name) : "";
36 }
37 }
Filter(const std::string &name, const std::string &options="", const std::string &instanceName="")
Definition: Filter.cpp:12
std::string getName() const
Definition: Filter.cpp:33
AVFilterContext * _context
Definition: Filter.hpp:34
AVFilter * _filter
Definition: Filter.hpp:33