Changeset 773:8e54a8bd56be in roaraudio


Ignore:
Timestamp:
09/07/08 04:37:44 (16 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added roar_stream_attach_simple()

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/stream.h

    r758 r773  
    6363int roar_stream_passfh  (struct roar_connection * con, struct roar_stream * s, int fh); 
    6464 
     65int roar_stream_attach_simple (struct roar_connection * con, struct roar_stream * s, int client); 
     66 
    6567int roar_stream_add_data (struct roar_connection * con, struct roar_stream * s, char * data, size_t len); 
    6668 
  • libroar/stream.c

    r761 r773  
    182182 
    183183 return -1; 
     184} 
     185 
     186int roar_stream_attach_simple (struct roar_connection * con, struct roar_stream * s, int client) { 
     187 struct roar_message m; 
     188 uint16_t * info = (uint16_t *) m.data; 
     189 int i; 
     190 
     191 m.cmd     = ROAR_CMD_ATTACH; 
     192 m.stream  = s->id; 
     193 m.pos     = 0; 
     194 m.datalen = 6; 
     195 
     196 info[0] = 0; 
     197 info[1] = ROAR_ATTACH_SIMPLE; 
     198 info[2] = client; 
     199 
     200 for (i = 0; i < m.datalen/2; i++) { 
     201  info[i] = ROAR_HOST2NET16(info[i]); 
     202 } 
     203 
     204 if ( roar_req(con, &m, NULL) == -1 ) 
     205  return -1; 
     206 
     207 if ( m.cmd != ROAR_CMD_OK ) 
     208  return -1; 
     209 
     210 return 0; 
    184211} 
    185212 
Note: See TracChangeset for help on using the changeset viewer.