Changeset 416:3c1e97685b59 in roaraudio for libroarpulse


Ignore:
Timestamp:
08/10/08 12:40:39 (11 years ago)
Author:
phi
Branch:
default
Message:

use roar_simple_new_stream_obj() not roar_simple_*() to create a new stream so we can update meta data

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/simple.c

    r411 r416  
    1616    ) { 
    1717 struct roarpulse_simple * s = malloc(sizeof(struct roarpulse_simple)); 
    18  int (*roarfunc)(int rate, int channels, int bits, int codec, char * server, char * name) = roar_simple_play; 
     18 int roar_dir; 
    1919 int codec = -1; 
     20 struct roar_meta meta; 
    2021 
    2122 if ( !s ) 
     
    2324 
    2425 if ( dir == PA_STREAM_PLAYBACK ) { 
    25   roarfunc = roar_simple_play; 
     26  roar_dir = ROAR_DIR_PLAY; 
    2627 } else if ( dir == PA_STREAM_RECORD ) { 
    27   roarfunc = roar_simple_record; 
     28  roar_dir = ROAR_DIR_RECORD; 
    2829 } else { 
    2930  free(s); 
     
    3334 codec = roar_codec_pulse2roar(ss->format); 
    3435 
    35  s->data_fh = roarfunc(ss->rate, ss->channels, 16 /* does PulseAudio support something diffrent? */, 
    36                        codec, (char*)server, (char*)name); 
     36 if ( roar_simple_connect(&(s->con), (char*)server, (char*)name) == -1 ) { 
     37  free(s); 
     38  return NULL; 
     39 } 
     40 
     41 s->data_fh = roar_simple_new_stream_obj(&(s->con), &(s->stream), ss->rate, ss->channels, 
     42                  16 /* does PulseAudio support something diffrent? */, codec, roar_dir); 
     43 
     44 if ( s->data_fh == -1 ) { 
     45  roar_disconnect(&(s->con)); 
     46  free(s); 
     47  return NULL; 
     48 } 
     49 
     50 meta.value  = (char*)stream_name; 
     51 meta.key[0] = 0; 
     52 meta.type   = ROAR_META_TYPE_DESCRIPTION; 
     53 
     54 roar_stream_meta_set(&(s->con), &(s->stream), ROAR_META_MODE_SET, &meta); 
    3755 
    3856 return (pa_simple*) s; 
     
    4664 
    4765 close(ss->data_fh); 
     66 roar_disconnect(&(ss->con)); 
    4867 
    4968 free(s); 
Note: See TracChangeset for help on using the changeset viewer.