audiodev_imp.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  1. /*
  2. * Copyright (C) 2008-2011 Teluu Inc. (http://www.teluu.com)
  3. * Copyright (C) 2003-2008 Benny Prijono <benny@prijono.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  18. */
  19. #ifndef __AUDIODEV_IMP_H__
  20. #define __AUDIODEV_IMP_H__
  21. #include <pjmedia-audiodev/audiodev.h>
  22. /**
  23. * @defgroup s8_audio_device_implementors_api Audio Device Implementors API
  24. * @ingroup audio_device_api
  25. * @brief API for audio device implementors
  26. * @{
  27. */
  28. /**
  29. * Sound device factory operations.
  30. */
  31. typedef struct pjmedia_aud_dev_factory_op
  32. {
  33. /**
  34. * Initialize the audio device factory.
  35. *
  36. * @param f The audio device factory.
  37. */
  38. pj_status_t (*init)(pjmedia_aud_dev_factory *f);
  39. /**
  40. * Close this audio device factory and release all resources back to the
  41. * operating system.
  42. *
  43. * @param f The audio device factory.
  44. */
  45. pj_status_t (*destroy)(pjmedia_aud_dev_factory *f);
  46. /**
  47. * Get the number of audio devices installed in the system.
  48. *
  49. * @param f The audio device factory.
  50. */
  51. unsigned (*get_dev_count)(pjmedia_aud_dev_factory *f);
  52. /**
  53. * Get the audio device information and capabilities.
  54. *
  55. * @param f The audio device factory.
  56. * @param index Device index.
  57. * @param info The audio device information structure which will be
  58. * initialized by this function once it returns
  59. * successfully.
  60. */
  61. pj_status_t (*get_dev_info)(pjmedia_aud_dev_factory *f,
  62. unsigned index,
  63. pjmedia_aud_dev_info *info);
  64. /**
  65. * Initialize the specified audio device parameter with the default
  66. * values for the specified device.
  67. *
  68. * @param f The audio device factory.
  69. * @param index Device index.
  70. * @param param The audio device parameter.
  71. */
  72. pj_status_t (*default_param)(pjmedia_aud_dev_factory *f,
  73. unsigned index,
  74. pjmedia_aud_param *param);
  75. /**
  76. * Open the audio device and create audio stream. See
  77. * #pjmedia_aud_stream_create()
  78. */
  79. pj_status_t (*create_stream)(pjmedia_aud_dev_factory *f,
  80. const pjmedia_aud_param *param,
  81. pjmedia_aud_rec_cb rec_cb,
  82. pjmedia_aud_play_cb play_cb,
  83. void *user_data,
  84. pjmedia_aud_stream **p_aud_strm);
  85. /**
  86. * Refresh the list of audio devices installed in the system.
  87. *
  88. * @param f The audio device factory.
  89. */
  90. pj_status_t (*refresh)(pjmedia_aud_dev_factory *f);
  91. } pjmedia_aud_dev_factory_op;
  92. /**
  93. * This structure describes an audio device factory.
  94. */
  95. struct pjmedia_aud_dev_factory
  96. {
  97. /** Internal data to be initialized by audio subsystem. */
  98. struct {
  99. /** Driver index */
  100. unsigned drv_idx;
  101. } sys;
  102. /** Operations */
  103. pjmedia_aud_dev_factory_op *op;
  104. };
  105. /**
  106. * Sound stream operations.
  107. */
  108. typedef struct pjmedia_aud_stream_op
  109. {
  110. /**
  111. * See #pjmedia_aud_stream_get_param()
  112. */
  113. pj_status_t (*get_param)(pjmedia_aud_stream *strm,
  114. pjmedia_aud_param *param);
  115. /**
  116. * See #pjmedia_aud_stream_get_cap()
  117. */
  118. pj_status_t (*get_cap)(pjmedia_aud_stream *strm,
  119. pjmedia_aud_dev_cap cap,
  120. void *value);
  121. /**
  122. * See #pjmedia_aud_stream_set_cap()
  123. */
  124. pj_status_t (*set_cap)(pjmedia_aud_stream *strm,
  125. pjmedia_aud_dev_cap cap,
  126. const void *value);
  127. /**
  128. * See #pjmedia_aud_stream_start()
  129. */
  130. pj_status_t (*start)(pjmedia_aud_stream *strm);
  131. /**
  132. * See #pjmedia_aud_stream_stop().
  133. */
  134. pj_status_t (*stop)(pjmedia_aud_stream *strm);
  135. /**
  136. * See #pjmedia_aud_stream_destroy().
  137. */
  138. pj_status_t (*destroy)(pjmedia_aud_stream *strm);
  139. } pjmedia_aud_stream_op;
  140. /**
  141. * This structure describes the audio device stream.
  142. */
  143. struct pjmedia_aud_stream
  144. {
  145. /** Internal data to be initialized by audio subsystem */
  146. struct {
  147. /** Driver index */
  148. unsigned drv_idx;
  149. } sys;
  150. /** Operations */
  151. pjmedia_aud_stream_op *op;
  152. };
  153. /**
  154. * @}
  155. */
  156. #endif /* __AUDIODEV_IMP_H__ */