| 1 | /* GStreamer
 | 
|---|
| 2 |  * Copyright (C)  2005 Wim Taymans <wim@fluendo.com>
 | 
|---|
| 3 |  * Copyright (C)  2008 Matthias Kretz <kretz@kde.org>
 | 
|---|
| 4 |  *
 | 
|---|
| 5 |  * gstalsasink2.h:
 | 
|---|
| 6 |  *
 | 
|---|
| 7 |  * This library is free software; you can redistribute it and/or
 | 
|---|
| 8 |  * modify it under the terms of the GNU Library General Public
 | 
|---|
| 9 |  * License as published by the Free Software Foundation; either
 | 
|---|
| 10 |  * version 2 of the License, or (at your option) any later version.
 | 
|---|
| 11 |  *
 | 
|---|
| 12 |  * This library is distributed in the hope that it will be useful,
 | 
|---|
| 13 |  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
|---|
| 14 |  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 | 
|---|
| 15 |  * Library General Public License for more details.
 | 
|---|
| 16 |  *
 | 
|---|
| 17 |  * You should have received a copy of the GNU Library General Public
 | 
|---|
| 18 |  * License along with this library; if not, write to the
 | 
|---|
| 19 |  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 | 
|---|
| 20 |  * Boston, MA 02111-1307, USA.
 | 
|---|
| 21 |  */
 | 
|---|
| 22 | 
 | 
|---|
| 23 | 
 | 
|---|
| 24 | #ifndef ALSASINK2_H
 | 
|---|
| 25 | #define ALSASINK2_H
 | 
|---|
| 26 | 
 | 
|---|
| 27 | #include <gst/gst.h>
 | 
|---|
| 28 | #include <gst/audio/gstaudiosink.h>
 | 
|---|
| 29 | #include <alsa/asoundlib.h>
 | 
|---|
| 30 | 
 | 
|---|
| 31 | G_BEGIN_DECLS
 | 
|---|
| 32 | 
 | 
|---|
| 33 | #define GST_TYPE_ALSA_SINK2            (gst_alsasink2_get_type())
 | 
|---|
| 34 | #define GST_ALSA_SINK2(obj)            (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ALSA_SINK2,_k_GstAlsaSink))
 | 
|---|
| 35 | #define GST_ALSA_SINK2_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_ALSA_SINK2,_k_GstAlsaSinkClass))
 | 
|---|
| 36 | #define GST_IS_ALSA_SINK2(obj)         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ALSA_SINK2))
 | 
|---|
| 37 | #define GST_IS_ALSA_SINK2_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_ALSA_SINK2))
 | 
|---|
| 38 | #define GST_ALSA_SINK2_CAST(obj)       ((_k_GstAlsaSink *) (obj))
 | 
|---|
| 39 | 
 | 
|---|
| 40 | typedef struct _k_GstAlsaSink _k_GstAlsaSink;
 | 
|---|
| 41 | typedef struct _k_GstAlsaSinkClass _k_GstAlsaSinkClass;
 | 
|---|
| 42 | 
 | 
|---|
| 43 | #define GST_ALSA_SINK2_GET_LOCK(obj)    (GST_ALSA_SINK2_CAST (obj)->alsa_lock)
 | 
|---|
| 44 | #define GST_ALSA_SINK2_LOCK(obj)                (g_mutex_lock (GST_ALSA_SINK2_GET_LOCK (obj)))
 | 
|---|
| 45 | #define GST_ALSA_SINK2_UNLOCK(obj)      (g_mutex_unlock (GST_ALSA_SINK2_GET_LOCK (obj)))
 | 
|---|
| 46 | 
 | 
|---|
| 47 | /**
 | 
|---|
| 48 |  * _k_GstAlsaSink:
 | 
|---|
| 49 |  *
 | 
|---|
| 50 |  * Opaque data structure
 | 
|---|
| 51 |  */
 | 
|---|
| 52 | struct _k_GstAlsaSink {
 | 
|---|
| 53 |   GstAudioSink    sink;
 | 
|---|
| 54 | 
 | 
|---|
| 55 |   gchar                 *device;
 | 
|---|
| 56 | 
 | 
|---|
| 57 |   snd_pcm_t             *handle;
 | 
|---|
| 58 |   snd_pcm_hw_params_t   *hwparams;
 | 
|---|
| 59 |   snd_pcm_sw_params_t   *swparams;
 | 
|---|
| 60 | 
 | 
|---|
| 61 |   snd_pcm_access_t access;
 | 
|---|
| 62 |   snd_pcm_format_t format;
 | 
|---|
| 63 |   guint rate;
 | 
|---|
| 64 |   guint channels;
 | 
|---|
| 65 |   gint bytes_per_sample;
 | 
|---|
| 66 |   gboolean iec958;
 | 
|---|
| 67 |   gboolean need_swap;
 | 
|---|
| 68 | 
 | 
|---|
| 69 |   guint buffer_time;
 | 
|---|
| 70 |   guint period_time;
 | 
|---|
| 71 |   snd_pcm_uframes_t buffer_size;
 | 
|---|
| 72 |   snd_pcm_uframes_t period_size;
 | 
|---|
| 73 | 
 | 
|---|
| 74 |   GstCaps *cached_caps;
 | 
|---|
| 75 | 
 | 
|---|
| 76 |   GMutex *alsa_lock;
 | 
|---|
| 77 | };
 | 
|---|
| 78 | 
 | 
|---|
| 79 | struct _k_GstAlsaSinkClass {
 | 
|---|
| 80 |   GstAudioSinkClass parent_class;
 | 
|---|
| 81 | };
 | 
|---|
| 82 | 
 | 
|---|
| 83 | GType gst_alsasink2_get_type(void);
 | 
|---|
| 84 | 
 | 
|---|
| 85 | G_END_DECLS
 | 
|---|
| 86 | 
 | 
|---|
| 87 | #endif /* ALSASINK2_H */
 | 
|---|