Commit 457d98c8 authored by Max Kellermann's avatar Max Kellermann

output/raop: delete the RAOP plugin

This plugin is horrible code, I mean it. Last year, I tried hard to fix it, but I figured would take less time to do a full rewrite. Given that I don't even have any device that supports RAOP, I can't do that properly. After 16 months, nobody volunteered for fixing it. Hereby, I delete it, because having no RAOP plugin is better than having this mess. Sorry.
parent 3c3f1b7f
......@@ -841,15 +841,6 @@ if HAVE_OSX
liboutput_plugins_a_SOURCES += src/output/osx_output_plugin.c
endif
if ENABLE_RAOP_OUTPUT
liboutput_plugins_a_SOURCES += \
src/ntp_server.c src/ntp_server.h \
src/rtsp_client.c src/rtsp_client.h \
src/output/raop_output_plugin.c
libmixer_plugins_a_SOURCES += src/mixer/raop_mixer_plugin.c
OUTPUT_LIBS += $(OPENSSL_LIBS)
endif
if HAVE_PULSE
liboutput_plugins_a_SOURCES += \
src/output/pulse_output_plugin.c src/output/pulse_output_plugin.h
......@@ -992,7 +983,6 @@ noinst_PROGRAMS = \
test/dump_playlist \
test/run_decoder \
test/read_tags \
test/run_ntp_server \
test/run_filter \
test/run_output \
test/run_convert \
......@@ -1131,14 +1121,6 @@ test_dump_rva2_SOURCES = test/dump_rva2.c \
src/tag_rva2.c
endif
test_run_ntp_server_LDADD = \
$(GLIB_LIBS)
test_run_ntp_server_SOURCES = test/run_ntp_server.c \
test/signals.c test/signals.h \
src/io_thread.c src/io_thread.h \
src/udp_server.c src/udp_server.h \
src/ntp_server.c src/ntp_server.h
test_run_filter_LDADD = \
$(FILTER_LIBS) \
$(GLIB_LIBS)
......
......@@ -24,7 +24,6 @@ ver 0.17 (2011/??/??)
- openal: improve buffer cancellation
- osx: allow user to specify other audio devices
- osx: implement 32 bit playback
- raop: new output plugin
- shout: add possibility to set url
- roar: new output plugin for RoarAudio
- winmm: fail if wrong device specified instead of using default device
......
......@@ -230,11 +230,6 @@ AC_ARG_ENABLE(httpd-output,
[enables the HTTP server output]),,
[enable_httpd_output=auto])
AC_ARG_ENABLE(raop-output,
AS_HELP_STRING([--enable-raop-output],
[enables the RAOP output]),,
[enable_raop_output=auto])
AC_ARG_ENABLE(id3,
AS_HELP_STRING([--enable-id3],
[enable id3 support]),,
......@@ -1428,17 +1423,6 @@ fi
AM_CONDITIONAL(ENABLE_SOLARIS_OUTPUT, test x$enable_solaris_output = xyes)
dnl --------------------------------- RAOP ------------------------------------
MPD_AUTO_PKG(raop_output, OPENSSL, [openssl],
[RAOP output], [OpenSSL not found])
if test x$enable_raop_output = xyes; then
AC_DEFINE(ENABLE_RAOP_OUTPUT, 1, [Define for compiling RAOP support])
fi
AM_CONDITIONAL(ENABLE_RAOP_OUTPUT, test x$enable_raop_output = xyes)
dnl --------------------------------- WinMM ---------------------------------
case "$host_os" in
......@@ -1468,7 +1452,6 @@ if
test x$enable_openal = xno &&
test x$enable_oss = xno &&
test x$enable_osx = xno &&
test x$enable_raop_output = xno &&
test x$enable_pipe_output = xno &&
test x$enable_pulse = xno &&
test x$enable_recorder_output = xno &&
......@@ -1601,7 +1584,6 @@ results(osx, [OS X])
results(pipe_output, [Pipeline])
printf '\n\t'
results(pulse, [PulseAudio])
results(raop_output, [RAOP])
results(roar,[ROAR])
results(shout, [SHOUTcast])
results(solaris_output, [Solaris])
......
/*
* Copyright (C) 2003-2009 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 "../output/raop_output_plugin.h"
#include "output_plugin.h"
#include "mixer_api.h"
struct raop_mixer_plugin {
struct mixer base;
struct raop_data *rd;
};
static struct mixer *
raop_mixer_init(void *ao, G_GNUC_UNUSED const struct config_param *param,
G_GNUC_UNUSED GError **error_r)
{
struct raop_mixer_plugin *rm = g_new(struct raop_mixer_plugin, 1);
rm->rd = (struct raop_data *) ao;
mixer_init(&rm->base, &raop_mixer_plugin);
return &rm->base;
}
static void
raop_mixer_finish(struct mixer *data)
{
struct raop_mixer_plugin *rm = (struct raop_mixer_plugin *) data;
g_free(rm);
}
static int
raop_mixer_get_volume(struct mixer *mixer, G_GNUC_UNUSED GError **error_r)
{
struct raop_mixer_plugin *rm = (struct raop_mixer_plugin *)mixer;
return raop_get_volume(rm->rd);
}
static bool
raop_mixer_set_volume(struct mixer *mixer, unsigned volume, GError **error_r)
{
struct raop_mixer_plugin *rm = (struct raop_mixer_plugin *)mixer;
return raop_set_volume(rm->rd, volume, error_r);
}
const struct mixer_plugin raop_mixer_plugin = {
.init = raop_mixer_init,
.finish = raop_mixer_finish,
.get_volume = raop_mixer_get_volume,
.set_volume = raop_mixer_set_volume,
};
......@@ -30,7 +30,6 @@ extern const struct mixer_plugin alsa_mixer_plugin;
extern const struct mixer_plugin oss_mixer_plugin;
extern const struct mixer_plugin roar_mixer_plugin;
extern const struct mixer_plugin pulse_mixer_plugin;
extern const struct mixer_plugin raop_mixer_plugin;
extern const struct mixer_plugin winmm_mixer_plugin;
#endif
/*
* Copyright (C) 2003-2011 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 "ntp_server.h"
#include "udp_server.h"
#include <glib.h>
#include <assert.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#ifdef WIN32
#include <ws2tcpip.h>
#include <winsock.h>
#else
#include <sys/socket.h>
#endif
/*
* Calculate the current NTP time, store it in the buffer.
*/
static void
fill_int(unsigned char *buffer, uint32_t value)
{
uint32_t be = GINT32_TO_BE(value);
memcpy(buffer, &be, sizeof(be));
}
/*
* Store time in the NTP format in the buffer
*/
static void
fill_time_buffer_with_time(unsigned char *buffer, struct timeval *tout)
{
unsigned long secs_to_baseline = 964697997;
double fraction;
unsigned long long_fraction;
unsigned long secs;
fraction = ((double) tout->tv_usec) / 1000000.0;
long_fraction = (unsigned long) (fraction * 256.0 * 256.0 * 256.0 * 256.0);
secs = secs_to_baseline + tout->tv_sec;
fill_int(buffer, secs);
fill_int(buffer + 4, long_fraction);
}
/*
* Calculate the current NTP time, store it in the buffer.
*/
static void
fill_time_buffer(unsigned char *buffer)
{
struct timeval current_time;
gettimeofday(&current_time,NULL);
fill_time_buffer_with_time(buffer, &current_time);
}
static void
ntp_server_datagram(int fd, const void *data, size_t num_bytes,
const struct sockaddr *source_address,
size_t source_address_length, G_GNUC_UNUSED void *ctx)
{
unsigned char buf[32];
int iter;
if (num_bytes > sizeof(buf))
num_bytes = sizeof(buf);
memcpy(buf, data, num_bytes);
fill_time_buffer(buf + 16);
// set to response
buf[1] = 0xd3;
// copy request
for (iter = 0; iter < 8; iter++) {
buf[8 + iter] = buf[24 + iter];
}
fill_time_buffer(buf + 24);
sendto(fd, (void *)buf, num_bytes, 0,
source_address, source_address_length);
}
static const struct udp_server_handler ntp_server_handler = {
.datagram = ntp_server_datagram,
};
void
ntp_server_init(struct ntp_server *ntp)
{
ntp->port = 6002;
ntp->udp = NULL;
}
bool
ntp_server_open(struct ntp_server *ntp, GError **error_r)
{
assert(ntp->udp == NULL);
ntp->udp = udp_server_new(ntp->port, &ntp_server_handler, ntp,
error_r);
return ntp->udp != NULL;
}
void
ntp_server_close(struct ntp_server *ntp)
{
if (ntp->udp != NULL) {
udp_server_free(ntp->udp);
ntp->udp = NULL;
}
}
/*
* Copyright (C) 2003-2011 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_NTP_SERVER_H
#define MPD_NTP_SERVER_H
#include <glib.h>
#include <stdbool.h>
struct timeval;
struct ntp_server {
unsigned short port;
struct udp_server *udp;
};
void
ntp_server_init(struct ntp_server *ntp);
bool
ntp_server_open(struct ntp_server *ntp, GError **error_r);
void
ntp_server_close(struct ntp_server *ntp);
#endif
/*
* Copyright (C) 2003-2011 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_RAOP_OUTPUT_PLUGIN_H
#define MPD_RAOP_OUTPUT_PLUGIN_H
#include <glib.h>
#include <stdbool.h>
struct raop_data;
extern const struct audio_output_plugin raop_output_plugin;
bool
raop_set_volume(struct raop_data *rd, unsigned volume, GError **error_r);
int
raop_get_volume(struct raop_data *rd);
#endif
......@@ -33,7 +33,6 @@
#include "output/osx_output_plugin.h"
#include "output/pipe_output_plugin.h"
#include "output/pulse_output_plugin.h"
#include "output/raop_output_plugin.h"
#include "output/recorder_output_plugin.h"
#include "output/roar_output_plugin.h"
#include "output/shout_output_plugin.h"
......@@ -69,9 +68,6 @@ const struct audio_output_plugin *audio_output_plugins[] = {
#ifdef HAVE_OSX
&osx_output_plugin,
#endif
#ifdef ENABLE_RAOP_OUTPUT
&raop_output_plugin,
#endif
#ifdef ENABLE_SOLARIS_OUTPUT
&solaris_output_plugin,
#endif
......
/*
* Copyright (C) 2003-2011 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.
*/
/*
* Based on the RTSP client by Shiro Ninomiya <shiron@snino.com>
*/
#ifndef MPD_RTSP_CLIENT_H
#define MPD_RTSP_CLIENT_H
#include <stdbool.h>
#include <glib.h>
#ifdef WIN32
#include <ws2tcpip.h>
#include <winsock.h>
#else
#include <netinet/in.h>
#endif
struct key_data {
char *key;
char *data;
struct key_data *next;
};
struct rtspcl_data {
GMutex *mutex;
GCond *cond;
GQueue *received_lines;
struct tcp_socket *tcp_socket;
char url[128];
int cseq;
struct key_data *exthds;
char *session;
char *transport;
unsigned short server_port;
unsigned short control_port;
struct in_addr host_addr;
struct in_addr local_addr;
const char *useragent;
};
/**
* The quark used for GError.domain.
*/
static inline GQuark
rtsp_client_quark(void)
{
return g_quark_from_static_string("rtsp_client");
}
void
free_kd(struct key_data *kd);
char *
kd_lookup(struct key_data *kd, const char *key);
G_GNUC_MALLOC
struct rtspcl_data *
rtspcl_open(void);
bool
rtspcl_connect(struct rtspcl_data *rtspcld, const char *host, short destport,
const char *sid, GError **error_r);
void
rtspcl_close(struct rtspcl_data *rtspcld);
void
rtspcl_add_exthds(struct rtspcl_data *rtspcld, const char *key, char *data);
bool
exec_request(struct rtspcl_data *rtspcld, const char *cmd,
const char *content_type, const char *content,
int get_response,
const struct key_data *hds, struct key_data **kd,
GError **error_r);
bool
rtspcl_set_parameter(struct rtspcl_data *rtspcld, const char *parameter,
GError **error_r);
void
rtspcl_set_useragent(struct rtspcl_data *rtspcld, const char *name);
bool
rtspcl_announce_sdp(struct rtspcl_data *rtspcld, const char *sdp,
GError **error_r);
bool
rtspcl_setup(struct rtspcl_data *rtspcld, struct key_data **kd,
int control_port, int ntp_port,
GError **error_r);
bool
rtspcl_record(struct rtspcl_data *rtspcld,
int seq_num, int rtptime,
GError **error_r);
char *
rtspcl_local_ip(struct rtspcl_data *rtspcld);
#endif
......@@ -83,25 +83,6 @@ roar_output_set_volume(G_GNUC_UNUSED struct roar *roar,
#endif
#ifdef ENABLE_RAOP_OUTPUT
#include "output/raop_output_plugin.h"
bool
raop_set_volume(G_GNUC_UNUSED struct raop_data *rd,
G_GNUC_UNUSED unsigned volume,
G_GNUC_UNUSED GError **error_r)
{
return false;
}
int
raop_get_volume(G_GNUC_UNUSED struct raop_data *rd)
{
return -1;
}
#endif
void
event_pipe_emit(G_GNUC_UNUSED enum pipe_event event)
{
......
/*
* Copyright (C) 2003-2011 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 "config.h"
#include "ntp_server.h"
#include "signals.h"
#include "io_thread.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#ifdef WIN32
#include <ws2tcpip.h>
#include <winsock.h>
#else
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#endif
void
on_quit(void)
{
io_thread_quit();
}
int
main(G_GNUC_UNUSED int argc, G_GNUC_UNUSED char **argv)
{
g_thread_init(NULL);
signals_init();
io_thread_init();
struct ntp_server ntp;
ntp_server_init(&ntp);
GError *error = NULL;
if (!ntp_server_open(&ntp, &error)) {
io_thread_deinit();
g_printerr("%s\n", error->message);
g_error_free(error);
return EXIT_FAILURE;
}
io_thread_run();
ntp_server_close(&ntp);
io_thread_deinit();
return EXIT_SUCCESS;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment