223 |
return psz; |
return psz; |
224 |
} |
} |
225 |
|
|
226 |
|
// Unquote and make a duplicate of an in-split string. |
227 |
|
void lscp_unquote_dup ( char **ppszDst, char **ppszSrc ) |
228 |
|
{ |
229 |
|
// Free desteny string, if already there. |
230 |
|
if (*ppszDst) |
231 |
|
free(*ppszDst); |
232 |
|
*ppszDst = NULL; |
233 |
|
// Unquote and duplicate. |
234 |
|
if (*ppszSrc) |
235 |
|
*ppszDst = lscp_unquote(ppszSrc, 1); |
236 |
|
} |
237 |
|
|
238 |
|
|
239 |
// Custom tokenizer. |
// Custom tokenizer. |
240 |
char *lscp_strtok ( char *pchBuffer, const char *pszSeps, char **ppch ) |
char *lscp_strtok ( char *pchBuffer, const char *pszSeps, char **ppch ) |
568 |
|
|
569 |
if (ppList && *ppList) { |
if (ppList && *ppList) { |
570 |
pParams = *ppList; |
pParams = *ppList; |
571 |
while (pParams[i].key) |
while (pParams[i].key) { |
572 |
|
if (strcasecmp(pParams[i].key, pszKey) == 0) { |
573 |
|
if (pParams[i].value) |
574 |
|
free(pParams[i].value); |
575 |
|
pParams[i].value = strdup(pszValue); |
576 |
|
return; |
577 |
|
} |
578 |
i++; |
i++; |
579 |
|
} |
580 |
iSize = LSCP_SPLIT_SIZE(i); |
iSize = LSCP_SPLIT_SIZE(i); |
581 |
pParams[i].key = strdup(pszKey); |
pParams[i].key = strdup(pszKey); |
582 |
pParams[i].value = strdup(pszValue); |
pParams[i].value = strdup(pszValue); |
597 |
} |
} |
598 |
} |
} |
599 |
|
|
600 |
|
#ifdef LSCP_PLIST_COUNT |
601 |
|
|
602 |
// Compute a parameter list valid item count. |
// Compute a parameter list valid item count. |
603 |
int lscp_plist_count ( lscp_param_t **ppList ) |
int lscp_plist_count ( lscp_param_t **ppList ) |
612 |
return i; |
return i; |
613 |
} |
} |
614 |
|
|
|
|
|
615 |
// Compute the legal parameter list size. |
// Compute the legal parameter list size. |
616 |
int lscp_plist_size ( lscp_param_t **ppList ) |
int lscp_plist_size ( lscp_param_t **ppList ) |
617 |
{ |
{ |
618 |
return LSCP_SPLIT_SIZE(lscp_plist_count(ppList)); |
return LSCP_SPLIT_SIZE(lscp_plist_count(ppList)); |
619 |
} |
} |
620 |
|
|
621 |
|
#endif // LSCP_PLIST_COUNT |
622 |
|
|
623 |
|
|
624 |
//------------------------------------------------------------------------- |
//------------------------------------------------------------------------- |
630 |
pEngineInfo->version = NULL; |
pEngineInfo->version = NULL; |
631 |
} |
} |
632 |
|
|
633 |
void lscp_engine_info_reset ( lscp_engine_info_t *pEngineInfo ) |
void lscp_engine_info_free ( lscp_engine_info_t *pEngineInfo ) |
634 |
{ |
{ |
635 |
if (pEngineInfo->description) |
if (pEngineInfo->description) |
636 |
free(pEngineInfo->description); |
free(pEngineInfo->description); |
637 |
if (pEngineInfo->version) |
if (pEngineInfo->version) |
638 |
free(pEngineInfo->version); |
free(pEngineInfo->version); |
639 |
|
} |
640 |
|
|
641 |
|
void lscp_engine_info_reset ( lscp_engine_info_t *pEngineInfo ) |
642 |
|
{ |
643 |
|
lscp_engine_info_free(pEngineInfo); |
644 |
lscp_engine_info_init(pEngineInfo); |
lscp_engine_info_init(pEngineInfo); |
645 |
} |
} |
646 |
|
|
663 |
pChannelInfo->volume = 0.0; |
pChannelInfo->volume = 0.0; |
664 |
} |
} |
665 |
|
|
666 |
void lscp_channel_info_reset ( lscp_channel_info_t *pChannelInfo ) |
void lscp_channel_info_free ( lscp_channel_info_t *pChannelInfo ) |
667 |
{ |
{ |
668 |
if (pChannelInfo->engine_name) |
if (pChannelInfo->engine_name) |
669 |
free(pChannelInfo->engine_name); |
free(pChannelInfo->engine_name); |
671 |
lscp_szsplit_destroy(pChannelInfo->audio_routing); |
lscp_szsplit_destroy(pChannelInfo->audio_routing); |
672 |
if (pChannelInfo->instrument_file) |
if (pChannelInfo->instrument_file) |
673 |
free(pChannelInfo->instrument_file); |
free(pChannelInfo->instrument_file); |
674 |
|
} |
675 |
|
|
676 |
|
void lscp_channel_info_reset ( lscp_channel_info_t *pChannelInfo ) |
677 |
|
{ |
678 |
|
lscp_channel_info_free(pChannelInfo); |
679 |
lscp_channel_info_init(pChannelInfo); |
lscp_channel_info_init(pChannelInfo); |
680 |
} |
} |
681 |
|
|
690 |
pDriverInfo->parameters = NULL; |
pDriverInfo->parameters = NULL; |
691 |
} |
} |
692 |
|
|
693 |
void lscp_driver_info_reset ( lscp_driver_info_t *pDriverInfo ) |
void lscp_driver_info_free ( lscp_driver_info_t *pDriverInfo ) |
694 |
{ |
{ |
695 |
if (pDriverInfo->description) |
if (pDriverInfo->description) |
696 |
free(pDriverInfo->description); |
free(pDriverInfo->description); |
697 |
if (pDriverInfo->version) |
if (pDriverInfo->version) |
698 |
free(pDriverInfo->version); |
free(pDriverInfo->version); |
699 |
lscp_szsplit_destroy(pDriverInfo->parameters); |
lscp_szsplit_destroy(pDriverInfo->parameters); |
700 |
|
} |
701 |
|
|
702 |
|
void lscp_driver_info_reset ( lscp_driver_info_t *pDriverInfo ) |
703 |
|
{ |
704 |
|
lscp_driver_info_free(pDriverInfo); |
705 |
lscp_driver_info_init(pDriverInfo); |
lscp_driver_info_init(pDriverInfo); |
706 |
} |
} |
707 |
|
|
715 |
lscp_plist_alloc(&(pDeviceInfo->params)); |
lscp_plist_alloc(&(pDeviceInfo->params)); |
716 |
} |
} |
717 |
|
|
718 |
void lscp_device_info_reset ( lscp_device_info_t *pDeviceInfo ) |
void lscp_device_info_free ( lscp_device_info_t *pDeviceInfo ) |
719 |
{ |
{ |
720 |
if (pDeviceInfo->driver) |
if (pDeviceInfo->driver) |
721 |
free(pDeviceInfo->driver); |
free(pDeviceInfo->driver); |
722 |
lscp_plist_free(&(pDeviceInfo->params)); |
lscp_plist_free(&(pDeviceInfo->params)); |
723 |
|
} |
724 |
|
|
725 |
|
void lscp_device_info_reset ( lscp_device_info_t *pDeviceInfo ) |
726 |
|
{ |
727 |
|
lscp_device_info_free(pDeviceInfo); |
728 |
lscp_device_info_init(pDeviceInfo); |
lscp_device_info_init(pDeviceInfo); |
729 |
} |
} |
730 |
|
|
738 |
lscp_plist_alloc(&(pDevicePortInfo->params)); |
lscp_plist_alloc(&(pDevicePortInfo->params)); |
739 |
} |
} |
740 |
|
|
741 |
void lscp_device_port_info_reset ( lscp_device_port_info_t *pDevicePortInfo ) |
void lscp_device_port_info_free ( lscp_device_port_info_t *pDevicePortInfo ) |
742 |
{ |
{ |
743 |
if (pDevicePortInfo->name) |
if (pDevicePortInfo->name) |
744 |
free(pDevicePortInfo->name); |
free(pDevicePortInfo->name); |
745 |
lscp_plist_free(&(pDevicePortInfo->params)); |
lscp_plist_free(&(pDevicePortInfo->params)); |
746 |
|
} |
747 |
|
|
748 |
|
void lscp_device_port_info_reset ( lscp_device_port_info_t *pDevicePortInfo ) |
749 |
|
{ |
750 |
|
lscp_device_port_info_free(pDevicePortInfo); |
751 |
lscp_device_port_info_init(pDevicePortInfo); |
lscp_device_port_info_init(pDevicePortInfo); |
752 |
} |
} |
753 |
|
|
769 |
pParamInfo->possibilities = NULL; |
pParamInfo->possibilities = NULL; |
770 |
} |
} |
771 |
|
|
772 |
void lscp_param_info_reset ( lscp_param_info_t *pParamInfo ) |
void lscp_param_info_free ( lscp_param_info_t *pParamInfo ) |
773 |
{ |
{ |
774 |
if (pParamInfo->description) |
if (pParamInfo->description) |
775 |
free(pParamInfo->description); |
free(pParamInfo->description); |
781 |
if (pParamInfo->range_max) |
if (pParamInfo->range_max) |
782 |
free(pParamInfo->range_max); |
free(pParamInfo->range_max); |
783 |
lscp_szsplit_destroy(pParamInfo->possibilities); |
lscp_szsplit_destroy(pParamInfo->possibilities); |
784 |
|
} |
785 |
|
|
786 |
|
void lscp_param_info_reset ( lscp_param_info_t *pParamInfo ) |
787 |
|
{ |
788 |
|
lscp_param_info_free(pParamInfo); |
789 |
lscp_param_info_init(pParamInfo); |
lscp_param_info_init(pParamInfo); |
790 |
} |
} |
791 |
|
|