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
fbbbfb96
Commit
fbbbfb96
authored
Nov 16, 2020
by
Max Kellermann
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'v0.22.x'
parents
eb9f5339
38b41fc3
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
167 additions
and
5 deletions
+167
-5
NEWS
NEWS
+4
-0
PartitionCommands.cxx
src/command/PartitionCommands.cxx
+2
-3
FfmpegFilterPlugin.cxx
src/filter/plugins/FfmpegFilterPlugin.cxx
+4
-1
DetectFilterFormat.cxx
src/lib/ffmpeg/DetectFilterFormat.cxx
+76
-0
DetectFilterFormat.hxx
src/lib/ffmpeg/DetectFilterFormat.hxx
+46
-0
meson.build
src/lib/ffmpeg/meson.build
+4
-1
Control.cxx
src/output/Control.cxx
+11
-0
Control.hxx
src/output/Control.hxx
+3
-0
MultipleOutputs.cxx
src/output/MultipleOutputs.cxx
+13
-0
MultipleOutputs.hxx
src/output/MultipleOutputs.hxx
+4
-0
No files found.
NEWS
View file @
fbbbfb96
...
@@ -5,6 +5,10 @@ ver 0.23 (not yet released)
...
@@ -5,6 +5,10 @@ ver 0.23 (not yet released)
ver 0.22.4 (not yet released)
ver 0.22.4 (not yet released)
* decoder
* decoder
- dsdiff: apply padding to odd-sized chunks
- dsdiff: apply padding to odd-sized chunks
* filter
- ffmpeg: detect the output sample format
* output
- moveoutput: fix always_on and tag lost on move
ver 0.22.3 (2020/11/06)
ver 0.22.3 (2020/11/06)
* playlist
* playlist
...
...
src/command/PartitionCommands.cxx
View file @
fbbbfb96
...
@@ -183,9 +183,8 @@ handle_moveoutput(Client &client, Request request, Response &response)
...
@@ -183,9 +183,8 @@ handle_moveoutput(Client &client, Request request, Response &response)
existing_output
->
ReplaceDummy
(
output
->
Steal
(),
existing_output
->
ReplaceDummy
(
output
->
Steal
(),
was_enabled
);
was_enabled
);
else
else
/* add it to the output list */
/* copy the AudioOutputControl and add it to the output list */
dest_partition
.
outputs
.
Add
(
output
->
Steal
(),
dest_partition
.
outputs
.
AddCopy
(
output
,
was_enabled
);
was_enabled
);
instance
.
EmitIdle
(
IDLE_OUTPUT
);
instance
.
EmitIdle
(
IDLE_OUTPUT
);
return
CommandResult
::
OK
;
return
CommandResult
::
OK
;
...
...
src/filter/plugins/FfmpegFilterPlugin.cxx
View file @
fbbbfb96
...
@@ -23,6 +23,7 @@
...
@@ -23,6 +23,7 @@
#include "filter/Filter.hxx"
#include "filter/Filter.hxx"
#include "filter/Prepared.hxx"
#include "filter/Prepared.hxx"
#include "lib/ffmpeg/Filter.hxx"
#include "lib/ffmpeg/Filter.hxx"
#include "lib/ffmpeg/DetectFilterFormat.hxx"
#include "config/Block.hxx"
#include "config/Block.hxx"
class
PreparedFfmpegFilter
final
:
public
PreparedFilter
{
class
PreparedFfmpegFilter
final
:
public
PreparedFilter
{
...
@@ -60,7 +61,9 @@ PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)
...
@@ -60,7 +61,9 @@ PreparedFfmpegFilter::Open(AudioFormat &in_audio_format)
graph
.
CheckAndConfigure
();
graph
.
CheckAndConfigure
();
auto
out_audio_format
=
in_audio_format
;
// TODO
const
auto
out_audio_format
=
Ffmpeg
::
DetectFilterOutputFormat
(
in_audio_format
,
*
buffer_src
,
*
buffer_sink
);
return
std
::
make_unique
<
FfmpegFilter
>
(
in_audio_format
,
return
std
::
make_unique
<
FfmpegFilter
>
(
in_audio_format
,
out_audio_format
,
out_audio_format
,
...
...
src/lib/ffmpeg/DetectFilterFormat.cxx
0 → 100644
View file @
fbbbfb96
/*
* Copyright 2003-2020 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 "DetectFilterFormat.hxx"
#include "Frame.hxx"
#include "SampleFormat.hxx"
#include "pcm/Silence.hxx"
#include "pcm/CheckAudioFormat.hxx"
#include "util/WritableBuffer.hxx"
extern
"C"
{
#include <libavfilter/buffersrc.h>
#include <libavfilter/buffersink.h>
}
#include <cassert>
namespace
Ffmpeg
{
AudioFormat
DetectFilterOutputFormat
(
const
AudioFormat
&
in_audio_format
,
AVFilterContext
&
buffer_src
,
AVFilterContext
&
buffer_sink
)
{
uint_least64_t
silence
[
MAX_CHANNELS
];
const
size_t
silence_size
=
in_audio_format
.
GetFrameSize
();
assert
(
sizeof
(
silence
)
>=
silence_size
);
PcmSilence
(
WritableBuffer
<
void
>
{
&
silence
,
silence_size
},
in_audio_format
.
format
);
Frame
frame
;
frame
->
format
=
ToFfmpegSampleFormat
(
in_audio_format
.
format
);
frame
->
sample_rate
=
in_audio_format
.
sample_rate
;
frame
->
channels
=
in_audio_format
.
channels
;
frame
->
nb_samples
=
1
;
frame
.
GetBuffer
();
memcpy
(
frame
.
GetData
(
0
),
silence
,
silence_size
);
int
err
=
av_buffersrc_add_frame
(
&
buffer_src
,
frame
.
get
());
if
(
err
<
0
)
throw
MakeFfmpegError
(
err
,
"av_buffersrc_add_frame() failed"
);
frame
.
Unref
();
err
=
av_buffersink_get_frame
(
&
buffer_sink
,
frame
.
get
());
if
(
err
<
0
)
throw
MakeFfmpegError
(
err
,
"av_buffersink_get_frame() failed"
);
const
SampleFormat
sample_format
=
FromFfmpegSampleFormat
(
AVSampleFormat
(
frame
->
format
));
if
(
sample_format
==
SampleFormat
::
UNDEFINED
)
throw
std
::
runtime_error
(
"Unsupported FFmpeg sample format"
);
return
CheckAudioFormat
(
frame
->
sample_rate
,
sample_format
,
frame
->
channels
);
}
}
// namespace Ffmpeg
src/lib/ffmpeg/DetectFilterFormat.hxx
0 → 100644
View file @
fbbbfb96
/*
* Copyright 2003-2020 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_DETECT_FILTER_FORMAT_HXX
#define MPD_FFMPEG_DETECT_FILTER_FORMAT_HXX
struct
AVFilterContext
;
struct
AudioFormat
;
namespace
Ffmpeg
{
/**
* Attempt to detect the output format of the given FFmpeg filter by
* sending one frame of silence and checking what format comes back
* from the filter.
*
* This is a kludge because MPD needs to know the output format of a
* filter while initializing and cannot cope with format changes in
* between.
*
* This function can throw if the FFmpeg filter fails.
*/
AudioFormat
DetectFilterOutputFormat
(
const
AudioFormat
&
in_audio_format
,
AVFilterContext
&
buffer_src
,
AVFilterContext
&
buffer_sink
);
}
// namespace Ffmpeg
#endif
src/lib/ffmpeg/meson.build
View file @
fbbbfb96
...
@@ -20,7 +20,10 @@ endif
...
@@ -20,7 +20,10 @@ endif
ffmpeg_sources = []
ffmpeg_sources = []
if libavfilter_dep.found()
if libavfilter_dep.found()
ffmpeg_sources += 'Filter.cxx'
ffmpeg_sources += [
'Filter.cxx',
'DetectFilterFormat.cxx',
]
endif
endif
ffmpeg = static_library(
ffmpeg = static_library(
...
...
src/output/Control.cxx
View file @
fbbbfb96
...
@@ -39,6 +39,17 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _out
...
@@ -39,6 +39,17 @@ AudioOutputControl::AudioOutputControl(std::unique_ptr<FilteredAudioOutput> _out
{
{
}
}
AudioOutputControl
::
AudioOutputControl
(
AudioOutputControl
*
_output
,
AudioOutputClient
&
_client
)
noexcept
:
output
(
_output
->
Steal
()),
name
(
output
->
GetName
()),
client
(
_client
),
thread
(
BIND_THIS_METHOD
(
Task
))
{
tags
=
_output
->
tags
;
always_on
=
_output
->
always_on
;
}
AudioOutputControl
::~
AudioOutputControl
()
noexcept
AudioOutputControl
::~
AudioOutputControl
()
noexcept
{
{
StopThread
();
StopThread
();
...
...
src/output/Control.hxx
View file @
fbbbfb96
...
@@ -245,6 +245,9 @@ public:
...
@@ -245,6 +245,9 @@ public:
AudioOutputControl
(
std
::
unique_ptr
<
FilteredAudioOutput
>
_output
,
AudioOutputControl
(
std
::
unique_ptr
<
FilteredAudioOutput
>
_output
,
AudioOutputClient
&
_client
)
noexcept
;
AudioOutputClient
&
_client
)
noexcept
;
AudioOutputControl
(
AudioOutputControl
*
_outputControl
,
AudioOutputClient
&
_client
)
noexcept
;
~
AudioOutputControl
()
noexcept
;
~
AudioOutputControl
()
noexcept
;
AudioOutputControl
(
const
AudioOutputControl
&
)
=
delete
;
AudioOutputControl
(
const
AudioOutputControl
&
)
=
delete
;
...
...
src/output/MultipleOutputs.cxx
View file @
fbbbfb96
...
@@ -141,6 +141,19 @@ MultipleOutputs::Add(std::unique_ptr<FilteredAudioOutput> output,
...
@@ -141,6 +141,19 @@ MultipleOutputs::Add(std::unique_ptr<FilteredAudioOutput> output,
}
}
void
void
MultipleOutputs
::
AddCopy
(
AudioOutputControl
*
outputControl
,
bool
enable
)
noexcept
{
// TODO: this operation needs to be protected with a mutex
outputs
.
emplace_back
(
std
::
make_unique
<
AudioOutputControl
>
(
outputControl
,
client
));
outputs
.
back
()
->
LockSetEnabled
(
enable
);
client
.
ApplyEnabled
();
}
void
MultipleOutputs
::
EnableDisable
()
MultipleOutputs
::
EnableDisable
()
{
{
/* parallel execution */
/* parallel execution */
...
...
src/output/MultipleOutputs.hxx
View file @
fbbbfb96
...
@@ -128,6 +128,10 @@ public:
...
@@ -128,6 +128,10 @@ public:
void
Add
(
std
::
unique_ptr
<
FilteredAudioOutput
>
output
,
void
Add
(
std
::
unique_ptr
<
FilteredAudioOutput
>
output
,
bool
enable
)
noexcept
;
bool
enable
)
noexcept
;
void
AddCopy
(
AudioOutputControl
*
outputControl
,
bool
enable
)
noexcept
;
void
SetReplayGainMode
(
ReplayGainMode
mode
)
noexcept
;
void
SetReplayGainMode
(
ReplayGainMode
mode
)
noexcept
;
/**
/**
...
...
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