/* Stream audio data to a Shoutcast(-ish) server. Adam Sampson */ #include #include #include #include #include int main(int argc, char **argv) { shout_t *conn; char buff[4096]; long read, ret, total; int foo; if (argc < 10) { printf("usage: shoutto server port user password name url genre description bitrate\n"); return 20; } shout_init(); shout_set_host(conn, argv[1]); shout_set_port(conn, atoi(argv[2])); shout_set_user(conn, argv[3]); shout_set_password(conn, argv[4]); shout_set_name(conn, argv[5]); shout_set_url(conn, argv[6]); shout_set_genre(conn, argv[7]); shout_set_description(conn, argv[8]); shout_set_bitrate(conn, atoi(argv[9])); if (shout_open(conn)) { printf("Connected to server...\n"); total = 0; while (1) { read = fread(buff, 1, 4096, stdin); total = total + read; if (read > 0) { ret = shout_send(conn, buff, read); if (!ret) { printf("DEBUG: Send error: %i...\n", conn->error); break; } } else { break; } foo = shout_delay(conn); } } else { printf("Couldn't connect to %s %d %s...%i %d\n", conn->ip, conn->port, conn->password, conn->error, conn->_socket); } foo = shout_close(conn); shout_free(conn); shout_shutdown(); return 0; }