Changeset 1814:66a142f333e9 in roaraudio
- Timestamp:
- 05/22/09 19:56:03 (15 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarmon.c
r1808 r1814 41 41 " --light - Output light control\n" 42 42 " --thru - Output copy of other stream\n" 43 " --rel-id ID - Set ID of relative stream\n" 43 44 " --help - Show this help\n" 44 45 ); … … 52 53 int codec = ROAR_CODEC_DEFAULT; 53 54 int dir = ROAR_DIR_MONITOR; 55 int rel_id = -1; 54 56 char * server = NULL; 55 57 char * k; … … 58 60 int out = -1; 59 61 char buf[BUFSIZE]; 62 struct roar_connection con; 63 struct roar_stream s; 60 64 61 65 for (i = 1; i < argc; i++) { … … 87 91 } else if ( !strcmp(k, "--thru") ) { 88 92 dir = ROAR_DIR_THRU; 93 } else if ( !strcmp(k, "--rel-id") ) { 94 rel_id = atoi(argv[++i]); 89 95 90 96 } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) { … … 106 112 out = ROAR_STDOUT; 107 113 108 if ( (fh = roar_simple_stream(rate, channels, bits, codec, server, dir, "roarmon")) == -1 ) {109 fprintf(stderr, "Error: can not start monitoring\n");110 return 1 ;114 if ( roar_simple_connect(&con, server, "roarmon") == -1 ) { 115 fprintf(stderr, "Error: can not connect to server\n"); 116 return 10; 111 117 } 118 119 if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) { 120 fprintf(stderr, "Error: can not create stream\n"); 121 roar_disconnect(&con); 122 return 20; 123 } 124 125 if ( rel_id != -1 ) { 126 if ( roar_stream_set_rel_id(&s, rel_id) ) { 127 fprintf(stderr, "Error: can not set id or realative stream\n"); 128 roar_disconnect(&con); 129 return 21; 130 } 131 } 132 133 if ( roar_stream_connect(&con, &s, dir) == -1 ) { 134 fprintf(stderr, "Error: can not connect stream to server\n"); 135 roar_disconnect(&con); 136 return 11; 137 } 138 139 if ( roar_stream_exec(&con, &s) == -1 ) { 140 fprintf(stderr, "Error: can not exec stream\n"); 141 roar_disconnect(&con); 142 return 12; 143 } 144 145 if ( (fh = roar_get_connection_fh(&con)) == -1 ) { 146 fprintf(stderr, "Error: can not get stream fh\n"); 147 roar_disconnect(&con); 148 return 13; 149 } 150 151 ROAR_SHUTDOWN(fh, SHUT_WR); 112 152 113 153 while((i = read(fh, buf, BUFSIZE)))
Note: See TracChangeset
for help on using the changeset viewer.