mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 13:41:48 +00:00
total code reorganization as a start to get alsasrc working - sink and src are now really different classes, not just...
Original commit message from CVS: total code reorganization as a start to get alsasrc working - sink and src are now really different classes, not just on paper - includes a fix that makes the testsuite work that might be an older bug
This commit is contained in:
parent
232891aaf1
commit
dcdb424424
2 changed files with 672 additions and 513 deletions
1138
ext/alsa/gstalsa.c
1138
ext/alsa/gstalsa.c
File diff suppressed because it is too large
Load diff
|
@ -38,6 +38,7 @@
|
||||||
|
|
||||||
#define GST_ALSA(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_ALSA, GstAlsa)
|
#define GST_ALSA(obj) G_TYPE_CHECK_INSTANCE_CAST(obj, GST_TYPE_ALSA, GstAlsa)
|
||||||
#define GST_ALSA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_ALSA, GstAlsaClass)
|
#define GST_ALSA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST(klass, GST_TYPE_ALSA, GstAlsaClass)
|
||||||
|
#define GST_ALSA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_ALSA, GstAlsaClass))
|
||||||
#define GST_IS_ALSA(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, GST_TYPE_ALSA)
|
#define GST_IS_ALSA(obj) G_TYPE_CHECK_INSTANCE_TYPE(obj, GST_TYPE_ALSA)
|
||||||
#define GST_IS_ALSA_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_ALSA)
|
#define GST_IS_ALSA_CLASS(klass) G_TYPE_CHECK_CLASS_TYPE(klass, GST_TYPE_ALSA)
|
||||||
#define GST_TYPE_ALSA gst_alsa_get_type()
|
#define GST_TYPE_ALSA gst_alsa_get_type()
|
||||||
|
@ -65,10 +66,10 @@
|
||||||
|
|
||||||
typedef struct _GstAlsa GstAlsa;
|
typedef struct _GstAlsa GstAlsa;
|
||||||
typedef struct _GstAlsaClass GstAlsaClass;
|
typedef struct _GstAlsaClass GstAlsaClass;
|
||||||
typedef GstAlsa GstAlsaSink;
|
typedef struct _GstAlsaSink GstAlsaSink;
|
||||||
typedef GstAlsaClass GstAlsaSinkClass;
|
typedef struct _GstAlsaSinkClass GstAlsaSinkClass;
|
||||||
typedef GstAlsa GstAlsaSrc;
|
typedef struct _GstAlsaSrc GstAlsaSrc;
|
||||||
typedef GstAlsaClass GstAlsaSrcClass;
|
typedef struct _GstAlsaSrcClass GstAlsaSrcClass;
|
||||||
|
|
||||||
typedef struct _GstAlsaClock GstAlsaClock;
|
typedef struct _GstAlsaClock GstAlsaClock;
|
||||||
typedef struct _GstAlsaClockClass GstAlsaClockClass;
|
typedef struct _GstAlsaClockClass GstAlsaClockClass;
|
||||||
|
@ -98,14 +99,6 @@ typedef enum {
|
||||||
|
|
||||||
typedef int (*GstAlsaTransmitFunction) (GstAlsa *this, snd_pcm_sframes_t *avail);
|
typedef int (*GstAlsaTransmitFunction) (GstAlsa *this, snd_pcm_sframes_t *avail);
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
GstPad * pad;
|
|
||||||
guint8 * data; /* pointer into buffer */
|
|
||||||
guint size; /* sink: bytes left in buffer */
|
|
||||||
GstBuffer * buf; /* current buffer */
|
|
||||||
guint behaviour; /* 0 = data points into buffer (so unref when size == 0),
|
|
||||||
1 = data should be freed, use buffer after that */
|
|
||||||
} GstAlsaPad;
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
snd_pcm_format_t format;
|
snd_pcm_format_t format;
|
||||||
guint rate;
|
guint rate;
|
||||||
|
@ -116,10 +109,9 @@ struct _GstAlsa {
|
||||||
GstElement parent;
|
GstElement parent;
|
||||||
|
|
||||||
/* array of GstAlsaPads */
|
/* array of GstAlsaPads */
|
||||||
GstAlsaPad pads[GST_ALSA_MAX_CHANNELS];
|
GstPad * pad[GST_ALSA_MAX_CHANNELS];
|
||||||
|
|
||||||
gchar * device;
|
gchar * device;
|
||||||
snd_pcm_stream_t stream;
|
|
||||||
snd_pcm_t * handle;
|
snd_pcm_t * handle;
|
||||||
guint pcm_caps; /* capabilities of the pcm device, see GstAlsaPcmCaps */
|
guint pcm_caps; /* capabilities of the pcm device, see GstAlsaPcmCaps */
|
||||||
snd_output_t * out;
|
snd_output_t * out;
|
||||||
|
@ -146,9 +138,32 @@ struct _GstAlsa {
|
||||||
*/
|
*/
|
||||||
};
|
};
|
||||||
struct _GstAlsaClass {
|
struct _GstAlsaClass {
|
||||||
GstElementClass parent_class;
|
GstElementClass parent_class;
|
||||||
};
|
|
||||||
|
|
||||||
|
snd_pcm_stream_t stream;
|
||||||
|
|
||||||
|
/* different transmit functions */
|
||||||
|
GstAlsaTransmitFunction transmit_mmap;
|
||||||
|
GstAlsaTransmitFunction transmit_rw;
|
||||||
|
};
|
||||||
|
struct _GstAlsaSink {
|
||||||
|
GstAlsa parent;
|
||||||
|
/* array of the data on the channels */
|
||||||
|
guint8 * data[GST_ALSA_MAX_CHANNELS]; /* pointer into buffer */
|
||||||
|
guint size[GST_ALSA_MAX_CHANNELS]; /* sink: bytes left in buffer */
|
||||||
|
GstBuffer * buf[GST_ALSA_MAX_CHANNELS]; /* current buffer */
|
||||||
|
guint behaviour[GST_ALSA_MAX_CHANNELS]; /* 0 = data points into buffer (so unref when size == 0),
|
||||||
|
1 = data should be freed, use buffer after that */
|
||||||
|
};
|
||||||
|
struct _GstAlsaSinkClass {
|
||||||
|
GstAlsaClass parent_class;
|
||||||
|
};
|
||||||
|
struct _GstAlsaSrc {
|
||||||
|
GstAlsa parent;
|
||||||
|
};
|
||||||
|
struct _GstAlsaSrcClass {
|
||||||
|
GstAlsaClass parent_class;
|
||||||
|
};
|
||||||
|
|
||||||
struct _GstAlsaClock {
|
struct _GstAlsaClock {
|
||||||
GstSystemClock parent;
|
GstSystemClock parent;
|
||||||
|
|
Loading…
Reference in a new issue