2011-05-23 11:41:36 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
2013-04-17 00:18:58 +00:00
|
|
|
*
|
2011-05-23 11:41:36 +00:00
|
|
|
* Copyright (C) 2005 Thomas Vander Stichele <thomas@apestaart.org>
|
|
|
|
* Copyright (C) 2005 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
* Copyright (C) 2009-2010 Chris Robinson <chris.kcat@gmail.com>
|
2013-04-17 00:18:58 +00:00
|
|
|
* Copyright (C) 2013 Juan Manuel Borges Caño <juanmabcmail@gmail.com>
|
|
|
|
*
|
2011-05-23 11:41:36 +00:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 20:38:00 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2011-05-23 11:41:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_OPENALSINK_H__
|
|
|
|
#define __GST_OPENALSINK_H__
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
2013-04-17 00:18:58 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2011-05-23 11:41:36 +00:00
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
#include <al.h>
|
|
|
|
#include <alc.h>
|
|
|
|
#include <alext.h>
|
|
|
|
#else
|
|
|
|
#include <AL/al.h>
|
|
|
|
#include <AL/alc.h>
|
|
|
|
#include <AL/alext.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
#define GST_TYPE_OPENAL_SINK \
|
|
|
|
(gst_openal_sink_get_type())
|
2011-05-23 11:41:36 +00:00
|
|
|
#define GST_OPENAL_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_OPENAL_SINK,GstOpenALSink))
|
|
|
|
#define GST_OPENAL_SINK_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_OPENAL_SINK,GstOpenALSinkClass))
|
|
|
|
#define GST_IS_OPENAL_SINK(obj) \
|
|
|
|
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_OPENAL_SINK))
|
|
|
|
#define GST_IS_OPENAL_SINK_CLASS(klass) \
|
|
|
|
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_OPENAL_SINK))
|
2013-04-17 00:18:58 +00:00
|
|
|
#define GST_OPENAL_SINK_CAST(obj) \
|
|
|
|
((GstOpenALSink*)obj)
|
2011-05-23 11:41:36 +00:00
|
|
|
|
|
|
|
#if 1
|
|
|
|
#define GST_ALC_ERROR(Device) ("ALC error: %s", alcGetString((Device), alcGetError((Device))))
|
|
|
|
#else
|
|
|
|
#define GST_ALC_ERROR(Device) ("ALC error: 0x%x", alcGetError((Device)))
|
|
|
|
#endif
|
|
|
|
|
|
|
|
typedef struct _GstOpenALSink GstOpenALSink;
|
|
|
|
typedef struct _GstOpenALSinkClass GstOpenALSinkClass;
|
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
#define GST_OPENAL_SINK_GET_LOCK(obj) (&GST_OPENAL_SINK_CAST(obj)->openal_lock)
|
2011-05-23 11:41:36 +00:00
|
|
|
#define GST_OPENAL_SINK_LOCK(obj) (g_mutex_lock(GST_OPENAL_SINK_GET_LOCK(obj)))
|
|
|
|
#define GST_OPENAL_SINK_UNLOCK(obj) (g_mutex_unlock(GST_OPENAL_SINK_GET_LOCK(obj)))
|
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
struct _GstOpenALSink
|
|
|
|
{
|
|
|
|
GstAudioSink sink;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
gchar *device_name;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALCdevice *default_device;
|
|
|
|
/* When set, device is not owned */
|
|
|
|
ALCdevice *user_device;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALCcontext *default_context;
|
|
|
|
/* When set, device or context is not owned */
|
|
|
|
ALCcontext *user_context;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALuint default_source;
|
|
|
|
/* When set, source is not owned */
|
|
|
|
ALuint user_source;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALuint buffer_idx;
|
|
|
|
ALuint buffer_count;
|
|
|
|
ALuint *buffers;
|
|
|
|
ALuint buffer_length;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALenum format;
|
|
|
|
ALuint rate;
|
|
|
|
ALuint channels;
|
|
|
|
ALuint bytes_per_sample;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
ALboolean write_reset;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
GstCaps *probed_caps;
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
GMutex openal_lock;
|
2011-05-23 11:41:36 +00:00
|
|
|
};
|
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
struct _GstOpenALSinkClass
|
|
|
|
{
|
|
|
|
GstAudioSinkClass parent_class;
|
|
|
|
};
|
2011-05-23 11:41:36 +00:00
|
|
|
|
2013-04-17 00:18:58 +00:00
|
|
|
GType gst_openal_sink_get_type (void);
|
2011-05-23 11:41:36 +00:00
|
|
|
|
|
|
|
G_END_DECLS
|
|
|
|
|
|
|
|
#endif /* __GST_OPENALSINK_H__ */
|