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>
|
2009-01-29 08:10:08 +00:00
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-01 (0.10.4)
|
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
|
|
|
#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>
|
2012-06-19 10:15:33 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
|
|
|
#include <gst/audio/gstaudioiec61937.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 <CoreAudio/CoreAudio.h>
|
2008-08-26 21:13:08 +00:00
|
|
|
#include <CoreAudio/AudioHardware.h>
|
2012-06-19 10:15:33 +00:00
|
|
|
|
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,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
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
|
|
|
"endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
|
|
|
|
"signed = (boolean) { TRUE }, "
|
2006-04-28 14:55:20 +00:00
|
|
|
"width = (int) 32, "
|
2008-08-26 21:13:08 +00:00
|
|
|
"depth = (int) 32, "
|
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-01 14:37:00 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
|
|
|
|
"signed = (boolean) { TRUE }, "
|
|
|
|
"width = (int) 32, "
|
|
|
|
"depth = (int) 32, "
|
|
|
|
"rate = (int) [1, MAX], "
|
2012-06-19 10:15:33 +00:00
|
|
|
"channels = (int) [1, 9];"
|
2012-06-01 14:37:00 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
|
|
|
|
"signed = (boolean) { TRUE }, "
|
|
|
|
"width = (int) 24, "
|
|
|
|
"depth = (int) 24, "
|
|
|
|
"rate = (int) [1, MAX], "
|
2012-06-19 10:15:33 +00:00
|
|
|
"channels = (int) [1, 9];"
|
2012-06-01 14:37:00 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
|
|
|
|
"signed = (boolean) { TRUE }, "
|
|
|
|
"width = (int) 16, "
|
|
|
|
"depth = (int) 16, "
|
|
|
|
"rate = (int) [1, MAX], "
|
2012-06-19 10:15:33 +00:00
|
|
|
"channels = (int) [1, 9];"
|
2012-06-01 14:37:00 +00:00
|
|
|
"audio/x-raw-int, "
|
|
|
|
"endianness = (int) {" G_STRINGIFY (G_BYTE_ORDER) " }, "
|
|
|
|
"signed = (boolean) { TRUE }, "
|
|
|
|
"width = (int) 8, "
|
|
|
|
"depth = (int) 8, "
|
2012-06-12 10:42:31 +00:00
|
|
|
"rate = (int) [1, MAX], " "channels = (int) [1, MAX];"
|
|
|
|
"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);
|
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
static gboolean gst_osx_audio_sink_stop (GstBaseSink * base);
|
|
|
|
static GstCaps *gst_osx_audio_sink_getcaps (GstBaseSink * base);
|
|
|
|
static gboolean gst_osx_audio_sink_acceptcaps (GstPad * pad, GstCaps * caps);
|
|
|
|
|
|
|
|
static GstBuffer *gst_osx_audio_sink_sink_payload (GstBaseAudioSink * sink,
|
|
|
|
GstBuffer * buf);
|
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 GstRingBuffer *gst_osx_audio_sink_create_ringbuffer (GstBaseAudioSink *
|
|
|
|
sink);
|
|
|
|
static void gst_osx_audio_sink_osxelement_init (gpointer g_iface,
|
|
|
|
gpointer iface_data);
|
2012-06-12 10:42:31 +00:00
|
|
|
static gboolean gst_osx_audio_sink_select_device (GstOsxAudioSink * osxsink);
|
2009-01-02 20:39:34 +00:00
|
|
|
static void gst_osx_audio_sink_set_volume (GstOsxAudioSink * sink);
|
|
|
|
|
|
|
|
static OSStatus gst_osx_audio_sink_io_proc (GstOsxRingBuffer * buf,
|
|
|
|
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");
|
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
|
|
|
|
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_BOILERPLATE_FULL (GstOsxAudioSink, gst_osx_audio_sink, GstBaseAudioSink,
|
2009-01-02 20:39:34 +00:00
|
|
|
GST_TYPE_BASE_AUDIO_SINK, gst_osx_audio_sink_do_init);
|
2004-05-20 19:45:13 +00:00
|
|
|
|
2006-05-06 00:14:09 +00:00
|
|
|
static void
|
|
|
|
gst_osx_audio_sink_base_init (gpointer g_class)
|
2004-05-20 19:45:13 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_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
|
|
|
gst_static_pad_template_get (&sink_factory));
|
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class, "Audio Sink (OSX)",
|
2010-03-18 13:31:35 +00:00
|
|
|
"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
|
|
|
}
|
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;
|
|
|
|
GstBaseAudioSinkClass *gstbaseaudiosink_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;
|
|
|
|
gstbaseaudiosink_class = (GstBaseAudioSinkClass *) 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
|
|
|
|
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));
|
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
|
|
|
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);
|
|
|
|
|
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
|
|
|
gstbaseaudiosink_class->create_ringbuffer =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_create_ringbuffer);
|
2012-06-12 10:42:31 +00:00
|
|
|
gstbaseaudiosink_class->payload =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_sink_payload);
|
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_init (GstOsxAudioSink * sink, GstOsxAudioSinkClass * gclass)
|
2004-05-20 19:45:13 +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
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;
|
2012-06-12 10:42:31 +00:00
|
|
|
|
|
|
|
gst_pad_set_acceptcaps_function (GST_BASE_SINK (sink)->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_osx_audio_sink_acceptcaps));
|
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) {
|
|
|
|
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;
|
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
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
|
|
|
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;
|
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
|
|
|
}
|
|
|
|
|
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 *
|
|
|
|
gst_osx_audio_sink_getcaps (GstBaseSink * base)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (base);
|
|
|
|
gchar *caps_string = NULL;
|
|
|
|
|
|
|
|
if (sink->cached_caps) {
|
|
|
|
caps_string = gst_caps_to_string (sink->cached_caps);
|
|
|
|
GST_DEBUG_OBJECT (sink, "using cached caps: %s", caps_string);
|
|
|
|
g_free (caps_string);
|
|
|
|
return gst_caps_ref (sink->cached_caps);
|
|
|
|
}
|
|
|
|
|
2012-06-19 10:15:33 +00:00
|
|
|
GST_DEBUG_OBJECT (sink, "using template caps");
|
|
|
|
return NULL;
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_osx_audio_sink_acceptcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *sink = GST_OSX_AUDIO_SINK (gst_pad_get_parent_element (pad));
|
|
|
|
GstOsxRingBuffer *osxbuf;
|
|
|
|
GstCaps *pad_caps;
|
|
|
|
GstStructure *st;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
GstRingBufferSpec spec = { 0 };
|
|
|
|
gchar *caps_string = NULL;
|
|
|
|
|
|
|
|
osxbuf = GST_OSX_RING_BUFFER (GST_BASE_AUDIO_SINK (sink)->ringbuffer);
|
|
|
|
|
|
|
|
caps_string = gst_caps_to_string (caps);
|
|
|
|
GST_DEBUG_OBJECT (sink, "acceptcaps called with %s", caps_string);
|
|
|
|
g_free (caps_string);
|
|
|
|
|
2012-09-14 15:55:16 +00:00
|
|
|
pad_caps = gst_pad_get_caps (pad);
|
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;
|
|
|
|
if (!gst_ring_buffer_parse_caps (&spec, caps))
|
|
|
|
goto done;
|
|
|
|
|
|
|
|
/* Make sure input is framed and can be payloaded */
|
|
|
|
switch (spec.type) {
|
|
|
|
case GST_BUFTYPE_AC3:
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
case GST_BUFTYPE_DTS:
|
|
|
|
{
|
|
|
|
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:
|
|
|
|
gst_object_unref (sink);
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
|
|
|
gst_osx_audio_sink_sink_payload (GstBaseAudioSink * sink, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstOsxAudioSink *osxsink;
|
|
|
|
|
|
|
|
osxsink = GST_OSX_AUDIO_SINK (sink);
|
|
|
|
|
|
|
|
if (RINGBUFFER_IS_SPDIF (sink->ringbuffer->spec.type)) {
|
|
|
|
gint framesize = gst_audio_iec61937_frame_size (&sink->ringbuffer->spec);
|
|
|
|
GstBuffer *out;
|
|
|
|
|
|
|
|
if (framesize <= 0)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
out = gst_buffer_new_and_alloc (framesize);
|
|
|
|
|
2012-09-19 03:47:03 +00:00
|
|
|
/* FIXME: the endianness needs to be queried and then set */
|
2012-06-12 10:42:31 +00:00
|
|
|
if (!gst_audio_iec61937_payload (GST_BUFFER_DATA (buf),
|
|
|
|
GST_BUFFER_SIZE (buf), GST_BUFFER_DATA (out),
|
2012-09-19 03:47:03 +00:00
|
|
|
GST_BUFFER_SIZE (out), &sink->ringbuffer->spec, G_BYTE_ORDER)) {
|
2012-06-12 10:42:31 +00:00
|
|
|
gst_buffer_unref (out);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_buffer_copy_metadata (out, buf, GST_BUFFER_COPY_ALL);
|
|
|
|
|
|
|
|
/* Fix endianness */
|
|
|
|
swab ((gchar *) GST_BUFFER_DATA (buf),
|
|
|
|
(gchar *) GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (buf));
|
|
|
|
return out;
|
|
|
|
} else {
|
|
|
|
return gst_buffer_ref (buf);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
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 GstRingBuffer *
|
|
|
|
gst_osx_audio_sink_create_ringbuffer (GstBaseAudioSink * 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;
|
2008-08-26 21:13:08 +00:00
|
|
|
GstOsxRingBuffer *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
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
if (!gst_osx_audio_sink_select_device (osxsink)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
2008-08-26 21:13:08 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Creating ringbuffer");
|
|
|
|
ringbuffer = g_object_new (GST_TYPE_OSX_RING_BUFFER, NULL);
|
2012-06-12 10:42:31 +00:00
|
|
|
GST_DEBUG ("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
|
|
|
|
|
|
|
gst_osx_audio_sink_set_volume (osxsink);
|
|
|
|
|
2008-08-26 21:13:08 +00:00
|
|
|
ringbuffer->element = GST_OSX_AUDIO_ELEMENT_GET_INTERFACE (osxsink);
|
|
|
|
ringbuffer->device_id = osxsink->device_id;
|
|
|
|
|
|
|
|
return GST_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
|
|
|
|
gst_osx_audio_sink_io_proc (GstOsxRingBuffer * buf,
|
|
|
|
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;
|
2012-06-12 10:42:31 +00:00
|
|
|
gint stream_idx = buf->stream_idx;
|
|
|
|
gint remaining = bufferList->mBuffers[stream_idx].mDataByteSize;
|
2009-01-02 20:39:34 +00:00
|
|
|
gint offset = 0;
|
|
|
|
|
|
|
|
while (remaining) {
|
|
|
|
if (!gst_ring_buffer_prepare_read (GST_RING_BUFFER (buf),
|
|
|
|
&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;
|
|
|
|
|
|
|
|
if ((gint) buf->segoffset == GST_RING_BUFFER (buf)->spec.segsize) {
|
|
|
|
/* clear written samples */
|
|
|
|
gst_ring_buffer_clear (GST_RING_BUFFER (buf), readseg);
|
|
|
|
|
|
|
|
/* we wrote one segment */
|
|
|
|
gst_ring_buffer_advance (GST_RING_BUFFER (buf), 1);
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
|
|
|
if (!sink->audiounit)
|
|
|
|
return;
|
|
|
|
|
|
|
|
AudioUnitSetParameter (sink->audiounit, kHALOutputParam_Volume,
|
|
|
|
kAudioUnitScope_Global, 0, (float) sink->volume, 0);
|
|
|
|
}
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
static inline void
|
|
|
|
_dump_channel_layout (AudioChannelLayout * channel_layout)
|
|
|
|
{
|
|
|
|
UInt32 i;
|
|
|
|
|
|
|
|
GST_DEBUG ("mChannelLayoutTag: 0x%lx",
|
|
|
|
(unsigned long) channel_layout->mChannelLayoutTag);
|
|
|
|
GST_DEBUG ("mChannelBitmap: 0x%lx",
|
|
|
|
(unsigned long) channel_layout->mChannelBitmap);
|
|
|
|
GST_DEBUG ("mNumberChannelDescriptions: %lu",
|
|
|
|
(unsigned long) channel_layout->mNumberChannelDescriptions);
|
|
|
|
for (i = 0; i < channel_layout->mNumberChannelDescriptions; i++) {
|
|
|
|
AudioChannelDescription *channel_desc =
|
|
|
|
&channel_layout->mChannelDescriptions[i];
|
|
|
|
GST_DEBUG (" mChannelLabel: 0x%lx mChannelFlags: 0x%lx "
|
|
|
|
"mCoordinates[0]: %f mCoordinates[1]: %f "
|
|
|
|
"mCoordinates[2]: %f",
|
|
|
|
(unsigned long) channel_desc->mChannelLabel,
|
|
|
|
(unsigned long) channel_desc->mChannelFlags,
|
|
|
|
channel_desc->mCoordinates[0], channel_desc->mCoordinates[1],
|
|
|
|
channel_desc->mCoordinates[2]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-19 10:15:33 +00:00
|
|
|
static gboolean
|
|
|
|
gst_osx_audio_sink_allowed_caps (GstOsxAudioSink * osxsink)
|
|
|
|
{
|
|
|
|
gint i, max_channels = 0;
|
|
|
|
gboolean spdif_allowed, use_positions = FALSE;
|
|
|
|
AudioChannelLayout *layout;
|
|
|
|
GstElementClass *element_class;
|
|
|
|
GstPadTemplate *pad_template;
|
|
|
|
GstCaps *caps, *in_caps;
|
|
|
|
|
|
|
|
GstAudioChannelPosition pos[9] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID
|
|
|
|
};
|
|
|
|
|
|
|
|
/* First collect info about the HW capabilites and preferences */
|
|
|
|
spdif_allowed = _audio_device_is_spdif_avail (osxsink->device_id);
|
|
|
|
layout = _audio_device_get_channel_layout (osxsink->device_id);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (osxsink, "Selected device ID: %u SPDIF allowed: %d",
|
|
|
|
(unsigned) osxsink->device_id, spdif_allowed);
|
|
|
|
|
|
|
|
if (layout) {
|
|
|
|
_dump_channel_layout (layout);
|
|
|
|
max_channels = layout->mNumberChannelDescriptions;
|
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (osxsink, "This driver does not support "
|
|
|
|
"kAudioDevicePropertyPreferredChannelLayout.");
|
|
|
|
max_channels = 2;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (max_channels > 2) {
|
|
|
|
max_channels = MIN (max_channels, 9);
|
|
|
|
use_positions = TRUE;
|
|
|
|
for (i = 0; i < max_channels; i++) {
|
|
|
|
switch (layout->mChannelDescriptions[i].mChannelLabel) {
|
|
|
|
case kAudioChannelLabel_Left:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_Right:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_Center:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_LFEScreen:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_LFE;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_LeftSurround:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_RightSurround:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_RearSurroundLeft:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_RearSurroundRight:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT;
|
|
|
|
break;
|
|
|
|
case kAudioChannelLabel_CenterSurround:
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_REAR_CENTER;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING_OBJECT (osxsink, "unrecognized channel: %d",
|
|
|
|
(int) layout->mChannelDescriptions[i].mChannelLabel);
|
|
|
|
use_positions = FALSE;
|
|
|
|
max_channels = 2;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (layout);
|
|
|
|
|
|
|
|
/* 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));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (max_channels > 2 && use_positions) {
|
|
|
|
out_s = gst_structure_copy (in_s);
|
|
|
|
gst_structure_remove_field (out_s, "channels");
|
|
|
|
gst_structure_set (out_s, "channels", G_TYPE_INT, max_channels, NULL);
|
|
|
|
gst_audio_set_channel_positions (out_s, pos);
|
|
|
|
gst_caps_append_structure (caps, out_s);
|
|
|
|
}
|
|
|
|
out_s = gst_structure_copy (in_s);
|
|
|
|
gst_structure_remove_field (out_s, "channels");
|
|
|
|
gst_structure_set (out_s, "channels", GST_TYPE_INT_RANGE, 1, 2, NULL);
|
|
|
|
gst_caps_append_structure (caps, out_s);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (osxsink->cached_caps) {
|
|
|
|
gst_caps_unref (osxsink->cached_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
osxsink->cached_caps = caps;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
static gboolean
|
2008-08-26 21:13:08 +00:00
|
|
|
gst_osx_audio_sink_select_device (GstOsxAudioSink * osxsink)
|
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
|
|
|
AudioDeviceID *devices = NULL;
|
|
|
|
AudioDeviceID default_device_id = 0;
|
|
|
|
AudioChannelLayout *channel_layout;
|
|
|
|
gint i, ndevices = 0;
|
|
|
|
gboolean res = FALSE;
|
2006-04-28 14:55:20 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
devices = _audio_system_get_devices (&ndevices);
|
|
|
|
|
|
|
|
if (ndevices < 1) {
|
|
|
|
GST_ERROR_OBJECT (osxsink, "no audio output devices found");
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (osxsink, "found %d audio device(s)", ndevices);
|
|
|
|
|
|
|
|
for (i = 0; i < ndevices; i++) {
|
|
|
|
gchar *device_name;
|
|
|
|
|
|
|
|
if ((device_name = _audio_device_get_name (devices[i]))) {
|
|
|
|
if (!_audio_device_has_output (devices[i])) {
|
|
|
|
GST_DEBUG_OBJECT (osxsink, "Input Device ID: %u Name: %s",
|
|
|
|
(unsigned) devices[i], device_name);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG_OBJECT (osxsink, "Output Device ID: %u Name: %s",
|
|
|
|
(unsigned) devices[i], device_name);
|
|
|
|
|
|
|
|
channel_layout = _audio_device_get_channel_layout (devices[i]);
|
|
|
|
if (channel_layout) {
|
|
|
|
_dump_channel_layout (channel_layout);
|
|
|
|
g_free (channel_layout);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
g_free (device_name);
|
2009-01-02 20:39:34 +00:00
|
|
|
}
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Find the ID of the default output device */
|
|
|
|
default_device_id = _audio_system_get_default_output ();
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
/* Here we decide if selected device is valid or autoselect
|
|
|
|
* the default one when required */
|
|
|
|
if (osxsink->device_id == kAudioDeviceUnknown) {
|
|
|
|
if (default_device_id != kAudioDeviceUnknown) {
|
|
|
|
osxsink->device_id = default_device_id;
|
|
|
|
res = TRUE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
for (i = 0; i < ndevices; i++) {
|
|
|
|
if (osxsink->device_id == devices[i]) {
|
|
|
|
res = TRUE;
|
|
|
|
}
|
2009-01-02 20:39:34 +00:00
|
|
|
}
|
2008-08-26 21:13:08 +00:00
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
if (res && !_audio_device_is_alive (osxsink->device_id)) {
|
|
|
|
GST_ERROR_OBJECT (osxsink, "Requested device not usable");
|
|
|
|
res = FALSE;
|
2012-06-19 10:15:33 +00:00
|
|
|
goto done;
|
2012-06-12 10:42:31 +00:00
|
|
|
}
|
2008-08-26 21:13:08 +00:00
|
|
|
}
|
2012-06-12 10:42:31 +00:00
|
|
|
|
2012-06-19 10:15:33 +00:00
|
|
|
res = gst_osx_audio_sink_allowed_caps (osxsink);
|
|
|
|
|
2012-06-12 10:42:31 +00:00
|
|
|
done:
|
|
|
|
g_free (devices);
|
|
|
|
|
|
|
|
return res;
|
2008-08-26 21:13:08 +00:00
|
|
|
}
|