httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
/*
|
2017-01-03 20:48:59 +01:00
|
|
|
* Copyright 2003-2017 The Music Player Daemon Project
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
*
|
|
|
|
* Internal declarations for the "httpd" audio output plugin.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MPD_OUTPUT_HTTPD_INTERNAL_H
|
|
|
|
#define MPD_OUTPUT_HTTPD_INTERNAL_H
|
|
|
|
|
2015-10-19 15:18:47 +02:00
|
|
|
#include "HttpdClient.hxx"
|
2017-08-09 16:58:44 +02:00
|
|
|
#include "output/Interface.hxx"
|
2014-02-19 09:08:29 +01:00
|
|
|
#include "output/Timer.hxx"
|
2013-01-15 18:22:17 +01:00
|
|
|
#include "thread/Mutex.hxx"
|
2017-04-28 21:45:47 +02:00
|
|
|
#include "thread/Cond.hxx"
|
2013-01-30 13:20:27 +01:00
|
|
|
#include "event/ServerSocket.hxx"
|
2013-12-31 16:31:36 +01:00
|
|
|
#include "event/DeferredMonitor.hxx"
|
2013-12-26 11:42:34 +01:00
|
|
|
#include "util/Cast.hxx"
|
2014-08-30 00:46:52 +02:00
|
|
|
#include "Compiler.h"
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2016-03-01 22:08:13 +01:00
|
|
|
#include <boost/intrusive/list.hpp>
|
|
|
|
|
2013-12-31 16:31:36 +01:00
|
|
|
#include <queue>
|
|
|
|
#include <list>
|
2013-01-15 18:22:17 +01:00
|
|
|
|
2015-01-21 22:13:44 +01:00
|
|
|
struct ConfigBlock;
|
2013-01-30 13:29:21 +01:00
|
|
|
class EventLoop;
|
2013-01-30 12:56:23 +01:00
|
|
|
class ServerSocket;
|
2013-01-15 18:22:17 +01:00
|
|
|
class HttpdClient;
|
2016-05-04 18:29:31 +02:00
|
|
|
class PreparedEncoder;
|
2016-05-04 09:31:21 +02:00
|
|
|
class Encoder;
|
2013-07-30 20:11:57 +02:00
|
|
|
struct Tag;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
class HttpdOutput final : AudioOutput, ServerSocket, DeferredMonitor {
|
2009-11-05 23:47:29 +01:00
|
|
|
/**
|
|
|
|
* True if the audio output is open and accepts client
|
|
|
|
* connections.
|
|
|
|
*/
|
|
|
|
bool open;
|
|
|
|
|
2017-05-23 11:13:41 +02:00
|
|
|
bool pause;
|
|
|
|
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
/**
|
|
|
|
* The configured encoder plugin.
|
|
|
|
*/
|
2016-05-04 09:31:21 +02:00
|
|
|
PreparedEncoder *prepared_encoder = nullptr;
|
2017-11-10 21:15:57 +01:00
|
|
|
Encoder *encoder = nullptr;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2010-08-06 22:18:01 +02:00
|
|
|
/**
|
|
|
|
* Number of bytes which were fed into the encoder, without
|
|
|
|
* ever receiving new output. This is used to estimate
|
|
|
|
* whether MPD should manually flush the encoder, to avoid
|
|
|
|
* buffer underruns in the client.
|
|
|
|
*/
|
2017-11-10 21:15:57 +01:00
|
|
|
size_t unflushed_input = 0;
|
2010-08-06 22:18:01 +02:00
|
|
|
|
2013-12-31 16:54:00 +01:00
|
|
|
public:
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
/**
|
|
|
|
* The MIME type produced by the #encoder.
|
|
|
|
*/
|
|
|
|
const char *content_type;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This mutex protects the listener socket and the client
|
|
|
|
* list.
|
|
|
|
*/
|
2013-01-15 18:22:17 +01:00
|
|
|
mutable Mutex mutex;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2013-12-31 16:31:36 +01:00
|
|
|
/**
|
|
|
|
* This condition gets signalled when an item is removed from
|
|
|
|
* #pages.
|
|
|
|
*/
|
|
|
|
Cond cond;
|
|
|
|
|
2013-12-31 16:54:00 +01:00
|
|
|
private:
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
/**
|
2013-05-12 15:03:42 +02:00
|
|
|
* A #Timer object to synchronize this output with the
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
* wallclock.
|
|
|
|
*/
|
2013-05-12 15:03:42 +02:00
|
|
|
Timer *timer;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The header page, which is sent to every client on connect.
|
|
|
|
*/
|
2017-02-19 20:12:30 +01:00
|
|
|
PagePtr header;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2009-04-13 19:35:02 +02:00
|
|
|
/**
|
|
|
|
* The metadata, which is sent to every client.
|
|
|
|
*/
|
2017-02-19 20:12:30 +01:00
|
|
|
PagePtr metadata;
|
2009-04-13 19:35:02 +02:00
|
|
|
|
2013-12-31 16:31:36 +01:00
|
|
|
/**
|
|
|
|
* The page queue, i.e. pages from the encoder to be
|
|
|
|
* broadcasted to all clients. This container is necessary to
|
|
|
|
* pass pages from the OutputThread to the IOThread. It is
|
|
|
|
* protected by #mutex, and removing signals #cond.
|
|
|
|
*/
|
2017-02-19 20:12:30 +01:00
|
|
|
std::queue<PagePtr, std::list<PagePtr>> pages;
|
2013-12-31 16:31:36 +01:00
|
|
|
|
2013-12-31 16:54:00 +01:00
|
|
|
public:
|
2010-04-05 13:11:10 +02:00
|
|
|
/**
|
|
|
|
* The configured name.
|
|
|
|
*/
|
|
|
|
char const *name;
|
|
|
|
/**
|
|
|
|
* The configured genre.
|
|
|
|
*/
|
|
|
|
char const *genre;
|
|
|
|
/**
|
|
|
|
* The configured website address.
|
|
|
|
*/
|
|
|
|
char const *website;
|
|
|
|
|
2013-12-31 16:54:00 +01:00
|
|
|
private:
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
/**
|
|
|
|
* A linked list containing all clients which are currently
|
|
|
|
* connected.
|
|
|
|
*/
|
2015-10-19 15:18:47 +02:00
|
|
|
boost::intrusive::list<HttpdClient,
|
|
|
|
boost::intrusive::constant_time_size<true>> clients;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A temporary buffer for the httpd_output_read_page()
|
|
|
|
* function.
|
|
|
|
*/
|
|
|
|
char buffer[32768];
|
2009-10-29 22:38:18 +01:00
|
|
|
|
|
|
|
/**
|
2011-02-04 10:39:21 +01:00
|
|
|
* The maximum and current number of clients connected
|
2009-10-29 22:38:18 +01:00
|
|
|
* at the same time.
|
|
|
|
*/
|
2015-10-19 15:18:47 +02:00
|
|
|
unsigned clients_max;
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2013-12-31 16:54:00 +01:00
|
|
|
public:
|
2016-10-28 21:27:29 +02:00
|
|
|
HttpdOutput(EventLoop &_loop, const ConfigBlock &block);
|
2013-01-30 13:29:21 +01:00
|
|
|
~HttpdOutput();
|
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
static AudioOutput *Create(EventLoop &event_loop,
|
|
|
|
const ConfigBlock &block) {
|
|
|
|
return new HttpdOutput(event_loop, block);
|
2013-12-31 16:59:18 +01:00
|
|
|
}
|
|
|
|
|
2014-01-05 02:13:21 +01:00
|
|
|
using DeferredMonitor::GetEventLoop;
|
|
|
|
|
2016-10-28 10:36:05 +02:00
|
|
|
void Bind();
|
2013-01-27 23:23:46 +01:00
|
|
|
void Unbind();
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
void Enable() override {
|
2017-01-25 10:03:17 +01:00
|
|
|
Bind();
|
|
|
|
}
|
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
void Disable() noexcept override {
|
2017-01-25 10:03:17 +01:00
|
|
|
Unbind();
|
|
|
|
}
|
|
|
|
|
2013-01-27 23:23:46 +01:00
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
2016-11-07 09:20:12 +01:00
|
|
|
*
|
|
|
|
* Throws #std::runtime_error on error.
|
2013-01-27 23:23:46 +01:00
|
|
|
*/
|
2016-11-07 09:20:12 +01:00
|
|
|
void OpenEncoder(AudioFormat &audio_format);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
2017-08-09 16:58:44 +02:00
|
|
|
void Open(AudioFormat &audio_format) override;
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
2017-08-09 16:58:44 +02:00
|
|
|
void Close() noexcept override;
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether there is at least one client.
|
|
|
|
*
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
|
|
|
gcc_pure
|
2017-06-03 21:33:44 +02:00
|
|
|
bool HasClients() const noexcept {
|
2013-01-27 23:23:46 +01:00
|
|
|
return !clients.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether there is at least one client.
|
|
|
|
*/
|
|
|
|
gcc_pure
|
2017-06-03 21:33:44 +02:00
|
|
|
bool LockHasClients() const noexcept {
|
2017-01-03 07:11:57 +01:00
|
|
|
const std::lock_guard<Mutex> protect(mutex);
|
2013-01-27 23:23:46 +01:00
|
|
|
return HasClients();
|
|
|
|
}
|
|
|
|
|
2017-11-10 20:43:14 +01:00
|
|
|
void AddClient(UniqueSocketDescriptor fd);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Removes a client from the httpd_output.clients linked list.
|
|
|
|
*/
|
|
|
|
void RemoveClient(HttpdClient &client);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Sends the encoder header to the client. This is called
|
|
|
|
* right after the response headers have been sent.
|
|
|
|
*/
|
|
|
|
void SendHeader(HttpdClient &client) const;
|
|
|
|
|
2013-12-31 17:01:08 +01:00
|
|
|
gcc_pure
|
2017-08-09 16:58:44 +02:00
|
|
|
std::chrono::steady_clock::duration Delay() const noexcept override;
|
2013-12-31 17:01:08 +01:00
|
|
|
|
2013-01-27 23:23:46 +01:00
|
|
|
/**
|
|
|
|
* Reads data from the encoder (as much as available) and
|
|
|
|
* returns it as a new #page object.
|
|
|
|
*/
|
2017-02-19 20:12:30 +01:00
|
|
|
PagePtr ReadPage();
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcasts a page struct to all clients.
|
|
|
|
*
|
|
|
|
* Mutext must not be locked.
|
|
|
|
*/
|
2017-02-19 20:12:30 +01:00
|
|
|
void BroadcastPage(PagePtr page);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcasts data from the encoder to all clients.
|
|
|
|
*/
|
|
|
|
void BroadcastFromEncoder();
|
|
|
|
|
2016-11-07 09:20:12 +01:00
|
|
|
/**
|
|
|
|
* Throws #std::runtime_error on error.
|
|
|
|
*/
|
|
|
|
void EncodeAndPlay(const void *chunk, size_t size);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
void SendTag(const Tag &tag) override;
|
2013-01-30 13:20:27 +01:00
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
size_t Play(const void *chunk, size_t size) override;
|
2013-12-31 17:01:08 +01:00
|
|
|
|
|
|
|
void CancelAllClients();
|
|
|
|
|
2017-08-09 16:58:44 +02:00
|
|
|
void Cancel() noexcept override;
|
2017-09-08 14:45:53 +02:00
|
|
|
bool Pause() override;
|
2017-01-25 10:03:17 +01:00
|
|
|
|
2013-01-30 13:20:27 +01:00
|
|
|
private:
|
2013-12-31 16:31:36 +01:00
|
|
|
virtual void RunDeferred() override;
|
|
|
|
|
2017-11-10 20:43:14 +01:00
|
|
|
void OnAccept(UniqueSocketDescriptor fd,
|
2017-08-10 19:13:18 +02:00
|
|
|
SocketAddress address, int uid) override;
|
2013-01-27 23:23:46 +01:00
|
|
|
};
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
|
2013-09-27 22:31:24 +02:00
|
|
|
extern const class Domain httpd_output_domain;
|
|
|
|
|
httpd: new output plugin to replace "shout"
Let's get rid of the "shout" plugin, and the awfully complicated
icecast daemon setup! MPD can do better if it's doing the HTTP server
stuff on its own. This new plugin has several advantages:
- easier to set up - only one daemon, no password settings, no mount
settings
- MPD controls the encoder and thus already knows the packet
boundaries - icecast has to parse them
- MPD doesn't bother to encode data while nobody is listening
This implementation is very experimental (no header parsing, ignores
request URI, no icy-metadata, ...). It should be able to suport
several encoders in parallel in the future (with different bit rates,
different codec, ...), to make MPD the perfect streaming server. Once
MPD gets multi-player support, we can even mount several different
radio stations on one server.
2009-03-15 03:32:34 +01:00
|
|
|
#endif
|