gstaudiosink.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
  3. * 2005 Wim Taymans <wim@fluendo.com>
  4. *
  5. * gstaudiosink.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_SINK_H__
  26. #define __GST_AUDIO_SINK_H__
  27. #include <gst/gst.h>
  28. #include <gst/audio/gstaudiobasesink.h>
  29. G_BEGIN_DECLS
  30. #define GST_TYPE_AUDIO_SINK (gst_audio_sink_get_type())
  31. #define GST_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SINK,GstAudioSink))
  32. #define GST_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
  33. #define GST_AUDIO_SINK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SINK,GstAudioSinkClass))
  34. #define GST_IS_AUDIO_SINK(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SINK))
  35. #define GST_IS_AUDIO_SINK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SINK))
  36. typedef struct _GstAudioSink GstAudioSink;
  37. typedef struct _GstAudioSinkClass GstAudioSinkClass;
  38. /**
  39. * GstAudioSink:
  40. *
  41. * Opaque #GstAudioSink.
  42. */
  43. struct _GstAudioSink {
  44. GstAudioBaseSink element;
  45. /*< private >*/ /* with LOCK */
  46. GThread *thread;
  47. /*< private >*/
  48. gpointer _gst_reserved[GST_PADDING];
  49. };
  50. /**
  51. * GstAudioSinkClass:
  52. * @parent_class: the parent class structure.
  53. * @open: Open the device. No configuration needs to be done at this point.
  54. * This function is also used to check if the device is available.
  55. * @prepare: Prepare the device to operate with the specified parameters.
  56. * @unprepare: Undo operations done in prepare.
  57. * @close: Close the device.
  58. * @write: Write data to the device.
  59. * @delay: Return how many frames are still in the device. This is used to
  60. * drive the synchronisation.
  61. * @reset: Returns as quickly as possible from a write and flush any pending
  62. * samples from the device.
  63. *
  64. * #GstAudioSink class. Override the vmethods to implement functionality.
  65. */
  66. struct _GstAudioSinkClass {
  67. GstAudioBaseSinkClass parent_class;
  68. /* vtable */
  69. /* open the device with given specs */
  70. gboolean (*open) (GstAudioSink *sink);
  71. /* prepare resources and state to operate with the given specs */
  72. gboolean (*prepare) (GstAudioSink *sink, GstAudioRingBufferSpec *spec);
  73. /* undo anything that was done in prepare() */
  74. gboolean (*unprepare) (GstAudioSink *sink);
  75. /* close the device */
  76. gboolean (*close) (GstAudioSink *sink);
  77. /* write samples to the device */
  78. gint (*write) (GstAudioSink *sink, gpointer data, guint length);
  79. /* get number of frames queued in the device */
  80. guint (*delay) (GstAudioSink *sink);
  81. /* reset the audio device, unblock from a write */
  82. void (*reset) (GstAudioSink *sink);
  83. /*< private >*/
  84. gpointer _gst_reserved[GST_PADDING];
  85. };
  86. GType gst_audio_sink_get_type(void);
  87. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  88. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstAudioSink, gst_object_unref)
  89. #endif
  90. G_END_DECLS
  91. #endif /* __GST_AUDIO_SINK_H__ */