+ removed the access_addr crap from GstAlsaPad ... just use this->access_addr[channel] instead + completely reorganiz...

Original commit message from CVS:
+ removed the access_addr crap from GstAlsaPad ... just use
this->access_addr[channel] instead
+ completely reorganized and reindented code
+ removed the gst_alsa_sink_silence_on_channel function, needs to be completely
redone anyway
+ got alsasink to work on my machine finally ! yay !
This commit is contained in:
Leif Johnson 2003-01-27 12:59:24 +00:00
parent 6e8404d9bb
commit f032898326
2 changed files with 1191 additions and 1304 deletions

File diff suppressed because it is too large Load diff

View file

@ -1,23 +1,22 @@
/* -*- c-basic-offset: 4 -*- */
/* /*
Copyright (C) 2001 CodeFactory AB * Copyright (C) 2001 CodeFactory AB
Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se> * Copyright (C) 2001 Thomas Nyberg <thomas@codefactory.se>
Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu> * Copyright (C) 2001-2002 Andy Wingo <apwingo@eos.ncsu.edu>
*
This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public * modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either * License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version. * version 2 of the License, or (at your option) any later version.
*
This library is distributed in the hope that it will be useful, * This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details. * Library General Public License for more details.
*
You should have received a copy of the GNU Library General Public * You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free * License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#ifndef __GST_ALSA_H__ #ifndef __GST_ALSA_H__
#define __GST_ALSA_H__ #define __GST_ALSA_H__
@ -58,68 +57,68 @@ typedef GstAlsa GstAlsaSrc;
typedef GstAlsaClass GstAlsaSrcClass; typedef GstAlsaClass GstAlsaSrcClass;
enum { enum {
GST_ALSA_OPEN = GST_ELEMENT_FLAG_LAST, GST_ALSA_OPEN = GST_ELEMENT_FLAG_LAST,
GST_ALSA_RUNNING, GST_ALSA_RUNNING,
GST_ALSA_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 3, GST_ALSA_FLAG_LAST = GST_ELEMENT_FLAG_LAST + 3,
}; };
typedef gboolean (*GstAlsaProcessFunc) (GstAlsa *, snd_pcm_uframes_t frames); typedef gboolean (*GstAlsaProcessFunc) (GstAlsa *, snd_pcm_uframes_t frames);
typedef struct { typedef struct {
gint channel; gint channel;
GstPad *pad; GstPad *pad;
GstByteStream *bs; GstByteStream *bs;
/* pointer to where we can access mmap_areas */
char *access_addr; /* buf and offset are only used for src elements to hold data from the sound
char *buf; card, while we're waiting for an entire period_frames data. */
/* how much of the buffer we have used */ char *buf;
snd_pcm_uframes_t offset; snd_pcm_uframes_t offset;
} GstAlsaPad; } GstAlsaPad;
struct _GstAlsa { struct _GstAlsa {
GstElement parent; GstElement parent;
/* list of GstAlsaPads */ /* list of GstAlsaPads */
GList *pads; GList *pads;
gchar *device;
snd_pcm_stream_t stream;
snd_pcm_t *handle;
snd_output_t *out;
/* our mmap'd data areas */
gboolean mmap_open;
const snd_pcm_channel_area_t *mmap_areas;
char **access_addr;
snd_pcm_uframes_t offset;
snd_pcm_sframes_t avail;
GstAlsaProcessFunc process;
snd_pcm_format_t format;
guint rate;
gint channels;
guint32 mute; /* bitmask. */
/* the gstreamer data */
gboolean data_interleaved;
/* access to the hardware */
gboolean access_interleaved;
guint sample_bytes;
guint interleave_unit;
guint interleave_skip;
guint buffer_frames;
guint period_count; /* 'number of fragments' in oss-speak */
guint period_frames;
gboolean debug; gchar *device;
snd_pcm_stream_t stream;
snd_pcm_t *handle;
snd_output_t *out;
/* our mmap'd data areas */
gboolean mmap_open;
const snd_pcm_channel_area_t *mmap_areas;
char **access_addr;
snd_pcm_uframes_t offset;
snd_pcm_sframes_t avail;
GstAlsaProcessFunc process;
snd_pcm_format_t format;
guint rate;
gint channels;
guint32 mute; /* bitmask. */
/* the gstreamer data */
gboolean data_interleaved;
gboolean autorecover;
/* access to the hardware */
gboolean access_interleaved;
guint sample_bytes;
guint interleave_unit;
guint interleave_skip;
guint buffer_frames;
guint period_count; /* 'number of fragments' in oss-speak */
guint period_frames;
gboolean debug;
}; };
struct _GstAlsaClass { struct _GstAlsaClass {
GstElementClass parent_class; GstElementClass parent_class;
}; };
GType gst_alsa_get_type (void); GType gst_alsa_get_type (void);