@@ -35,7 +35,7 @@ FilterGraph::~FilterGraph()
35
35
avfilter_graph_free (&_graph);
36
36
}
37
37
38
- void FilterGraph::process (Frame& frame )
38
+ void FilterGraph::process (const Frame& inputFrame, Frame& outputFrame )
39
39
{
40
40
if (!hasFilters ())
41
41
{
@@ -45,10 +45,10 @@ void FilterGraph::process(Frame& frame)
45
45
46
46
// init filter graph
47
47
if (!_isInit)
48
- init (frame );
48
+ init (inputFrame, outputFrame );
49
49
50
50
// setup source frame
51
- int ret = av_buffersrc_write_frame (_filters.at (0 )->getAVFilterContext (), &frame .getAVFrame ());
51
+ int ret = av_buffersrc_write_frame (_filters.at (0 )->getAVFilterContext (), &inputFrame .getAVFrame ());
52
52
if (ret < 0 )
53
53
{
54
54
throw std::runtime_error (" Error when adding a frame to the source buffer used to start to process filters: " +
@@ -58,7 +58,7 @@ void FilterGraph::process(Frame& frame)
58
58
// pull filtered data from the filter graph
59
59
for (;;)
60
60
{
61
- ret = av_buffersink_get_frame (_filters.at (_filters.size () - 1 )->getAVFilterContext (), &frame .getAVFrame ());
61
+ ret = av_buffersink_get_frame (_filters.at (_filters.size () - 1 )->getAVFilterContext (), &outputFrame .getAVFrame ());
62
62
if (ret == AVERROR_EOF || ret == AVERROR (EAGAIN))
63
63
break ;
64
64
if (ret < 0 )
@@ -77,15 +77,15 @@ Filter& FilterGraph::addFilter(const std::string& filterName, const std::string&
77
77
return *_filters.back ();
78
78
}
79
79
80
- void FilterGraph::init (const Frame& frame )
80
+ void FilterGraph::init (const Frame& inputFrame, Frame& outputFrame )
81
81
{
82
82
// push filters to the graph
83
- pushInBuffer (frame );
83
+ pushInBuffer (inputFrame );
84
84
for (size_t i = 1 ; i < _filters.size (); ++i)
85
85
{
86
86
pushFilter (*_filters.at (i));
87
87
}
88
- pushOutBuffer (frame );
88
+ pushOutBuffer (outputFrame );
89
89
90
90
// connect filters
91
91
for (size_t index = 0 ; index < _filters.size () - 1 ; ++index)
0 commit comments