2005-07-06 15:27:17 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
|
|
|
|
* 2005 Wim Taymans <wim@fluendo.com>
|
|
|
|
*
|
2005-07-10 12:03:58 +00:00
|
|
|
* gstaudiosrc.h:
|
2005-07-06 15:27:17 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2005-07-06 15:27:17 +00:00
|
|
|
*/
|
|
|
|
|
2013-08-16 12:06:58 +00:00
|
|
|
#ifndef __GST_AUDIO_AUDIO_H__
|
|
|
|
#include <gst/audio/audio.h>
|
|
|
|
#endif
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
#ifndef __GST_AUDIO_SRC_H__
|
|
|
|
#define __GST_AUDIO_SRC_H__
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2011-11-11 11:00:52 +00:00
|
|
|
#include <gst/audio/gstaudiobasesrc.h>
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define GST_TYPE_AUDIO_SRC (gst_audio_src_get_type())
|
|
|
|
#define GST_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_AUDIO_SRC,GstAudioSrc))
|
|
|
|
#define GST_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
|
|
|
|
#define GST_AUDIO_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),GST_TYPE_AUDIO_SRC,GstAudioSrcClass))
|
|
|
|
#define GST_IS_AUDIO_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AUDIO_SRC))
|
2006-04-08 18:09:17 +00:00
|
|
|
#define GST_IS_AUDIO_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AUDIO_SRC))
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
typedef struct _GstAudioSrc GstAudioSrc;
|
|
|
|
typedef struct _GstAudioSrcClass GstAudioSrcClass;
|
|
|
|
|
2008-08-11 09:20:33 +00:00
|
|
|
/**
|
|
|
|
* GstAudioSrc:
|
|
|
|
*
|
|
|
|
* Base class for simple audio sources.
|
|
|
|
*/
|
2005-07-06 15:27:17 +00:00
|
|
|
struct _GstAudioSrc {
|
2011-11-11 10:52:47 +00:00
|
|
|
GstAudioBaseSrc element;
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
/*< private >*/ /* with LOCK */
|
|
|
|
GThread *thread;
|
2005-08-09 17:29:40 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2005-07-06 15:27:17 +00:00
|
|
|
};
|
|
|
|
|
2008-08-11 09:20:33 +00:00
|
|
|
/**
|
|
|
|
* GstAudioSrcClass:
|
|
|
|
* @parent_class: the parent class.
|
|
|
|
* @open: open the device with the specified caps
|
|
|
|
* @prepare: configure device with format
|
|
|
|
* @unprepare: undo the configuration
|
|
|
|
* @close: close the device
|
2014-02-09 10:28:48 +00:00
|
|
|
* @read: read samples from the audio device
|
2015-04-26 19:08:14 +00:00
|
|
|
* @delay: the number of frames queued in the device
|
2008-08-11 09:20:33 +00:00
|
|
|
* @reset: unblock a read to the device and reset.
|
|
|
|
*
|
|
|
|
* #GstAudioSrc class. Override the vmethod to implement
|
|
|
|
* functionality.
|
|
|
|
*/
|
2005-07-06 15:27:17 +00:00
|
|
|
struct _GstAudioSrcClass {
|
2011-11-11 10:52:47 +00:00
|
|
|
GstAudioBaseSrcClass parent_class;
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
/* vtable */
|
|
|
|
|
|
|
|
/* open the device with given specs */
|
2005-08-22 15:11:31 +00:00
|
|
|
gboolean (*open) (GstAudioSrc *src);
|
|
|
|
/* prepare resources and state to operate with the given specs */
|
2011-11-11 10:21:41 +00:00
|
|
|
gboolean (*prepare) (GstAudioSrc *src, GstAudioRingBufferSpec *spec);
|
2005-08-22 15:11:31 +00:00
|
|
|
/* undo anything that was done in prepare() */
|
|
|
|
gboolean (*unprepare) (GstAudioSrc *src);
|
2005-07-06 15:27:17 +00:00
|
|
|
/* close the device */
|
2005-08-22 15:11:31 +00:00
|
|
|
gboolean (*close) (GstAudioSrc *src);
|
2005-07-06 15:27:17 +00:00
|
|
|
/* read samples from the device */
|
2012-09-10 09:26:38 +00:00
|
|
|
guint (*read) (GstAudioSrc *src, gpointer data, guint length,
|
|
|
|
GstClockTime *timestamp);
|
2015-04-27 08:08:17 +00:00
|
|
|
/* get number of frames queued in the device */
|
2005-08-22 15:11:31 +00:00
|
|
|
guint (*delay) (GstAudioSrc *src);
|
2005-07-06 15:27:17 +00:00
|
|
|
/* reset the audio device, unblock from a write */
|
2005-08-22 15:11:31 +00:00
|
|
|
void (*reset) (GstAudioSrc *src);
|
2005-08-09 17:29:40 +00:00
|
|
|
|
|
|
|
/*< private >*/
|
|
|
|
gpointer _gst_reserved[GST_PADDING];
|
2005-07-06 15:27:17 +00:00
|
|
|
};
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
GType gst_audio_src_get_type(void);
|
2005-07-06 15:27:17 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
2005-07-10 12:03:58 +00:00
|
|
|
#endif /* __GST_AUDIO_SRC_H__ */
|