Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7b4225aa
Commit
7b4225aa
authored
Aug 24, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/ffmpeg/Filter: add ParseSingleInOut()
Merge some duplicate code.
parent
71a5311b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
23 deletions
+18
-23
FfmpegFilterPlugin.cxx
src/filter/plugins/FfmpegFilterPlugin.cxx
+1
-11
HdcdFilterPlugin.cxx
src/filter/plugins/HdcdFilterPlugin.cxx
+1
-12
Filter.cxx
src/lib/ffmpeg/Filter.cxx
+13
-0
Filter.hxx
src/lib/ffmpeg/Filter.hxx
+3
-0
No files found.
src/filter/plugins/FfmpegFilterPlugin.cxx
View file @
7b4225aa
...
...
@@ -47,17 +47,7 @@ PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)
auto
&
buffer_sink
=
Ffmpeg
::
MakeAudioBufferSink
(
*
graph
);
Ffmpeg
::
FilterInOut
io_sink
(
"out"
,
buffer_sink
);
Ffmpeg
::
FilterInOut
io_src
(
"in"
,
buffer_src
);
auto
io
=
graph
.
Parse
(
graph_string
,
std
::
move
(
io_sink
),
std
::
move
(
io_src
));
if
(
io
.
first
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open input"
);
if
(
io
.
second
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open output"
);
graph
.
ParseSingleInOut
(
graph_string
,
buffer_sink
,
buffer_src
);
graph
.
CheckAndConfigure
();
const
auto
out_audio_format
=
...
...
src/filter/plugins/HdcdFilterPlugin.cxx
View file @
7b4225aa
...
...
@@ -48,18 +48,7 @@ OpenHdcdFilter(AudioFormat &in_audio_format)
auto
&
buffer_sink
=
Ffmpeg
::
MakeAudioBufferSink
(
*
graph
);
Ffmpeg
::
FilterInOut
io_sink
(
"out"
,
buffer_sink
);
Ffmpeg
::
FilterInOut
io_src
(
"in"
,
buffer_src
);
auto
io
=
graph
.
Parse
(
hdcd_graph
,
std
::
move
(
io_sink
),
std
::
move
(
io_src
));
if
(
io
.
first
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open input"
);
if
(
io
.
second
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open output"
);
graph
.
ParseSingleInOut
(
hdcd_graph
,
buffer_sink
,
buffer_src
);
graph
.
CheckAndConfigure
();
auto
out_audio_format
=
in_audio_format
;
...
...
src/lib/ffmpeg/Filter.cxx
View file @
7b4225aa
...
...
@@ -100,4 +100,17 @@ MakeAudioBufferSink(AVFilterGraph &graph_ctx)
graph_ctx
);
}
void
FilterGraph
::
ParseSingleInOut
(
const
char
*
filters
,
AVFilterContext
&
in
,
AVFilterContext
&
out
)
{
auto
[
inputs
,
outputs
]
=
Parse
(
filters
,
{
"out"
,
in
},
{
"in"
,
out
});
if
(
inputs
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open input"
);
if
(
outputs
.
get
()
!=
nullptr
)
throw
std
::
runtime_error
(
"FFmpeg filter has an open output"
);
}
}
// namespace Ffmpeg
src/lib/ffmpeg/Filter.hxx
View file @
7b4225aa
...
...
@@ -138,6 +138,9 @@ public:
return
std
::
make_pair
(
std
::
move
(
inputs
),
std
::
move
(
outputs
));
}
void
ParseSingleInOut
(
const
char
*
filters
,
AVFilterContext
&
in
,
AVFilterContext
&
out
);
std
::
pair
<
FilterInOut
,
FilterInOut
>
Parse
(
const
char
*
filters
)
{
AVFilterInOut
*
inputs
,
*
outputs
;
int
err
=
avfilter_graph_parse2
(
graph
,
filters
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment