40 |
char *pszToken; |
char *pszToken; |
41 |
char *pch; |
char *pch; |
42 |
|
|
43 |
lscp_driver_info_reset(pDriverInfo); |
// Lock this section up. |
44 |
|
lscp_mutex_lock(pClient->mutex); |
|
if (lscp_client_query(pClient, pszQuery) != LSCP_OK) |
|
|
return NULL; |
|
45 |
|
|
46 |
pszResult = lscp_client_get_result(pClient); |
lscp_driver_info_reset(pDriverInfo); |
47 |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
if (lscp_client_call(pClient, pszQuery) == LSCP_OK) { |
48 |
while (pszToken) { |
pszResult = lscp_client_get_result(pClient); |
49 |
if (strcasecmp(pszToken, "DESCRIPTION") == 0) { |
pszToken = lscp_strtok((char *) pszResult, pszSeps, &(pch)); |
50 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
while (pszToken) { |
51 |
if (pszToken) |
if (strcasecmp(pszToken, "DESCRIPTION") == 0) { |
52 |
pDriverInfo->description = lscp_unquote(&pszToken, 1); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
53 |
} |
if (pszToken) |
54 |
else if (strcasecmp(pszToken, "VERSION") == 0) { |
pDriverInfo->description = lscp_unquote(&pszToken, 1); |
55 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
} |
56 |
if (pszToken) |
else if (strcasecmp(pszToken, "VERSION") == 0) { |
57 |
pDriverInfo->version = lscp_unquote(&pszToken, 1); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
58 |
} |
if (pszToken) |
59 |
else if (strcasecmp(pszToken, "PARAMETERS") == 0) { |
pDriverInfo->version = lscp_unquote(&pszToken, 1); |
60 |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
} |
61 |
if (pszToken) |
else if (strcasecmp(pszToken, "PARAMETERS") == 0) { |
62 |
pDriverInfo->parameters = lscp_szsplit_create(pszToken, ","); |
pszToken = lscp_strtok(NULL, pszCrlf, &(pch)); |
63 |
|
if (pszToken) |
64 |
|
pDriverInfo->parameters = lscp_szsplit_create(pszToken, ","); |
65 |
|
} |
66 |
|
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
67 |
} |
} |
|
pszToken = lscp_strtok(NULL, pszSeps, &(pch)); |
|
68 |
} |
} |
69 |
|
|
70 |
|
// Unlock this section down. |
71 |
|
lscp_mutex_unlock(pClient->mutex); |
72 |
|
|
73 |
return pDriverInfo; |
return pDriverInfo; |
74 |
} |
} |
90 |
{ |
{ |
91 |
const char *pszSeps = ","; |
const char *pszSeps = ","; |
92 |
|
|
93 |
|
// Lock this section up. |
94 |
|
lscp_mutex_lock(pClient->mutex); |
95 |
|
|
96 |
if (pClient->audio_drivers) { |
if (pClient->audio_drivers) { |
97 |
lscp_szsplit_destroy(pClient->audio_drivers); |
lscp_szsplit_destroy(pClient->audio_drivers); |
98 |
pClient->audio_drivers = NULL; |
pClient->audio_drivers = NULL; |
99 |
} |
} |
100 |
|
|
101 |
if (lscp_client_query(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n") == LSCP_OK) |
if (lscp_client_call(pClient, "GET AVAILABLE_AUDIO_OUTPUT_DRIVERS\r\n") == LSCP_OK) |
102 |
pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps); |
pClient->audio_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps); |
103 |
|
|
104 |
|
// Unlock this section down. |
105 |
|
lscp_mutex_unlock(pClient->mutex); |
106 |
|
|
107 |
return (const char **) pClient->audio_drivers; |
return (const char **) pClient->audio_drivers; |
108 |
} |
} |
109 |
|
|
222 |
int lscp_get_audio_devices ( lscp_client_t *pClient ) |
int lscp_get_audio_devices ( lscp_client_t *pClient ) |
223 |
{ |
{ |
224 |
int iAudioDevices = -1; |
int iAudioDevices = -1; |
225 |
if (lscp_client_query(pClient, "GET AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK) |
|
226 |
|
// Lock this section up. |
227 |
|
lscp_mutex_lock(pClient->mutex); |
228 |
|
|
229 |
|
if (lscp_client_call(pClient, "GET AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK) |
230 |
iAudioDevices = atoi(lscp_client_get_result(pClient)); |
iAudioDevices = atoi(lscp_client_get_result(pClient)); |
231 |
|
|
232 |
|
// Unlock this section down. |
233 |
|
lscp_mutex_unlock(pClient->mutex); |
234 |
|
|
235 |
return iAudioDevices; |
return iAudioDevices; |
236 |
} |
} |
237 |
|
|
252 |
if (pClient == NULL) |
if (pClient == NULL) |
253 |
return NULL; |
return NULL; |
254 |
|
|
255 |
|
// Lock this section up. |
256 |
|
lscp_mutex_lock(pClient->mutex); |
257 |
|
|
258 |
if (pClient->audio_devices) { |
if (pClient->audio_devices) { |
259 |
lscp_isplit_destroy(pClient->audio_devices); |
lscp_isplit_destroy(pClient->audio_devices); |
260 |
pClient->audio_devices = NULL; |
pClient->audio_devices = NULL; |
261 |
} |
} |
262 |
|
|
263 |
if (lscp_client_query(pClient, "LIST AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK) |
if (lscp_client_call(pClient, "LIST AUDIO_OUTPUT_DEVICES\r\n") == LSCP_OK) |
264 |
pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
pClient->audio_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
265 |
|
|
266 |
|
// Unlock this section down. |
267 |
|
lscp_mutex_unlock(pClient->mutex); |
268 |
|
|
269 |
return pClient->audio_devices; |
return pClient->audio_devices; |
270 |
} |
} |
271 |
|
|
417 |
{ |
{ |
418 |
const char *pszSeps = ","; |
const char *pszSeps = ","; |
419 |
|
|
420 |
|
// Lock this section up. |
421 |
|
lscp_mutex_lock(pClient->mutex); |
422 |
|
|
423 |
if (pClient->midi_drivers) { |
if (pClient->midi_drivers) { |
424 |
lscp_szsplit_destroy(pClient->midi_drivers); |
lscp_szsplit_destroy(pClient->midi_drivers); |
425 |
pClient->midi_drivers = NULL; |
pClient->midi_drivers = NULL; |
426 |
} |
} |
427 |
|
|
428 |
if (lscp_client_query(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n") == LSCP_OK) |
if (lscp_client_call(pClient, "GET AVAILABLE_MIDI_INPUT_DRIVERS\r\n") == LSCP_OK) |
429 |
pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps); |
pClient->midi_drivers = lscp_szsplit_create(lscp_client_get_result(pClient), pszSeps); |
430 |
|
|
431 |
|
// Unlock this section up. |
432 |
|
lscp_mutex_unlock(pClient->mutex); |
433 |
|
|
434 |
return (const char **) pClient->midi_drivers; |
return (const char **) pClient->midi_drivers; |
435 |
} |
} |
436 |
|
|
551 |
int lscp_get_midi_devices ( lscp_client_t *pClient ) |
int lscp_get_midi_devices ( lscp_client_t *pClient ) |
552 |
{ |
{ |
553 |
int iMidiDevices = -1; |
int iMidiDevices = -1; |
554 |
if (lscp_client_query(pClient, "GET MIDI_INPUT_DEVICES\r\n") == LSCP_OK) |
|
555 |
|
// Lock this section up. |
556 |
|
lscp_mutex_lock(pClient->mutex); |
557 |
|
|
558 |
|
if (lscp_client_call(pClient, "GET MIDI_INPUT_DEVICES\r\n") == LSCP_OK) |
559 |
iMidiDevices = atoi(lscp_client_get_result(pClient)); |
iMidiDevices = atoi(lscp_client_get_result(pClient)); |
560 |
|
|
561 |
|
// Unlock this section down. |
562 |
|
lscp_mutex_unlock(pClient->mutex); |
563 |
|
|
564 |
return iMidiDevices; |
return iMidiDevices; |
565 |
} |
} |
566 |
|
|
581 |
if (pClient == NULL) |
if (pClient == NULL) |
582 |
return NULL; |
return NULL; |
583 |
|
|
584 |
|
// Lock this section up. |
585 |
|
lscp_mutex_lock(pClient->mutex); |
586 |
|
|
587 |
if (pClient->midi_devices) { |
if (pClient->midi_devices) { |
588 |
lscp_isplit_destroy(pClient->midi_devices); |
lscp_isplit_destroy(pClient->midi_devices); |
589 |
pClient->midi_devices = NULL; |
pClient->midi_devices = NULL; |
590 |
} |
} |
591 |
|
|
592 |
if (lscp_client_query(pClient, "LIST MIDI_INPUT_DEVICES\r\n") == LSCP_OK) |
if (lscp_client_call(pClient, "LIST MIDI_INPUT_DEVICES\r\n") == LSCP_OK) |
593 |
pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
pClient->midi_devices = lscp_isplit_create(lscp_client_get_result(pClient), pszSeps); |
594 |
|
|
595 |
|
// Unlock this section down. |
596 |
|
lscp_mutex_unlock(pClient->mutex); |
597 |
|
|
598 |
return pClient->midi_devices; |
return pClient->midi_devices; |
599 |
} |
} |
600 |
|
|