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
|
|
|
/*
|
2014-01-13 22:30:36 +01:00
|
|
|
* Copyright (C) 2003-2014 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
|
|
|
|
|
2014-02-19 09:08:29 +01:00
|
|
|
#include "output/Internal.hxx"
|
|
|
|
#include "output/Timer.hxx"
|
2013-01-15 18:22:17 +01:00
|
|
|
#include "thread/Mutex.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"
|
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-11-11 08:31:40 +01:00
|
|
|
#ifdef _LIBCPP_VERSION
|
|
|
|
/* can't use incomplete template arguments with libc++ */
|
|
|
|
#include "HttpdClient.hxx"
|
|
|
|
#endif
|
|
|
|
|
2013-01-15 18:22:17 +01:00
|
|
|
#include <forward_list>
|
2013-12-31 16:31:36 +01:00
|
|
|
#include <queue>
|
|
|
|
#include <list>
|
2013-01-15 18:22:17 +01:00
|
|
|
|
2013-01-30 13:29:21 +01:00
|
|
|
struct config_param;
|
2013-08-10 18:02:44 +02:00
|
|
|
class Error;
|
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;
|
2013-01-30 13:42:16 +01:00
|
|
|
class Page;
|
2013-07-30 09:04:05 +02:00
|
|
|
struct 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
|
|
|
|
2013-12-31 16:31:36 +01:00
|
|
|
class HttpdOutput final : ServerSocket, DeferredMonitor {
|
2014-01-28 11:34:09 +01:00
|
|
|
AudioOutput base;
|
2011-09-16 23:31:48 +02:00
|
|
|
|
2009-11-05 23:47:29 +01:00
|
|
|
/**
|
|
|
|
* True if the audio output is open and accepts client
|
|
|
|
* connections.
|
|
|
|
*/
|
|
|
|
bool open;
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-07-30 09:04:05 +02:00
|
|
|
Encoder *encoder;
|
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.
|
|
|
|
*/
|
|
|
|
size_t unflushed_input;
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-01-30 09:18:52 +01:00
|
|
|
Page *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.
|
|
|
|
*/
|
2013-01-30 09:18:52 +01:00
|
|
|
Page *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.
|
|
|
|
*/
|
|
|
|
std::queue<Page *, std::list<Page *>> pages;
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-01-15 18:22:17 +01:00
|
|
|
std::forward_list<HttpdClient> 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.
|
|
|
|
*/
|
2013-10-02 12:20:36 +02:00
|
|
|
unsigned clients_max, clients_cnt;
|
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:
|
2013-01-30 13:29:21 +01:00
|
|
|
HttpdOutput(EventLoop &_loop);
|
|
|
|
~HttpdOutput();
|
|
|
|
|
2013-12-31 16:59:18 +01:00
|
|
|
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
|
|
|
|
#pragma GCC diagnostic push
|
|
|
|
#pragma GCC diagnostic ignored "-Winvalid-offsetof"
|
|
|
|
#endif
|
|
|
|
|
2014-01-28 11:34:09 +01:00
|
|
|
static constexpr HttpdOutput *Cast(AudioOutput *ao) {
|
2013-12-26 11:42:34 +01:00
|
|
|
return ContainerCast(ao, HttpdOutput, base);
|
2013-12-31 16:59:18 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
#if GCC_CHECK_VERSION(4,6) || defined(__clang__)
|
|
|
|
#pragma GCC diagnostic pop
|
|
|
|
#endif
|
|
|
|
|
2014-01-05 02:13:21 +01:00
|
|
|
using DeferredMonitor::GetEventLoop;
|
|
|
|
|
2013-12-31 16:55:26 +01:00
|
|
|
bool Init(const config_param ¶m, Error &error);
|
|
|
|
|
2013-08-10 18:02:44 +02:00
|
|
|
bool Configure(const config_param ¶m, Error &error);
|
2013-01-30 13:29:21 +01:00
|
|
|
|
2014-01-28 11:34:09 +01:00
|
|
|
AudioOutput *InitAndConfigure(const config_param ¶m,
|
2013-12-31 16:55:26 +01:00
|
|
|
Error &error) {
|
|
|
|
if (!Init(param, error))
|
|
|
|
return nullptr;
|
|
|
|
|
2014-01-28 12:24:48 +01:00
|
|
|
if (!Configure(param, error))
|
2013-12-31 16:55:26 +01:00
|
|
|
return nullptr;
|
|
|
|
|
|
|
|
return &base;
|
|
|
|
}
|
|
|
|
|
2013-08-10 18:02:44 +02:00
|
|
|
bool Bind(Error &error);
|
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
|
|
|
|
2013-01-27 23:23:46 +01:00
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
2013-08-10 18:02:44 +02:00
|
|
|
bool OpenEncoder(AudioFormat &audio_format, Error &error);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
2013-08-10 18:02:44 +02:00
|
|
|
bool Open(AudioFormat &audio_format, Error &error);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
|
|
|
void Close();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether there is at least one client.
|
|
|
|
*
|
|
|
|
* Caller must lock the mutex.
|
|
|
|
*/
|
|
|
|
gcc_pure
|
|
|
|
bool HasClients() const {
|
|
|
|
return !clients.empty();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Check whether there is at least one client.
|
|
|
|
*/
|
|
|
|
gcc_pure
|
|
|
|
bool LockHasClients() const {
|
|
|
|
const ScopeLock protect(mutex);
|
|
|
|
return HasClients();
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddClient(int fd);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|
|
|
|
unsigned Delay() const;
|
|
|
|
|
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.
|
|
|
|
*/
|
2013-01-30 09:18:52 +01:00
|
|
|
Page *ReadPage();
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcasts a page struct to all clients.
|
|
|
|
*
|
|
|
|
* Mutext must not be locked.
|
|
|
|
*/
|
2013-01-30 09:18:52 +01:00
|
|
|
void BroadcastPage(Page *page);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Broadcasts data from the encoder to all clients.
|
|
|
|
*/
|
|
|
|
void BroadcastFromEncoder();
|
|
|
|
|
2013-08-10 18:02:44 +02:00
|
|
|
bool EncodeAndPlay(const void *chunk, size_t size, Error &error);
|
2013-01-27 23:23:46 +01:00
|
|
|
|
2013-07-30 20:11:57 +02:00
|
|
|
void SendTag(const Tag *tag);
|
2013-01-30 13:20:27 +01:00
|
|
|
|
2013-12-31 17:01:08 +01:00
|
|
|
size_t Play(const void *chunk, size_t size, Error &error);
|
|
|
|
|
|
|
|
void CancelAllClients();
|
|
|
|
|
2013-01-30 13:20:27 +01:00
|
|
|
private:
|
2013-12-31 16:31:36 +01:00
|
|
|
virtual void RunDeferred() override;
|
|
|
|
|
2013-01-30 13:20:27 +01:00
|
|
|
virtual void OnAccept(int fd, const sockaddr &address,
|
|
|
|
size_t address_length, 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
|