gstaudiosrc.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  3. * 2005 Wim Taymans <wim@fluendo.com>
  4. *
  5. * gstaudiosrc.h:
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __GST_AUDIO_AUDIO_H__
  23. #include <gst/audio/audio.h>
  24. #endif
  25. #ifndef __GST_AUDIO_SRC_H__
  26. #define __GST_AUDIO_SRC_H__
  27. #include <gst/gst.h>
  28. #include <gst/audio/gstaudiobasesrc.h>
  29. G_BEGIN_DECLS
  30. #define GST_TYPE_AUDIO_SRC (gst_audio_src_get_type())
  31. #define GST_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc))
  32. #define GST_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
  33. #define GST_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
  34. #define GST_IS_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC))
  35. #define GST_IS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
  36. typedef struct _GstAudioSrc GstAudioSrc;
  37. typedef struct _GstAudioSrcClass GstAudioSrcClass;
  38. /**
  39. * GstAudioSrc:
  40. *
  41. * Base class for simple audio sources.
  42. */
  43. struct _GstAudioSrc {
  44. GstAudioBaseSrc element;
  45. /*< private >*/ /* with LOCK */
  46. GThread *thread;
  47. /*< private >*/
  48. gpointer _gst_reserved[GST_PADDING];
  49. };
  50. /**
  51. * GstAudioSrcClass:
  52. * @parent_class: the parent class.
  53. * @open: open the device with the specified caps
  54. * @prepare: configure device with format
  55. * @unprepare: undo the configuration
  56. * @close: close the device
  57. * @read: read samples from the audio device
  58. * @delay: the number of frames queued in the device
  59. * @reset: unblock a read to the device and reset.
  60. *
  61. * #GstAudioSrc class. Override the vmethod to implement
  62. * functionality.
  63. */
  64. struct _GstAudioSrcClass {
  65. GstAudioBaseSrcClass parent_class;
  66. /* vtable */
  67. /* open the device with given specs */
  68. gboolean (*open) (GstAudioSrc *src);
  69. /* prepare resources and state to operate with the given specs */
  70. gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec);
  71. /* undo anything that was done in prepare() */
  72. gboolean (*unprepare) (GstAudioSrc *src);
  73. /* close the device */
  74. gboolean (*close) (GstAudioSrc *src);
  75. /* read samples from the device */
  76. guint (*read) (GstAudioSrc *src, gpointer data, guint length,
  77. GstClockTime *timestamp);
  78. /* get number of frames queued in the device */
  79. guint (*delay) (GstAudioSrc *src);
  80. /* reset the audio device, unblock from a write */
  81. void (*reset) (GstAudioSrc *src);
  82. /*< private >*/
  83. gpointer _gst_reserved[GST_PADDING];
  84. };
  85. GType gst_audio_src_get_type(void);
  86. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  87. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSrc, gst_object_unref)
  88. #endif
  89. G_END_DECLS
  90. #endif /* __GST_AUDIO_SRC_H__ */