ext/alsa/: Make alsasink/src a subclass of alsamixer so that mixer stuff shows up in gst-rec. Needs some finetuning.

Original commit message from CVS:
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_type),
(gst_alsa_sink_class_init):
* ext/alsa/gstalsasink.h:
* ext/alsa/gstalsasrc.c: (gst_alsa_src_get_type),
(gst_alsa_src_class_init):
* ext/alsa/gstalsasrc.h:
Make alsasink/src a subclass of alsamixer so that mixer stuff
shows up in gst-rec. Needs some finetuning.
This commit is contained in:
Ronald S. Bultje 2004-05-07 04:56:56 +00:00
parent 07974d8869
commit 7fa3cd3b18
6 changed files with 41 additions and 19 deletions

View file

@ -1,3 +1,15 @@
2004-05-07 Ronald Bultje <rbultje@ronald.bitfreak.net>
* ext/alsa/gstalsamixer.c: (gst_alsa_mixer_build_list):
* ext/alsa/gstalsasink.c: (gst_alsa_sink_get_type),
(gst_alsa_sink_class_init):
* ext/alsa/gstalsasink.h:
* ext/alsa/gstalsasrc.c: (gst_alsa_src_get_type),
(gst_alsa_src_class_init):
* ext/alsa/gstalsasrc.h:
Make alsasink/src a subclass of alsamixer so that mixer stuff
shows up in gst-rec. Needs some finetuning.
2004-05-05 Benjamin Otte <in7y118@public.uni-hamburg.de>
* ext/lame/gstlame.c: (gst_lame_chain):

View file

@ -225,9 +225,17 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
gint i, count;
snd_mixer_elem_t *element;
GstMixerTrack *track;
const GList *templates;
GstPadDirection dir = GST_PAD_UNKNOWN;
g_return_if_fail (((gint) mixer->mixer_handle) != -1);
/* find direction */
templates =
gst_element_class_get_pad_template_list (GST_ELEMENT_GET_CLASS (mixer));
if (templates)
dir = GST_PAD_TEMPLATE (templates->data)->direction;
count = snd_mixer_get_count (mixer->mixer_handle);
element = snd_mixer_first_elem (mixer->mixer_handle);
@ -240,10 +248,10 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
continue;
/* find out if this element can be an input */
if (snd_mixer_selem_has_capture_channel (element, 0) ||
snd_mixer_selem_has_capture_switch (element) ||
snd_mixer_selem_is_capture_mono (element)) {
if ((dir == GST_PAD_SRC || dir == GST_PAD_UNKNOWN) &&
(snd_mixer_selem_has_capture_channel (element, 0) ||
snd_mixer_selem_has_capture_switch (element) ||
snd_mixer_selem_is_capture_mono (element))) {
while (snd_mixer_selem_has_capture_channel (element, channels))
channels++;
@ -256,9 +264,10 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
channels = 0;
if (snd_mixer_selem_has_playback_channel (element, 0) ||
snd_mixer_selem_has_playback_switch (element) ||
snd_mixer_selem_is_playback_mono (element)) {
if ((dir == GST_PAD_SINK || dir == GST_PAD_UNKNOWN) &&
(snd_mixer_selem_has_playback_channel (element, 0) ||
snd_mixer_selem_has_playback_switch (element) ||
snd_mixer_selem_is_playback_mono (element))) {
while (snd_mixer_selem_has_playback_channel (element, channels))
channels++;

View file

@ -95,8 +95,8 @@ gst_alsa_sink_get_type (void)
};
alsa_sink_type =
g_type_register_static (GST_TYPE_ALSA, "GstAlsaSink", &alsa_sink_info,
0);
g_type_register_static (GST_TYPE_ALSA_MIXER, "GstAlsaSink",
&alsa_sink_info, 0);
}
return alsa_sink_type;
}
@ -128,7 +128,7 @@ gst_alsa_sink_class_init (gpointer g_class, gpointer class_data)
alsa_class = (GstAlsaClass *) klass;
if (sink_parent_class == NULL)
sink_parent_class = g_type_class_ref (GST_TYPE_ALSA);
sink_parent_class = g_type_class_ref (GST_TYPE_ALSA_MIXER);
alsa_class->stream = SND_PCM_STREAM_PLAYBACK;
alsa_class->transmit_mmap = gst_alsa_sink_mmap;
@ -294,7 +294,7 @@ gst_alsa_sink_mmap (GstAlsa * this, snd_pcm_sframes_t * avail)
goto out;
}
out:
out:
g_free (src);
return err;
}

View file

@ -22,7 +22,7 @@
#ifndef __GST_ALSA_SINK_H__
#define __GST_ALSA_SINK_H__
#include "gstalsa.h"
#include "gstalsamixer.h"
G_BEGIN_DECLS
@ -36,7 +36,7 @@ typedef struct _GstAlsaSink GstAlsaSink;
typedef struct _GstAlsaSinkClass GstAlsaSinkClass;
struct _GstAlsaSink {
GstAlsa parent;
GstAlsaMixer parent;
/* array of the data on the channels */
guint8 *data[GST_ALSA_MAX_TRACKS]; /* pointer into buffer */
@ -47,7 +47,7 @@ struct _GstAlsaSink {
};
struct _GstAlsaSinkClass {
GstAlsaClass parent_class;
GstAlsaMixerClass parent_class;
};
GType gst_alsa_sink_get_type (void);

View file

@ -79,7 +79,8 @@ gst_alsa_src_get_type (void)
};
alsa_src_type =
g_type_register_static (GST_TYPE_ALSA, "GstAlsaSrc", &alsa_src_info, 0);
g_type_register_static (GST_TYPE_ALSA_MIXER, "GstAlsaSrc",
&alsa_src_info, 0);
}
return alsa_src_type;
}
@ -109,7 +110,7 @@ gst_alsa_src_class_init (gpointer g_class, gpointer class_data)
alsa_class = (GstAlsaClass *) klass;
if (src_parent_class == NULL)
src_parent_class = g_type_class_ref (GST_TYPE_ALSA);
src_parent_class = g_type_class_ref (GST_TYPE_ALSA_MIXER);
alsa_class->stream = SND_PCM_STREAM_CAPTURE;
alsa_class->transmit_mmap = gst_alsa_src_mmap;

View file

@ -22,7 +22,7 @@
#ifndef __GST_ALSA_SRC_H__
#define __GST_ALSA_SRC_H__
#include "gstalsa.h"
#include "gstalsamixer.h"
G_BEGIN_DECLS
@ -36,12 +36,12 @@ typedef struct _GstAlsaSrc GstAlsaSrc;
typedef struct _GstAlsaSrcClass GstAlsaSrcClass;
struct _GstAlsaSrc {
GstAlsa parent;
GstAlsaMixer parent;
GstBuffer *buf[GST_ALSA_MAX_TRACKS];
};
struct _GstAlsaSrcClass {
GstAlsaClass parent_class;
GstAlsaMixerClass parent_class;
};
GType gst_alsa_src_get_type (void);