sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
/*
|
|
|
|
* GStreamer
|
2009-01-02 20:39:34 +00:00
|
|
|
* Copyright (C) 2005,2006 Zaheer Abbas Merali <zaheerabbas at merali dot org>
|
|
|
|
* Copyright (C) 2007,2008 Pioneers of the Inevitable <songbird@songbirdnest.com>
|
2012-06-12 10:42:31 +00:00
|
|
|
* Copyright (C) 2012 Fluendo S.A. <support@fluendo.com>
|
2009-01-02 20:39:34 +00:00
|
|
|
*
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
* copy of this software and associated documentation files (the "Software"),
|
|
|
|
* to deal in the Software without restriction, including without limitation
|
|
|
|
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
|
|
|
* and/or sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
2004-05-20 19:45:13 +00:00
|
|
|
*
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
* The above copyright notice and this permission notice shall be included in
|
|
|
|
* all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
|
|
* DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the
|
|
|
|
* GNU Lesser General Public License Version 2.1 (the "LGPL"), in
|
|
|
|
* which case the following provisions apply instead of the ones
|
|
|
|
* mentioned above:
|
2004-05-20 19:45:13 +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-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2007-02-27 11:59:21 +00:00
|
|
|
*
|
2009-01-02 20:39:34 +00:00
|
|
|
* The development of this code was made possible due to the involvement of
|
|
|
|
* Pioneers of the Inevitable, the creators of the Songbird Music player
|
2007-02-27 11:59:21 +00:00
|
|
|
*
|
2004-05-20 19:45:13 +00:00
|
|
|
*/
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
/**
|
2009-01-29 08:10:08 +00:00
|
|
|
* SECTION:element-osxaudiosink
|
|
|
|
*
|
|
|
|
* This element renders raw audio samples using the CoreAudio api.
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2009-01-29 08:10:08 +00:00
|
|
|
* <title>Example pipelines</title>
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! audioresample ! osxaudiosink
|
2009-01-29 08:10:08 +00:00
|
|
|
* ]| Play an Ogg/Vorbis file.
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2004-05-20 19:45:13 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
# include <config.h>
|
2004-05-20 19:45:13 +00:00
|
|
|
#endif
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
#include <gst/gst.h>
|
2013-04-05 08:02:38 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2013-03-30 13:49:34 +00:00
|
|
|
#include <gst/audio/audio-channels.h>
|
2012-06-19 10:15:33 +00:00
|
|
|
#include <gst/audio/gstaudioiec61937.h>
|
|
|
|
|
2004-05-20 19:45:13 +00:00
|
|
|
#include "gstosxaudiosink.h"
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
#include "gstosxaudioelement.h"
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (osx_audiosink_debug);
|
|
|
|
#define GST_CAT_DEFAULT osx_audiosink_debug
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
#include "gstosxcoreaudio.h"
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
/* Filter signals and args */
|
2004-05-20 19:45:13 +00:00
|
|
|
enum
|
|
|
|
{
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
/* FILL ME */
|
2004-05-20 19:45:13 +00:00
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
2009-01-02 20:39:34 +00:00
|
|
|
ARG_DEVICE,
|
|
|
|
ARG_VOLUME
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
};
|
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
#define DEFAULT_VOLUME 1.0
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
2004-05-20 19:45:13 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2013-03-30 13:49:34 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw, "
|
2014-12-22 11:56:19 +00:00
|
|
|
"format = (string) " GST_AUDIO_FORMATS_ALL ", "
|
2013-03-30 13:49:34 +00:00
|
|
|
"layout = (string) interleaved, "
|
2012-06-01 14:37:00 +00:00
|
|
|
"rate = (int) [1, MAX], "
|
2012-06-19 10:15:33 +00:00
|
|
|
"channels = (int) [1, 9];"
|
2012-06-12 10:42:31 +00:00
|
|
|
"audio/x-ac3, framed = (boolean) true;"
|
|
|
|
"audio/x-dts, framed = (boolean) true")
|
2004-05-20 19:45:13 +00:00
|
|
|
);
|
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
static void gst_osx_audio_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_osx_audio_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
|
|
|
|
2014-11-28 16:53:17 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_osx_audio_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
static gboolean gst_osx_audio_sink_query (GstBaseSink * base, GstQuery * query);
|
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
static gboolean gst_osx_audio_sink_stop (GstBaseSink * base);
|
2013-03-30 13:49:34 +00:00
|
|
|
static GstCaps *gst_osx_audio_sink_getcaps (GstBaseSink * base,
|
|
|
|
GstCaps * filter);
|
|
|
|
static gboolean gst_osx_audio_sink_acceptcaps (GstOsxAudioSink * sink,
|
|
|
|
GstCaps * caps);
|
2012-06-12 10:42:31 +00:00
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
static GstBuffer *gst_osx_audio_sink_sink_payload (GstAudioBaseSink * sink,
|
2012-06-12 10:42:31 +00:00
|
|
|
GstBuffer * buf);
|
2013-03-30 13:49:34 +00:00
|
|
|
static GstAudioRingBuffer
|
|
|
|
* gst_osx_audio_sink_create_ringbuffer (GstAudioBaseSink * sink);
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
static void gst_osx_audio_sink_osxelement_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
2014-11-28 14:10:52 +00:00
|
|
|
static void gst_osx_audio_sink_probe_caps (GstOsxAudioSink * sink);
|
2009-01-02 20:39:34 +00:00
|
|
|
static void gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink);
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
static OSStatus gst_osx_audio_sink_io_proc (GstOsxAudioRingBuffer * buf,
|
2009-01-02 20:39:34 +00:00
|
|
|
AudioUnitRenderActionFlags * ioActionFlags,
|
|
|
|
const AudioTimeStamp * inTimeStamp,
|
|
|
|
UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * bufferList);
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2004-05-20 19:45:13 +00:00
|
|
|
static void
|
2009-01-02 20:39:34 +00:00
|
|
|
gst_osx_audio_sink_do_init (GType type)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
static const GInterfaceInfo osxelement_info = {
|
|
|
|
gst_osx_audio_sink_osxelement_init,
|
|
|
|
NULL,
|
|
|
|
NULL
|
|
|
|
};
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (osx_audiosink_debug, "osxaudiosink", 0,
|
|
|
|
"OSX Audio Sink");
|
2013-03-05 20:17:52 +00:00
|
|
|
gst_core_audio_init_debug ();
|
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
2007-03-15 11:39:53 +00:00
|
|
|
GST_DEBUG ("Adding static interface");
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
g_type_add_interface_static (type, GST_OSX_AUDIO_ELEMENT_TYPE,
|
|
|
|
&osxelement_info);
|
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
#define gst_osx_audio_sink_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstOsxAudioSink, gst_osx_audio_sink,
|
2013-04-09 16:21:49 +00:00
|
|
|
GST_TYPE_AUDIO_BASE_SINK, gst_osx_audio_sink_do_init (g_define_type_id));
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
2004-05-20 19:45:13 +00:00
|
|
|
static void
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
gst_osx_audio_sink_class_init (GstOsxAudioSinkClass * klass)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
GstBaseSinkClass *gstbasesink_class;
|
2013-03-30 13:49:34 +00:00
|
|
|
GstAudioBaseSinkClass *gstaudiobasesink_class;
|
2004-05-20 19:45:13 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
gstbasesink_class = (GstBaseSinkClass *) klass;
|
2013-03-30 13:49:34 +00:00
|
|
|
gstaudiobasesink_class = (GstAudioBaseSinkClass *) klass;
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2006-04-08 21:21:45 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2010-06-06 15:57:03 +00:00
|
|
|
gobject_class->set_property = gst_osx_audio_sink_set_property;
|
|
|
|
gobject_class->get_property = gst_osx_audio_sink_get_property;
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2014-11-28 16:53:17 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_change_state);
|
|
|
|
|
2013-03-05 20:22:18 +00:00
|
|
|
#ifndef HAVE_IOS
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_DEVICE,
|
|
|
|
g_param_spec_int ("device", "Device ID", "Device ID of output device",
|
2010-10-13 14:21:23 +00:00
|
|
|
0, G_MAXINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2013-03-05 20:22:18 +00:00
|
|
|
#endif
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
gstbasesink_class->query = GST_DEBUG_FUNCPTR (gst_osx_audio_sink_query);
|
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
g_object_class_install_property (gobject_class, ARG_VOLUME,
|
|
|
|
g_param_spec_double ("volume", "Volume", "Volume of this stream",
|
2010-10-13 14:21:23 +00:00
|
|
|
0, 1.0, 1.0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-01-02 20:39:34 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
gstbasesink_class->get_caps = GST_DEBUG_FUNCPTR (gst_osx_audio_sink_getcaps);
|
|
|
|
gstbasesink_class->stop = GST_DEBUG_FUNCPTR (gst_osx_audio_sink_stop);
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
gstaudiobasesink_class->create_ringbuffer =
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_create_ringbuffer);
|
2013-03-30 13:49:34 +00:00
|
|
|
gstaudiobasesink_class->payload =
|
2012-06-12 10:42:31 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_sink_payload);
|
2013-03-30 13:49:34 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (gstelement_class,
|
|
|
|
gst_static_pad_template_get (&sink_factory));
|
|
|
|
|
|
|
|
gst_element_class_set_static_metadata (gstelement_class, "Audio Sink (OSX)",
|
|
|
|
"Sink/Audio",
|
|
|
|
"Output to a sound card in OS X",
|
|
|
|
"Zaheer Abbas Merali <zaheerabbas at merali dot org>");
|
2004-05-20 19:45:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_osx_audio_sink_init (GstOsxAudioSink * sink)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
2013-04-10 12:06:16 +00:00
|
|
|
gint i;
|
|
|
|
|
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
2007-03-15 11:39:53 +00:00
|
|
|
GST_DEBUG ("Initialising object");
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2008-08-26 21:13:08 +00:00
|
|
|
sink->device_id = kAudioDeviceUnknown;
|
2012-06-12 10:42:31 +00:00
|
|
|
sink->cached_caps = NULL;
|
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
sink->volume = DEFAULT_VOLUME;
|
2013-04-10 12:06:16 +00:00
|
|
|
|
|
|
|
sink->channels = 0;
|
|
|
|
for (i = 0; i < GST_OSX_AUDIO_MAX_CHANNEL; i++) {
|
|
|
|
sink->channel_positions[i] = GST_AUDIO_CHANNEL_POSITION_INVALID;
|
|
|
|
}
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
static void
|
|
|
|
gst_osx_audio_sink_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (object);
|
2004-05-20 19:45:13 +00:00
|
|
|
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
switch (prop_id) {
|
2013-03-05 20:22:18 +00:00
|
|
|
#ifndef HAVE_IOS
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
case ARG_DEVICE:
|
2008-08-26 21:13:08 +00:00
|
|
|
sink->device_id = g_value_get_int (value);
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
break;
|
2013-03-05 20:22:18 +00:00
|
|
|
#endif
|
2009-01-02 20:39:34 +00:00
|
|
|
case ARG_VOLUME:
|
|
|
|
sink->volume = g_value_get_double (value);
|
|
|
|
gst_osx_audio_sink_set_volume (sink);
|
|
|
|
break;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
}
|
|
|
|
|
2014-11-28 16:53:17 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_osx_audio_sink_change_state (GstElement * element,
|
|
|
|
GstStateChange transition)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *osxsink = GST_OSX_AUDIO_SINK (element);
|
|
|
|
GstOsxAudioRingBuffer *ringbuffer;
|
|
|
|
GstStateChangeReturn ret;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
|
|
/* Device has been selected, AudioUnit set up, so initialize volume */
|
|
|
|
gst_osx_audio_sink_set_volume (osxsink);
|
|
|
|
|
|
|
|
/* The device is open now, so fix our device_id if it changed */
|
|
|
|
ringbuffer =
|
|
|
|
GST_OSX_AUDIO_RING_BUFFER (GST_AUDIO_BASE_SINK (osxsink)->ringbuffer);
|
2014-12-22 09:23:01 +00:00
|
|
|
if (ringbuffer->core_audio->device_id != osxsink->device_id) {
|
|
|
|
osxsink->device_id = ringbuffer->core_audio->device_id;
|
|
|
|
g_object_notify (G_OBJECT (osxsink), "device");
|
|
|
|
}
|
2014-11-28 16:53:17 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
out:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-05-20 19:45:13 +00:00
|
|
|
static void
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
gst_osx_audio_sink_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (object);
|
|
|
|
switch (prop_id) {
|
2013-03-05 20:22:18 +00:00
|
|
|
#ifndef HAVE_IOS
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
case ARG_DEVICE:
|
2008-08-26 21:13:08 +00:00
|
|
|
g_value_set_int (value, sink->device_id);
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
break;
|
2013-03-05 20:22:18 +00:00
|
|
|
#endif
|
2009-01-02 20:39:34 +00:00
|
|
|
case ARG_VOLUME:
|
|
|
|
g_value_set_double (value, sink->volume);
|
|
|
|
break;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
2004-05-20 19:45:13 +00:00
|
|
|
}
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
}
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
static gboolean
|
|
|
|
gst_osx_audio_sink_query (GstBaseSink * base, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_ACCEPT_CAPS:
|
|
|
|
{
|
|
|
|
GstCaps *caps = NULL;
|
|
|
|
|
|
|
|
gst_query_parse_accept_caps (query, &caps);
|
|
|
|
ret = gst_osx_audio_sink_acceptcaps (sink, caps);
|
|
|
|
gst_query_set_accept_caps_result (query, ret);
|
|
|
|
ret = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ret = GST_BASE_SINK_CLASS (parent_class)->query (base, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
static gboolean
|
|
|
|
gst_osx_audio_sink_stop (GstBaseSink * base)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
|
|
|
|
|
|
|
if (sink->cached_caps) {
|
|
|
|
gst_caps_unref (sink->cached_caps);
|
|
|
|
sink->cached_caps = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_CALL_PARENT_WITH_DEFAULT (GST_BASE_SINK_CLASS, stop, (base), TRUE);
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2014-11-29 17:46:30 +00:00
|
|
|
gst_osx_audio_sink_getcaps (GstBaseSink * sink, GstCaps * filter)
|
2012-06-12 10:42:31 +00:00
|
|
|
{
|
2014-11-29 17:46:30 +00:00
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
GstOsxAudioSink *osxsink;
|
|
|
|
GstAudioRingBuffer *buf;
|
|
|
|
GstCaps *ret = NULL;
|
|
|
|
|
|
|
|
gstelement_class = GST_ELEMENT_GET_CLASS (sink);
|
|
|
|
osxsink = GST_OSX_AUDIO_SINK (sink);
|
2014-12-08 17:08:22 +00:00
|
|
|
|
|
|
|
GST_OBJECT_LOCK (osxsink);
|
2014-11-29 17:46:30 +00:00
|
|
|
buf = GST_AUDIO_BASE_SINK (sink)->ringbuffer;
|
2014-12-08 17:08:22 +00:00
|
|
|
if (buf)
|
|
|
|
gst_object_ref (buf);
|
|
|
|
GST_OBJECT_UNLOCK (osxsink);
|
2012-06-12 10:42:31 +00:00
|
|
|
|
2014-11-28 14:10:52 +00:00
|
|
|
if (buf) {
|
|
|
|
GST_OBJECT_LOCK (buf);
|
2014-11-29 17:46:30 +00:00
|
|
|
|
2014-12-22 14:33:51 +00:00
|
|
|
if (buf->acquired && buf->spec.caps) {
|
2014-11-29 17:46:30 +00:00
|
|
|
/* Caps are fixed, use what we have */
|
2014-12-22 14:33:51 +00:00
|
|
|
ret = gst_caps_ref (buf->spec.caps);
|
|
|
|
}
|
2014-11-29 17:46:30 +00:00
|
|
|
|
2014-12-22 14:33:51 +00:00
|
|
|
if (!ret && buf->open && !osxsink->cached_caps) {
|
2014-11-28 14:10:52 +00:00
|
|
|
/* Device is open, let's probe its caps */
|
2014-11-29 17:46:30 +00:00
|
|
|
gst_osx_audio_sink_probe_caps (osxsink);
|
2014-11-28 14:10:52 +00:00
|
|
|
}
|
2014-11-29 17:46:30 +00:00
|
|
|
|
|
|
|
if (!ret && osxsink->cached_caps)
|
|
|
|
ret = gst_caps_ref (osxsink->cached_caps);
|
|
|
|
|
2014-11-28 14:10:52 +00:00
|
|
|
GST_OBJECT_UNLOCK (buf);
|
2014-12-08 17:08:22 +00:00
|
|
|
|
|
|
|
gst_object_unref (buf);
|
2014-11-28 14:10:52 +00:00
|
|
|
}
|
|
|
|
|
2014-11-29 17:46:30 +00:00
|
|
|
if (ret && filter) {
|
|
|
|
GstCaps *tmp;
|
2014-12-12 12:40:35 +00:00
|
|
|
tmp = gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
|
2014-11-29 17:46:30 +00:00
|
|
|
gst_caps_unref (ret);
|
|
|
|
ret = tmp;
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
|
|
|
|
2014-11-29 17:46:30 +00:00
|
|
|
return ret;
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_osx_audio_sink_acceptcaps (GstOsxAudioSink * sink, GstCaps * caps)
|
2012-06-12 10:42:31 +00:00
|
|
|
{
|
|
|
|
GstCaps *pad_caps;
|
|
|
|
GstStructure *st;
|
|
|
|
gboolean ret = FALSE;
|
2013-03-30 13:49:34 +00:00
|
|
|
GstAudioRingBufferSpec spec = { 0 };
|
2012-06-12 10:42:31 +00:00
|
|
|
gchar *caps_string = NULL;
|
|
|
|
|
|
|
|
caps_string = gst_caps_to_string (caps);
|
|
|
|
GST_DEBUG_OBJECT (sink, "acceptcaps called with %s", caps_string);
|
|
|
|
g_free (caps_string);
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
pad_caps = gst_pad_query_caps (GST_BASE_SINK_PAD (sink), caps);
|
2012-06-12 10:42:31 +00:00
|
|
|
if (pad_caps) {
|
|
|
|
gboolean cret = gst_caps_can_intersect (pad_caps, caps);
|
|
|
|
gst_caps_unref (pad_caps);
|
|
|
|
if (!cret)
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If we've not got fixed caps, creating a stream might fail,
|
|
|
|
* so let's just return from here with default acceptcaps
|
|
|
|
* behaviour */
|
|
|
|
if (!gst_caps_is_fixed (caps))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* parse helper expects this set, so avoid nasty warning
|
|
|
|
* will be set properly later on anyway */
|
|
|
|
spec.latency_time = GST_SECOND;
|
2013-03-30 13:49:34 +00:00
|
|
|
if (!gst_audio_ring_buffer_parse_caps (&spec, caps))
|
2012-06-12 10:42:31 +00:00
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* Make sure input is framed and can be payloaded */
|
|
|
|
switch (spec.type) {
|
2013-03-30 13:49:34 +00:00
|
|
|
case GST_AUDIO_RING_BUFFER_FORMAT_TYPE_AC3:
|
2012-06-12 10:42:31 +00:00
|
|
|
{
|
|
|
|
gboolean framed = FALSE;
|
|
|
|
|
|
|
|
st = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
gst_structure_get_boolean (st, "framed", &framed);
|
|
|
|
if (!framed || gst_audio_iec61937_frame_size (&spec) <= 0)
|
|
|
|
goto done;
|
|
|
|
break;
|
|
|
|
}
|
2013-03-30 13:49:34 +00:00
|
|
|
case GST_AUDIO_RING_BUFFER_FORMAT_TYPE_DTS:
|
2012-06-12 10:42:31 +00:00
|
|
|
{
|
|
|
|
gboolean parsed = FALSE;
|
|
|
|
|
|
|
|
st = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
gst_structure_get_boolean (st, "parsed", &parsed);
|
|
|
|
if (!parsed || gst_audio_iec61937_frame_size (&spec) <= 0)
|
|
|
|
goto done;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ret = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_osx_audio_sink_sink_payload (GstAudioBaseSink * sink, GstBuffer * buf)
|
2012-06-12 10:42:31 +00:00
|
|
|
{
|
|
|
|
if (RINGBUFFER_IS_SPDIF (sink->ringbuffer->spec.type)) {
|
|
|
|
gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec);
|
|
|
|
GstBuffer *out;
|
2013-03-30 13:49:34 +00:00
|
|
|
GstMapInfo inmap, outmap;
|
|
|
|
gboolean res;
|
2012-06-12 10:42:31 +00:00
|
|
|
|
|
|
|
if (framesize <= 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
out = gst_buffer_new_and_alloc (framesize);
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_buffer_map (buf, &inmap, GST_MAP_READ);
|
|
|
|
gst_buffer_map (out, &outmap, GST_MAP_WRITE);
|
|
|
|
|
2012-09-19 03:47:03 +00:00
|
|
|
/* FIXME: the endianness needs to be queried and then set */
|
2013-03-30 13:49:34 +00:00
|
|
|
res = gst_audio_iec61937_payload (inmap.data, inmap.size,
|
|
|
|
outmap.data, outmap.size, &sink->ringbuffer->spec, G_BIG_ENDIAN);
|
|
|
|
|
|
|
|
gst_buffer_unmap (buf, &inmap);
|
|
|
|
gst_buffer_unmap (out, &outmap);
|
|
|
|
|
|
|
|
if (!res) {
|
2012-06-12 10:42:31 +00:00
|
|
|
gst_buffer_unref (out);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_buffer_copy_into (out, buf, GST_BUFFER_COPY_METADATA, 0, -1);
|
2012-06-12 10:42:31 +00:00
|
|
|
return out;
|
2013-03-30 13:49:34 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
} else {
|
|
|
|
return gst_buffer_ref (buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
static GstAudioRingBuffer *
|
|
|
|
gst_osx_audio_sink_create_ringbuffer (GstAudioBaseSink * sink)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
GstOsxAudioSink *osxsink;
|
2013-03-30 13:49:34 +00:00
|
|
|
GstOsxAudioRingBuffer *ringbuffer;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
|
|
|
osxsink = GST_OSX_AUDIO_SINK (sink);
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2013-03-05 20:17:52 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "Creating ringbuffer");
|
2013-03-30 13:49:34 +00:00
|
|
|
ringbuffer = g_object_new (GST_TYPE_OSX_AUDIO_RING_BUFFER, NULL);
|
2013-03-05 20:17:52 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "osx sink %p element %p ioproc %p", osxsink,
|
2008-08-26 21:13:08 +00:00
|
|
|
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink),
|
|
|
|
(void *) gst_osx_audio_sink_io_proc);
|
2009-01-02 20:39:34 +00:00
|
|
|
|
2013-03-05 20:17:52 +00:00
|
|
|
ringbuffer->core_audio->element =
|
|
|
|
GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink);
|
|
|
|
ringbuffer->core_audio->is_src = FALSE;
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2014-12-22 09:23:01 +00:00
|
|
|
/* By default the coreaudio instance created by the ringbuffer
|
|
|
|
* has device_id==kAudioDeviceUnknown. The user might have
|
|
|
|
* selected a different one here
|
|
|
|
*/
|
|
|
|
if (ringbuffer->core_audio->device_id != osxsink->device_id)
|
2014-11-28 16:53:17 +00:00
|
|
|
ringbuffer->core_audio->device_id = osxsink->device_id;
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
return GST_AUDIO_RING_BUFFER (ringbuffer);
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
/* HALOutput AudioUnit will request fairly arbitrarily-sized chunks
|
|
|
|
* of data, not of a fixed size. So, we keep track of where in
|
|
|
|
* the current ringbuffer segment we are, and only advance the segment
|
|
|
|
* once we've read the whole thing */
|
2009-01-02 20:39:34 +00:00
|
|
|
static OSStatus
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_osx_audio_sink_io_proc (GstOsxAudioRingBuffer * buf,
|
2009-01-02 20:39:34 +00:00
|
|
|
AudioUnitRenderActionFlags * ioActionFlags,
|
|
|
|
const AudioTimeStamp * inTimeStamp,
|
|
|
|
UInt32 inBusNumber, UInt32 inNumberFrames, AudioBufferList * bufferList)
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
{
|
|
|
|
guint8 *readptr;
|
|
|
|
gint readseg;
|
|
|
|
gint len;
|
2013-03-05 20:17:52 +00:00
|
|
|
gint stream_idx = buf->core_audio->stream_idx;
|
2012-06-12 10:42:31 +00:00
|
|
|
gint remaining = bufferList->mBuffers[stream_idx].mDataByteSize;
|
2009-01-02 20:39:34 +00:00
|
|
|
gint offset = 0;
|
|
|
|
|
|
|
|
while (remaining) {
|
2013-03-30 13:49:34 +00:00
|
|
|
if (!gst_audio_ring_buffer_prepare_read (GST_AUDIO_RING_BUFFER (buf),
|
2009-01-02 20:39:34 +00:00
|
|
|
&readseg, &readptr, &len))
|
|
|
|
return 0;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
len -= buf->segoffset;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
if (len > remaining)
|
|
|
|
len = remaining;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
memcpy ((char *) bufferList->mBuffers[stream_idx].mData + offset,
|
2009-01-02 20:39:34 +00:00
|
|
|
readptr + buf->segoffset, len);
|
|
|
|
|
|
|
|
buf->segoffset += len;
|
|
|
|
offset += len;
|
|
|
|
remaining -= len;
|
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
if ((gint) buf->segoffset == GST_AUDIO_RING_BUFFER (buf)->spec.segsize) {
|
2009-01-02 20:39:34 +00:00
|
|
|
/* clear written samples */
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_audio_ring_buffer_clear (GST_AUDIO_RING_BUFFER (buf), readseg);
|
2009-01-02 20:39:34 +00:00
|
|
|
|
|
|
|
/* we wrote one segment */
|
2013-03-30 13:49:34 +00:00
|
|
|
gst_audio_ring_buffer_advance (GST_AUDIO_RING_BUFFER (buf), 1);
|
2009-01-02 20:39:34 +00:00
|
|
|
|
|
|
|
buf->segoffset = 0;
|
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
}
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_osx_audio_sink_osxelement_init (gpointer g_iface, gpointer iface_data)
|
|
|
|
{
|
|
|
|
GstOsxAudioElementInterface *iface = (GstOsxAudioElementInterface *) g_iface;
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
iface->io_proc = (AURenderCallback) gst_osx_audio_sink_io_proc;
|
sys/osxaudio/: Port of osxaudiosink to 0.10
Original commit message from CVS:
2006-04-26 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* sys/osxaudio/Makefile.am:
* sys/osxaudio/gstosxaudioelement.c:
(gst_osx_audio_element_get_type),
(gst_osx_audio_element_class_init):
* sys/osxaudio/gstosxaudioelement.h:
* sys/osxaudio/gstosxaudiosink.c:
(gst_osx_audio_sink_osxelement_do_init),
(gst_osx_audio_sink_base_init), (gst_osx_audio_sink_class_init),
(gst_osx_audio_sink_init), (gst_osx_audio_sink_set_property),
(gst_osx_audio_sink_get_property), (gst_osx_audio_sink_getcaps),
(gst_osx_audio_sink_create_ringbuffer),
(gst_osx_audio_sink_io_proc), (gst_osx_audio_sink_osxelement_init),
(plugin_init):
* sys/osxaudio/gstosxaudiosink.h:
Port of osxaudiosink to 0.10
2006-04-26 16:29:38 +00:00
|
|
|
}
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2009-01-02 20:39:34 +00:00
|
|
|
static void
|
|
|
|
gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink)
|
|
|
|
{
|
2013-03-30 13:49:34 +00:00
|
|
|
GstOsxAudioRingBuffer *osxbuf;
|
2009-01-02 20:39:34 +00:00
|
|
|
|
2013-03-30 13:49:34 +00:00
|
|
|
osxbuf = GST_OSX_AUDIO_RING_BUFFER (GST_AUDIO_BASE_SINK (sink)->ringbuffer);
|
2013-03-05 20:17:52 +00:00
|
|
|
if (!osxbuf)
|
|
|
|
return;
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2013-03-05 20:17:52 +00:00
|
|
|
gst_core_audio_set_volume (osxbuf->core_audio, sink->volume);
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
|
|
|
|
2014-11-28 14:10:52 +00:00
|
|
|
static void
|
|
|
|
gst_osx_audio_sink_probe_caps (GstOsxAudioSink * osxsink)
|
2012-06-19 10:15:33 +00:00
|
|
|
{
|
2013-04-10 12:06:16 +00:00
|
|
|
gint i, channels;
|
2013-04-09 16:21:49 +00:00
|
|
|
gboolean spdif_allowed;
|
2012-06-19 10:15:33 +00:00
|
|
|
AudioChannelLayout *layout;
|
|
|
|
GstElementClass *element_class;
|
|
|
|
GstPadTemplate *pad_template;
|
|
|
|
GstCaps *caps, *in_caps;
|
2013-04-17 19:05:14 +00:00
|
|
|
guint64 channel_mask = 0;
|
2013-04-10 12:06:16 +00:00
|
|
|
GstAudioChannelPosition *pos = osxsink->channel_positions;
|
2012-06-19 10:15:33 +00:00
|
|
|
|
|
|
|
/* First collect info about the HW capabilites and preferences */
|
2013-03-05 20:17:52 +00:00
|
|
|
spdif_allowed =
|
|
|
|
gst_core_audio_audio_device_is_spdif_avail (osxsink->device_id);
|
2014-11-28 09:04:34 +00:00
|
|
|
layout = gst_core_audio_audio_device_get_channel_layout (osxsink->device_id,
|
|
|
|
TRUE);
|
2012-06-19 10:15:33 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (osxsink, "Selected device ID: %u SPDIF allowed: %d",
|
|
|
|
(unsigned) osxsink->device_id, spdif_allowed);
|
|
|
|
|
|
|
|
if (layout) {
|
2013-04-10 12:06:16 +00:00
|
|
|
channels = MIN (layout->mNumberChannelDescriptions,
|
|
|
|
GST_OSX_AUDIO_MAX_CHANNEL);
|
2013-04-09 16:21:49 +00:00
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (osxsink, "This driver does not support "
|
|
|
|
"kAudioDevicePropertyPreferredChannelLayout.");
|
2013-04-10 12:06:16 +00:00
|
|
|
channels = 2;
|
|
|
|
}
|
|
|
|
|
2014-12-01 15:36:27 +00:00
|
|
|
if (!gst_core_audio_parse_channel_layout (layout, channels, &channel_mask,
|
|
|
|
pos)) {
|
|
|
|
GST_WARNING_OBJECT (osxsink, "Failed to parse channel layout");
|
2012-06-19 10:15:33 +00:00
|
|
|
}
|
2014-12-01 15:36:27 +00:00
|
|
|
|
2012-06-19 10:15:33 +00:00
|
|
|
g_free (layout);
|
|
|
|
|
2014-12-09 08:08:26 +00:00
|
|
|
if (!gst_audio_channel_positions_to_mask (pos, channels, TRUE, &channel_mask)) {
|
|
|
|
GST_WARNING_OBJECT (osxsink, "Probably unsupported channel order");
|
|
|
|
}
|
|
|
|
|
2012-06-19 10:15:33 +00:00
|
|
|
/* Recover the template caps */
|
|
|
|
element_class = GST_ELEMENT_GET_CLASS (osxsink);
|
|
|
|
pad_template = gst_element_class_get_pad_template (element_class, "sink");
|
|
|
|
in_caps = gst_pad_template_get_caps (pad_template);
|
|
|
|
|
|
|
|
/* Create the allowed subset */
|
|
|
|
caps = gst_caps_new_empty ();
|
|
|
|
for (i = 0; i < gst_caps_get_size (in_caps); i++) {
|
|
|
|
GstStructure *in_s, *out_s;
|
|
|
|
|
|
|
|
in_s = gst_caps_get_structure (in_caps, i);
|
|
|
|
|
|
|
|
if (gst_structure_has_name (in_s, "audio/x-ac3") ||
|
|
|
|
gst_structure_has_name (in_s, "audio/x-dts")) {
|
|
|
|
if (spdif_allowed) {
|
|
|
|
gst_caps_append_structure (caps, gst_structure_copy (in_s));
|
|
|
|
}
|
2014-12-01 15:02:04 +00:00
|
|
|
} else {
|
|
|
|
out_s = gst_structure_copy (in_s);
|
2014-12-09 08:08:26 +00:00
|
|
|
|
|
|
|
gst_structure_remove_fields (out_s, "channels", NULL);
|
|
|
|
gst_structure_set (out_s, "channels", G_TYPE_INT, channels, NULL);
|
|
|
|
|
|
|
|
if (channel_mask) {
|
|
|
|
gst_structure_remove_fields (out_s, "channel-mask", NULL);
|
|
|
|
gst_structure_set (out_s, "channel-mask", GST_TYPE_BITMASK,
|
|
|
|
channel_mask, NULL);
|
|
|
|
}
|
|
|
|
|
2014-12-01 15:02:04 +00:00
|
|
|
gst_caps_append_structure (caps, out_s);
|
2012-06-19 10:15:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (osxsink->cached_caps) {
|
|
|
|
gst_caps_unref (osxsink->cached_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
osxsink->cached_caps = caps;
|
2013-04-10 12:06:16 +00:00
|
|
|
osxsink->channels = channels;
|
2012-06-19 10:15:33 +00:00
|
|
|
}
|