Changeset 5740:b3aff85876f1 in roaraudio
- Timestamp:
- 11/09/12 02:51:16 (11 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r5721 r5740 5 5 * Added new plugins: dmx-random, dmx-waveform, protocol-http. 6 6 * Added CPI support to roarpluginrunner. 7 * Moved protocol support into new plugins protocol-esound, 8 protocol-rplay and protocol-gopher (Closes: #311) 7 9 8 10 v. 1.0beta7 - Tue Oct 23 2012 23:28 CEST -
plugins/roard/Makefile
r5711 r5740 2 2 include ../../Makefile.inc 3 3 4 TARGETS=protocol-irc$(SHARED_SUFFIX) listenpty$(SHARED_SUFFIX) dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX) 4 TARGETS_PROTO=protocol-irc$(SHARED_SUFFIX) protocol-esound$(SHARED_SUFFIX) protocol-rplay$(SHARED_SUFFIX) protocol-gopher$(SHARED_SUFFIX) 5 TARGETS_DMX=dmx-random$(SHARED_SUFFIX) dmx-waveform$(SHARED_SUFFIX) 6 TARGETS_MISC=listenpty$(SHARED_SUFFIX) 7 TARGETS=$(TARGETS_PROTO) $(TARGETS_DMX) $(TARGETS_MISC) 5 8 6 9 #DEFINES = -DDEBUG -
plugins/roard/protocol-esound.c
r5739 r5740 24 24 */ 25 25 26 #include "roard.h"26 #include <roard/include/roard.h> 27 27 28 28 #ifndef ROAR_WITHOUT_DCOMP_EMUL_ESD … … 46 46 47 47 static 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);49 48 static int emul_esd_int_write (int client, int data, struct roar_vio_calls * vio); 50 49 static int emul_esd_test_auth (int client, void * data, struct roar_vio_calls * vio); … … 166 165 167 166 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) { 167 168 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 169 168 170 if ( emul_esd_exec_command(client, ESD_PROTO_CONNECT, vio) == -1 ) 169 171 return -1; … … 174 176 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) { 175 177 _cmd_t cmd; 178 179 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 176 180 177 181 if ( client == -1 ) … … 190 194 _cmd_t d; 191 195 196 (void)client; 197 192 198 if ( data == NULL || buf == NULL ) 193 199 return -1; 194 200 195 201 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;209 202 210 203 *data = d; … … 216 209 _cmd_t d = data; 217 210 211 (void)client; 212 218 213 return roar_vio_write(vio, &d, _INTSIZE) == _INTSIZE ? 0 : -1; 219 214 } … … 221 216 static int emul_esd_test_auth (int client, void * data, struct roar_vio_calls * vio) { 222 217 // accept all clients for the moment. 218 219 (void)data; 220 223 221 return emul_esd_int_write(client, 1, vio); 224 222 } … … 247 245 // handler: 248 246 static int emul_esd_on_connect (int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 247 248 (void)cmd; 249 249 250 250 ROAR_DBG("emul_esd_on_connect(client=%i, cmd=%p, data=%p, vio=%p) = ?", client, cmd, data, vio); … … 356 356 int lag = ROAR_OUTPUT_CFREQ; 357 357 358 (void)cmd, (void)data; 359 358 360 lag *= 2.0 * 44100.0 / (float)g_sa->rate; 359 361 … … 382 384 static int emul_esd_on_standbymode(int client, struct emul_esd_command * cmd, void * data, struct roar_vio_calls * vio) { 383 385 int mode = ESM_ERROR; 386 387 (void)cmd, (void)data; 384 388 385 389 if ( g_standby ) { … … 402 406 int ok = 0; 403 407 408 (void)cmd; 409 404 410 emul_esd_int_read_buf(client, &stream, data + 0*_INTSIZE); 405 411 emul_esd_int_read_buf(client, &left, data + 1*_INTSIZE); … … 423 429 int rate = g_sa->rate; 424 430 int format = 0; 431 432 (void)cmd, (void)data; 425 433 426 434 switch (g_sa->bits) { … … 556 564 } 557 565 558 st ruct roar_dl_proto __proto_common_esd = {566 static struct roar_dl_proto __proto_common_esd = { 559 567 .proto = ROAR_PROTO_ESOUND, 560 568 .description = "EsounD emulation", … … 564 572 }; 565 573 574 static 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 580 ROAR_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 566 592 #endif 567 593 #endif -
plugins/roard/protocol-gopher.c
r5739 r5740 24 24 */ 25 25 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 27 37 28 38 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER … … 93 103 94 104 static 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);105 static int send_text (const char * text, struct roar_buffer ** obuffer); 96 106 97 107 … … 100 110 const size_t len = 1024; 101 111 const char * server_version = NULL; 112 113 (void)client, (void)vio, (void)selector, (void)text, (void)sitem; 102 114 103 115 if ( DISTRIBUTION_VERSION_STRING[0] == 0 ) { … … 138 150 size_t len; 139 151 152 (void)client, (void)vio; 153 140 154 toks = roar_mm_strseltok(sitem->selector, selector, &tok, 1); 141 155 … … 169 183 size_t i; 170 184 int ret; 185 186 (void)selector, (void)text, (void)sitem; 171 187 172 188 memset(items, 0, sizeof(items)); … … 224 240 int ret; 225 241 242 (void)selector, (void)text, (void)sitem; 243 226 244 memset(items, 0, sizeof(items)); 227 245 … … 281 299 char tmp[80]; 282 300 301 (void)text; 302 283 303 memset(items, 0, sizeof(items)); 284 304 … … 356 376 int id; 357 377 378 (void)text; 379 358 380 memset(items, 0, sizeof(items)); 359 381 … … 391 413 s->info.rate, s->info.bits, s->info.channels, roar_codec2str(s->info.codec)); 392 414 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 ) { 394 416 item = &(items[menu.items_len++]); 395 417 item->type = _INFO; … … 431 453 size_t i; 432 454 455 (void)selector, (void)text, (void)sitem; 456 433 457 memset(items, 0, sizeof(items)); 434 458 … … 472 496 int stream = -1; 473 497 498 (void)vio, (void)text; 499 474 500 toks = roar_mm_strseltok(sitem->selector, selector, tok, 5); 475 501 … … 496 522 info.codec = roar_str2codec(tok[4]); 497 523 498 if ( info.codec == -1)524 if ( info.codec == ROAR_AUDIO_INFO_INVALID ) 499 525 return -1; 500 526 … … 593 619 break; 594 620 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; 597 623 snprintf(data, len-1, "%c%s\t%s\t%s\t%u\r\n", item->type, item->name, item->selector, host, port); 598 624 break; … … 615 641 } 616 642 617 static int send_text ( int client, const char * text, struct roar_vio_calls * vio) {643 static int send_text (const char * text, struct roar_buffer ** obuffer) { 618 644 struct roar_buffer * buf; 619 645 void * data; … … 626 652 //memcpy(data+len, "\r\n.\r\n\0", 6); 627 653 memcpy(data+len, "\0", 1); 628 clients_add_output(client, &buf); 654 if ( roar_buffer_moveintoqueue(obuffer, &buf) == -1 ) 655 return -1; 629 656 630 657 return 0; … … 642 669 char * text; 643 670 671 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 672 644 673 ROAR_DBG("emul_gopher_check_client(client=%i, vio=%p) = ?", client, vio); 645 674 … … 718 747 719 748 if ( funcret == 0 && text != NULL ) 720 funcret = send_text( client, text, vio);749 funcret = send_text(text, obuffer); 721 750 722 751 if ( text != NULL ) … … 728 757 break; 729 758 case _FILE: 730 funcret = send_text(c lient, c->text, vio);759 funcret = send_text(c->text, obuffer); 731 760 break; 732 761 default: … … 749 778 750 779 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) { 780 781 (void)client, (void)vio, (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 782 751 783 ROAR_DBG("emul_gopher_flushed_client(client=%i, vio=%p) = ?", client, vio); 752 784 … … 754 786 } 755 787 756 st ruct roar_dl_proto __proto_common_gopher = {788 static struct roar_dl_proto __proto_common_gopher = { 757 789 .proto = ROAR_PROTO_GOPHER, 758 790 .description = "The Internet Gopher Protocol", … … 762 794 }; 763 795 796 static 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 802 ROAR_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 764 814 #endif 765 815 -
plugins/roard/protocol-rplay.c
r5739 r5740 24 24 */ 25 25 26 #include "roard.h"26 #include <roard/include/roard.h> 27 27 28 28 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY … … 83 83 static inline int is_true(const char * str) { 84 84 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++) 88 88 if ( !strcasecmp(str, ts[i]) ) 89 89 return 1; … … 137 137 138 138 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) { 139 140 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 141 139 142 if ( emul_rplay_on_status(client, NULL, vio, NULL, 0) == -1 ) 140 143 return -1; … … 146 149 char buf[1024]; 147 150 ssize_t len; 151 152 (void)obuffer, (void)userdata, (void)protopara, (void)protoparalen, (void)pluginpara; 148 153 149 154 if ( client == -1 ) … … 210 215 const char * cd = NULL; 211 216 217 (void)client; 218 212 219 if ( cmd != NULL ) { 213 220 command = cmd->name; … … 236 243 int fragsize = ROAR_OUTPUT_CALC_OUTBUFSIZE(g_sa); 237 244 int h, m, s; 245 246 (void)client, (void)cmd, (void)kv, (void)kvlen; 238 247 239 248 s = g_pos / g_sa->rate / g_sa->channels; … … 281 290 282 291 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) { 292 293 (void)client, (void)cmd, (void)vio, (void)kv, (void)kvlen; 294 283 295 return -1; 284 296 } … … 286 298 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) { 287 299 struct emul_rplay_command * c; 300 301 (void)client, (void)cmd, (void)kv, (void)kvlen; 288 302 289 303 roar_vio_printf(vio, "+message=\"command summary\" command=help\n"); … … 504 518 //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); 505 519 506 st ruct roar_dl_proto __proto_common_rplay = {520 static struct roar_dl_proto __proto_common_rplay = { 507 521 .proto = ROAR_PROTO_RPLAY, 508 522 .description = "RPlay emulation", … … 512 526 }; 513 527 528 static 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 534 ROAR_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 514 546 #endif 515 547 -
roard/Makefile
r5575 r5740 6 6 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 7 7 CF_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.o8 EMUL=emul_simple.o emul_rsound.o 9 9 HWMIXER=hwmixer_dstr.o hwmixer_oss.o 10 10 -
roard/clients.c
r5739 r5740 33 33 struct roar_client_server * g_clients[ROAR_CLIENTS_MAX]; 34 34 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 39 35 static struct roard_proto_handle __protos[MAX_PROTOS] = { 40 36 {.proto = ROAR_PROTO_ROARAUDIO, .lhandle = NULL, .type = ROARD_PROTO_TYPE_BUILDIN, 41 37 .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 #endif46 #ifndef ROAR_WITHOUT_DCOMP_EMUL_RPLAY47 {.proto = ROAR_PROTO_RPLAY, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,48 .impl = {.common = &__proto_common_rplay}},49 #endif50 #ifndef ROAR_WITHOUT_DCOMP_EMUL_GOPHER51 {.proto = ROAR_PROTO_GOPHER, .lhandle = NULL, .type = ROARD_PROTO_TYPE_COMMON,52 .impl = {.common = &__proto_common_gopher}},53 #endif54 38 {.proto = -1} 55 39 }; -
roard/include/roard.h
r5624 r5740 120 120 #include "commands.h" 121 121 #include "req.h" 122 #include "emul_esd.h" /* MFOI */123 122 #include "emul_simple.h" /* MFOI */ 124 123 #include "emul_rsound.h" /* MFOI */ 125 #include "emul_rplay.h" /* MFOI */126 #include "emul_gopher.h" /* MFOI */127 124 #include "sources.h" 128 125 #include "sample.h" -
roard/include/streams.h
r5624 r5740 87 87 int is_new; 88 88 int codecfilter; 89 intcodec_orgi;89 ROAR_AUDIO_INFO_TYPE codec_orgi; 90 90 CODECFILTER_USERDATA_T codecfilter_inst; 91 91 int socktype;
Note: See TracChangeset
for help on using the changeset viewer.