forked from h4tr3d/avcpp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfilter.cpp
72 lines (57 loc) · 1.27 KB
/
filter.cpp
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#include "filter.h"
using namespace std;
namespace av {
static size_t get_pad_count(const AVFilter *filter, bool output)
{
#if LIBAVFILTER_VERSION_MAJOR >= 8 // FFmpeg 5.0
return avfilter_filter_pad_count(filter, output);
#else
return avfilter_pad_count(output ? filter->outputs : filter->inputs);
#endif
}
Filter::Filter(const AVFilter *ptr)
: FFWrapperPtr<const AVFilter>(ptr)
{
}
Filter::Filter(const std::string &name)
{
setFilter(name);
}
Filter::Filter(const char *name)
{
setFilter(name);
}
bool Filter::setFilter(const std::string& name)
{
return setFilter(name.c_str());
}
bool Filter::setFilter(const char *name)
{
m_raw = avfilter_get_by_name(name);
return m_raw;
}
std::string Filter::name() const
{
return RAW_GET(name, string());
}
string Filter::description() const
{
return RAW_GET(description, string());
}
FilterPadList Filter::inputs() const
{
return (m_raw ? FilterPadList(m_raw->inputs, get_pad_count(m_raw, false)) : FilterPadList());
}
FilterPadList Filter::outputs() const
{
return (m_raw ? FilterPadList(m_raw->outputs, get_pad_count(m_raw, true)) : FilterPadList());
}
int Filter::flags() const
{
return RAW_GET(flags, 0);
}
av::Filter::operator bool() const
{
return !isNull();
}
} // namespace av