forked from avTranscoder/avTranscoder
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFilter.cpp
More file actions
37 lines (31 loc) · 770 Bytes
/
Copy pathFilter.cpp
File metadata and controls
37 lines (31 loc) · 770 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#include "Filter.hpp"
extern "C" {
#include <libavfilter/avfilter.h>
}
#include <stdexcept>
namespace avtranscoder
{
Filter::Filter(const std::string& name, const std::string& options, const std::string& instanceName)
: _filter(NULL)
, _context(NULL)
, _options(options)
, _instanceName(instanceName.empty() ? name : instanceName)
{
_filter = (AVFilter*)avfilter_get_by_name(name.c_str());
if(!_filter)
{
std::string msg("Cannot find filter ");
msg += name;
msg += ". It will not be added to the filter graph.";
throw std::runtime_error(msg);
}
}
Filter::~Filter()
{
avfilter_free(_context);
}
std::string Filter::getName() const
{
return _filter->name ? std::string(_filter->name) : "";
}
}