mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
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:
parent
07974d8869
commit
7fa3cd3b18
6 changed files with 41 additions and 19 deletions
12
ChangeLog
12
ChangeLog
|
@ -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>
|
2004-05-05 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
|
|
||||||
* ext/lame/gstlame.c: (gst_lame_chain):
|
* ext/lame/gstlame.c: (gst_lame_chain):
|
||||||
|
|
|
@ -225,9 +225,17 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
|
||||||
gint i, count;
|
gint i, count;
|
||||||
snd_mixer_elem_t *element;
|
snd_mixer_elem_t *element;
|
||||||
GstMixerTrack *track;
|
GstMixerTrack *track;
|
||||||
|
const GList *templates;
|
||||||
|
GstPadDirection dir = GST_PAD_UNKNOWN;
|
||||||
|
|
||||||
g_return_if_fail (((gint) mixer->mixer_handle) != -1);
|
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);
|
count = snd_mixer_get_count (mixer->mixer_handle);
|
||||||
element = snd_mixer_first_elem (mixer->mixer_handle);
|
element = snd_mixer_first_elem (mixer->mixer_handle);
|
||||||
|
|
||||||
|
@ -240,10 +248,10 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* find out if this element can be an input */
|
/* find out if this element can be an input */
|
||||||
|
if ((dir == GST_PAD_SRC || dir == GST_PAD_UNKNOWN) &&
|
||||||
if (snd_mixer_selem_has_capture_channel (element, 0) ||
|
(snd_mixer_selem_has_capture_channel (element, 0) ||
|
||||||
snd_mixer_selem_has_capture_switch (element) ||
|
snd_mixer_selem_has_capture_switch (element) ||
|
||||||
snd_mixer_selem_is_capture_mono (element)) {
|
snd_mixer_selem_is_capture_mono (element))) {
|
||||||
while (snd_mixer_selem_has_capture_channel (element, channels))
|
while (snd_mixer_selem_has_capture_channel (element, channels))
|
||||||
channels++;
|
channels++;
|
||||||
|
|
||||||
|
@ -256,9 +264,10 @@ gst_alsa_mixer_build_list (GstAlsaMixer * mixer)
|
||||||
|
|
||||||
channels = 0;
|
channels = 0;
|
||||||
|
|
||||||
if (snd_mixer_selem_has_playback_channel (element, 0) ||
|
if ((dir == GST_PAD_SINK || dir == GST_PAD_UNKNOWN) &&
|
||||||
snd_mixer_selem_has_playback_switch (element) ||
|
(snd_mixer_selem_has_playback_channel (element, 0) ||
|
||||||
snd_mixer_selem_is_playback_mono (element)) {
|
snd_mixer_selem_has_playback_switch (element) ||
|
||||||
|
snd_mixer_selem_is_playback_mono (element))) {
|
||||||
while (snd_mixer_selem_has_playback_channel (element, channels))
|
while (snd_mixer_selem_has_playback_channel (element, channels))
|
||||||
channels++;
|
channels++;
|
||||||
|
|
||||||
|
|
|
@ -95,8 +95,8 @@ gst_alsa_sink_get_type (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
alsa_sink_type =
|
alsa_sink_type =
|
||||||
g_type_register_static (GST_TYPE_ALSA, "GstAlsaSink", &alsa_sink_info,
|
g_type_register_static (GST_TYPE_ALSA_MIXER, "GstAlsaSink",
|
||||||
0);
|
&alsa_sink_info, 0);
|
||||||
}
|
}
|
||||||
return alsa_sink_type;
|
return alsa_sink_type;
|
||||||
}
|
}
|
||||||
|
@ -128,7 +128,7 @@ gst_alsa_sink_class_init (gpointer g_class, gpointer class_data)
|
||||||
alsa_class = (GstAlsaClass *) klass;
|
alsa_class = (GstAlsaClass *) klass;
|
||||||
|
|
||||||
if (sink_parent_class == NULL)
|
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->stream = SND_PCM_STREAM_PLAYBACK;
|
||||||
alsa_class->transmit_mmap = gst_alsa_sink_mmap;
|
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;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
g_free (src);
|
g_free (src);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef __GST_ALSA_SINK_H__
|
#ifndef __GST_ALSA_SINK_H__
|
||||||
#define __GST_ALSA_SINK_H__
|
#define __GST_ALSA_SINK_H__
|
||||||
|
|
||||||
#include "gstalsa.h"
|
#include "gstalsamixer.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ typedef struct _GstAlsaSink GstAlsaSink;
|
||||||
typedef struct _GstAlsaSinkClass GstAlsaSinkClass;
|
typedef struct _GstAlsaSinkClass GstAlsaSinkClass;
|
||||||
|
|
||||||
struct _GstAlsaSink {
|
struct _GstAlsaSink {
|
||||||
GstAlsa parent;
|
GstAlsaMixer parent;
|
||||||
|
|
||||||
/* array of the data on the channels */
|
/* array of the data on the channels */
|
||||||
guint8 *data[GST_ALSA_MAX_TRACKS]; /* pointer into buffer */
|
guint8 *data[GST_ALSA_MAX_TRACKS]; /* pointer into buffer */
|
||||||
|
@ -47,7 +47,7 @@ struct _GstAlsaSink {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstAlsaSinkClass {
|
struct _GstAlsaSinkClass {
|
||||||
GstAlsaClass parent_class;
|
GstAlsaMixerClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_alsa_sink_get_type (void);
|
GType gst_alsa_sink_get_type (void);
|
||||||
|
|
|
@ -79,7 +79,8 @@ gst_alsa_src_get_type (void)
|
||||||
};
|
};
|
||||||
|
|
||||||
alsa_src_type =
|
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;
|
return alsa_src_type;
|
||||||
}
|
}
|
||||||
|
@ -109,7 +110,7 @@ gst_alsa_src_class_init (gpointer g_class, gpointer class_data)
|
||||||
alsa_class = (GstAlsaClass *) klass;
|
alsa_class = (GstAlsaClass *) klass;
|
||||||
|
|
||||||
if (src_parent_class == NULL)
|
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->stream = SND_PCM_STREAM_CAPTURE;
|
||||||
alsa_class->transmit_mmap = gst_alsa_src_mmap;
|
alsa_class->transmit_mmap = gst_alsa_src_mmap;
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
#ifndef __GST_ALSA_SRC_H__
|
#ifndef __GST_ALSA_SRC_H__
|
||||||
#define __GST_ALSA_SRC_H__
|
#define __GST_ALSA_SRC_H__
|
||||||
|
|
||||||
#include "gstalsa.h"
|
#include "gstalsamixer.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
@ -36,12 +36,12 @@ typedef struct _GstAlsaSrc GstAlsaSrc;
|
||||||
typedef struct _GstAlsaSrcClass GstAlsaSrcClass;
|
typedef struct _GstAlsaSrcClass GstAlsaSrcClass;
|
||||||
|
|
||||||
struct _GstAlsaSrc {
|
struct _GstAlsaSrc {
|
||||||
GstAlsa parent;
|
GstAlsaMixer parent;
|
||||||
GstBuffer *buf[GST_ALSA_MAX_TRACKS];
|
GstBuffer *buf[GST_ALSA_MAX_TRACKS];
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstAlsaSrcClass {
|
struct _GstAlsaSrcClass {
|
||||||
GstAlsaClass parent_class;
|
GstAlsaMixerClass parent_class;
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_alsa_src_get_type (void);
|
GType gst_alsa_src_get_type (void);
|
||||||
|
|
Loading…
Reference in a new issue