+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):
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);
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++;
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++;
};
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;
}
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;
goto out;
}
- out:
+out:
g_free (src);
return err;
}
#ifndef __GST_ALSA_SINK_H__
#define __GST_ALSA_SINK_H__
-#include "gstalsa.h"
+#include "gstalsamixer.h"
G_BEGIN_DECLS
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 */
};
struct _GstAlsaSinkClass {
- GstAlsaClass parent_class;
+ GstAlsaMixerClass parent_class;
};
GType gst_alsa_sink_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;
}
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;
#ifndef __GST_ALSA_SRC_H__
#define __GST_ALSA_SRC_H__
-#include "gstalsa.h"
+#include "gstalsamixer.h"
G_BEGIN_DECLS
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);