Changeset 605:f1450dcc5dc5 in roaraudio for roarclients
- Timestamp:
- 08/19/08 19:42:00 (16 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarshout.c
r600 r605 4 4 5 5 #ifdef ROAR_HAVE_LIBSHOUT 6 #include <shout/shout.h> 6 7 7 #define BUFSIZE 10248 #define BUFSIZE 2048 8 9 9 10 void usage (void) { … … 29 30 char * server = NULL; 30 31 char * k; 31 char * s_server = NULL;32 char * s_server = "localhost"; 32 33 char * s_mount = "/roar.ogg"; 33 34 char * s_pw = "hackme"; … … 36 37 int i; 37 38 char buf[BUFSIZE]; 39 shout_t * shout; 38 40 39 41 for (i = 1; i < argc; i++) { … … 60 62 } 61 63 62 if ( (fh = roar_simple_monitor(rate, channels, bits, codec, server, "roarmon")) == -1 ) { 64 shout_init(); 65 66 if (!(shout = shout_new())) { 67 ROAR_ERR("Can not clreate shout object"); 68 return 1; 69 } 70 71 if (shout_set_host(shout, s_server) != SHOUTERR_SUCCESS) { 72 ROAR_ERR("Error setting hostname: %s", shout_get_error(shout)); 73 return 1; 74 } 75 76 if (shout_set_protocol(shout, SHOUT_PROTOCOL_HTTP) != SHOUTERR_SUCCESS) { 77 ROAR_ERR("Error setting protocol: %s", shout_get_error(shout)); 78 return 1; 79 } 80 81 if (shout_set_port(shout, s_port) != SHOUTERR_SUCCESS) { 82 ROAR_ERR("Error setting port: %s", shout_get_error(shout)); 83 return 1; 84 } 85 86 if (shout_set_password(shout, s_pw) != SHOUTERR_SUCCESS) { 87 ROAR_ERR("Error setting password: %s", shout_get_error(shout)); 88 return 1; 89 } 90 91 if (shout_set_mount(shout, s_mount) != SHOUTERR_SUCCESS) { 92 ROAR_ERR("Error setting mount: %s", shout_get_error(shout)); 93 return 1; 94 } 95 96 if (shout_set_user(shout, "source") != SHOUTERR_SUCCESS) { 97 ROAR_ERR("Error setting user: %s", shout_get_error(shout)); 98 return 1; 99 } 100 101 if (shout_set_format(shout, SHOUT_FORMAT_OGG) != SHOUTERR_SUCCESS) { 102 ROAR_ERR("Error setting format: %s", shout_get_error(shout)); 103 return 1; 104 } 105 106 if ( (fh = roar_simple_monitor(rate, channels, bits, codec, server, "roarshout")) == -1 ) { 63 107 fprintf(stderr, "Error: can not start monetoring\n"); 64 108 return 1; 65 109 } 66 110 111 if (shout_open(shout) != SHOUTERR_SUCCESS) { 112 ROAR_ERR("Can not open connection via libshout!"); 113 return -1; 114 } 115 67 116 while((i = read(fh, buf, BUFSIZE))) 68 if ( write(1, buf, i) != i)117 if (shout_send(shout, buf, i) != SHOUTERR_SUCCESS) 69 118 break; 70 119 71 120 roar_simple_close(fh); 121 122 shout_sync(shout); 123 124 shout_close(shout); 125 126 shout_shutdown(); 72 127 73 128 return 0;
Note: See TracChangeset
for help on using the changeset viewer.