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
7a68775e
Commit
7a68775e
authored
Feb 23, 2021
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
output/snapcast: Zeroconf support
parent
e4fccc85
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
37 additions
and
3 deletions
+37
-3
plugins.rst
doc/plugins.rst
+3
-0
meson.build
meson.build
+2
-1
meson.build
src/output/plugins/meson.build
+1
-1
Internal.hxx
src/output/plugins/snapcast/Internal.hxx
+11
-0
SnapcastOutputPlugin.cxx
src/output/plugins/snapcast/SnapcastOutputPlugin.cxx
+20
-1
No files found.
doc/plugins.rst
View file @
7a68775e
...
...
@@ -1167,6 +1167,9 @@ connect to it and receive audio data from MPD.
- Binds the Snapcast server to the specified address. Multiple
addresses in parallel are not supported. The default is to
bind on all addresses on port :samp:`1704`.
* - **zeroconf yes|no**
- Publish the Snapcast server as service type ``_snapcast._tcp``
via Zeroconf (Avahi or Bonjour). Default is :samp:`yes`.
solaris
...
...
meson.build
View file @
7a68775e
...
...
@@ -369,6 +369,8 @@ subdir('src/lib/yajl')
subdir('src/lib/crypto')
subdir('src/zeroconf')
subdir('src/fs')
subdir('src/config')
subdir('src/tag')
...
...
@@ -384,7 +386,6 @@ subdir('src/decoder')
subdir('src/encoder')
subdir('src/song')
subdir('src/playlist')
subdir('src/zeroconf')
if curl_dep.found()
sources += 'src/RemoteTagCache.cxx'
...
...
src/output/plugins/meson.build
View file @
7a68775e
...
...
@@ -119,7 +119,7 @@ if get_option('snapcast')
'snapcast/SnapcastOutputPlugin.cxx',
'snapcast/Client.cxx',
]
output_plugins_deps += [ event_dep, net_dep, yajl_dep ]
output_plugins_deps += [ event_dep, net_dep, yajl_dep
, zeroconf_dep
]
output_features.set('HAVE_YAJL', yajl_dep.found())
...
...
src/output/plugins/snapcast/Internal.hxx
View file @
7a68775e
...
...
@@ -30,14 +30,21 @@
#include "util/AllocatedArray.hxx"
#include "util/IntrusiveList.hxx"
#include "config.h" // for HAVE_ZEROCONF
#include <memory>
struct
ConfigBlock
;
class
SnapcastClient
;
class
PreparedEncoder
;
class
Encoder
;
class
ZeroconfHelper
;
class
SnapcastOutput
final
:
AudioOutput
,
ServerSocket
{
#ifdef HAVE_ZEROCONF
unsigned
zeroconf_port
=
0
;
#endif
/**
* True if the audio output is open and accepts client
* connections.
...
...
@@ -46,6 +53,10 @@ class SnapcastOutput final : AudioOutput, ServerSocket {
InjectEvent
inject_event
;
#ifdef HAVE_ZEROCONF
std
::
unique_ptr
<
ZeroconfHelper
>
zeroconf_helper
;
#endif
/**
* The configured encoder plugin.
*/
...
...
src/output/plugins/snapcast/SnapcastOutputPlugin.cxx
View file @
7a68775e
...
...
@@ -32,6 +32,10 @@
#include "util/DeleteDisposer.hxx"
#include "config/Net.hxx"
#ifdef HAVE_ZEROCONF
#include "zeroconf/Helper.hxx"
#endif
#ifdef HAVE_YAJL
#include "lib/yajl/Gen.hxx"
#endif
...
...
@@ -49,8 +53,14 @@ SnapcastOutput::SnapcastOutput(EventLoop &_loop, const ConfigBlock &block)
// TODO: support other encoder plugins?
prepared_encoder
(
encoder_init
(
wave_encoder_plugin
,
block
))
{
const
unsigned
port
=
block
.
GetBlockValue
(
"port"
,
1704U
);
ServerSocketAddGeneric
(
*
this
,
block
.
GetBlockValue
(
"bind_to_address"
),
block
.
GetBlockValue
(
"port"
,
1704U
));
port
);
#ifdef HAVE_ZEROCONF
if
(
block
.
GetBlockValue
(
"zeroconf"
,
true
))
zeroconf_port
=
port
;
#endif
}
SnapcastOutput
::~
SnapcastOutput
()
noexcept
=
default
;
...
...
@@ -62,6 +72,13 @@ SnapcastOutput::Bind()
BlockingCall
(
GetEventLoop
(),
[
this
](){
ServerSocket
::
Open
();
#ifdef HAVE_ZEROCONF
if
(
zeroconf_port
>
0
)
zeroconf_helper
=
std
::
make_unique
<
ZeroconfHelper
>
(
GetEventLoop
(),
"Music Player Daemon"
,
"_snapcast._tcp"
,
zeroconf_port
);
#endif
});
// TODO: Zeroconf integration
...
...
@@ -73,6 +90,8 @@ SnapcastOutput::Unbind() noexcept
assert
(
!
open
);
BlockingCall
(
GetEventLoop
(),
[
this
](){
zeroconf_helper
.
reset
();
ServerSocket
::
Close
();
});
}
...
...
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