Changeset e172429 in mainline
- Timestamp:
- 2017-12-08T21:03:35Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 86bbca4
- Parents:
- a99cbc1e
- git-author:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 02:50:42)
- git-committer:
- Jiří Zárevúcky <zarevucky.jiri@…> (2017-12-08 21:03:35)
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/wavplay/dplay.c
ra99cbc1e re172429 345 345 } 346 346 printf("Playing on device: %s.\n", device); 347 if (audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK) <= 0) { 347 sysarg_t val; 348 ret = audio_pcm_query_cap(session, AUDIO_CAP_PLAYBACK, &val); 349 if (ret != EOK || !val) { 348 350 printf("Device %s does not support playback\n", device); 349 351 ret = ENOTSUP; … … 386 388 goto cleanup; 387 389 } 388 if (audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS) > 0) { 390 ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_BUFFER_POS, &val); 391 if (ret == EOK && val) { 389 392 play(&pb); 390 393 } else { 391 if (audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT) > 0) 394 ret = audio_pcm_query_cap(pb.device, AUDIO_CAP_INTERRUPT, &val); 395 if (ret == EOK && val) 392 396 play_fragment(&pb); 393 397 else -
uspace/app/wavplay/drec.c
ra99cbc1e re172429 176 176 int ret = EOK; 177 177 audio_pcm_sess_t *session = NULL; 178 sysarg_t val; 178 179 if (str_cmp(device, "default") == 0) { 179 180 session = audio_pcm_open_default(); … … 186 187 } 187 188 printf("Recording on device: %s.\n", device); 188 if (audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE) <= 0) { 189 ret = audio_pcm_query_cap(session, AUDIO_CAP_CAPTURE, &val); 190 if (ret != EOK || !val) { 189 191 printf("Device %s does not support recording\n", device); 190 192 ret = ENOTSUP; … … 225 227 goto cleanup; 226 228 } 227 if (audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT) > 0) 229 ret = audio_pcm_query_cap(rec.device, AUDIO_CAP_INTERRUPT, &val); 230 if (ret == EOK && val) 228 231 record_fragment(&rec, format); 229 232 else -
uspace/lib/drv/generic/remote_audio_pcm.c
ra99cbc1e re172429 221 221 * @param sess Audio device session. 222 222 * @param cap Audio device capability. 223 * @param val Place to store queried value. 224 * 225 * @return Error code. 226 */ 227 int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap) 228 { 229 async_exch_t *exch = async_exchange_begin(sess); 230 sysarg_t value = 0; 223 * @param[out] val Place to store queried value. 224 * 225 * @return Error code. 226 */ 227 int audio_pcm_query_cap(audio_pcm_sess_t *sess, audio_cap_t cap, sysarg_t *value) 228 { 229 async_exch_t *exch = async_exchange_begin(sess); 231 230 const int ret = async_req_2_1(exch, 232 231 DEV_IFACE_ID(AUDIO_PCM_BUFFER_IFACE), IPC_M_AUDIO_PCM_QUERY_CAPS, 233 cap, &value); 234 async_exchange_end(exch); 235 if (ret == EOK) 236 return value; 232 cap, value); 233 async_exchange_end(exch); 237 234 return ret; 238 235 } -
uspace/lib/drv/include/audio_pcm_iface.h
ra99cbc1e re172429 83 83 int audio_pcm_test_format(audio_pcm_sess_t *, unsigned *, unsigned *, 84 84 pcm_sample_format_t *); 85 int audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t );85 int audio_pcm_query_cap(audio_pcm_sess_t *, audio_cap_t, sysarg_t *); 86 86 int audio_pcm_register_event_callback(audio_pcm_sess_t *, 87 87 async_port_handler_t, void *); -
uspace/srv/audio/hound/audio_device.c
ra99cbc1e re172429 121 121 { 122 122 assert(dev); 123 if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE)) 123 sysarg_t val; 124 int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_CAPTURE, &val); 125 if (rc == EOK && val) 124 126 return &dev->source; 125 127 return NULL; … … 135 137 { 136 138 assert(dev); 137 if (audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK)) 139 sysarg_t val; 140 int rc = audio_pcm_query_cap(dev->sess, AUDIO_CAP_PLAYBACK, &val); 141 if (rc == EOK && val) 138 142 return &dev->sink; 139 143 return NULL;
Note:
See TracChangeset
for help on using the changeset viewer.