jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

124 lines
4.4KB

  1. /*
  2. Copyright (C) 2003 Bob Ham <rah@bash.sh>
  3. Copyright (C) 2008 Nedko Arnaudov <nedko@arnaudov.name>
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU Lesser General Public License as published by
  6. the Free Software Foundation; either version 2.1 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU Lesser General Public License for more details.
  12. You should have received a copy of the GNU Lesser General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  15. */
  16. #ifndef __jack_driver_interface_h__
  17. #define __jack_driver_interface_h__
  18. #ifdef __cplusplus
  19. extern "C"
  20. {
  21. #endif
  22. #include <limits.h>
  23. #include "jslist.h"
  24. #include "JackCompilerDeps.h"
  25. #include "JackSystemDeps.h"
  26. #define JACK_DRIVER_NAME_MAX 15
  27. #define JACK_DRIVER_PARAM_NAME_MAX 15
  28. #define JACK_DRIVER_PARAM_STRING_MAX 127
  29. #define JACK_DRIVER_PARAM_DESC 255
  30. #define JACK_PATH_MAX 511
  31. #define JACK_CONSTRAINT_FLAG_RANGE ((uint32_t)1) /**< if set, constraint is a range (min-max) */
  32. #define JACK_CONSTRAINT_FLAG_STRICT ((uint32_t)2) /**< if set, constraint is strict, i.e. supplying non-matching value will not work */
  33. #define JACK_CONSTRAINT_FLAG_FAKE_VALUE ((uint32_t)4) /**< if set, values have no user meaningful meaning */
  34. /** Driver parameter types */
  35. typedef enum
  36. {
  37. JackDriverParamInt = 1,
  38. JackDriverParamUInt,
  39. JackDriverParamChar,
  40. JackDriverParamString,
  41. JackDriverParamBool
  42. } jack_driver_param_type_t;
  43. /** Driver parameter value */
  44. typedef union
  45. {
  46. uint32_t ui;
  47. int32_t i;
  48. char c;
  49. char str[JACK_DRIVER_PARAM_STRING_MAX + 1];
  50. } jack_driver_param_value_t;
  51. typedef struct {
  52. jack_driver_param_value_t value;
  53. char short_desc[64]; /**< A short (~30 chars) description for the user */
  54. } jack_driver_param_value_enum_t;
  55. typedef struct {
  56. uint32_t flags; /**< JACK_CONSTRAINT_FLAG_XXX */
  57. union {
  58. struct {
  59. jack_driver_param_value_t min;
  60. jack_driver_param_value_t max;
  61. } range; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is set */
  62. struct {
  63. uint32_t count;
  64. jack_driver_param_value_enum_t * possible_values_array;
  65. } enumeration; /**< valid when JACK_CONSTRAINT_FLAG_RANGE flag is not set */
  66. } constraint;
  67. } jack_driver_param_constraint_desc_t;
  68. /** A driver parameter descriptor */
  69. typedef struct {
  70. char name[JACK_DRIVER_NAME_MAX + 1]; /**< The parameter's name */
  71. char character; /**< The parameter's character (for getopt, etc) */
  72. jack_driver_param_type_t type; /**< The parameter's type */
  73. jack_driver_param_value_t value; /**< The parameter's (default) value */
  74. jack_driver_param_constraint_desc_t * constraint; /**< Pointer to parameter constraint descriptor. NULL if there is no constraint */
  75. char short_desc[64]; /**< A short (~30 chars) description for the user */
  76. char long_desc[1024]; /**< A longer description for the user */
  77. }
  78. jack_driver_param_desc_t;
  79. /** A driver parameter */
  80. typedef struct {
  81. char character;
  82. jack_driver_param_value_t value;
  83. }
  84. jack_driver_param_t;
  85. /** A struct for describing a jack driver */
  86. typedef struct {
  87. char name[JACK_DRIVER_NAME_MAX + 1]; /**< The driver's canonical name */
  88. char desc[JACK_DRIVER_PARAM_DESC + 1]; /**< The driver's extended description */
  89. char file[JACK_PATH_MAX + 1]; /**< The filename of the driver's shared object file */
  90. uint32_t nparams; /**< The number of parameters the driver has */
  91. jack_driver_param_desc_t * params; /**< An array of parameter descriptors */
  92. }
  93. jack_driver_desc_t;
  94. SERVER_EXPORT int jack_parse_driver_params (jack_driver_desc_t * desc, int argc, char* argv[], JSList ** param_ptr);
  95. #ifdef __cplusplus
  96. }
  97. #endif
  98. #endif /* __jack_driver_interface_h__ */