2003-11-21 21:20:42 +00:00
|
|
|
/* GStreamer FAAD (Free AAC Decoder) plugin
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
|
2003-11-21 21:20:42 +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
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <string.h>
|
2005-10-20 15:08:14 +00:00
|
|
|
#include <gst/audio/audio.h>
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
2005-11-11 18:17:22 +00:00
|
|
|
|
2005-11-11 18:54:14 +00:00
|
|
|
/* These are the correct types for these functions, as defined in the source,
|
|
|
|
* with types changed to match glib types, since those are defined for us.
|
2005-11-11 18:17:22 +00:00
|
|
|
* However, upstream FAAD is distributed with a broken header file that defined
|
|
|
|
* these wrongly (in a way which was broken on 64 bit systems).
|
2007-02-11 11:59:49 +00:00
|
|
|
*
|
2005-11-11 18:17:22 +00:00
|
|
|
* Upstream CVS still has the bug, but has also renamed all the public symbols
|
2007-02-11 11:59:49 +00:00
|
|
|
* for Better Corporate Branding (or whatever), so we need to take that
|
|
|
|
* (FAAD_IS_NEAAC) into account as well.
|
2005-11-11 18:17:22 +00:00
|
|
|
*
|
|
|
|
* We must call them using these definitions. Most distributions now have the
|
|
|
|
* corrected header file (they distribute a patch along with the source),
|
2007-02-11 11:59:49 +00:00
|
|
|
* but not all, hence this Truly Evil Hack.
|
|
|
|
*
|
|
|
|
* Note: The prototypes don't need to be defined conditionaly, as the cpp will
|
|
|
|
* do that for us.
|
2005-11-11 18:17:22 +00:00
|
|
|
*/
|
2009-03-06 11:42:50 +00:00
|
|
|
#if FAAD2_MINOR_VERSION < 7
|
2007-02-11 11:35:47 +00:00
|
|
|
#ifdef FAAD_IS_NEAAC
|
|
|
|
#define NeAACDecInit NeAACDecInit_no_definition
|
|
|
|
#define NeAACDecInit2 NeAACDecInit2_no_definition
|
|
|
|
#else
|
2005-11-21 18:45:54 +00:00
|
|
|
#define faacDecInit faacDecInit_no_definition
|
|
|
|
#define faacDecInit2 faacDecInit2_no_definition
|
2007-02-11 11:35:47 +00:00
|
|
|
#endif
|
2009-03-06 11:42:50 +00:00
|
|
|
#endif /* FAAD2_MINOR_VERSION < 7 */
|
|
|
|
|
2003-11-21 21:20:42 +00:00
|
|
|
#include "gstfaad.h"
|
2009-03-06 11:42:50 +00:00
|
|
|
|
|
|
|
#if FAAD2_MINOR_VERSION < 7
|
2007-02-11 11:35:47 +00:00
|
|
|
#ifdef FAAD_IS_NEAAC
|
|
|
|
#undef NeAACDecInit
|
|
|
|
#undef NeAACDecInit2
|
|
|
|
#else
|
2005-11-11 18:54:14 +00:00
|
|
|
#undef faacDecInit
|
|
|
|
#undef faacDecInit2
|
2007-02-11 11:35:47 +00:00
|
|
|
#endif
|
2005-11-11 18:17:22 +00:00
|
|
|
|
2005-11-11 18:54:14 +00:00
|
|
|
extern long faacDecInit (faacDecHandle, guint8 *, guint32, guint32 *, guint8 *);
|
2009-03-04 10:14:18 +00:00
|
|
|
extern gint8 faacDecInit2 (faacDecHandle, guint8 *, guint32,
|
2005-11-11 18:54:14 +00:00
|
|
|
guint32 *, guint8 *);
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2009-03-06 11:42:50 +00:00
|
|
|
#endif /* FAAD2_MINOR_VERSION < 7 */
|
|
|
|
|
2005-08-10 09:33:58 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (faad_debug);
|
|
|
|
#define GST_CAT_DEFAULT faad_debug
|
|
|
|
|
2006-05-13 18:39:13 +00:00
|
|
|
#define MAX_DECODE_ERRORS 5
|
|
|
|
|
2006-04-25 21:56:38 +00:00
|
|
|
static const GstElementDetails faad_details =
|
2006-04-06 11:35:26 +00:00
|
|
|
GST_ELEMENT_DETAILS ("AAC audio decoder",
|
|
|
|
"Codec/Decoder/Audio",
|
|
|
|
"Free MPEG-2/4 AAC decoder",
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2004-11-07 18:30:06 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2004-11-07 18:30:06 +00:00
|
|
|
GST_STATIC_CAPS ("audio/mpeg, " "mpegversion = (int) { 2, 4 }")
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#define STATIC_INT_CAPS(bpp) \
|
|
|
|
"audio/x-raw-int, " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"signed = (bool) TRUE, " \
|
|
|
|
"width = (int) " G_STRINGIFY (bpp) ", " \
|
|
|
|
"depth = (int) " G_STRINGIFY (bpp) ", " \
|
|
|
|
"rate = (int) [ 8000, 96000 ], " \
|
|
|
|
"channels = (int) [ 1, 8 ]"
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
#if 0
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#define STATIC_FLOAT_CAPS(bpp) \
|
|
|
|
"audio/x-raw-float, " \
|
|
|
|
"endianness = (int) BYTE_ORDER, " \
|
|
|
|
"depth = (int) " G_STRINGIFY (bpp) ", " \
|
|
|
|
"rate = (int) [ 8000, 96000 ], " \
|
|
|
|
"channels = (int) [ 1, 8 ]"
|
2005-08-08 19:20:02 +00:00
|
|
|
#endif
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* All except 16-bit integer are disabled until someone fixes FAAD.
|
|
|
|
* FAAD allocates approximately 8*1024*2 bytes bytes, which is enough
|
|
|
|
* for 1 frame (1024 samples) of 6 channel (5.1) 16-bit integer 16bpp
|
|
|
|
* audio, but not for any other. You'll get random segfaults, crashes
|
|
|
|
* and even valgrind goes crazy.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#define STATIC_CAPS \
|
|
|
|
STATIC_INT_CAPS (16)
|
|
|
|
#if 0
|
2005-01-06 10:34:40 +00:00
|
|
|
#define NOTUSED "; " \
|
|
|
|
STATIC_INT_CAPS (24) \
|
|
|
|
"; " \
|
|
|
|
STATIC_INT_CAPS (32) \
|
|
|
|
"; " \
|
|
|
|
STATIC_FLOAT_CAPS (32) \
|
|
|
|
"; " \
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
STATIC_FLOAT_CAPS (64)
|
|
|
|
#endif
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2005-01-06 10:34:40 +00:00
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
GST_STATIC_CAPS (STATIC_CAPS)
|
2004-03-14 22:34:33 +00:00
|
|
|
);
|
|
|
|
|
2005-01-06 10:34:40 +00:00
|
|
|
static void gst_faad_base_init (GstFaadClass * klass);
|
|
|
|
static void gst_faad_class_init (GstFaadClass * klass);
|
|
|
|
static void gst_faad_init (GstFaad * faad);
|
2006-05-31 13:37:27 +00:00
|
|
|
static void gst_faad_dispose (GObject * object);
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
static gboolean gst_faad_setcaps (GstPad * pad, GstCaps * caps);
|
2005-01-06 10:34:40 +00:00
|
|
|
static GstCaps *gst_faad_srcgetcaps (GstPad * pad);
|
2006-03-04 20:04:11 +00:00
|
|
|
static gboolean gst_faad_src_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_faad_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_faad_src_query (GstPad * pad, GstQuery * query);
|
2005-07-19 20:51:15 +00:00
|
|
|
static GstFlowReturn gst_faad_chain (GstPad * pad, GstBuffer * buffer);
|
2005-09-05 15:10:18 +00:00
|
|
|
static GstStateChangeReturn gst_faad_change_state (GstElement * element,
|
|
|
|
GstStateChange transition);
|
2006-03-04 20:04:11 +00:00
|
|
|
static gboolean gst_faad_src_convert (GstFaad * faad, GstFormat src_format,
|
|
|
|
gint64 src_val, GstFormat dest_format, gint64 * dest_val);
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
static gboolean gst_faad_open_decoder (GstFaad * faad);
|
|
|
|
static void gst_faad_close_decoder (GstFaad * faad);
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
static GstElementClass *parent_class; /* NULL */
|
2003-11-21 21:20:42 +00:00
|
|
|
|
|
|
|
GType
|
|
|
|
gst_faad_get_type (void)
|
|
|
|
{
|
|
|
|
static GType gst_faad_type = 0;
|
|
|
|
|
|
|
|
if (!gst_faad_type) {
|
|
|
|
static const GTypeInfo gst_faad_info = {
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstFaadClass),
|
2003-11-21 21:20:42 +00:00
|
|
|
(GBaseInitFunc) gst_faad_base_init,
|
|
|
|
NULL,
|
|
|
|
(GClassInitFunc) gst_faad_class_init,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2004-03-14 22:34:33 +00:00
|
|
|
sizeof (GstFaad),
|
2003-11-21 21:20:42 +00:00
|
|
|
0,
|
|
|
|
(GInstanceInitFunc) gst_faad_init,
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_faad_type = g_type_register_static (GST_TYPE_ELEMENT,
|
2004-03-15 19:32:27 +00:00
|
|
|
"GstFaad", &gst_faad_info, 0);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return gst_faad_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_base_init (GstFaadClass * klass)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&src_template));
|
2003-11-21 21:20:42 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_static_pad_template_get (&sink_template));
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
gst_element_class_set_details (element_class, &faad_details);
|
2005-10-20 15:08:14 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (faad_debug, "faad", 0, "AAC decoding");
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_class_init (GstFaadClass * klass)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2006-05-31 13:37:27 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2003-11-21 21:20:42 +00:00
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
parent_class = g_type_class_peek_parent (klass);
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2006-05-31 13:37:27 +00:00
|
|
|
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_faad_dispose);
|
|
|
|
|
2005-10-20 15:08:14 +00:00
|
|
|
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_faad_change_state);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_init (GstFaad * faad)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
|
|
|
faad->handle = NULL;
|
|
|
|
faad->samplerate = -1;
|
|
|
|
faad->channels = -1;
|
2004-10-01 13:00:41 +00:00
|
|
|
faad->tempbuf = NULL;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
faad->need_channel_setup = TRUE;
|
|
|
|
faad->channel_positions = NULL;
|
|
|
|
faad->init = FALSE;
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->next_ts = 0;
|
2005-10-20 15:08:14 +00:00
|
|
|
faad->prev_ts = GST_CLOCK_TIME_NONE;
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->bytes_in = 0;
|
|
|
|
faad->sum_dur_out = 0;
|
|
|
|
faad->packetised = FALSE;
|
2006-05-13 18:39:13 +00:00
|
|
|
faad->error_count = 0;
|
2006-05-31 13:37:27 +00:00
|
|
|
faad->segment = gst_segment_new ();
|
2003-11-22 11:35:11 +00:00
|
|
|
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
faad->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
2003-11-21 21:20:42 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (faad), faad->sinkpad);
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_pad_set_event_function (faad->sinkpad,
|
2006-03-04 20:04:11 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_sink_event));
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_pad_set_setcaps_function (faad->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_setcaps));
|
|
|
|
gst_pad_set_chain_function (faad->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_chain));
|
2003-11-21 21:20:42 +00:00
|
|
|
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
faad->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
2005-07-19 20:51:15 +00:00
|
|
|
gst_pad_use_fixed_caps (faad->srcpad);
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_pad_set_getcaps_function (faad->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_srcgetcaps));
|
2006-03-04 20:04:11 +00:00
|
|
|
gst_pad_set_query_function (faad->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_src_query));
|
|
|
|
gst_pad_set_event_function (faad->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_src_event));
|
|
|
|
gst_element_add_pad (GST_ELEMENT (faad), faad->srcpad);
|
|
|
|
}
|
|
|
|
|
2006-05-31 13:37:27 +00:00
|
|
|
static void
|
|
|
|
gst_faad_dispose (GObject * object)
|
|
|
|
{
|
|
|
|
GstFaad *faad = GST_FAAD (object);
|
|
|
|
|
|
|
|
if (faad->segment) {
|
|
|
|
gst_segment_free (faad->segment);
|
|
|
|
faad->segment = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
static void
|
|
|
|
gst_faad_send_tags (GstFaad * faad)
|
|
|
|
{
|
|
|
|
GstTagList *tags;
|
|
|
|
|
|
|
|
tags = gst_tag_list_new ();
|
|
|
|
|
|
|
|
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_AUDIO_CODEC, "MPEG-4 AAC audio", NULL);
|
|
|
|
|
|
|
|
gst_element_found_tags (GST_ELEMENT (faad), tags);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
static gint
|
|
|
|
aac_rate_idx (gint rate)
|
|
|
|
{
|
|
|
|
if (92017 <= rate)
|
|
|
|
return 0;
|
|
|
|
else if (75132 <= rate)
|
|
|
|
return 1;
|
|
|
|
else if (55426 <= rate)
|
|
|
|
return 2;
|
|
|
|
else if (46009 <= rate)
|
|
|
|
return 3;
|
|
|
|
else if (37566 <= rate)
|
|
|
|
return 4;
|
|
|
|
else if (27713 <= rate)
|
|
|
|
return 5;
|
|
|
|
else if (23004 <= rate)
|
|
|
|
return 6;
|
|
|
|
else if (18783 <= rate)
|
|
|
|
return 7;
|
|
|
|
else if (13856 <= rate)
|
|
|
|
return 8;
|
|
|
|
else if (11502 <= rate)
|
|
|
|
return 9;
|
|
|
|
else if (9391 <= rate)
|
|
|
|
return 10;
|
|
|
|
else
|
|
|
|
return 11;
|
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
static gboolean
|
|
|
|
gst_faad_setcaps (GstPad * pad, GstCaps * caps)
|
|
|
|
{
|
2005-08-08 19:20:02 +00:00
|
|
|
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
GstStructure *str = gst_caps_get_structure (caps, 0);
|
|
|
|
GstBuffer *buf;
|
|
|
|
const GValue *value;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* Assume raw stream */
|
|
|
|
faad->packetised = FALSE;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
if ((value = gst_structure_get_value (str, "codec_data"))) {
|
2009-03-06 11:42:50 +00:00
|
|
|
#if FAAD2_MINOR_VERSION >= 7
|
|
|
|
unsigned long samplerate;
|
|
|
|
#else
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
guint32 samplerate;
|
2009-03-06 11:42:50 +00:00
|
|
|
#endif
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
guint8 channels;
|
2006-10-06 15:49:39 +00:00
|
|
|
guint8 *cdata;
|
|
|
|
guint csize;
|
2005-08-08 19:20:02 +00:00
|
|
|
|
|
|
|
/* We have codec data, means packetised stream */
|
|
|
|
faad->packetised = TRUE;
|
2006-10-06 15:49:39 +00:00
|
|
|
buf = gst_value_get_buffer (value);
|
|
|
|
|
|
|
|
cdata = GST_BUFFER_DATA (buf);
|
|
|
|
csize = GST_BUFFER_SIZE (buf);
|
|
|
|
|
|
|
|
if (csize < 2)
|
|
|
|
goto wrong_length;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2009-01-23 14:00:10 +00:00
|
|
|
GST_DEBUG ("codec_data: object_type=%d, sample_rate=%d, channels=%d",
|
|
|
|
((cdata[0] & 0xf8) >> 3),
|
|
|
|
(((cdata[0] & 0x07) << 1) | ((cdata[1] & 0x80) >> 7)),
|
|
|
|
((cdata[1] & 0x78) >> 3));
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* someone forgot that char can be unsigned when writing the API */
|
2006-10-06 15:49:39 +00:00
|
|
|
if ((gint8) faacDecInit2 (faad->handle, cdata, csize, &samplerate,
|
2006-07-16 14:46:02 +00:00
|
|
|
&channels) < 0)
|
|
|
|
goto init_failed;
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
|
2009-01-23 14:00:10 +00:00
|
|
|
if (channels != ((cdata[1] & 0x78) >> 3)) {
|
|
|
|
/* https://bugs.launchpad.net/ubuntu/+source/faad2/+bug/290259 */
|
|
|
|
GST_WARNING_OBJECT (faad,
|
|
|
|
"buggy faad version, wrong nr of channels %d instead of %d", channels,
|
|
|
|
((cdata[1] & 0x78) >> 3));
|
|
|
|
}
|
|
|
|
|
2007-08-16 11:34:54 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "codec_data init: channels=%u, rate=%u", channels,
|
2009-10-12 10:29:44 +00:00
|
|
|
(guint32) samplerate);
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* not updating these here, so they are updated in the
|
|
|
|
* chain function, and new caps are created etc. */
|
|
|
|
faad->samplerate = 0;
|
|
|
|
faad->channels = 0;
|
|
|
|
|
|
|
|
faad->init = TRUE;
|
|
|
|
|
|
|
|
if (faad->tempbuf) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
2006-01-27 12:47:12 +00:00
|
|
|
} else if ((value = gst_structure_get_value (str, "framed")) &&
|
|
|
|
g_value_get_boolean (value) == TRUE) {
|
|
|
|
faad->packetised = TRUE;
|
2007-08-16 11:34:54 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "we have packetized audio");
|
2005-08-08 19:20:02 +00:00
|
|
|
} else {
|
|
|
|
faad->init = FALSE;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
faad->fake_codec_data[0] = 0;
|
|
|
|
faad->fake_codec_data[1] = 0;
|
|
|
|
|
|
|
|
if (faad->packetised) {
|
|
|
|
gint rate, channels;
|
|
|
|
|
|
|
|
if (gst_structure_get_int (str, "rate", &rate) &&
|
|
|
|
gst_structure_get_int (str, "channels", &channels)) {
|
|
|
|
gint rate_idx, profile;
|
|
|
|
|
2006-05-03 10:25:46 +00:00
|
|
|
profile = 3; /* 0=MAIN, 1=LC, 2=SSR, 3=LTP */
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
rate_idx = aac_rate_idx (rate);
|
|
|
|
|
|
|
|
faad->fake_codec_data[0] = ((profile + 1) << 3) | ((rate_idx & 0xE) >> 1);
|
|
|
|
faad->fake_codec_data[1] = ((rate_idx & 0x1) << 7) | (channels << 3);
|
2006-05-03 10:25:46 +00:00
|
|
|
GST_LOG_OBJECT (faad, "created fake codec data (%u,%u): 0x%x 0x%x", rate,
|
|
|
|
channels, (int) faad->fake_codec_data[0],
|
|
|
|
(int) faad->fake_codec_data[1]);
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->need_channel_setup = TRUE;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
if (!faad->packetised)
|
|
|
|
gst_faad_send_tags (faad);
|
|
|
|
|
2009-10-13 14:01:26 +00:00
|
|
|
gst_object_unref (faad);
|
2005-07-19 20:51:15 +00:00
|
|
|
return TRUE;
|
2006-07-16 14:46:02 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
2006-10-06 15:49:39 +00:00
|
|
|
wrong_length:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (faad, "codec_data less than 2 bytes long");
|
2009-10-13 14:01:26 +00:00
|
|
|
gst_object_unref (faad);
|
2006-10-06 15:49:39 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2006-07-16 14:46:02 +00:00
|
|
|
init_failed:
|
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (faad, "faacDecInit2() failed");
|
2009-10-13 14:01:26 +00:00
|
|
|
gst_object_unref (faad);
|
2006-07-16 14:46:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/*
|
|
|
|
* Channel identifier conversion - caller g_free()s result!
|
|
|
|
*/
|
2005-07-19 20:51:15 +00:00
|
|
|
/*
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static guchar *
|
|
|
|
gst_faad_chanpos_from_gst (GstAudioChannelPosition * pos, guint num)
|
|
|
|
{
|
|
|
|
guchar *fpos = g_new (guchar, num);
|
|
|
|
guint n;
|
|
|
|
|
|
|
|
for (n = 0; n < num; n++) {
|
|
|
|
switch (pos[n]) {
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT:
|
|
|
|
fpos[n] = FRONT_CHANNEL_LEFT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT:
|
|
|
|
fpos[n] = FRONT_CHANNEL_RIGHT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER:
|
2004-12-03 15:34:19 +00:00
|
|
|
case GST_AUDIO_CHANNEL_POSITION_FRONT_MONO:
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
fpos[n] = FRONT_CHANNEL_CENTER;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT:
|
|
|
|
fpos[n] = SIDE_CHANNEL_LEFT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT:
|
|
|
|
fpos[n] = SIDE_CHANNEL_RIGHT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_REAR_LEFT:
|
|
|
|
fpos[n] = BACK_CHANNEL_LEFT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT:
|
|
|
|
fpos[n] = BACK_CHANNEL_RIGHT;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_REAR_CENTER:
|
|
|
|
fpos[n] = BACK_CHANNEL_CENTER;
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CHANNEL_POSITION_LFE:
|
|
|
|
fpos[n] = LFE_CHANNEL;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
GST_WARNING ("Unsupported GST channel position 0x%x encountered",
|
|
|
|
pos[n]);
|
|
|
|
g_free (fpos);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return fpos;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
*/
|
2005-08-08 19:20:02 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static GstAudioChannelPosition *
|
2007-09-19 21:18:27 +00:00
|
|
|
gst_faad_chanpos_to_gst (GstFaad * faad, guchar * fpos, guint num,
|
2008-01-31 15:52:18 +00:00
|
|
|
gboolean * channel_map_failed)
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
{
|
2008-04-22 15:07:35 +00:00
|
|
|
GstAudioChannelPosition *pos;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
guint n;
|
2005-12-09 15:30:21 +00:00
|
|
|
gboolean unknown_channel = FALSE;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2007-09-19 21:18:27 +00:00
|
|
|
*channel_map_failed = FALSE;
|
|
|
|
|
|
|
|
/* special handling for the common cases for mono and stereo */
|
|
|
|
if (num == 1 && fpos[0] == FRONT_CHANNEL_CENTER) {
|
|
|
|
GST_DEBUG_OBJECT (faad, "mono common case; won't set channel positions");
|
|
|
|
return NULL;
|
|
|
|
} else if (num == 2 && fpos[0] == FRONT_CHANNEL_LEFT
|
|
|
|
&& fpos[1] == FRONT_CHANNEL_RIGHT) {
|
|
|
|
GST_DEBUG_OBJECT (faad, "stereo common case; won't set channel positions");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2008-04-22 15:07:35 +00:00
|
|
|
pos = g_new (GstAudioChannelPosition, num);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
for (n = 0; n < num; n++) {
|
2007-09-19 21:18:27 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "faad channel %d as %d", n, fpos[n]);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
switch (fpos[n]) {
|
|
|
|
case FRONT_CHANNEL_LEFT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
break;
|
|
|
|
case FRONT_CHANNEL_RIGHT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
break;
|
|
|
|
case FRONT_CHANNEL_CENTER:
|
2004-12-03 15:34:19 +00:00
|
|
|
/* argh, mono = center */
|
|
|
|
if (num == 1)
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_MONO;
|
|
|
|
else
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
break;
|
|
|
|
case SIDE_CHANNEL_LEFT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT;
|
|
|
|
break;
|
|
|
|
case SIDE_CHANNEL_RIGHT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT;
|
|
|
|
break;
|
|
|
|
case BACK_CHANNEL_LEFT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
|
|
|
|
break;
|
|
|
|
case BACK_CHANNEL_RIGHT:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
|
|
|
|
break;
|
|
|
|
case BACK_CHANNEL_CENTER:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_REAR_CENTER;
|
|
|
|
break;
|
|
|
|
case LFE_CHANNEL:
|
|
|
|
pos[n] = GST_AUDIO_CHANNEL_POSITION_LFE;
|
|
|
|
break;
|
|
|
|
default:
|
2007-09-19 21:18:27 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "unknown channel %d at %d", fpos[n], n);
|
2005-12-09 15:30:21 +00:00
|
|
|
unknown_channel = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (unknown_channel) {
|
2007-09-19 21:18:27 +00:00
|
|
|
g_free (pos);
|
|
|
|
pos = NULL;
|
2006-01-27 12:47:12 +00:00
|
|
|
switch (num) {
|
|
|
|
case 1:{
|
2007-09-19 21:18:27 +00:00
|
|
|
GST_DEBUG_OBJECT (faad,
|
|
|
|
"FAAD reports unknown 1 channel mapping. Forcing to mono");
|
2006-01-27 12:47:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 2:{
|
2007-09-19 21:18:27 +00:00
|
|
|
GST_DEBUG_OBJECT (faad,
|
|
|
|
"FAAD reports unknown 2 channel mapping. Forcing to stereo");
|
2006-01-27 12:47:12 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
GST_WARNING ("Unsupported FAAD channel position 0x%x encountered",
|
|
|
|
fpos[n]);
|
2007-09-19 21:18:27 +00:00
|
|
|
*channel_map_failed = TRUE;
|
2006-01-27 12:47:12 +00:00
|
|
|
break;
|
|
|
|
}
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
2003-11-21 21:20:42 +00:00
|
|
|
static GstCaps *
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_srcgetcaps (GstPad * pad)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2005-10-20 15:08:14 +00:00
|
|
|
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static GstAudioChannelPosition *supported_positions = NULL;
|
2005-01-17 23:01:43 +00:00
|
|
|
static gint num_supported_positions = LFE_CHANNEL - FRONT_CHANNEL_CENTER + 1;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
GstCaps *templ;
|
|
|
|
|
|
|
|
if (!supported_positions) {
|
2005-01-17 23:01:43 +00:00
|
|
|
guchar *supported_fpos = g_new0 (guchar, num_supported_positions);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gint n;
|
2007-09-19 21:18:27 +00:00
|
|
|
gboolean map_failed;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-01-17 23:34:45 +00:00
|
|
|
for (n = 0; n < num_supported_positions; n++) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
supported_fpos[n] = n + FRONT_CHANNEL_CENTER;
|
|
|
|
}
|
2007-09-19 21:18:27 +00:00
|
|
|
supported_positions = gst_faad_chanpos_to_gst (faad, supported_fpos,
|
|
|
|
num_supported_positions, &map_failed);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
g_free (supported_fpos);
|
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
if (faad->handle != NULL && faad->channels != -1 && faad->samplerate != -1) {
|
2004-03-10 05:45:23 +00:00
|
|
|
GstCaps *caps = gst_caps_new_empty ();
|
|
|
|
GstStructure *str;
|
|
|
|
gint fmt[] = {
|
|
|
|
FAAD_FMT_16BIT,
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#if 0
|
2004-03-10 05:45:23 +00:00
|
|
|
FAAD_FMT_24BIT,
|
|
|
|
FAAD_FMT_32BIT,
|
|
|
|
FAAD_FMT_FLOAT,
|
|
|
|
FAAD_FMT_DOUBLE,
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#endif
|
2004-03-10 05:45:23 +00:00
|
|
|
-1
|
2004-03-14 22:34:33 +00:00
|
|
|
}
|
|
|
|
, n;
|
2004-03-10 05:45:23 +00:00
|
|
|
|
|
|
|
for (n = 0; fmt[n] != -1; n++) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
switch (fmt[n]) {
|
2004-03-15 19:32:27 +00:00
|
|
|
case FAAD_FMT_16BIT:
|
|
|
|
str = gst_structure_new ("audio/x-raw-int",
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"width", G_TYPE_INT, 16, "depth", G_TYPE_INT, 16, NULL);
|
|
|
|
break;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#if 0
|
2004-03-15 19:32:27 +00:00
|
|
|
case FAAD_FMT_24BIT:
|
|
|
|
str = gst_structure_new ("audio/x-raw-int",
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"width", G_TYPE_INT, 24, "depth", G_TYPE_INT, 24, NULL);
|
|
|
|
break;
|
|
|
|
case FAAD_FMT_32BIT:
|
|
|
|
str = gst_structure_new ("audio/x-raw-int",
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"width", G_TYPE_INT, 32, "depth", G_TYPE_INT, 32, NULL);
|
|
|
|
break;
|
|
|
|
case FAAD_FMT_FLOAT:
|
|
|
|
str = gst_structure_new ("audio/x-raw-float",
|
|
|
|
"depth", G_TYPE_INT, 32, NULL);
|
|
|
|
break;
|
|
|
|
case FAAD_FMT_DOUBLE:
|
|
|
|
str = gst_structure_new ("audio/x-raw-float",
|
|
|
|
"depth", G_TYPE_INT, 64, NULL);
|
|
|
|
break;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#endif
|
2004-03-15 19:32:27 +00:00
|
|
|
default:
|
|
|
|
str = NULL;
|
|
|
|
break;
|
2004-03-10 05:45:23 +00:00
|
|
|
}
|
|
|
|
if (!str)
|
2004-03-15 19:32:27 +00:00
|
|
|
continue;
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-11-28 15:43:29 +00:00
|
|
|
if (faad->samplerate > 0) {
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_structure_set (str, "rate", G_TYPE_INT, faad->samplerate, NULL);
|
2003-11-21 21:20:42 +00:00
|
|
|
} else {
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_structure_set (str, "rate", GST_TYPE_INT_RANGE, 8000, 96000, NULL);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2005-11-28 15:43:29 +00:00
|
|
|
if (faad->channels > 0) {
|
2004-03-15 19:32:27 +00:00
|
|
|
gst_structure_set (str, "channels", G_TYPE_INT, faad->channels, NULL);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* put channel information here */
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if (faad->channel_positions) {
|
|
|
|
GstAudioChannelPosition *pos;
|
2007-09-19 21:18:27 +00:00
|
|
|
gboolean map_failed;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2007-09-19 21:18:27 +00:00
|
|
|
pos = gst_faad_chanpos_to_gst (faad, faad->channel_positions,
|
|
|
|
faad->channels, &map_failed);
|
|
|
|
if (map_failed) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gst_structure_free (str);
|
|
|
|
continue;
|
|
|
|
}
|
2007-09-19 21:18:27 +00:00
|
|
|
if (pos) {
|
|
|
|
gst_audio_set_channel_positions (str, pos);
|
|
|
|
g_free (pos);
|
|
|
|
}
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
} else {
|
|
|
|
gst_audio_set_structure_channel_positions_list (str,
|
|
|
|
supported_positions, num_supported_positions);
|
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
} else {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gst_structure_set (str, "channels", GST_TYPE_INT_RANGE, 1, 8, NULL);
|
|
|
|
/* we set channel positions later */
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_structure_set (str, "endianness", G_TYPE_INT, G_BYTE_ORDER, NULL);
|
2004-03-10 05:45:23 +00:00
|
|
|
|
|
|
|
gst_caps_append_structure (caps, str);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if (faad->channels == -1) {
|
|
|
|
gst_audio_set_caps_channel_positions_list (caps,
|
|
|
|
supported_positions, num_supported_positions);
|
|
|
|
}
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_object_unref (faad);
|
2003-11-21 21:20:42 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* template with channel positions */
|
|
|
|
templ = gst_caps_copy (GST_PAD_TEMPLATE_CAPS (GST_PAD_PAD_TEMPLATE (pad)));
|
|
|
|
gst_audio_set_caps_channel_positions_list (templ,
|
|
|
|
supported_positions, num_supported_positions);
|
|
|
|
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_object_unref (faad);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
return templ;
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2005-11-15 16:50:18 +00:00
|
|
|
/*
|
2003-11-21 21:20:42 +00:00
|
|
|
static GstPadLinkReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_srcconnect (GstPad * pad, const GstCaps * caps)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2003-12-22 06:56:16 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
const gchar *mimetype;
|
New DTS decoder.
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/dts/Makefile.am:
* ext/dts/gstdtsdec.c: (gst_dtsdec_get_type),
(gst_dtsdec_base_init), (gst_dtsdec_class_init), (gst_dtsdec_init),
(gst_dtsdec_channels), (gst_dtsdec_renegotiate),
(gst_dtsdec_handle_event), (gst_dtsdec_update_streaminfo),
(gst_dtsdec_loop), (gst_dtsdec_change_state),
(gst_dtsdec_set_property), (gst_dtsdec_get_property),
(plugin_init):
* ext/dts/gstdtsdec.h:
New DTS decoder.
* ext/faad/gstfaad.c: (gst_faad_sinkconnect),
(gst_faad_srcconnect):
Add ESDS atom handling (.m4a).
2004-04-29 00:00:25 +00:00
|
|
|
gint fmt = -1;
|
2004-03-10 05:45:23 +00:00
|
|
|
gint depth, rate, channels;
|
2003-11-21 21:20:42 +00:00
|
|
|
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
if (!faad->handle || (faad->samplerate == -1 || faad->channels == -1) ||
|
|
|
|
!faad->channel_positions) {
|
2003-11-21 21:20:42 +00:00
|
|
|
return GST_PAD_LINK_DELAYED;
|
|
|
|
}
|
|
|
|
|
2003-12-22 06:56:16 +00:00
|
|
|
mimetype = gst_structure_get_name (structure);
|
2004-03-10 05:45:23 +00:00
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// Samplerate and channels are normally provided through
|
|
|
|
// * the getcaps function
|
2004-03-10 05:45:23 +00:00
|
|
|
if (!gst_structure_get_int (structure, "channels", &channels) ||
|
|
|
|
!gst_structure_get_int (structure, "rate", &rate) ||
|
|
|
|
rate != faad->samplerate || channels != faad->channels) {
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
}
|
2004-03-14 22:34:33 +00:00
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// Another internal checkup.
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if (faad->need_channel_setup) {
|
|
|
|
GstAudioChannelPosition *pos;
|
|
|
|
guchar *fpos;
|
|
|
|
guint i;
|
|
|
|
|
|
|
|
pos = gst_audio_get_channel_positions (structure);
|
|
|
|
if (!pos) {
|
|
|
|
return GST_PAD_LINK_DELAYED;
|
|
|
|
}
|
|
|
|
fpos = gst_faad_chanpos_from_gst (pos, faad->channels);
|
|
|
|
g_free (pos);
|
|
|
|
if (!fpos)
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
|
|
|
|
for (i = 0; i < faad->channels; i++) {
|
|
|
|
if (fpos[i] != faad->channel_positions[i]) {
|
|
|
|
g_free (fpos);
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_free (fpos);
|
|
|
|
}
|
|
|
|
|
2003-12-22 06:56:16 +00:00
|
|
|
if (!strcmp (mimetype, "audio/x-raw-int")) {
|
|
|
|
gint width;
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (structure, "depth", &depth) ||
|
2004-03-15 19:32:27 +00:00
|
|
|
!gst_structure_get_int (structure, "width", &width))
|
2003-12-22 06:56:16 +00:00
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
if (depth != width)
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
|
|
|
|
switch (depth) {
|
|
|
|
case 16:
|
2004-03-15 19:32:27 +00:00
|
|
|
fmt = FAAD_FMT_16BIT;
|
|
|
|
break;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#if 0
|
2003-12-22 06:56:16 +00:00
|
|
|
case 24:
|
2004-03-15 19:32:27 +00:00
|
|
|
fmt = FAAD_FMT_24BIT;
|
|
|
|
break;
|
2003-12-22 06:56:16 +00:00
|
|
|
case 32:
|
2004-03-15 19:32:27 +00:00
|
|
|
fmt = FAAD_FMT_32BIT;
|
|
|
|
break;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#endif
|
2003-12-22 06:56:16 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (!gst_structure_get_int (structure, "depth", &depth))
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
|
|
|
|
switch (depth) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#if 0
|
2003-12-22 06:56:16 +00:00
|
|
|
case 32:
|
2004-03-15 19:32:27 +00:00
|
|
|
fmt = FAAD_FMT_FLOAT;
|
|
|
|
break;
|
2003-12-22 06:56:16 +00:00
|
|
|
case 64:
|
2004-03-15 19:32:27 +00:00
|
|
|
fmt = FAAD_FMT_DOUBLE;
|
|
|
|
break;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#endif
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
2003-12-22 06:56:16 +00:00
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
|
New DTS decoder.
Original commit message from CVS:
* configure.ac:
* ext/Makefile.am:
* ext/dts/Makefile.am:
* ext/dts/gstdtsdec.c: (gst_dtsdec_get_type),
(gst_dtsdec_base_init), (gst_dtsdec_class_init), (gst_dtsdec_init),
(gst_dtsdec_channels), (gst_dtsdec_renegotiate),
(gst_dtsdec_handle_event), (gst_dtsdec_update_streaminfo),
(gst_dtsdec_loop), (gst_dtsdec_change_state),
(gst_dtsdec_set_property), (gst_dtsdec_get_property),
(plugin_init):
* ext/dts/gstdtsdec.h:
New DTS decoder.
* ext/faad/gstfaad.c: (gst_faad_sinkconnect),
(gst_faad_srcconnect):
Add ESDS atom handling (.m4a).
2004-04-29 00:00:25 +00:00
|
|
|
if (fmt != -1) {
|
2003-12-22 06:56:16 +00:00
|
|
|
faacDecConfiguration *conf;
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2003-12-22 06:56:16 +00:00
|
|
|
conf = faacDecGetCurrentConfiguration (faad->handle);
|
|
|
|
conf->outputFormat = fmt;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
if (faacDecSetConfiguration (faad->handle, conf) == 0)
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
2004-12-01 16:07:43 +00:00
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// FIXME: handle return value, how?
|
2004-03-10 05:45:23 +00:00
|
|
|
faad->bps = depth / 8;
|
2003-12-22 06:56:16 +00:00
|
|
|
|
2004-03-10 05:45:23 +00:00
|
|
|
return GST_PAD_LINK_OK;
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
2004-12-01 16:07:43 +00:00
|
|
|
|
2003-11-21 21:20:42 +00:00
|
|
|
return GST_PAD_LINK_REFUSED;
|
2005-07-19 20:51:15 +00:00
|
|
|
}*/
|
|
|
|
|
2008-06-02 10:18:25 +00:00
|
|
|
static void
|
|
|
|
clear_queued (GstFaad * faad)
|
|
|
|
{
|
|
|
|
g_list_foreach (faad->queued, (GFunc) gst_mini_object_unref, NULL);
|
|
|
|
g_list_free (faad->queued);
|
|
|
|
faad->queued = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
flush_queued (GstFaad * faad)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
while (faad->queued) {
|
|
|
|
GstBuffer *buf = GST_BUFFER_CAST (faad->queued->data);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (faad, "pushing buffer %p, timestamp %"
|
|
|
|
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT, buf,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
|
|
|
|
|
|
|
/* iterate ouput queue an push downstream */
|
|
|
|
ret = gst_pad_push (faad->srcpad, buf);
|
|
|
|
|
|
|
|
faad->queued = g_list_delete_link (faad->queued, faad->queued);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_faad_drain (GstFaad * faad)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
|
|
|
|
if (faad->segment->rate < 0.0) {
|
|
|
|
/* if we have some queued frames for reverse playback, flush
|
|
|
|
* them now */
|
|
|
|
ret = flush_queued (faad);
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
static gboolean
|
2006-03-04 20:04:11 +00:00
|
|
|
gst_faad_do_raw_seek (GstFaad * faad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType start_type, end_type;
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate;
|
|
|
|
gint64 start, start_time;
|
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags, &start_type,
|
|
|
|
&start_time, &end_type, NULL);
|
|
|
|
|
|
|
|
if (rate != 1.0 ||
|
|
|
|
format != GST_FORMAT_TIME ||
|
|
|
|
start_type != GST_SEEK_TYPE_SET || end_type != GST_SEEK_TYPE_NONE) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gst_faad_src_convert (faad, GST_FORMAT_TIME, start_time,
|
|
|
|
GST_FORMAT_BYTES, &start)) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
event = gst_event_new_seek (1.0, GST_FORMAT_BYTES, flags,
|
|
|
|
GST_SEEK_TYPE_SET, start, GST_SEEK_TYPE_NONE, -1);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (faad, "seeking to %" GST_TIME_FORMAT " at byte offset %"
|
|
|
|
G_GINT64_FORMAT, GST_TIME_ARGS (start_time), start);
|
|
|
|
|
2008-06-02 10:18:25 +00:00
|
|
|
return gst_pad_push_event (faad->sinkpad, event);
|
2006-03-04 20:04:11 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_faad_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstFaad *faad;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (faad, "Handling %s event", GST_EVENT_TYPE_NAME (event));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:{
|
|
|
|
/* try upstream first, there might be a demuxer */
|
|
|
|
gst_event_ref (event);
|
2008-06-02 10:18:25 +00:00
|
|
|
if (!(res = gst_pad_push_event (faad->sinkpad, event))) {
|
2006-03-04 20:04:11 +00:00
|
|
|
res = gst_faad_do_raw_seek (faad, event);
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2008-06-02 10:18:25 +00:00
|
|
|
res = gst_pad_push_event (faad->sinkpad, event);
|
2006-03-04 20:04:11 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_object_unref (faad);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_faad_sink_event (GstPad * pad, GstEvent * event)
|
2005-07-19 20:51:15 +00:00
|
|
|
{
|
|
|
|
GstFaad *faad;
|
2005-08-08 19:20:02 +00:00
|
|
|
gboolean res = TRUE;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
|
|
|
faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
GST_LOG_OBJECT (faad, "Handling %s event", GST_EVENT_TYPE_NAME (event));
|
2005-07-19 20:51:15 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2008-06-02 10:18:25 +00:00
|
|
|
case GST_EVENT_FLUSH_STOP:
|
|
|
|
if (faad->tempbuf != NULL) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
|
|
|
clear_queued (faad);
|
|
|
|
res = gst_pad_push_event (faad->srcpad, event);
|
|
|
|
break;
|
2005-07-19 20:51:15 +00:00
|
|
|
case GST_EVENT_EOS:
|
2008-06-02 10:18:25 +00:00
|
|
|
gst_faad_drain (faad);
|
2005-08-08 19:20:02 +00:00
|
|
|
if (faad->tempbuf != NULL) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
|
|
|
res = gst_pad_push_event (faad->srcpad, event);
|
|
|
|
break;
|
2005-07-27 20:29:15 +00:00
|
|
|
case GST_EVENT_NEWSEGMENT:
|
2005-08-08 19:20:02 +00:00
|
|
|
{
|
|
|
|
GstFormat fmt;
|
2005-10-11 23:03:09 +00:00
|
|
|
gboolean is_update;
|
ext/faad/gstfaad.c: Sign/unsign mismatch.
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_event):
Sign/unsign mismatch.
* configure.ac:
* gst/qtdemux/qtdemux.c: (gst_qtdemux_class_init),
(gst_qtdemux_init), (gst_qtdemux_get_src_query_types),
(gst_qtdemux_handle_src_query), (gst_qtdemux_handle_src_event),
(plugin_init), (gst_qtdemux_handle_sink_event),
(gst_qtdemux_change_state), (gst_qtdemux_loop_header),
(qtdemux_sink_activate), (qtdemux_sink_activate_pull),
(gst_qtdemux_add_stream), (qtdemux_parse), (qtdemux_parse_tree),
(qtdemux_parse_trak), (qtdemux_video_caps), (qtdemux_audio_caps):
* gst/qtdemux/qtdemux.h:
Half-assed port (hey, it works).
2005-08-09 14:43:48 +00:00
|
|
|
gint64 start, end, base;
|
2005-08-08 19:20:02 +00:00
|
|
|
gdouble rate;
|
|
|
|
|
2005-11-22 11:57:51 +00:00
|
|
|
gst_event_parse_new_segment (event, &is_update, &rate, &fmt, &start,
|
2005-10-11 23:03:09 +00:00
|
|
|
&end, &base);
|
2008-06-02 10:18:25 +00:00
|
|
|
|
2008-06-02 17:06:34 +00:00
|
|
|
/* drain queued buffers before we activate the new segment */
|
|
|
|
gst_faad_drain (faad);
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
if (fmt == GST_FORMAT_TIME) {
|
2005-08-15 15:58:49 +00:00
|
|
|
GST_DEBUG ("Got NEWSEGMENT event in GST_FORMAT_TIME, passing on (%"
|
|
|
|
GST_TIME_FORMAT " - %" GST_TIME_FORMAT ")", GST_TIME_ARGS (start),
|
2005-08-08 19:20:02 +00:00
|
|
|
GST_TIME_ARGS (end));
|
2006-05-31 13:37:27 +00:00
|
|
|
gst_segment_set_newsegment (faad->segment, is_update, rate, fmt, start,
|
|
|
|
end, base);
|
2005-08-08 19:20:02 +00:00
|
|
|
} else if (fmt == GST_FORMAT_BYTES) {
|
2006-03-04 20:04:11 +00:00
|
|
|
gint64 new_start = 0;
|
|
|
|
gint64 new_end = -1;
|
2005-08-08 19:20:02 +00:00
|
|
|
|
|
|
|
GST_DEBUG ("Got NEWSEGMENT event in GST_FORMAT_BYTES (%"
|
|
|
|
G_GUINT64_FORMAT " - %" G_GUINT64_FORMAT ")", start, end);
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
if (gst_faad_src_convert (faad, GST_FORMAT_BYTES, start,
|
|
|
|
GST_FORMAT_TIME, &new_start)) {
|
|
|
|
if (end != -1) {
|
|
|
|
gst_faad_src_convert (faad, GST_FORMAT_BYTES, end,
|
|
|
|
GST_FORMAT_TIME, &new_end);
|
2005-08-08 19:20:02 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_DEBUG
|
|
|
|
("no average bitrate yet, sending newsegment with start at 0");
|
|
|
|
}
|
|
|
|
gst_event_unref (event);
|
2006-03-04 20:04:11 +00:00
|
|
|
|
|
|
|
event = gst_event_new_new_segment (is_update, rate,
|
|
|
|
GST_FORMAT_TIME, new_start, new_end, new_start);
|
|
|
|
|
2006-05-31 13:37:27 +00:00
|
|
|
gst_segment_set_newsegment (faad->segment, is_update, rate,
|
|
|
|
GST_FORMAT_TIME, new_start, new_end, new_start);
|
|
|
|
|
2005-08-15 15:58:49 +00:00
|
|
|
GST_DEBUG ("Sending new NEWSEGMENT event, time %" GST_TIME_FORMAT
|
|
|
|
" - %" GST_TIME_FORMAT, GST_TIME_ARGS (new_start),
|
2005-08-08 19:20:02 +00:00
|
|
|
GST_TIME_ARGS (new_end));
|
2006-03-04 20:04:11 +00:00
|
|
|
|
|
|
|
faad->next_ts = new_start;
|
|
|
|
faad->prev_ts = GST_CLOCK_TIME_NONE;
|
2005-08-08 19:20:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
res = gst_pad_push_event (faad->srcpad, event);
|
|
|
|
break;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
default:
|
2005-10-20 15:08:14 +00:00
|
|
|
res = gst_pad_event_default (pad, event);
|
2005-07-19 20:51:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
gst_object_unref (faad);
|
2005-07-19 20:51:15 +00:00
|
|
|
return res;
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
static gboolean
|
|
|
|
gst_faad_src_convert (GstFaad * faad, GstFormat src_format, gint64 src_val,
|
|
|
|
GstFormat dest_format, gint64 * dest_val)
|
|
|
|
{
|
|
|
|
guint64 bytes_in, time_out, val;
|
|
|
|
|
|
|
|
if (src_format == dest_format) {
|
|
|
|
if (dest_val)
|
|
|
|
*dest_val = src_val;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (faad);
|
|
|
|
bytes_in = faad->bytes_in;
|
|
|
|
time_out = faad->sum_dur_out;
|
|
|
|
GST_OBJECT_UNLOCK (faad);
|
|
|
|
|
|
|
|
if (bytes_in == 0 || time_out == 0)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
/* convert based on the average bitrate so far */
|
|
|
|
if (src_format == GST_FORMAT_BYTES && dest_format == GST_FORMAT_TIME) {
|
|
|
|
val = gst_util_uint64_scale (src_val, time_out, bytes_in);
|
|
|
|
} else if (src_format == GST_FORMAT_TIME && dest_format == GST_FORMAT_BYTES) {
|
|
|
|
val = gst_util_uint64_scale (src_val, bytes_in, time_out);
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dest_val)
|
|
|
|
*dest_val = (gint64) val;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_faad_src_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
gboolean res = FALSE;
|
|
|
|
GstFaad *faad;
|
|
|
|
GstPad *peer = NULL;
|
|
|
|
|
|
|
|
faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (faad, "processing %s query", GST_QUERY_TYPE_NAME (query));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_DURATION:{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 len_bytes, duration;
|
|
|
|
|
|
|
|
/* try upstream first, in case there's a demuxer */
|
|
|
|
if ((res = gst_pad_query_default (pad, query)))
|
|
|
|
break;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (faad, "query failed: can't handle format %s",
|
|
|
|
gst_format_get_name (format));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
peer = gst_pad_get_peer (faad->sinkpad);
|
|
|
|
if (peer == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
format = GST_FORMAT_BYTES;
|
|
|
|
if (!gst_pad_query_duration (peer, &format, &len_bytes)) {
|
|
|
|
GST_DEBUG_OBJECT (faad, "query failed: failed to get upstream length");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = gst_faad_src_convert (faad, GST_FORMAT_BYTES, len_bytes,
|
|
|
|
GST_FORMAT_TIME, &duration);
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
gst_query_set_duration (query, GST_FORMAT_TIME, duration);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (faad, "duration estimate: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (duration));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_QUERY_POSITION:{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 pos_bytes, pos;
|
|
|
|
|
|
|
|
/* try upstream first, in case there's a demuxer */
|
|
|
|
if ((res = gst_pad_query_default (pad, query)))
|
|
|
|
break;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, NULL);
|
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (faad, "query failed: can't handle format %s",
|
|
|
|
gst_format_get_name (format));
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
peer = gst_pad_get_peer (faad->sinkpad);
|
|
|
|
if (peer == NULL)
|
|
|
|
break;
|
|
|
|
|
|
|
|
format = GST_FORMAT_BYTES;
|
|
|
|
if (!gst_pad_query_position (peer, &format, &pos_bytes)) {
|
|
|
|
GST_OBJECT_LOCK (faad);
|
|
|
|
pos = faad->next_ts;
|
|
|
|
GST_OBJECT_UNLOCK (faad);
|
|
|
|
res = TRUE;
|
|
|
|
} else {
|
|
|
|
res = gst_faad_src_convert (faad, GST_FORMAT_BYTES, pos_bytes,
|
|
|
|
GST_FORMAT_TIME, &pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (res) {
|
|
|
|
gst_query_set_position (query, GST_FORMAT_TIME, pos);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (peer)
|
|
|
|
gst_object_unref (peer);
|
|
|
|
|
|
|
|
gst_object_unref (faad);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
static gboolean
|
2006-05-17 09:39:53 +00:00
|
|
|
gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info)
|
2005-08-08 19:20:02 +00:00
|
|
|
{
|
|
|
|
GstAudioChannelPosition *pos;
|
2006-05-17 09:39:53 +00:00
|
|
|
gboolean ret;
|
2007-09-19 21:18:27 +00:00
|
|
|
gboolean channel_map_failed;
|
2005-08-08 19:20:02 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
/* store new negotiation information */
|
|
|
|
faad->samplerate = info->samplerate;
|
|
|
|
faad->channels = info->channels;
|
|
|
|
g_free (faad->channel_positions);
|
|
|
|
faad->channel_positions = g_memdup (info->channel_position, faad->channels);
|
|
|
|
|
|
|
|
caps = gst_caps_new_simple ("audio/x-raw-int",
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
|
|
|
"width", G_TYPE_INT, 16,
|
|
|
|
"depth", G_TYPE_INT, 16,
|
|
|
|
"rate", G_TYPE_INT, faad->samplerate,
|
|
|
|
"channels", G_TYPE_INT, faad->channels, NULL);
|
|
|
|
|
|
|
|
faad->bps = 16 / 8;
|
|
|
|
|
2007-09-19 21:18:27 +00:00
|
|
|
channel_map_failed = FALSE;
|
|
|
|
pos =
|
|
|
|
gst_faad_chanpos_to_gst (faad, faad->channel_positions, faad->channels,
|
|
|
|
&channel_map_failed);
|
|
|
|
if (channel_map_failed) {
|
2005-12-09 15:30:21 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "Could not map channel positions");
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2007-09-19 21:18:27 +00:00
|
|
|
if (pos) {
|
|
|
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
|
|
|
g_free (pos);
|
|
|
|
}
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2007-09-19 21:18:27 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "New output caps: %" GST_PTR_FORMAT, caps);
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2006-05-17 09:39:53 +00:00
|
|
|
ret = gst_pad_set_caps (faad->srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2006-05-17 09:39:53 +00:00
|
|
|
return ret;
|
2005-08-08 19:20:02 +00:00
|
|
|
}
|
|
|
|
|
2006-01-27 12:47:12 +00:00
|
|
|
/*
|
|
|
|
* Find syncpoint in ADTS/ADIF stream. Doesn't work for raw,
|
|
|
|
* packetized streams. Be careful when calling.
|
|
|
|
* Returns FALSE on no-sync, fills offset/length if one/two
|
|
|
|
* syncpoints are found, only returns TRUE when it finds two
|
|
|
|
* subsequent syncpoints (similar to mp3 typefinding in
|
|
|
|
* gst/typefind/) for ADTS because 12 bits isn't very reliable.
|
|
|
|
*/
|
|
|
|
static gboolean
|
|
|
|
gst_faad_sync (GstBuffer * buf, guint * off)
|
|
|
|
{
|
|
|
|
guint8 *data = GST_BUFFER_DATA (buf);
|
|
|
|
guint size = GST_BUFFER_SIZE (buf), n;
|
|
|
|
gint snc;
|
|
|
|
|
|
|
|
GST_DEBUG ("Finding syncpoint");
|
|
|
|
|
2006-07-16 14:46:02 +00:00
|
|
|
/* check for too small a buffer */
|
|
|
|
if (size < 3)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-01-27 12:47:12 +00:00
|
|
|
/* FIXME: for no-sync, we go over the same data for every new buffer.
|
|
|
|
* We should save the information somewhere. */
|
|
|
|
for (n = 0; n < size - 3; n++) {
|
|
|
|
snc = GST_READ_UINT16_BE (&data[n]);
|
|
|
|
if ((snc & 0xfff6) == 0xfff0) {
|
|
|
|
/* we have an ADTS syncpoint. Parse length and find
|
|
|
|
* next syncpoint. */
|
|
|
|
guint len;
|
|
|
|
|
|
|
|
GST_DEBUG ("Found one ADTS syncpoint at offset 0x%x, tracing next...", n);
|
|
|
|
|
|
|
|
if (size - n < 5) {
|
|
|
|
GST_DEBUG ("Not enough data to parse ADTS header");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*off = n;
|
|
|
|
len = ((data[n + 3] & 0x03) << 11) |
|
|
|
|
(data[n + 4] << 3) | ((data[n + 5] & 0xe0) >> 5);
|
|
|
|
if (n + len + 2 >= size) {
|
|
|
|
GST_DEBUG ("Next frame is not within reach");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
snc = GST_READ_UINT16_BE (&data[n + len]);
|
|
|
|
if ((snc & 0xfff6) == 0xfff0) {
|
|
|
|
GST_DEBUG ("Found ADTS syncpoint at offset 0x%x (framelen %u)", n, len);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("No next frame found... (should be at 0x%x)", n + len);
|
|
|
|
} else if (!memcmp (&data[n], "ADIF", 4)) {
|
|
|
|
/* we have an ADIF syncpoint. 4 bytes is enough. */
|
|
|
|
*off = n;
|
|
|
|
GST_DEBUG ("Found ADIF syncpoint at offset 0x%x", n);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("Found no syncpoint");
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-05-03 10:25:46 +00:00
|
|
|
static gboolean
|
|
|
|
looks_like_valid_header (guint8 * input_data, guint input_size)
|
|
|
|
{
|
2008-03-08 04:27:03 +00:00
|
|
|
if (input_size < 4)
|
2006-05-03 10:25:46 +00:00
|
|
|
return FALSE;
|
|
|
|
|
2008-03-08 04:27:03 +00:00
|
|
|
if (input_data[0] == 'A'
|
|
|
|
&& input_data[1] == 'D' && input_data[2] == 'I' && input_data[3] == 'F')
|
|
|
|
/* ADIF type header */
|
|
|
|
return TRUE;
|
2006-05-03 10:25:46 +00:00
|
|
|
|
2008-03-08 04:27:03 +00:00
|
|
|
if (input_data[0] == 0xff && (input_data[1] >> 4) == 0xf)
|
|
|
|
/* ADTS type header */
|
|
|
|
return TRUE;
|
2006-05-03 10:25:46 +00:00
|
|
|
|
2008-03-08 04:27:03 +00:00
|
|
|
return FALSE;
|
2006-05-03 10:25:46 +00:00
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_faad_chain (GstPad * pad, GstBuffer * buffer)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2005-07-19 20:51:15 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2004-10-01 13:00:41 +00:00
|
|
|
guint input_size;
|
2005-02-21 18:58:46 +00:00
|
|
|
guint skip_bytes = 0;
|
2004-10-01 13:00:41 +00:00
|
|
|
guchar *input_data;
|
2005-08-08 19:20:02 +00:00
|
|
|
GstFaad *faad;
|
2005-07-19 20:51:15 +00:00
|
|
|
GstBuffer *outbuf;
|
2005-08-08 19:20:02 +00:00
|
|
|
faacDecFrameInfo info;
|
2003-11-21 21:20:42 +00:00
|
|
|
void *out;
|
2005-02-21 18:58:46 +00:00
|
|
|
gboolean run_loop = TRUE;
|
2006-01-27 12:47:12 +00:00
|
|
|
guint sync_off;
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-10-20 15:08:14 +00:00
|
|
|
faad = GST_FAAD (gst_pad_get_parent (pad));
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2008-06-02 10:18:25 +00:00
|
|
|
if (GST_BUFFER_IS_DISCONT (buffer)) {
|
|
|
|
gst_faad_drain (faad);
|
|
|
|
faacDecPostSeekReset (faad->handle, 0);
|
|
|
|
if (faad->tempbuf != NULL) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
|
|
|
faad->discont = TRUE;
|
|
|
|
}
|
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
GST_OBJECT_LOCK (faad);
|
|
|
|
faad->bytes_in += GST_BUFFER_SIZE (buffer);
|
|
|
|
GST_OBJECT_UNLOCK (faad);
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
if (GST_BUFFER_TIMESTAMP (buffer) != GST_CLOCK_TIME_NONE) {
|
2005-10-20 15:08:14 +00:00
|
|
|
/* some demuxers send multiple buffers in a row
|
|
|
|
* with the same timestamp (e.g. matroskademux) */
|
|
|
|
if (GST_BUFFER_TIMESTAMP (buffer) != faad->prev_ts) {
|
|
|
|
faad->next_ts = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
faad->prev_ts = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
}
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
GST_LOG_OBJECT (faad, "Timestamp on incoming buffer: %" GST_TIME_FORMAT
|
2005-10-20 15:08:14 +00:00
|
|
|
", next_ts: %" GST_TIME_FORMAT,
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buffer)),
|
2005-08-08 19:20:02 +00:00
|
|
|
GST_TIME_ARGS (faad->next_ts));
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* buffer + remaining data */
|
|
|
|
if (faad->tempbuf) {
|
2005-07-19 20:51:15 +00:00
|
|
|
buffer = gst_buffer_join (faad->tempbuf, buffer);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2006-01-27 12:47:12 +00:00
|
|
|
input_data = GST_BUFFER_DATA (buffer);
|
|
|
|
input_size = GST_BUFFER_SIZE (buffer);
|
2006-10-06 15:49:39 +00:00
|
|
|
|
2006-01-27 12:47:12 +00:00
|
|
|
if (!faad->packetised) {
|
|
|
|
if (!gst_faad_sync (buffer, &sync_off)) {
|
|
|
|
goto next;
|
|
|
|
} else {
|
|
|
|
input_data += sync_off;
|
|
|
|
input_size -= sync_off;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* init if not already done during capsnego */
|
|
|
|
if (!faad->init) {
|
2009-03-06 11:42:50 +00:00
|
|
|
#if FAAD2_MINOR_VERSION >= 7
|
|
|
|
unsigned long rate;
|
|
|
|
#else
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
guint32 rate;
|
2009-03-06 11:42:50 +00:00
|
|
|
#endif
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
guint8 ch;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (faad, "initialising ...");
|
2006-05-03 10:25:46 +00:00
|
|
|
/* We check if the first data looks like it might plausibly contain
|
|
|
|
* appropriate initialisation info... if not, we use our fake_codec_data
|
|
|
|
*/
|
|
|
|
if (looks_like_valid_header (input_data, input_size) || !faad->packetised) {
|
|
|
|
if (faacDecInit (faad->handle, input_data, input_size, &rate, &ch) < 0)
|
|
|
|
goto init_failed;
|
|
|
|
|
2009-10-12 10:29:44 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "faacDecInit() ok: rate=%u,channels=%u",
|
|
|
|
(guint32) rate, ch);
|
2006-05-03 10:25:46 +00:00
|
|
|
} else {
|
|
|
|
if ((gint8) faacDecInit2 (faad->handle, faad->fake_codec_data, 2,
|
|
|
|
&rate, &ch) < 0) {
|
|
|
|
goto init2_failed;
|
|
|
|
}
|
2009-10-12 10:29:44 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "faacDecInit2() ok: rate=%u,channels=%u",
|
|
|
|
(guint32) rate, ch);
|
2006-05-03 10:25:46 +00:00
|
|
|
}
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
|
|
|
|
skip_bytes = 0;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
faad->init = TRUE;
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* make sure we create new caps below */
|
|
|
|
faad->samplerate = 0;
|
|
|
|
faad->channels = 0;
|
2006-03-04 20:04:11 +00:00
|
|
|
gst_faad_send_tags (faad);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
2003-12-18 09:31:50 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* decode cycle */
|
2005-08-08 19:20:02 +00:00
|
|
|
info.bytesconsumed = input_size - skip_bytes;
|
2006-01-27 12:47:12 +00:00
|
|
|
info.error = 0;
|
2005-02-21 18:58:46 +00:00
|
|
|
|
|
|
|
if (!faad->packetised) {
|
|
|
|
/* We must check that ourselves for raw stream */
|
|
|
|
run_loop = (input_size >= FAAD_MIN_STREAMSIZE);
|
|
|
|
}
|
|
|
|
|
|
|
|
while ((input_size > 0) && run_loop) {
|
|
|
|
|
|
|
|
if (faad->packetised) {
|
|
|
|
/* Only one packet per buffer, no matter how much is really consumed */
|
|
|
|
run_loop = FALSE;
|
|
|
|
} else {
|
2005-08-08 19:20:02 +00:00
|
|
|
if (input_size < FAAD_MIN_STREAMSIZE || info.bytesconsumed <= 0) {
|
2005-02-21 18:58:46 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
out = faacDecDecode (faad->handle, &info, input_data + skip_bytes,
|
2005-02-21 18:58:46 +00:00
|
|
|
input_size - skip_bytes);
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
|
2006-10-06 15:49:39 +00:00
|
|
|
if (info.error > 0) {
|
2008-06-02 10:18:25 +00:00
|
|
|
GST_WARNING_OBJECT (faad, "decoding error: %s",
|
2006-10-06 15:49:39 +00:00
|
|
|
faacDecGetErrorMessage (info.error));
|
2008-06-02 10:18:25 +00:00
|
|
|
/* mark discont for the next buffer */
|
|
|
|
faad->discont = TRUE;
|
2006-10-06 15:49:39 +00:00
|
|
|
goto out;
|
2004-10-01 13:00:41 +00:00
|
|
|
}
|
2004-03-10 05:45:23 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
if (info.bytesconsumed > input_size)
|
|
|
|
info.bytesconsumed = input_size;
|
2006-10-06 15:49:39 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
input_size -= info.bytesconsumed;
|
|
|
|
input_data += info.bytesconsumed;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
if (out && info.samples > 0) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gboolean fmt_change = FALSE;
|
2004-10-01 13:00:41 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* see if we need to renegotiate */
|
2005-08-08 19:20:02 +00:00
|
|
|
if (info.samplerate != faad->samplerate ||
|
|
|
|
info.channels != faad->channels || !faad->channel_positions) {
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
fmt_change = TRUE;
|
|
|
|
} else {
|
|
|
|
gint i;
|
2004-10-01 13:00:41 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
for (i = 0; i < info.channels; i++) {
|
|
|
|
if (info.channel_position[i] != faad->channel_positions[i])
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
fmt_change = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (fmt_change) {
|
2006-05-17 09:39:53 +00:00
|
|
|
if (!gst_faad_update_caps (faad, &info)) {
|
2005-08-08 19:20:02 +00:00
|
|
|
GST_ELEMENT_ERROR (faad, CORE, NEGOTIATION, (NULL),
|
|
|
|
("Setting caps on source pad failed"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
2004-10-01 13:00:41 +00:00
|
|
|
}
|
|
|
|
|
2008-03-18 10:12:40 +00:00
|
|
|
if (info.samples > G_MAXUINT / faad->bps) {
|
|
|
|
/* C's lovely propensity for int overflow.. */
|
|
|
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
|
|
|
("Output buffer too large"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
/* play decoded data */
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
if (info.samples > 0) {
|
2005-08-08 19:20:02 +00:00
|
|
|
guint bufsize = info.samples * faad->bps;
|
2005-10-20 15:08:14 +00:00
|
|
|
guint num_samples = info.samples / faad->channels;
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2008-03-18 10:12:40 +00:00
|
|
|
GST_DEBUG_OBJECT (faad, "decoded %d samples", (guint) info.samples);
|
2006-10-06 15:49:39 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* note: info.samples is total samples, not per channel */
|
2005-12-05 13:04:22 +00:00
|
|
|
ret =
|
2006-05-17 09:15:55 +00:00
|
|
|
gst_pad_alloc_buffer_and_set_caps (faad->srcpad, 0, bufsize,
|
|
|
|
GST_PAD_CAPS (faad->srcpad), &outbuf);
|
2005-10-20 15:08:14 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2005-08-08 19:20:02 +00:00
|
|
|
goto out;
|
|
|
|
|
|
|
|
memcpy (GST_BUFFER_DATA (outbuf), out, GST_BUFFER_SIZE (outbuf));
|
|
|
|
GST_BUFFER_OFFSET (outbuf) =
|
2005-10-20 15:08:14 +00:00
|
|
|
GST_CLOCK_TIME_TO_FRAMES (faad->next_ts, faad->samplerate);
|
2005-08-08 19:20:02 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (outbuf) = faad->next_ts;
|
2005-10-20 15:08:14 +00:00
|
|
|
GST_BUFFER_DURATION (outbuf) =
|
|
|
|
GST_FRAMES_TO_CLOCK_TIME (num_samples, faad->samplerate);
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2006-03-04 20:04:11 +00:00
|
|
|
GST_OBJECT_LOCK (faad);
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->next_ts += GST_BUFFER_DURATION (outbuf);
|
|
|
|
faad->sum_dur_out += GST_BUFFER_DURATION (outbuf);
|
2006-03-04 20:04:11 +00:00
|
|
|
GST_OBJECT_UNLOCK (faad);
|
2005-08-08 19:20:02 +00:00
|
|
|
|
2007-07-24 05:15:41 +00:00
|
|
|
if ((outbuf = gst_audio_buffer_clip (outbuf, faad->segment,
|
|
|
|
faad->samplerate, faad->bps * faad->channels))) {
|
2006-05-31 13:37:27 +00:00
|
|
|
GST_LOG_OBJECT (faad,
|
|
|
|
"pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%" GST_TIME_FORMAT,
|
|
|
|
GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
2008-06-02 10:18:25 +00:00
|
|
|
|
|
|
|
if (faad->discont) {
|
|
|
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DISCONT);
|
|
|
|
faad->discont = FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (faad->segment->rate > 0.0) {
|
|
|
|
ret = gst_pad_push (faad->srcpad, outbuf);
|
|
|
|
} else {
|
|
|
|
/* reverse playback, queue frame till later when we get a discont. */
|
|
|
|
GST_DEBUG_OBJECT (faad, "queued frame");
|
|
|
|
faad->queued = g_list_prepend (faad->queued, outbuf);
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
}
|
2006-10-06 15:49:39 +00:00
|
|
|
if (ret != GST_FLOW_OK)
|
2006-05-31 13:37:27 +00:00
|
|
|
goto out;
|
2007-08-22 15:32:04 +00:00
|
|
|
}
|
2004-10-01 13:00:41 +00:00
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
}
|
2004-03-06 00:42:20 +00:00
|
|
|
|
2006-01-27 12:47:12 +00:00
|
|
|
next:
|
|
|
|
|
2005-02-21 18:58:46 +00:00
|
|
|
/* Keep the leftovers in raw stream */
|
|
|
|
if (input_size > 0 && !faad->packetised) {
|
2005-07-19 20:51:15 +00:00
|
|
|
if (input_size < GST_BUFFER_SIZE (buffer)) {
|
|
|
|
faad->tempbuf = gst_buffer_create_sub (buffer,
|
|
|
|
GST_BUFFER_SIZE (buffer) - input_size, input_size);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
} else {
|
2005-07-19 20:51:15 +00:00
|
|
|
faad->tempbuf = buffer;
|
|
|
|
gst_buffer_ref (buffer);
|
2004-10-01 13:00:41 +00:00
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
out:
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
gst_buffer_unref (buffer);
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_object_unref (faad);
|
2005-07-19 20:51:15 +00:00
|
|
|
|
|
|
|
return ret;
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
init_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
|
|
|
("Failed to init decoder from stream"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
init2_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
|
|
|
("%s() failed", (faad->handle) ? "faacDecInit2" : "faacDecOpen"));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_faad_open_decoder (GstFaad * faad)
|
|
|
|
{
|
|
|
|
faacDecConfiguration *conf;
|
|
|
|
|
|
|
|
faad->handle = faacDecOpen ();
|
|
|
|
|
|
|
|
if (faad->handle == NULL) {
|
|
|
|
GST_WARNING_OBJECT (faad, "faacDecOpen() failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
conf = faacDecGetCurrentConfiguration (faad->handle);
|
|
|
|
conf->defObjectType = LC;
|
2007-04-20 15:31:32 +00:00
|
|
|
conf->dontUpSampleImplicitSBR = 1;
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
conf->outputFormat = FAAD_FMT_16BIT;
|
|
|
|
|
|
|
|
if (faacDecSetConfiguration (faad->handle, conf) == 0) {
|
|
|
|
GST_WARNING_OBJECT (faad, "faacDecSetConfiguration() failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_faad_close_decoder (GstFaad * faad)
|
|
|
|
{
|
2006-10-06 15:49:39 +00:00
|
|
|
if (faad->handle) {
|
|
|
|
faacDecClose (faad->handle);
|
|
|
|
faad->handle = NULL;
|
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2005-09-05 15:10:18 +00:00
|
|
|
static GstStateChangeReturn
|
|
|
|
gst_faad_change_state (GstElement * element, GstStateChange transition)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2005-10-20 15:08:14 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
2003-11-21 21:20:42 +00:00
|
|
|
GstFaad *faad = GST_FAAD (element);
|
|
|
|
|
2005-09-05 15:10:18 +00:00
|
|
|
switch (transition) {
|
|
|
|
case GST_STATE_CHANGE_NULL_TO_READY:
|
ext/faad/gstfaad.*: If we run into a decoding error, try re-opening the decoder with faacDecInit2() using fake codec ...
Original commit message from CVS:
* ext/faad/gstfaad.c: (gst_faad_init), (aac_rate_idx),
(gst_faad_setcaps), (gst_faad_chain), (gst_faad_open_decoder),
(gst_faad_close_decoder), (gst_faad_change_state):
* ext/faad/gstfaad.h:
If we run into a decoding error, try re-opening the decoder
with faacDecInit2() using fake codec data created from the
data the demuxer gave us. Should fix a whole bunch of
GStreamer-faad problems incl. 'channel coupling not
implemented', 'maximum number of scalefactor bands exceeded'
etc. (#173007, #332892).
2006-04-28 11:04:12 +00:00
|
|
|
if (!gst_faad_open_decoder (faad))
|
2005-09-05 15:10:18 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2003-11-21 21:20:42 +00:00
|
|
|
break;
|
2006-05-31 13:37:27 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
2007-07-24 05:15:41 +00:00
|
|
|
gst_segment_init (faad->segment, GST_FORMAT_TIME);
|
2006-05-31 13:37:27 +00:00
|
|
|
break;
|
2005-10-20 15:08:14 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (GST_ELEMENT_CLASS (parent_class)->change_state)
|
|
|
|
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
|
|
|
|
|
|
|
|
switch (transition) {
|
2005-09-05 15:10:18 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
2003-11-21 21:20:42 +00:00
|
|
|
faad->samplerate = -1;
|
|
|
|
faad->channels = -1;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
faad->need_channel_setup = TRUE;
|
|
|
|
faad->init = FALSE;
|
|
|
|
g_free (faad->channel_positions);
|
|
|
|
faad->channel_positions = NULL;
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->next_ts = 0;
|
2005-10-20 15:08:14 +00:00
|
|
|
faad->prev_ts = GST_CLOCK_TIME_NONE;
|
2006-03-04 20:04:11 +00:00
|
|
|
faad->bytes_in = 0;
|
|
|
|
faad->sum_dur_out = 0;
|
2006-05-13 18:39:13 +00:00
|
|
|
faad->error_count = 0;
|
2004-10-01 13:00:41 +00:00
|
|
|
if (faad->tempbuf) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
2008-06-02 10:18:25 +00:00
|
|
|
clear_queued (faad);
|
|
|
|
break;
|
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
|
|
gst_faad_close_decoder (faad);
|
2003-11-21 21:20:42 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-10-20 15:08:14 +00:00
|
|
|
return ret;
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2003-11-21 21:20:42 +00:00
|
|
|
{
|
2005-07-19 20:51:15 +00:00
|
|
|
return gst_element_register (plugin, "faad", GST_RANK_PRIMARY, GST_TYPE_FAAD);
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"faad",
|
|
|
|
"Free AAC Decoder (FAAD)",
|
2006-04-01 10:09:11 +00:00
|
|
|
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN)
|