"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "seq/aseqnet/aseqnet.c" between
alsa-utils-1.2.5.tar.bz2 and alsa-utils-1.2.5.1.tar.bz2

About: ALSA (Advanced Linux Sound Architecture) - Utilities.

aseqnet.c  (alsa-utils-1.2.5.tar.bz2):aseqnet.c  (alsa-utils-1.2.5.1.tar.bz2)
skipping to change at line 40 skipping to change at line 40
#include "aconfig.h" #include "aconfig.h"
#include "gettext.h" #include "gettext.h"
/* /*
* prototypes * prototypes
*/ */
static void usage(void); static void usage(void);
static void init_buf(void); static void init_buf(void);
static void init_pollfds(void); static void init_pollfds(void);
static void close_files(void); static void close_files(void);
static void init_seq(char *source, char *dest); static void init_seq(char *source, char *dest, char *name);
static int get_port(char *service); static int get_port(char *service);
static void sigterm_exit(int sig); static void sigterm_exit(int sig);
static void init_server(int port); static void init_server(int port);
static void init_client(char *server, int port); static void init_client(char *server, int port);
static void do_loop(void); static void do_loop(void);
static int copy_local_to_remote(void); static int copy_local_to_remote(void);
static int copy_remote_to_local(int fd); static int copy_remote_to_local(int fd);
/* /*
* default TCP port number * default TCP port number
skipping to change at line 89 skipping to change at line 89
static int info = 0; static int info = 0;
/* /*
* main routine * main routine
*/ */
static const struct option long_option[] = { static const struct option long_option[] = {
{"port", 1, NULL, 'p'}, {"port", 1, NULL, 'p'},
{"source", 1, NULL, 's'}, {"source", 1, NULL, 's'},
{"dest", 1, NULL, 'd'}, {"dest", 1, NULL, 'd'},
{"name", 1, NULL, 'n'},
{"help", 0, NULL, 'h'}, {"help", 0, NULL, 'h'},
{"verbose", 0, NULL, 'v'}, {"verbose", 0, NULL, 'v'},
{"info", 0, NULL, 'i'}, {"info", 0, NULL, 'i'},
{NULL, 0, NULL, 0}, {NULL, 0, NULL, 0},
}; };
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
int c; int c;
int port = DEFAULT_PORT; int port = DEFAULT_PORT;
char *source = NULL, *dest = NULL; char *source = NULL, *dest = NULL;
char *name = NULL;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
setlocale(LC_ALL, ""); setlocale(LC_ALL, "");
textdomain(PACKAGE); textdomain(PACKAGE);
#endif #endif
while ((c = getopt_long(argc, argv, "p:s:d:vi", long_option, NULL)) != -1 ) { while ((c = getopt_long(argc, argv, "p:s:d:n:,vi", long_option, NULL)) != -1) {
switch (c) { switch (c) {
case 'p': case 'p':
if (isdigit(*optarg)) if (isdigit(*optarg))
port = atoi(optarg); port = atoi(optarg);
else else
port = get_port(optarg); port = get_port(optarg);
break; break;
case 's': case 's':
source = optarg; source = optarg;
break; break;
case 'd': case 'd':
dest = optarg; dest = optarg;
break; break;
case 'n':
name = optarg;
break;
case 'v': case 'v':
verbose++; verbose++;
break; break;
case 'i': case 'i':
info++; info++;
break; break;
default: default:
usage(); usage();
exit(1); exit(1);
} }
} }
signal(SIGINT, sigterm_exit); signal(SIGINT, sigterm_exit);
signal(SIGTERM, sigterm_exit); signal(SIGTERM, sigterm_exit);
init_buf(); init_buf();
init_seq(source, dest); init_seq(source, dest, name);
if (optind >= argc) { if (optind >= argc) {
server_mode = 1; server_mode = 1;
max_connection = MAX_CONNECTION; max_connection = MAX_CONNECTION;
init_pollfds(); init_pollfds();
init_server(port); init_server(port);
} else { } else {
server_mode = 0; server_mode = 0;
max_connection = 1; max_connection = 1;
init_pollfds(); init_pollfds();
skipping to change at line 171 skipping to change at line 176
{ {
printf(_("aseqnet - network client/server on ALSA sequencer\n")); printf(_("aseqnet - network client/server on ALSA sequencer\n"));
printf(_(" Copyright (C) 1999 Takashi Iwai\n")); printf(_(" Copyright (C) 1999 Takashi Iwai\n"));
printf(_("usage:\n")); printf(_("usage:\n"));
printf(_(" server mode: aseqnet [-options]\n")); printf(_(" server mode: aseqnet [-options]\n"));
printf(_(" client mode: aseqnet [-options] server_host\n")); printf(_(" client mode: aseqnet [-options] server_host\n"));
printf(_("options:\n")); printf(_("options:\n"));
printf(_(" -p,--port # : specify TCP port (digit or service name)\n")); printf(_(" -p,--port # : specify TCP port (digit or service name)\n"));
printf(_(" -s,--source addr : read from given addr (client:port)\n")); printf(_(" -s,--source addr : read from given addr (client:port)\n"));
printf(_(" -d,--dest addr : write to given addr (client:port)\n")); printf(_(" -d,--dest addr : write to given addr (client:port)\n"));
printf(_(" -n,--name value : use a specific midi process name\n"));
printf(_(" -v, --verbose : print verbose messages\n")); printf(_(" -v, --verbose : print verbose messages\n"));
printf(_(" -i, --info : print certain received events\n")); printf(_(" -i, --info : print certain received events\n"));
} }
/* /*
* allocate and initialize buffers * allocate and initialize buffers
*/ */
static void init_buf(void) static void init_buf(void)
{ {
max_wrlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t); max_wrlen = MAX_BUF_EVENTS * sizeof(snd_seq_event_t);
skipping to change at line 222 skipping to change at line 228
if (netfd[i] >= 0) if (netfd[i] >= 0)
close(netfd[i]); close(netfd[i]);
} }
if (sockfd >= 0) if (sockfd >= 0)
close(sockfd); close(sockfd);
} }
/* /*
* initialize sequencer * initialize sequencer
*/ */
static void init_seq(char *source, char *dest) static void init_seq(char *source, char *dest, char* name)
{ {
snd_seq_addr_t addr; snd_seq_addr_t addr;
int err, counti, counto; int err, counti, counto;
if (snd_seq_open(&handle, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) { if (snd_seq_open(&handle, "default", SND_SEQ_OPEN_DUPLEX, 0) < 0) {
perror("snd_seq_open"); perror("snd_seq_open");
exit(1); exit(1);
} }
if (seqifds) if (seqifds)
free(seqifds); free(seqifds);
skipping to change at line 251 skipping to change at line 257
seqofds = (struct pollfd *)calloc(counto, sizeof(struct pollfd)); seqofds = (struct pollfd *)calloc(counto, sizeof(struct pollfd));
assert(seqofds); assert(seqofds);
err = snd_seq_poll_descriptors(handle, seqifds, counti, POLLIN); err = snd_seq_poll_descriptors(handle, seqifds, counti, POLLIN);
assert(err == counti); assert(err == counti);
err = snd_seq_poll_descriptors(handle, seqofds, counto, POLLOUT); err = snd_seq_poll_descriptors(handle, seqofds, counto, POLLOUT);
assert(err == counto); assert(err == counto);
snd_seq_nonblock(handle, 1); snd_seq_nonblock(handle, 1);
/* set client info */ /* set client info */
if (server_mode) if (name)
snd_seq_set_client_name(handle, "Net Server"); snd_seq_set_client_name(handle, name);
else else {
snd_seq_set_client_name(handle, "Net Client"); if (server_mode)
snd_seq_set_client_name(handle, "Net Server");
else
snd_seq_set_client_name(handle, "Net Client");
}
/* create a port */ /* create a port */
seq_port = snd_seq_create_simple_port(handle, "Network", seq_port = snd_seq_create_simple_port(handle, "Network",
SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_READ |
SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_WRITE |
SND_SEQ_PORT_CAP_SUBS_READ | SND_SEQ_PORT_CAP_SUBS_READ |
SND_SEQ_PORT_CAP_SUBS_WRITE, SND_SEQ_PORT_CAP_SUBS_WRITE,
SND_SEQ_PORT_TYPE_MIDI_GENERIC); SND_SEQ_PORT_TYPE_MIDI_GENERIC);
if (seq_port < 0) { if (seq_port < 0) {
perror("create seq port"); perror("create seq port");
 End of changes. 9 change blocks. 
8 lines changed or deleted 18 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)