Index: ChangeLog
===================================================================
--- ChangeLog	(revision 5721)
+++ ChangeLog	(revision 5740)
@@ -5,4 +5,6 @@
 	* Added new plugins: dmx-random, dmx-waveform, protocol-http.
 	* Added CPI support to roarpluginrunner.
+	* Moved protocol support into new plugins protocol-esound,
+	  protocol-rplay and protocol-gopher (Closes: #311)
 
 v. 1.0beta7 - Tue Oct 23 2012 23:28 CEST
Index: plugins/roard/Makefile
===================================================================
--- plugins/roard/Makefile	(revision 5711)
+++ plugins/roard/Makefile	(revision 5740)
@@ -2,5 +2,8 @@
 include ../../Makefile.inc
 
-TARGETS=protocol-irc$(SHARED_SUFFIX) listenpty$(SHARED_SUFFIX) dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX)
+TARGETS_PROTO=protocol-irc$(SHARED_SUFFIX) protocol-esound$(SHARED_SUFFIX) protocol-rplay$(SHARED_SUFFIX) protocol-gopher$(SHARED_SUFFIX)
+TARGETS_DMX=dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX)
+TARGETS_MISC=listenpty$(SHARED_SUFFIX)
+TARGETS=$(TARGETS_PROTO) $(TARGETS_DMX) $(TARGETS_MISC)
 
 #DEFINES        = -DDEBUG
Index: plugins/roard/protocol-esound.c
===================================================================
--- plugins/roard/protocol-esound.c	(revision 5739)
+++ plugins/roard/protocol-esound.c	(revision 5740)
@@ -24,5 +24,5 @@
  */
 
-#include "roard.h"
+#include <roard/include/roard.h>
 
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD
@@ -46,5 +46,4 @@
 
 static int emul_esd_int_read_buf  (int client, int * data, void * buf);
-static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio);
 static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio);
 static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio);
@@ -166,4 +165,7 @@
 
 static int emul_esd_set_proto(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
+
+ (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
+
  if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, vio) == -1 )
   return -1;
@@ -174,4 +176,6 @@
 static int emul_esd_check_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
  _cmd_t cmd;
+
+ (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
 
  if ( client == -1 )
@@ -190,21 +194,10 @@
  _cmd_t d;
 
+ (void)client;
+
  if ( data == NULL || buf == NULL )
   return -1;
 
  d = *(_cmd_t*)buf;
-
- *data = d;
-
- return 0;
-}
-static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio) {
- _cmd_t d;
-
- if ( data == NULL )
-  return -1;
-
- if ( roar_vio_read(vio, &d, _INTSIZE) != _INTSIZE )
-  return -1;
 
  *data = d;
@@ -216,4 +209,6 @@
  _cmd_t d = data;
 
+ (void)client;
+
  return roar_vio_write(vio, &d, _INTSIZE) == _INTSIZE ? 0 : -1;
 }
@@ -221,4 +216,7 @@
 static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio) {
  // accept all clients for the moment.
+
+ (void)data;
+
  return emul_esd_int_write(client, 1, vio);
 }
@@ -247,4 +245,6 @@
 // handler:
 static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
+
+ (void)cmd;
 
  ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio);
@@ -356,4 +356,6 @@
  int lag = ROAR_OUTPUT_CFREQ;
 
+ (void)cmd, (void)data;
+
  lag *= 2.0 * 44100.0 / (float)g_sa->rate;
  
@@ -382,4 +384,6 @@
 static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) {
  int mode = ESM_ERROR;
+
+ (void)cmd, (void)data;
 
  if ( g_standby ) {
@@ -402,4 +406,6 @@
  int ok = 0;
 
+ (void)cmd;
+
  emul_esd_int_read_buf(client, &stream, data + 0*_INTSIZE);
  emul_esd_int_read_buf(client, &left,   data + 1*_INTSIZE);
@@ -423,4 +429,6 @@
  int rate    = g_sa->rate;
  int format  = 0;
+
+ (void)cmd, (void)data;
 
  switch (g_sa->bits) {
@@ -556,5 +564,5 @@
 }
 
-struct roar_dl_proto __proto_common_esd = {
+static struct roar_dl_proto __proto_common_esd = {
  .proto = ROAR_PROTO_ESOUND,
  .description = "EsounD emulation",
@@ -564,4 +572,22 @@
 };
 
+static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
+ (void)para, (void)lib;
+ ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_esd, ROAR_DL_PROTO_VERSION);
+ return 0;
+}
+
+ROAR_DL_PLUGIN_START(protocol_esd) {
+ ROARD_DL_CHECK_VERSIONS();
+
+ ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-esd", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
+ ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
+ ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
+ ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
+ ROAR_DL_PLUGIN_META_DESC("Implementation of the Enlightened Sound Daemon's protocol");
+
+ ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
+} ROAR_DL_PLUGIN_END
+
 #endif
 #endif
Index: plugins/roard/protocol-gopher.c
===================================================================
--- plugins/roard/protocol-gopher.c	(revision 5739)
+++ plugins/roard/protocol-gopher.c	(revision 5740)
@@ -24,5 +24,15 @@
  */
 
-#include "roard.h"
+#include <roard/include/roard.h>
+
+#ifndef DISTRIBUTION_VERSION_STRING
+#define DISTRIBUTION_VERSION_STRING ""
+#endif
+#ifndef PACKAGE_VERSION
+#define PACKAGE_VERSION ""
+#endif
+#ifndef DEVICE_VENDOR_STRING
+#define DEVICE_VENDOR_STRING ""
+#endif
 
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER
@@ -93,5 +103,5 @@
 
 static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio);
-static int send_text (int client, const char * text, struct roar_vio_calls * vio);
+static int send_text (const char * text, struct roar_buffer ** obuffer);
 
 
@@ -100,4 +110,6 @@
  const size_t len = 1024;
  const char * server_version = NULL;
+
+ (void)client, (void)vio, (void)selector, (void)text, (void)sitem;
 
  if ( DISTRIBUTION_VERSION_STRING[0] == 0 ) {
@@ -138,4 +150,6 @@
  size_t len;
 
+ (void)client, (void)vio;
+
  toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1);
 
@@ -169,4 +183,6 @@
  size_t i;
  int ret;
+
+ (void)selector, (void)text, (void)sitem;
 
  memset(items, 0, sizeof(items));
@@ -224,4 +240,6 @@
  int ret;
 
+ (void)selector, (void)text, (void)sitem;
+
  memset(items, 0, sizeof(items));
 
@@ -281,4 +299,6 @@
  char tmp[80];
 
+ (void)text;
+
  memset(items, 0, sizeof(items));
 
@@ -356,4 +376,6 @@
  int id;
 
+ (void)text;
+
  memset(items, 0, sizeof(items));
 
@@ -391,5 +413,5 @@
                             s->info.rate, s->info.bits, s->info.channels, roar_codec2str(s->info.codec));
 
- if ( ss->codec_orgi != -1 && ss->codec_orgi != s->info.codec ) {
+ if ( ss->codec_orgi != ROAR_AUDIO_INFO_INVALID && ss->codec_orgi != s->info.codec ) {
   item = &(items[menu.items_len++]);
   item->type = _INFO;
@@ -431,4 +453,6 @@
  size_t i;
 
+ (void)selector, (void)text, (void)sitem;
+
  memset(items, 0, sizeof(items));
 
@@ -472,4 +496,6 @@
  int stream = -1;
 
+ (void)vio, (void)text;
+
  toks = roar_mm_strseltok(sitem->selector, selector, tok, 5);
 
@@ -496,5 +522,5 @@
  info.codec    = roar_str2codec(tok[4]);
 
- if ( info.codec == -1 )
+ if ( info.codec == ROAR_AUDIO_INFO_INVALID )
   return -1;
 
@@ -593,6 +619,6 @@
     break;
    default:
-     host = item->host == NULL ? sockaddr.addr : item->host;
-     port = item->port ==    0 ? sockaddr.port : item->port;
+     host = item->host == NULL ?               sockaddr.addr : item->host;
+     port = item->port ==    0 ? (unsigned int)sockaddr.port : item->port;
      snprintf(data, len-1, "%c%s\t%s\t%s\t%u\r\n", item->type, item->name, item->selector, host, port);
     break;
@@ -615,5 +641,5 @@
 }
 
-static int send_text (int client, const char * text, struct roar_vio_calls * vio) {
+static int send_text (const char * text, struct roar_buffer ** obuffer) {
  struct roar_buffer * buf;
  void * data;
@@ -626,5 +652,6 @@
  //memcpy(data+len, "\r\n.\r\n\0", 6);
  memcpy(data+len, "\0", 1);
- clients_add_output(client, &buf);
+ if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 )
+  return -1;
 
  return 0;
@@ -642,4 +669,6 @@
  char * text;
 
+ (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
+
  ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio);
 
@@ -718,5 +747,5 @@
 
   if ( funcret == 0 && text != NULL )
-   funcret = send_text(client, text, vio);
+   funcret = send_text(text, obuffer);
 
   if ( text != NULL )
@@ -728,5 +757,5 @@
     break;
    case _FILE:
-     funcret = send_text(client, c->text, vio);
+     funcret = send_text(c->text, obuffer);
     break;
    default:
@@ -749,4 +778,7 @@
 
 static int emul_gopher_flushed_client(int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
+
+ (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
+
  ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio);
 
@@ -754,5 +786,5 @@
 }
 
-struct roar_dl_proto __proto_common_gopher = {
+static struct roar_dl_proto __proto_common_gopher = {
  .proto = ROAR_PROTO_GOPHER,
  .description = "The Internet Gopher Protocol",
@@ -762,4 +794,22 @@
 };
 
+static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
+ (void)para, (void)lib;
+ ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_gopher, ROAR_DL_PROTO_VERSION);
+ return 0;
+}
+
+ROAR_DL_PLUGIN_START(protocol_gopher) {
+ ROARD_DL_CHECK_VERSIONS();
+
+ ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-gopher", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
+ ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
+ ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
+ ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
+ ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet Gopher protocol");
+
+ ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
+} ROAR_DL_PLUGIN_END
+
 #endif
 
Index: plugins/roard/protocol-rplay.c
===================================================================
--- plugins/roard/protocol-rplay.c	(revision 5739)
+++ plugins/roard/protocol-rplay.c	(revision 5740)
@@ -24,5 +24,5 @@
  */
 
-#include "roard.h"
+#include <roard/include/roard.h>
 
 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY
@@ -83,7 +83,7 @@
 static inline int is_true(const char * str) {
  const char * ts[] = {"true", "t", "1", "yes", "y", "on"};
- int i;
-
- for (i = 0; i < sizeof(ts)/sizeof(*ts); i++)
+ size_t i;
+
+ for (i = 0; i < (sizeof(ts)/sizeof(*ts)); i++)
   if ( !strcasecmp(str, ts[i]) )
    return 1;
@@ -137,4 +137,7 @@
 
 static int emul_rplay_set_proto  (int client, struct roar_vio_calls * vio, struct roar_buffer ** obuffer, void ** userdata, const struct roar_keyval * protopara, ssize_t protoparalen, struct roar_dl_librarypara * pluginpara) {
+
+ (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
+
  if ( emul_rplay_on_status(client, NULL, vio, NULL, 0) == -1 )
   return -1;
@@ -146,4 +149,6 @@
  char buf[1024];
  ssize_t len;
+
+ (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara;
 
  if ( client == -1 )
@@ -210,4 +215,6 @@
  const char * cd = NULL;
 
+ (void)client;
+
  if ( cmd != NULL ) {
   command = cmd->name;
@@ -236,4 +243,6 @@
        int    fragsize  = ROAR_OUTPUT_CALC_OUTBUFSIZE(g_sa);
        int    h, m, s;
+
+ (void)client, (void)cmd, (void)kv, (void)kvlen;
 
  s  = g_pos / g_sa->rate / g_sa->channels;
@@ -281,4 +290,7 @@
 
 static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
+
+ (void)client, (void)cmd, (void)vio, (void)kv, (void)kvlen;
+
  return -1;
 }
@@ -286,4 +298,6 @@
 static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) {
  struct emul_rplay_command * c;
+
+ (void)client, (void)cmd, (void)kv, (void)kvlen;
 
  roar_vio_printf(vio, "+message=\"command summary\" command=help\n");
@@ -504,5 +518,5 @@
 //static int emul_rplay_on_stop(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen);
 
-struct roar_dl_proto __proto_common_rplay = {
+static struct roar_dl_proto __proto_common_rplay = {
  .proto = ROAR_PROTO_RPLAY,
  .description = "RPlay emulation",
@@ -512,4 +526,22 @@
 };
 
+static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) {
+ (void)para, (void)lib;
+ ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_rplay, ROAR_DL_PROTO_VERSION);
+ return 0;
+}
+
+ROAR_DL_PLUGIN_START(protocol_rplay) {
+ ROARD_DL_CHECK_VERSIONS();
+
+ ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-rplay", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO);
+ ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING);
+ ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0);
+ ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org");
+ ROAR_DL_PLUGIN_META_DESC("Implementation of the RPlay protocol");
+
+ ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto);
+} ROAR_DL_PLUGIN_END
+
 #endif
 
Index: roard/Makefile
===================================================================
--- roard/Makefile	(revision 5575)
+++ roard/Makefile	(revision 5740)
@@ -6,5 +6,5 @@
 CF_CODEC=codecfilter_cmd.o codecfilter_vorbis.o codecfilter_celt.o codecfilter_speex.o codecfilter_alaw.o codecfilter_mulaw.o codecfilter_sndfile.o codecfilter_fishsound.o codecfilter_flac.o
 CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o codecfilter_au.o
-EMUL=emul_esd.o emul_simple.o emul_rsound.o emul_rplay.o emul_gopher.o
+EMUL=emul_simple.o emul_rsound.o
 HWMIXER=hwmixer_dstr.o hwmixer_oss.o
 
Index: roard/clients.c
===================================================================
--- roard/clients.c	(revision 5739)
+++ roard/clients.c	(revision 5740)
@@ -33,23 +33,7 @@
 struct roar_client_server * g_clients[ROAR_CLIENTS_MAX];
 
-extern struct roar_dl_proto __proto_common_rplay;
-extern struct roar_dl_proto __proto_common_gopher;
-extern struct roar_dl_proto __proto_common_esd;
-
 static struct roard_proto_handle __protos[MAX_PROTOS] = {
  {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN,
  .impl = {.buildin = 0}},
-#if !defined(ROAR_WITHOUT_DCOMP_EMUL_ESD) && defined(ROAR_HAVE_H_ESD)
- {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
- .impl = {.common = &__proto_common_esd}},
-#endif
-#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY
- {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
- .impl = {.common = &__proto_common_rplay}},
-#endif
-#ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER
- {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,
- .impl = {.common = &__proto_common_gopher}},
-#endif
  {.proto = -1}
 };
Index: roard/include/roard.h
===================================================================
--- roard/include/roard.h	(revision 5624)
+++ roard/include/roard.h	(revision 5740)
@@ -120,9 +120,6 @@
 #include "commands.h"
 #include "req.h"
-#include "emul_esd.h" /* MFOI */
 #include "emul_simple.h" /* MFOI */
 #include "emul_rsound.h" /* MFOI */
-#include "emul_rplay.h" /* MFOI */
-#include "emul_gopher.h" /* MFOI */
 #include "sources.h"
 #include "sample.h"
Index: roard/include/streams.h
===================================================================
--- roard/include/streams.h	(revision 5624)
+++ roard/include/streams.h	(revision 5740)
@@ -87,5 +87,5 @@
  int is_new;
  int codecfilter;
- int codec_orgi;
+ ROAR_AUDIO_INFO_TYPE codec_orgi;
  CODECFILTER_USERDATA_T codecfilter_inst;
  int socktype;
