Changeset 465:82fd66e50dc3 in roaraudio
- Timestamp:
- 08/12/08 15:37:57 (16 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/stream.h
r229 r465 14 14 "unknown" ) 15 15 16 struct roar_stream_info { 17 int block_size; 18 }; 19 16 20 int roar_stream_connect (struct roar_connection * con, struct roar_stream * s, int dir); 17 21 … … 24 28 int roar_stream_add_data (struct roar_connection * con, struct roar_stream * s, char * data, size_t len); 25 29 30 int roar_stream_get_info (struct roar_connection * con, struct roar_stream * s, struct roar_stream_info * info); 31 26 32 int roar_stream_s2m (struct roar_stream * s, struct roar_message * m); 27 33 int roar_stream_m2s (struct roar_stream * s, struct roar_message * m); -
include/roaraudio/proto.h
r352 r465 46 46 #define ROAR_SET_ACL 26 /* set ACL, may have subtypes */ 47 47 48 #define ROAR_CMD_GET_STREAM_PARA 27 /* Get addition stream parameters like blocksizes */ 49 #define ROAR_CMD_SET_STREAM_PARA 28 /* set specal stream parameter */ 48 50 49 51 -
libroar/stream.c
r134 r465 138 138 } 139 139 140 int roar_stream_get_info (struct roar_connection * con, struct roar_stream * s, struct roar_stream_info * info) { 141 struct roar_message m; 142 uint16_t * data = (uint16_t *) m.data; 143 int i; 144 145 m.cmd = ROAR_CMD_GET_STREAM_PARA; 146 m.stream = s->id; 147 m.datalen = 4; 148 m.pos = 0; 149 150 data[0] = 0; // Version and reserved 151 data[1] = 1; // stream 152 153 for (i = 0; i < m.datalen/2; i++) { 154 data[i] = ROAR_HOST2NET16(data[i]); 155 } 156 157 if ( roar_req(con, &m, NULL) == -1 ) 158 return -1; 159 160 if ( m.cmd != ROAR_CMD_OK ) 161 return -1; 162 163 for (i = 0; i < m.datalen/2; i++) { 164 data[i] = ROAR_NET2HOST16(data[i]); 165 } 166 167 if ( m.datalen < 3*2 ) 168 return -1; 169 170 if ( data[0] != 0 || data[1] != 1 ) 171 return -1; 172 173 info->block_size = data[2]; 174 175 return 0; 176 } 140 177 141 178 #define _ROAR_STREAM_MESSAGE_LEN ((5+1)*4) … … 181 218 data[i] = ROAR_NET2HOST32(data[i]); 182 219 220 s->id = m->stream; 183 221 s->dir = data[0]; 184 222 s->pos_rel_id = data[1]; -
libroararts/libartsc.c
r463 r465 202 202 int arts_stream_get(arts_stream_t stream, arts_parameter_t param) { 203 203 struct _libroarartsc_stream * s = (struct _libroarartsc_stream *) stream; 204 struct roar_stream_info info; 205 204 206 if ( !stream ) 205 207 return -1; 206 208 207 209 if ( param == ARTS_P_PACKET_SIZE ) { 208 return 2048; 210 if ( roar_stream_get_info(_libroarartsc_connection, &(s->stream), &info) != -1 ) { 211 return info.block_size; 212 } 213 return -1; 209 214 } else if ( param == ARTS_P_PACKET_COUNT ) { 210 215 return 1; -
roarclients/roarctl.c
r449 r465 130 130 int id[ROAR_STREAMS_MAX]; 131 131 struct roar_stream s; 132 struct roar_stream_info info; 132 133 133 134 … … 153 154 printf("Input codec : %i (%s%s)\n", s.info.codec, roar_codec2str(s.info.codec), 154 155 s.info.codec == ROAR_CODEC_DEFAULT ? " native" : ""); 156 if ( roar_stream_get_info(con, &s, &info) != -1 ) { 157 printf("Input block size : %i Byte\n", info.block_size); 158 } 155 159 display_mixer(con, id[i]); 156 160 show_meta_all(con, id[i]); -
roard/commands.c
r232 r465 30 30 {ROAR_CMD_SET_VOL, "SET_VOL", req_on_set_vol}, 31 31 {ROAR_CMD_GET_VOL, "GET_VOL", req_on_get_vol}, 32 {ROAR_CMD_GET_STREAM_PARA, "GET_STREAM_PARA", req_on_get_stream_para}, 32 33 33 34 {ROAR_CMD_ADD_DATA, "ADD_DATA", req_on_add_data}, -
roard/include/req.h
r113 r465 32 32 int req_on_get_stream (int client, struct roar_message * mes, char * data); 33 33 34 int req_on_get_stream_para (int client, struct roar_message * mes, char * data); 35 34 36 int req_on_kick (int client, struct roar_message * mes, char * data); 35 37 -
roard/req.c
r443 r465 400 400 401 401 mes->cmd = ROAR_CMD_OK; 402 mes->stream = mes->data[0]; 402 403 403 404 return roar_stream_s2m(ROAR_STREAM(s), mes); 405 } 406 407 int req_on_get_stream_para (int client, struct roar_message * mes, char * data) { 408 struct roar_stream * s; 409 struct roar_audio_info * audio_info; 410 uint16_t * d = (uint16_t *) mes->data; 411 int i; 412 413 if ( mes->datalen != 4 ) 414 return -1; 415 416 for (i = 0; i < mes->datalen/2; i++) { 417 d[i] = ROAR_NET2HOST16(d[i]); 418 } 419 420 if ( streams_get(mes->stream, ROAR_STREAM_SERVER(&s)) == -1 ) { 421 ROAR_WARN("req_on_get_stream_para(*): request on non existing (or other error?) stream %i", mes->stream); 422 return -1; 423 } 424 425 audio_info = &(s->info); 426 427 if ( d[0] != 0 || d[1] != 1 ) { 428 ROAR_WARN("req_on_get_stream_para(*): unsupported command version: %i, %i", d[0], d[1]); 429 return -1; 430 } 431 432 mes->datalen = 2*3; 433 434 d[2] = ROAR_OUTPUT_CALC_OUTBUFSIZE(audio_info); 435 436 for (i = 0; i < mes->datalen/2; i++) { 437 d[i] = ROAR_HOST2NET16(d[i]); 438 } 439 440 mes->cmd = ROAR_CMD_OK; 441 return 0; 404 442 } 405 443
Note: See TracChangeset
for help on using the changeset viewer.