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
ec5be91f
Commit
ec5be91f
authored
Mar 12, 2019
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
filter/ffmpeg: new filter plugin
parent
a7a9490a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
143 additions
and
0 deletions
+143
-0
NEWS
NEWS
+1
-0
plugins.rst
doc/plugins.rst
+21
-0
FilterRegistry.cxx
src/filter/FilterRegistry.cxx
+2
-0
FfmpegFilterPlugin.cxx
src/filter/plugins/FfmpegFilterPlugin.cxx
+91
-0
FfmpegFilterPlugin.hxx
src/filter/plugins/FfmpegFilterPlugin.hxx
+27
-0
meson.build
src/filter/plugins/meson.build
+1
-0
No files found.
NEWS
View file @
ec5be91f
...
...
@@ -2,6 +2,7 @@ ver 0.22 (not yet released)
* input
- ffmpeg: allow partial reads
* filter
- ffmpeg: new plugin based on FFmpeg's libavfilter library
- hdcd: new plugin based on FFmpeg's "af_hdcd" for HDCD playback
ver 0.21.7 (not yet released)
...
...
doc/plugins.rst
View file @
ec5be91f
...
...
@@ -1078,6 +1078,27 @@ The "Solaris" plugin runs only on SUN Solaris, and plays via /dev/audio.
Filter plugins
--------------
ffmpeg
~~~~~~
Decode `HDCD
<https://en.wikipedia.org/wiki/High_Definition_Compatible_Digital>`_.
This plugin requires building with ``libavfilter`` (FFmpeg).
.. list-table::
:widths: 20 80
:header-rows: 1
* - Setting
- Description
* - **graph "..."**
- Specifies the ``libavfilter`` graph; read the `FFmpeg
documentation
<https://libav.org/documentation/libavfilter.html#Filtergraph-syntax-1>`_
for details
hdcd
~~~~
...
...
src/filter/FilterRegistry.cxx
View file @
ec5be91f
...
...
@@ -22,6 +22,7 @@
#include "plugins/NullFilterPlugin.hxx"
#include "plugins/RouteFilterPlugin.hxx"
#include "plugins/NormalizeFilterPlugin.hxx"
#include "plugins/FfmpegFilterPlugin.hxx"
#include "plugins/HdcdFilterPlugin.hxx"
#include "config.h"
...
...
@@ -32,6 +33,7 @@ static const FilterPlugin *const filter_plugins[] = {
&
route_filter_plugin
,
&
normalize_filter_plugin
,
#ifdef HAVE_LIBAVFILTER
&
ffmpeg_filter_plugin
,
&
hdcd_filter_plugin
,
#endif
nullptr
,
...
...
src/filter/plugins/FfmpegFilterPlugin.cxx
0 → 100644
View file @
ec5be91f
/*
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "FfmpegFilterPlugin.hxx"
#include "FfmpegFilter.hxx"
#include "filter/FilterPlugin.hxx"
#include "filter/Filter.hxx"
#include "filter/Prepared.hxx"
#include "filter/FilterRegistry.hxx"
#include "lib/ffmpeg/Filter.hxx"
#include "config/Block.hxx"
#include "AudioFormat.hxx"
class
PreparedFfmpegFilter
final
:
public
PreparedFilter
{
const
char
*
const
graph_string
;
public
:
explicit
PreparedFfmpegFilter
(
const
char
*
_graph
)
noexcept
:
graph_string
(
_graph
)
{}
/* virtual methods from class PreparedFilter */
std
::
unique_ptr
<
Filter
>
Open
(
AudioFormat
&
af
)
override
;
};
std
::
unique_ptr
<
Filter
>
PreparedFfmpegFilter
::
Open
(
AudioFormat
&
in_audio_format
)
{
Ffmpeg
::
FilterGraph
graph
;
auto
buffer_src
=
Ffmpeg
::
FilterContext
::
MakeAudioBufferSource
(
in_audio_format
,
*
graph
);
auto
buffer_sink
=
Ffmpeg
::
FilterContext
::
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
.
CheckAndConfigure
();
auto
out_audio_format
=
in_audio_format
;
// TODO
return
std
::
make_unique
<
FfmpegFilter
>
(
in_audio_format
,
out_audio_format
,
std
::
move
(
graph
),
std
::
move
(
buffer_src
),
std
::
move
(
buffer_sink
));
}
static
std
::
unique_ptr
<
PreparedFilter
>
ffmpeg_filter_init
(
const
ConfigBlock
&
block
)
{
const
char
*
graph
=
block
.
GetBlockValue
(
"graph"
);
if
(
graph
==
nullptr
)
throw
std
::
runtime_error
(
"Missing
\"
graph
\"
configuration"
);
/* check if the graph can be parsed (and discard the
object) */
Ffmpeg
::
FilterGraph
().
Parse
(
graph
);
return
std
::
make_unique
<
PreparedFfmpegFilter
>
(
graph
);
}
const
FilterPlugin
ffmpeg_filter_plugin
=
{
"ffmpeg"
,
ffmpeg_filter_init
,
};
src/filter/plugins/FfmpegFilterPlugin.hxx
0 → 100644
View file @
ec5be91f
/*
* Copyright 2003-2019 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_FFMPEG_FILTER_PLUGIN_HXX
#define MPD_FFMPEG_FILTER_PLUGIN_HXX
struct
FilterPlugin
;
extern
const
FilterPlugin
ffmpeg_filter_plugin
;
#endif
src/filter/plugins/meson.build
View file @
ec5be91f
...
...
@@ -4,6 +4,7 @@ filter_plugins_deps = []
if libavfilter_dep.found()
filter_plugins_sources += [
'FfmpegFilter.cxx',
'FfmpegFilterPlugin.cxx',
'HdcdFilterPlugin.cxx',
]
filter_plugins_deps += ffmpeg_dep
...
...
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