Changeset 3848:b161cd9c3443 in roaraudio for libroarpulse
- Timestamp:
- 05/16/10 22:30:52 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarpulse/simple.c
r3517 r3848 52 52 int *error /**< A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here. */ 53 53 ) { 54 struct roarpulse_simple * s = roar_mm_malloc(sizeof(struct roarpulse_simple));54 struct roarpulse_simple * s; 55 55 struct roar_audio_info info; 56 56 int roar_dir; 57 57 struct roar_meta meta; 58 59 if ( !s )60 return NULL;61 58 62 59 if ( dir == PA_STREAM_PLAYBACK ) { … … 65 62 roar_dir = ROAR_DIR_RECORD; 66 63 } else { 67 roar_mm_free(s);68 64 return NULL; 69 65 } 70 66 71 67 if ( roar_pa_sspec2auinfo(&info, ss) == -1 ) { 72 roar_mm_free(s);73 68 return NULL; 74 69 } 70 71 if ( (s = roar_mm_malloc(sizeof(struct roarpulse_simple))) == NULL ) 72 return NULL; 75 73 76 74 server = roar_pa_find_server((char*)server); … … 89 87 } 90 88 91 if ( stream_name && stream_name[0] != 0 ) {89 if ( stream_name != NULL && stream_name[0] != 0 ) { 92 90 meta.value = (char*)stream_name; 93 91 meta.key[0] = 0; … … 103 101 void pa_simple_free(pa_simple *s) { 104 102 struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 105 if ( !s ) 103 104 if ( s == NULL ) 106 105 return; 107 106 … … 115 114 int pa_simple_write(pa_simple *s, const void*data, size_t length, int *error) { 116 115 struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 117 if ( !s ) 116 117 if ( s == NULL ) 118 118 return -1; 119 119 … … 124 124 int pa_simple_drain(pa_simple *s, int *error) { 125 125 // struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 126 if ( !s ) 126 127 if ( s == NULL ) 127 128 return -1; 128 129 129 pa_simple_flush(s, NULL);130 pa_simple_flush(s, error); 130 131 131 132 return -1; … … 135 136 int pa_simple_read(pa_simple *s, void*data, size_t length, int *error) { 136 137 struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 137 if ( !s ) 138 139 if ( s == NULL ) 138 140 return -1; 139 141 … … 144 146 pa_usec_t pa_simple_get_latency(pa_simple *s, int *error) { 145 147 struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 146 if ( !s ) 148 149 if ( s == NULL ) 147 150 return -1; 148 151 … … 153 156 int pa_simple_flush(pa_simple *s, int *error) { 154 157 struct roarpulse_simple * ss = (struct roarpulse_simple*) s; 155 if ( !s ) 158 159 if ( s == NULL ) 156 160 return -1; 157 161 158 #ifdef ROAR_FDATASYNC159 162 return roar_vio_sync(&(ss->vio)); 160 #else161 return 0;162 #endif163 163 } 164 164
Note: See TracChangeset
for help on using the changeset viewer.