Changeset 5740:b3aff85876f1 in roaraudio


Ignore:
Timestamp:
11/09/12 02:51:16 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

commit 1: Moved protocol support into new plugins protocol-esound, protocol-rplay and protocol-gopher (Closes: #311)

Files:
9 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r5721 r5740  
    55        * Added new plugins: dmx-random, dmx-waveform, protocol-http. 
    66        * Added CPI support to roarpluginrunner. 
     7        * Moved protocol support into new plugins protocol-esound, 
     8          protocol-rplay and protocol-gopher (Closes: #311) 
    79 
    810v. 1.0beta7 - Tue Oct 23 2012 23:28 CEST 
  • plugins/roard/Makefile

    r5711 r5740  
    22include ../../Makefile.inc 
    33 
    4 TARGETS=protocol-irc$(SHARED_SUFFIX) listenpty$(SHARED_SUFFIX) dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX) 
     4TARGETS_PROTO=protocol-irc$(SHARED_SUFFIX) protocol-esound$(SHARED_SUFFIX) protocol-rplay$(SHARED_SUFFIX) protocol-gopher$(SHARED_SUFFIX) 
     5TARGETS_DMX=dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX) 
     6TARGETS_MISC=listenpty$(SHARED_SUFFIX) 
     7TARGETS=$(TARGETS_PROTO) $(TARGETS_DMX) $(TARGETS_MISC) 
    58 
    69#DEFINES        = -DDEBUG 
  • plugins/roard/protocol-esound.c

    r5739 r5740  
    2424 */ 
    2525 
    26 #include "roard.h" 
     26#include <roard/include/roard.h> 
    2727 
    2828#ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD 
     
    4646 
    4747static int emul_esd_int_read_buf  (int client, int * data, void * buf); 
    48 static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio); 
    4948static int emul_esd_int_write     (int client, int   data, struct roar_vio_calls * vio); 
    5049static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio); 
     
    166165 
    167166static 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) { 
     167 
     168 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
     169 
    168170 if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, vio) == -1 ) 
    169171  return -1; 
     
    174176static 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) { 
    175177 _cmd_t cmd; 
     178 
     179 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
    176180 
    177181 if ( client == -1 ) 
     
    190194 _cmd_t d; 
    191195 
     196 (void)client; 
     197 
    192198 if ( data == NULL || buf == NULL ) 
    193199  return -1; 
    194200 
    195201 d = *(_cmd_t*)buf; 
    196  
    197  *data = d; 
    198  
    199  return 0; 
    200 } 
    201 static int emul_esd_int_read      (int client, int * data, struct roar_vio_calls * vio) { 
    202  _cmd_t d; 
    203  
    204  if ( data == NULL ) 
    205   return -1; 
    206  
    207  if ( roar_vio_read(vio, &d, _INTSIZE) != _INTSIZE ) 
    208   return -1; 
    209202 
    210203 *data = d; 
     
    216209 _cmd_t d = data; 
    217210 
     211 (void)client; 
     212 
    218213 return roar_vio_write(vio, &d, _INTSIZE) == _INTSIZE ? 0 : -1; 
    219214} 
     
    221216static int emul_esd_test_auth     (int client, void * data, struct roar_vio_calls * vio) { 
    222217 // accept all clients for the moment. 
     218 
     219 (void)data; 
     220 
    223221 return emul_esd_int_write(client, 1, vio); 
    224222} 
     
    247245// handler: 
    248246static int emul_esd_on_connect    (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
     247 
     248 (void)cmd; 
    249249 
    250250 ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio); 
     
    356356 int lag = ROAR_OUTPUT_CFREQ; 
    357357 
     358 (void)cmd, (void)data; 
     359 
    358360 lag *= 2.0 * 44100.0 / (float)g_sa->rate; 
    359361  
     
    382384static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 
    383385 int mode = ESM_ERROR; 
     386 
     387 (void)cmd, (void)data; 
    384388 
    385389 if ( g_standby ) { 
     
    402406 int ok = 0; 
    403407 
     408 (void)cmd; 
     409 
    404410 emul_esd_int_read_buf(client, &stream, data + 0*_INTSIZE); 
    405411 emul_esd_int_read_buf(client, &left,   data + 1*_INTSIZE); 
     
    423429 int rate    = g_sa->rate; 
    424430 int format  = 0; 
     431 
     432 (void)cmd, (void)data; 
    425433 
    426434 switch (g_sa->bits) { 
     
    556564} 
    557565 
    558 struct roar_dl_proto __proto_common_esd = { 
     566static struct roar_dl_proto __proto_common_esd = { 
    559567 .proto = ROAR_PROTO_ESOUND, 
    560568 .description = "EsounD emulation", 
     
    564572}; 
    565573 
     574static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { 
     575 (void)para, (void)lib; 
     576 ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_esd, ROAR_DL_PROTO_VERSION); 
     577 return 0; 
     578} 
     579 
     580ROAR_DL_PLUGIN_START(protocol_esd) { 
     581 ROARD_DL_CHECK_VERSIONS(); 
     582 
     583 ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-esd", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); 
     584 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); 
     585 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); 
     586 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); 
     587 ROAR_DL_PLUGIN_META_DESC("Implementation of the Enlightened Sound Daemon's protocol"); 
     588 
     589 ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto); 
     590} ROAR_DL_PLUGIN_END 
     591 
    566592#endif 
    567593#endif 
  • plugins/roard/protocol-gopher.c

    r5739 r5740  
    2424 */ 
    2525 
    26 #include "roard.h" 
     26#include <roard/include/roard.h> 
     27 
     28#ifndef DISTRIBUTION_VERSION_STRING 
     29#define DISTRIBUTION_VERSION_STRING "" 
     30#endif 
     31#ifndef PACKAGE_VERSION 
     32#define PACKAGE_VERSION "" 
     33#endif 
     34#ifndef DEVICE_VENDOR_STRING 
     35#define DEVICE_VENDOR_STRING "" 
     36#endif 
    2737 
    2838#ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER 
     
    93103 
    94104static int send_menu (int client, struct roar_gopher_menu * menu, struct roar_vio_calls * vio); 
    95 static int send_text (int client, const char * text, struct roar_vio_calls * vio); 
     105static int send_text (const char * text, struct roar_buffer ** obuffer); 
    96106 
    97107 
     
    100110 const size_t len = 1024; 
    101111 const char * server_version = NULL; 
     112 
     113 (void)client, (void)vio, (void)selector, (void)text, (void)sitem; 
    102114 
    103115 if ( DISTRIBUTION_VERSION_STRING[0] == 0 ) { 
     
    138150 size_t len; 
    139151 
     152 (void)client, (void)vio; 
     153 
    140154 toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1); 
    141155 
     
    169183 size_t i; 
    170184 int ret; 
     185 
     186 (void)selector, (void)text, (void)sitem; 
    171187 
    172188 memset(items, 0, sizeof(items)); 
     
    224240 int ret; 
    225241 
     242 (void)selector, (void)text, (void)sitem; 
     243 
    226244 memset(items, 0, sizeof(items)); 
    227245 
     
    281299 char tmp[80]; 
    282300 
     301 (void)text; 
     302 
    283303 memset(items, 0, sizeof(items)); 
    284304 
     
    356376 int id; 
    357377 
     378 (void)text; 
     379 
    358380 memset(items, 0, sizeof(items)); 
    359381 
     
    391413                            s->info.rate, s->info.bits, s->info.channels, roar_codec2str(s->info.codec)); 
    392414 
    393  if ( ss->codec_orgi != -1 && ss->codec_orgi != s->info.codec ) { 
     415 if ( ss->codec_orgi != ROAR_AUDIO_INFO_INVALID && ss->codec_orgi != s->info.codec ) { 
    394416  item = &(items[menu.items_len++]); 
    395417  item->type = _INFO; 
     
    431453 size_t i; 
    432454 
     455 (void)selector, (void)text, (void)sitem; 
     456 
    433457 memset(items, 0, sizeof(items)); 
    434458 
     
    472496 int stream = -1; 
    473497 
     498 (void)vio, (void)text; 
     499 
    474500 toks = roar_mm_strseltok(sitem->selector, selector, tok, 5); 
    475501 
     
    496522 info.codec    = roar_str2codec(tok[4]); 
    497523 
    498  if ( info.codec == -1 ) 
     524 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) 
    499525  return -1; 
    500526 
     
    593619    break; 
    594620   default: 
    595      host = item->host == NULL ? sockaddr.addr : item->host; 
    596      port = item->port ==    0 ? sockaddr.port : item->port; 
     621     host = item->host == NULL ?               sockaddr.addr : item->host; 
     622     port = item->port ==    0 ? (unsigned int)sockaddr.port : item->port; 
    597623     snprintf(data, len-1, "%c%s\t%s\t%s\t%u\r\n", item->type, item->name, item->selector, host, port); 
    598624    break; 
     
    615641} 
    616642 
    617 static int send_text (int client, const char * text, struct roar_vio_calls * vio) { 
     643static int send_text (const char * text, struct roar_buffer ** obuffer) { 
    618644 struct roar_buffer * buf; 
    619645 void * data; 
     
    626652 //memcpy(data+len, "\r\n.\r\n\0", 6); 
    627653 memcpy(data+len, "\0", 1); 
    628  clients_add_output(client, &buf); 
     654 if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 ) 
     655  return -1; 
    629656 
    630657 return 0; 
     
    642669 char * text; 
    643670 
     671 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
     672 
    644673 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 
    645674 
     
    718747 
    719748  if ( funcret == 0 && text != NULL ) 
    720    funcret = send_text(client, text, vio); 
     749   funcret = send_text(text, obuffer); 
    721750 
    722751  if ( text != NULL ) 
     
    728757    break; 
    729758   case _FILE: 
    730      funcret = send_text(client, c->text, vio); 
     759     funcret = send_text(c->text, obuffer); 
    731760    break; 
    732761   default: 
     
    749778 
    750779static 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) { 
     780 
     781 (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
     782 
    751783 ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio); 
    752784 
     
    754786} 
    755787 
    756 struct roar_dl_proto __proto_common_gopher = { 
     788static struct roar_dl_proto __proto_common_gopher = { 
    757789 .proto = ROAR_PROTO_GOPHER, 
    758790 .description = "The Internet Gopher Protocol", 
     
    762794}; 
    763795 
     796static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { 
     797 (void)para, (void)lib; 
     798 ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_gopher, ROAR_DL_PROTO_VERSION); 
     799 return 0; 
     800} 
     801 
     802ROAR_DL_PLUGIN_START(protocol_gopher) { 
     803 ROARD_DL_CHECK_VERSIONS(); 
     804 
     805 ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-gopher", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); 
     806 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); 
     807 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); 
     808 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); 
     809 ROAR_DL_PLUGIN_META_DESC("Implementation of the Internet Gopher protocol"); 
     810 
     811 ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto); 
     812} ROAR_DL_PLUGIN_END 
     813 
    764814#endif 
    765815 
  • plugins/roard/protocol-rplay.c

    r5739 r5740  
    2424 */ 
    2525 
    26 #include "roard.h" 
     26#include <roard/include/roard.h> 
    2727 
    2828#ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
     
    8383static inline int is_true(const char * str) { 
    8484 const char * ts[] = {"true", "t", "1", "yes", "y", "on"}; 
    85  int i; 
    86  
    87  for (i = 0; i < sizeof(ts)/sizeof(*ts); i++) 
     85 size_t i; 
     86 
     87 for (i = 0; i < (sizeof(ts)/sizeof(*ts)); i++) 
    8888  if ( !strcasecmp(str, ts[i]) ) 
    8989   return 1; 
     
    137137 
    138138static 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) { 
     139 
     140 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
     141 
    139142 if ( emul_rplay_on_status(client, NULL, vio, NULL, 0) == -1 ) 
    140143  return -1; 
     
    146149 char buf[1024]; 
    147150 ssize_t len; 
     151 
     152 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 
    148153 
    149154 if ( client == -1 ) 
     
    210215 const char * cd = NULL; 
    211216 
     217 (void)client; 
     218 
    212219 if ( cmd != NULL ) { 
    213220  command = cmd->name; 
     
    236243       int    fragsize  = ROAR_OUTPUT_CALC_OUTBUFSIZE(g_sa); 
    237244       int    h, m, s; 
     245 
     246 (void)client, (void)cmd, (void)kv, (void)kvlen; 
    238247 
    239248 s  = g_pos / g_sa->rate / g_sa->channels; 
     
    281290 
    282291static int emul_rplay_on_quit(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
     292 
     293 (void)client, (void)cmd, (void)vio, (void)kv, (void)kvlen; 
     294 
    283295 return -1; 
    284296} 
     
    286298static int emul_rplay_on_help(int client, struct emul_rplay_command * cmd, struct roar_vio_calls * vio, struct roar_keyval * kv, size_t kvlen) { 
    287299 struct emul_rplay_command * c; 
     300 
     301 (void)client, (void)cmd, (void)kv, (void)kvlen; 
    288302 
    289303 roar_vio_printf(vio, "+message=\"command summary\" command=help\n"); 
     
    504518//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); 
    505519 
    506 struct roar_dl_proto __proto_common_rplay = { 
     520static struct roar_dl_proto __proto_common_rplay = { 
    507521 .proto = ROAR_PROTO_RPLAY, 
    508522 .description = "RPlay emulation", 
     
    512526}; 
    513527 
     528static int __reg_proto(struct roar_dl_librarypara * para, struct roar_dl_libraryinst * lib) { 
     529 (void)para, (void)lib; 
     530 ROAR_DL_PLUGIN_REG_FN(ROAR_DL_PROTO_SUBTYPE, __proto_common_rplay, ROAR_DL_PROTO_VERSION); 
     531 return 0; 
     532} 
     533 
     534ROAR_DL_PLUGIN_START(protocol_rplay) { 
     535 ROARD_DL_CHECK_VERSIONS(); 
     536 
     537 ROAR_DL_PLUGIN_META_PRODUCT_NIV("protocol-rplay", ROAR_VID_ROARAUDIO, ROAR_VNAME_ROARAUDIO); 
     538 ROAR_DL_PLUGIN_META_VERSION(ROAR_VERSION_STRING); 
     539 ROAR_DL_PLUGIN_META_LICENSE_TAG(GPLv3_0); 
     540 ROAR_DL_PLUGIN_META_CONTACT_FLNE("Philipp", "Schafft", "ph3-der-loewe", "lion@lion.leolix.org"); 
     541 ROAR_DL_PLUGIN_META_DESC("Implementation of the RPlay protocol"); 
     542 
     543 ROAR_DL_PLUGIN_REG(ROAR_DL_FN_PROTO, __reg_proto); 
     544} ROAR_DL_PLUGIN_END 
     545 
    514546#endif 
    515547 
  • roard/Makefile

    r5575 r5740  
    66CF_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 
    77CF_CONTAINER=codecfilter_wave.o codecfilter_raum.o codecfilter_au.o 
    8 EMUL=emul_esd.o emul_simple.o emul_rsound.o emul_rplay.o emul_gopher.o 
     8EMUL=emul_simple.o emul_rsound.o 
    99HWMIXER=hwmixer_dstr.o hwmixer_oss.o 
    1010 
  • roard/clients.c

    r5739 r5740  
    3333struct roar_client_server * g_clients[ROAR_CLIENTS_MAX]; 
    3434 
    35 extern struct roar_dl_proto __proto_common_rplay; 
    36 extern struct roar_dl_proto __proto_common_gopher; 
    37 extern struct roar_dl_proto __proto_common_esd; 
    38  
    3935static struct roard_proto_handle __protos[MAX_PROTOS] = { 
    4036 {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN, 
    4137 .impl = {.buildin = 0}}, 
    42 #if !defined(ROAR_WITHOUT_DCOMP_EMUL_ESD) && defined(ROAR_HAVE_H_ESD) 
    43  {.proto = ROAR_PROTO_ESOUND, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
    44  .impl = {.common = &__proto_common_esd}}, 
    45 #endif 
    46 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY 
    47  {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
    48  .impl = {.common = &__proto_common_rplay}}, 
    49 #endif 
    50 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER 
    51  {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON, 
    52  .impl = {.common = &__proto_common_gopher}}, 
    53 #endif 
    5438 {.proto = -1} 
    5539}; 
  • roard/include/roard.h

    r5624 r5740  
    120120#include "commands.h" 
    121121#include "req.h" 
    122 #include "emul_esd.h" /* MFOI */ 
    123122#include "emul_simple.h" /* MFOI */ 
    124123#include "emul_rsound.h" /* MFOI */ 
    125 #include "emul_rplay.h" /* MFOI */ 
    126 #include "emul_gopher.h" /* MFOI */ 
    127124#include "sources.h" 
    128125#include "sample.h" 
  • roard/include/streams.h

    r5624 r5740  
    8787 int is_new; 
    8888 int codecfilter; 
    89  int codec_orgi; 
     89 ROAR_AUDIO_INFO_TYPE codec_orgi; 
    9090 CODECFILTER_USERDATA_T codecfilter_inst; 
    9191 int socktype; 
Note: See TracChangeset for help on using the changeset viewer.