mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
Activate osxaudio in gst-plugins-good with proper build setup.
Original commit message from CVS: * configure.ac: * sys/Makefile.am: * sys/osxaudio/Makefile.am: * sys/osxaudio/gstosxaudio.c: * sys/osxaudio/gstosxaudiosink.c: (gst_osx_audio_sink_osxelement_do_init), (gst_osx_audio_sink_init), (gst_osx_audio_sink_getcaps), (gst_osx_audio_sink_create_ringbuffer), (plugin_init): * sys/osxaudio/gstosxaudiosrc.c: (gst_osx_audio_src_osxelement_do_init), (gst_osx_audio_src_init), (gst_osx_audio_src_create_ringbuffer): * sys/osxaudio/gstosxringbuffer.c: (gst_osx_ring_buffer_get_type), (gst_osx_ring_buffer_class_init), (gst_osx_ring_buffer_init), (gst_osx_ring_buffer_acquire), (gst_osx_ring_buffer_start), (gst_osx_ring_buffer_pause), (gst_osx_ring_buffer_stop): * sys/osxaudio/gstosxringbuffer.h: Activate osxaudio in gst-plugins-good with proper build setup. Add inlined documentation. Fix debug statements Fix ringbuffer when pausing. Fixes #323471
This commit is contained in:
parent
1be3219c70
commit
4d0df9433c
9 changed files with 127 additions and 52 deletions
24
ChangeLog
24
ChangeLog
|
@ -1,3 +1,27 @@
|
|||
2007-03-15 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* configure.ac:
|
||||
* sys/Makefile.am:
|
||||
* sys/osxaudio/Makefile.am:
|
||||
* sys/osxaudio/gstosxaudio.c:
|
||||
* sys/osxaudio/gstosxaudiosink.c:
|
||||
(gst_osx_audio_sink_osxelement_do_init), (gst_osx_audio_sink_init),
|
||||
(gst_osx_audio_sink_getcaps),
|
||||
(gst_osx_audio_sink_create_ringbuffer), (plugin_init):
|
||||
* sys/osxaudio/gstosxaudiosrc.c:
|
||||
(gst_osx_audio_src_osxelement_do_init), (gst_osx_audio_src_init),
|
||||
(gst_osx_audio_src_create_ringbuffer):
|
||||
* sys/osxaudio/gstosxringbuffer.c: (gst_osx_ring_buffer_get_type),
|
||||
(gst_osx_ring_buffer_class_init), (gst_osx_ring_buffer_init),
|
||||
(gst_osx_ring_buffer_acquire), (gst_osx_ring_buffer_start),
|
||||
(gst_osx_ring_buffer_pause), (gst_osx_ring_buffer_stop):
|
||||
* sys/osxaudio/gstosxringbuffer.h:
|
||||
Activate osxaudio in gst-plugins-good with proper build setup.
|
||||
Add inlined documentation.
|
||||
Fix debug statements
|
||||
Fix ringbuffer when pausing.
|
||||
Fixes #323471
|
||||
|
||||
2007-03-14 Philippe Kalaf <philippe.kalaf@collabora.co.uk>
|
||||
* gst/rtp/gstrtppcmapay.c:
|
||||
* gst/rtp/gstrtppcmapay.h:
|
||||
|
|
|
@ -376,6 +376,13 @@ AG_GST_CHECK_FEATURE(SUNAUDIO, [Sun Audio], sunaudio, [
|
|||
AC_CHECK_HEADER(sys/audioio.h, HAVE_SUNAUDIO="yes", HAVE_SUNAUDIO="no")
|
||||
])
|
||||
|
||||
dnl *** OSX Audio ***
|
||||
translit(dnm, m, l) AM_CONDITIONAL(USE_OSX_AUDIO, true)
|
||||
AG_GST_CHECK_FEATURE(OSX_AUDIO, [OSX audio], osxaudio, [
|
||||
AC_CHECK_HEADER(CoreAudio/CoreAudio.h, HAVE_OSX_AUDIO="yes", HAVE_OSX_AUDIO="no")
|
||||
])
|
||||
|
||||
|
||||
dnl *** Video 4 Linux 2 ***
|
||||
dnl for information about the header/define, see sys/v4l2/gstv4l2element.h
|
||||
dnl renamed to GST_V4L2 because of some conflict with kernel headers
|
||||
|
@ -779,6 +786,7 @@ dnl but we still need to set the conditionals
|
|||
AM_CONDITIONAL(USE_GCONFTOOL, false)
|
||||
AM_CONDITIONAL(USE_OSS, false)
|
||||
AM_CONDITIONAL(USE_SUNAUDIO, false)
|
||||
AM_CONDITIONAL(USE_OSX_AUDIO, false)
|
||||
AM_CONDITIONAL(USE_X, false)
|
||||
AM_CONDITIONAL(USE_XSHM, false)
|
||||
AM_CONDITIONAL(USE_AALIB, false)
|
||||
|
@ -902,6 +910,7 @@ ext/taglib/Makefile
|
|||
sys/Makefile
|
||||
sys/oss/Makefile
|
||||
sys/sunaudio/Makefile
|
||||
sys/osxaudio/Makefile
|
||||
sys/v4l2/Makefile
|
||||
sys/ximage/Makefile
|
||||
po/Makefile.in
|
||||
|
|
|
@ -16,11 +16,11 @@ else
|
|||
SUNAUDIO_DIR=
|
||||
endif
|
||||
|
||||
# if USE_OSX_AUDIO
|
||||
# OSX_AUDIO_DIR=osxaudio
|
||||
# else
|
||||
# OSX_AUDIO_DIR=
|
||||
# endif
|
||||
if USE_OSX_AUDIO
|
||||
OSX_AUDIO_DIR=osxaudio
|
||||
else
|
||||
OSX_AUDIO_DIR=
|
||||
endif
|
||||
|
||||
# if USE_OSX_VIDEO
|
||||
# OSX_VIDEO_DIR=osxvideo
|
||||
|
@ -64,6 +64,6 @@ else
|
|||
XIMAGE_DIR=
|
||||
endif
|
||||
|
||||
SUBDIRS=$(OSS_DIR) $(SUNAUDIO_DIR) $(V4L2_DIR) $(XIMAGE_DIR)
|
||||
SUBDIRS=$(OSS_DIR) $(OSX_AUDIO_DIR) $(SUNAUDIO_DIR) $(V4L2_DIR) $(XIMAGE_DIR)
|
||||
|
||||
DIST_SUBDIRS=oss sunaudio v4l2 ximage
|
||||
|
|
|
@ -5,8 +5,12 @@ libgstosxaudio_la_SOURCES = gstosxringbuffer.c \
|
|||
gstosxaudiosink.c \
|
||||
gstosxaudiosrc.c
|
||||
|
||||
libgstosxaudio_la_CFLAGS = $(GST_CFLAGS) $(GST_BASE_CFLAGS) $(GSTPB_BASE_FLAGS)
|
||||
libgstosxaudio_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(GSTPB_BASE_LIBS) -lgstaudio-@GST_MAJORMINOR@
|
||||
libgstosxaudio_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
|
||||
libgstosxaudio_la_LIBADD = \
|
||||
-lgstinterfaces-@GST_MAJORMINOR@ \
|
||||
-lgstaudio-@GST_MAJORMINOR@ \
|
||||
$(GST_PLUGINS_BASE_LIBS) \
|
||||
$(GST_LIBS)
|
||||
libgstosxaudio_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) -Wl,-framework -Wl,CoreAudio
|
||||
|
||||
noinst_HEADERS = gstosxaudiosink.h \
|
||||
|
|
|
@ -20,6 +20,27 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* SECTION:element-osxaudiosink
|
||||
* @short_description: play audio to an CoreAudio device
|
||||
*
|
||||
* <refsect2>
|
||||
* <para>
|
||||
* This element renders raw audio samples using the CoreAudio api.
|
||||
* </para>
|
||||
* <title>Example pipelines</title>
|
||||
* <para>
|
||||
* Play an Ogg/Vorbis file.
|
||||
* </para>
|
||||
* <programlisting>
|
||||
* gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! osxaudiosink
|
||||
* </programlisting>
|
||||
* </refsect2>
|
||||
*
|
||||
* Last reviewed on 2006-03-01 (0.10.4)
|
||||
*/
|
||||
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
|
|
@ -129,7 +129,7 @@ gst_osx_audio_sink_osxelement_do_init (GType type)
|
|||
|
||||
GST_DEBUG_CATEGORY_INIT (osx_audiosink_debug, "osxaudiosink", 0,
|
||||
"OSX Audio Sink");
|
||||
GST_DEBUG ("Adding static interface\n");
|
||||
GST_DEBUG ("Adding static interface");
|
||||
g_type_add_interface_static (type, GST_OSX_AUDIO_ELEMENT_TYPE,
|
||||
&osxelement_info);
|
||||
}
|
||||
|
@ -190,9 +190,9 @@ gst_osx_audio_sink_init (GstOsxAudioSink * sink, GstOsxAudioSinkClass * gclass)
|
|||
{
|
||||
/* GstElementClass *klass = GST_ELEMENT_GET_CLASS (sink); */
|
||||
sink->ringbuffer = NULL;
|
||||
GST_DEBUG ("Initialising object\n");
|
||||
gst_osx_audio_sink_create_ringbuffer (sink);
|
||||
GST_DEBUG ("Initialising object");
|
||||
|
||||
gst_osx_audio_sink_create_ringbuffer (GST_BASE_AUDIO_SINK (sink));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -256,11 +256,12 @@ gst_osx_audio_sink_getcaps (GstBaseSink * sink)
|
|||
kAudioDevicePropertyAvailableNominalSampleRates, &propertySize, &rates);
|
||||
|
||||
GST_DEBUG
|
||||
("Getting available sample rates: Status: %d number of ranges: %d\n",
|
||||
("Getting available sample rates: Status: %ld number of ranges: %lu",
|
||||
status, propertySize / sizeof (AudioValueRange));
|
||||
|
||||
for (i = 0; i < propertySize / sizeof (AudioValueRange); i++) {
|
||||
g_print ("Range from %f to %f\n", rates[i].mMinimum, rates[i].mMaximum);
|
||||
GST_LOG_OBJECT (osxsink, "Range from %f to %f", rates[i].mMinimum,
|
||||
rates[i].mMaximum);
|
||||
}
|
||||
|
||||
return caps;
|
||||
|
@ -274,9 +275,9 @@ gst_osx_audio_sink_create_ringbuffer (GstBaseAudioSink * sink)
|
|||
|
||||
osxsink = GST_OSX_AUDIO_SINK (sink);
|
||||
if (!osxsink->ringbuffer) {
|
||||
GST_DEBUG ("Creating ringbuffer\n");
|
||||
GST_DEBUG ("Creating ringbuffer");
|
||||
osxsink->ringbuffer = g_object_new (GST_TYPE_OSX_RING_BUFFER, NULL);
|
||||
GST_DEBUG ("osx sink 0x%x element 0x%x ioproc 0x%x\n", osxsink,
|
||||
GST_DEBUG ("osx sink 0x%p element 0x%p ioproc 0x%p", osxsink,
|
||||
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink),
|
||||
(void *) gst_osx_audio_sink_io_proc);
|
||||
osxsink->ringbuffer->element =
|
||||
|
@ -333,9 +334,9 @@ plugin_init (GstPlugin * plugin)
|
|||
gboolean ret;
|
||||
|
||||
ret = gst_element_register (plugin, "osxaudiosink",
|
||||
GST_RANK_NONE, GST_TYPE_OSX_AUDIO_SINK);
|
||||
GST_RANK_PRIMARY, GST_TYPE_OSX_AUDIO_SINK);
|
||||
return ret && gst_element_register (plugin, "osxaudiosrc",
|
||||
GST_RANK_NONE, GST_TYPE_OSX_AUDIO_SRC);
|
||||
GST_RANK_PRIMARY, GST_TYPE_OSX_AUDIO_SRC);
|
||||
}
|
||||
|
||||
/* this is the structure that gstreamer looks for to register plugins
|
||||
|
|
|
@ -122,7 +122,7 @@ gst_osx_audio_src_osxelement_do_init (GType type)
|
|||
|
||||
GST_DEBUG_CATEGORY_INIT (osx_audiosrc_debug, "osxaudiosrc", 0,
|
||||
"OSX Audio Src");
|
||||
GST_DEBUG ("Adding static interface\n");
|
||||
GST_DEBUG ("Adding static interface");
|
||||
g_type_add_interface_static (type, GST_OSX_AUDIO_ELEMENT_TYPE,
|
||||
&osxelement_info);
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ gst_osx_audio_src_init (GstOsxAudioSrc * src, GstOsxAudioSrcClass * gclass)
|
|||
/* GstElementClass *klass = GST_ELEMENT_GET_CLASS (sink); */
|
||||
gst_base_src_set_live (GST_BASE_SRC (src), TRUE);
|
||||
src->ringbuffer = NULL;
|
||||
GST_DEBUG ("Initialising object\n");
|
||||
GST_DEBUG ("Initialising object");
|
||||
gst_osx_audio_src_create_ringbuffer (GST_BASE_AUDIO_SRC (src));
|
||||
}
|
||||
|
||||
|
@ -233,9 +233,9 @@ gst_osx_audio_src_create_ringbuffer (GstBaseAudioSrc * src)
|
|||
|
||||
osxsrc = GST_OSX_AUDIO_SRC (src);
|
||||
if (!osxsrc->ringbuffer) {
|
||||
GST_DEBUG ("Creating ringbuffer\n");
|
||||
GST_DEBUG ("Creating ringbuffer");
|
||||
osxsrc->ringbuffer = g_object_new (GST_TYPE_OSX_RING_BUFFER, NULL);
|
||||
GST_DEBUG ("osx src 0x%x element 0x%x ioproc 0x%x\n", osxsrc,
|
||||
GST_DEBUG ("osx src 0x%p element 0x%p ioproc 0x%p", osxsrc,
|
||||
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsrc),
|
||||
(void *) gst_osx_audio_src_io_proc);
|
||||
osxsrc->ringbuffer->element = GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsrc);
|
||||
|
|
|
@ -90,7 +90,7 @@ gst_osx_ring_buffer_get_type (void)
|
|||
};
|
||||
GST_DEBUG_CATEGORY_INIT (osx_audio_debug, "osxaudio", 0,
|
||||
"OSX Audio Elements");
|
||||
GST_DEBUG ("Creating osx ring buffer type\n");
|
||||
GST_DEBUG ("Creating osx ring buffer type");
|
||||
|
||||
ringbuffer_type =
|
||||
g_type_register_static (GST_TYPE_RING_BUFFER, "GstOsxRingBuffer",
|
||||
|
@ -130,7 +130,7 @@ gst_osx_ring_buffer_class_init (GstOsxRingBufferClass * klass)
|
|||
|
||||
gstringbuffer_class->delay = GST_DEBUG_FUNCPTR (gst_osx_ring_buffer_delay);
|
||||
|
||||
GST_DEBUG ("osx ring buffer class init\n");
|
||||
GST_DEBUG ("osx ring buffer class init");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -141,21 +141,21 @@ gst_osx_ring_buffer_init (GstOsxRingBuffer * ringbuffer,
|
|||
UInt32 propertySize;
|
||||
|
||||
/* currently do bugger all */
|
||||
GST_DEBUG ("osx ring buffer init\n");
|
||||
GST_DEBUG ("osx ring buffer init");
|
||||
propertySize = sizeof (ringbuffer->device_id);
|
||||
status =
|
||||
AudioHardwareGetProperty (kAudioHardwarePropertyDefaultOutputDevice,
|
||||
&propertySize, &(ringbuffer->device_id));
|
||||
GST_DEBUG ("osx ring buffer called AudioHardwareGetProperty\n");
|
||||
GST_DEBUG ("osx ring buffer called AudioHardwareGetProperty");
|
||||
if (status) {
|
||||
GST_DEBUG ("AudioHardwareGetProperty returned %d\n", (int) status);
|
||||
GST_WARNING ("AudioHardwareGetProperty returned %d", (int) status);
|
||||
} else {
|
||||
GST_DEBUG ("AudioHardwareGetProperty returned 0\n");
|
||||
GST_DEBUG ("AudioHardwareGetProperty returned 0");
|
||||
}
|
||||
if (ringbuffer->device_id == kAudioDeviceUnknown) {
|
||||
GST_DEBUG ("AudioHardwareGetProperty: device_id is kAudioDeviceUnknown\n");
|
||||
GST_DEBUG ("AudioHardwareGetProperty: device_id is kAudioDeviceUnknown");
|
||||
}
|
||||
GST_DEBUG ("AudioHardwareGetProperty: device_id is %d\n",
|
||||
GST_DEBUG ("AudioHardwareGetProperty: device_id is %lu",
|
||||
ringbuffer->device_id);
|
||||
/* get requested buffer length */
|
||||
propertySize = sizeof (ringbuffer->buffer_len);
|
||||
|
@ -163,11 +163,11 @@ gst_osx_ring_buffer_init (GstOsxRingBuffer * ringbuffer,
|
|||
AudioDeviceGetProperty (ringbuffer->device_id, 0, false,
|
||||
kAudioDevicePropertyBufferSize, &propertySize, &ringbuffer->buffer_len);
|
||||
if (status) {
|
||||
GST_DEBUG
|
||||
("AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize\n",
|
||||
GST_WARNING
|
||||
("AudioDeviceGetProperty returned %d when getting kAudioDevicePropertyBufferSize",
|
||||
(int) status);
|
||||
}
|
||||
GST_DEBUG ("%5d ringbuffer->buffer_len\n", (int) ringbuffer->buffer_len);
|
||||
GST_DEBUG ("%5d ringbuffer->buffer_len", (int) ringbuffer->buffer_len);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -207,7 +207,7 @@ gst_osx_ring_buffer_acquire (GstRingBuffer * buf, GstRingBufferSpec * spec)
|
|||
spec->segsize = osxbuf->buffer_len;
|
||||
spec->segtotal = 16;
|
||||
|
||||
GST_DEBUG ("osx ring buffer acquire\n");
|
||||
GST_DEBUG ("osx ring buffer acquire");
|
||||
|
||||
buf->data = gst_buffer_new_and_alloc (spec->segtotal * spec->segsize);
|
||||
memset (GST_BUFFER_DATA (buf->data), 0, GST_BUFFER_SIZE (buf->data));
|
||||
|
@ -233,24 +233,29 @@ static gboolean
|
|||
gst_osx_ring_buffer_start (GstRingBuffer * buf)
|
||||
{
|
||||
/* stub */
|
||||
OSErr status;
|
||||
OSStatus status;
|
||||
GstOsxRingBuffer *osxbuf;
|
||||
|
||||
osxbuf = GST_OSX_RING_BUFFER (buf);
|
||||
|
||||
GST_DEBUG ("osx ring buffer start ioproc: 0x%x device_id %d\n",
|
||||
GST_DEBUG ("osx ring buffer start ioproc: 0x%p device_id %lu",
|
||||
osxbuf->element->io_proc, osxbuf->device_id);
|
||||
status =
|
||||
AudioDeviceAddIOProc (osxbuf->device_id, osxbuf->element->io_proc,
|
||||
osxbuf);
|
||||
if (!osxbuf->io_proc_active) {
|
||||
status =
|
||||
AudioDeviceAddIOProc (osxbuf->device_id, osxbuf->element->io_proc,
|
||||
osxbuf);
|
||||
|
||||
if (status) {
|
||||
GST_DEBUG ("AudioDeviceAddIOProc returned %d\n", (int) status);
|
||||
return FALSE;
|
||||
if (status) {
|
||||
GST_WARNING ("AudioDeviceAddIOProc returned %" GST_FOURCC_FORMAT,
|
||||
GST_FOURCC_ARGS (status));
|
||||
return FALSE;
|
||||
}
|
||||
osxbuf->io_proc_active = TRUE;
|
||||
}
|
||||
|
||||
status = AudioDeviceStart (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status) {
|
||||
GST_DEBUG ("AudioDeviceStart returned %d\n", (int) status);
|
||||
GST_WARNING ("AudioDeviceStart returned %d", (int) status);
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -264,9 +269,15 @@ gst_osx_ring_buffer_pause (GstRingBuffer * buf)
|
|||
OSErr status;
|
||||
GstOsxRingBuffer *osxbuf = GST_OSX_RING_BUFFER (buf);
|
||||
|
||||
status = AudioDeviceStop (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status)
|
||||
GST_DEBUG ("AudioDeviceStop returned %d\n", (int) status);
|
||||
GST_DEBUG ("osx ring buffer pause ioproc: 0x%p device_id %lu",
|
||||
osxbuf->element->io_proc, osxbuf->device_id);
|
||||
if (osxbuf->io_proc_active) {
|
||||
status =
|
||||
AudioDeviceRemoveIOProc (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status)
|
||||
GST_WARNING ("AudioDeviceRemoveIOProc " "returned %d", (int) status);
|
||||
osxbuf->io_proc_active = FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -279,16 +290,20 @@ gst_osx_ring_buffer_stop (GstRingBuffer * buf)
|
|||
|
||||
osxbuf = GST_OSX_RING_BUFFER (buf);
|
||||
|
||||
GST_DEBUG ("osx ring buffer stop ioproc: 0x%p device_id %lu",
|
||||
osxbuf->element->io_proc, osxbuf->device_id);
|
||||
/* stop callback */
|
||||
status = AudioDeviceStop (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status)
|
||||
GST_DEBUG ("AudioDeviceStop returned %d\n", (int) status);
|
||||
|
||||
status =
|
||||
AudioDeviceRemoveIOProc (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status)
|
||||
GST_DEBUG ("AudioDeviceRemoveIOProc " "returned %d\n", (int) status);
|
||||
GST_WARNING ("AudioDeviceStop returned %d", (int) status);
|
||||
|
||||
if (osxbuf->io_proc_active) {
|
||||
status =
|
||||
AudioDeviceRemoveIOProc (osxbuf->device_id, osxbuf->element->io_proc);
|
||||
if (status)
|
||||
GST_WARNING ("AudioDeviceRemoveIOProc " "returned %d", (int) status);
|
||||
osxbuf->io_proc_active = FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -67,6 +67,7 @@ struct _GstOsxRingBuffer {
|
|||
GstRingBuffer object;
|
||||
|
||||
AudioDeviceID device_id;
|
||||
gboolean io_proc_active;
|
||||
guint buffer_len;
|
||||
GstOsxAudioElementInterface* element;
|
||||
};
|
||||
|
@ -78,4 +79,4 @@ struct _GstOsxRingBufferClass {
|
|||
GType gst_osx_ring_buffer_get_type (void);
|
||||
G_END_DECLS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue