2003-11-21 21:20:42 +00:00
|
|
|
/* GStreamer FAAD (Free AAC Decoder) plugin
|
|
|
|
* Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
|
|
|
*
|
|
|
|
* 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>
|
2003-11-21 21:20:42 +00:00
|
|
|
#include "gstfaad.h"
|
|
|
|
|
2005-08-10 09:33:58 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (faad_debug);
|
|
|
|
#define GST_CAT_DEFAULT faad_debug
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
static GstElementDetails faad_details = {
|
|
|
|
"Free AAC Decoder (FAAD)",
|
|
|
|
"Codec/Decoder/Audio",
|
|
|
|
"Free MPEG-2/4 AAC decoder",
|
|
|
|
"Ronald Bultje <rbultje@ronald.bitfreak.net>"
|
|
|
|
};
|
|
|
|
|
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);
|
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);
|
2005-07-19 20:51:15 +00:00
|
|
|
static gboolean gst_faad_event (GstPad * pad, GstEvent * event);
|
|
|
|
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);
|
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
|
|
|
{
|
|
|
|
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
|
|
|
|
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;
|
2003-11-22 11:35:11 +00:00
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
faad->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&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,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_faad_event));
|
|
|
|
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
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
faad->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
|
|
|
|
"src");
|
2003-11-21 21:20:42 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (faad), faad->srcpad);
|
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));
|
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-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"))) {
|
|
|
|
gulong samplerate;
|
|
|
|
guchar channels;
|
|
|
|
|
|
|
|
/* We have codec data, means packetised stream */
|
|
|
|
faad->packetised = TRUE;
|
2005-08-10 09:33:58 +00:00
|
|
|
buf = GST_BUFFER (gst_value_get_mini_object (value));
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* someone forgot that char can be unsigned when writing the API */
|
|
|
|
if ((gint8) faacDecInit2 (faad->handle, GST_BUFFER_DATA (buf),
|
|
|
|
GST_BUFFER_SIZE (buf), &samplerate, &channels) < 0) {
|
|
|
|
GST_DEBUG ("faacDecInit2() failed");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
faad->samplerate = samplerate;
|
|
|
|
faad->channels = channels;
|
|
|
|
#endif
|
|
|
|
/* 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;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
faad->init = FALSE;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
faad->need_channel_setup = TRUE;
|
2005-07-19 20:51:15 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
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 *
|
|
|
|
gst_faad_chanpos_to_gst (guchar * fpos, guint num)
|
|
|
|
{
|
|
|
|
GstAudioChannelPosition *pos = g_new (GstAudioChannelPosition, num);
|
|
|
|
guint n;
|
|
|
|
|
|
|
|
for (n = 0; n < num; n++) {
|
|
|
|
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:
|
|
|
|
GST_WARNING ("Unsupported FAAD channel position 0x%x encountered",
|
|
|
|
fpos[n]);
|
|
|
|
g_free (pos);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return pos;
|
|
|
|
}
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
/*
|
2003-11-21 21:20:42 +00:00
|
|
|
static GstPadLinkReturn
|
2004-03-14 22:34:33 +00:00
|
|
|
gst_faad_sinkconnect (GstPad * pad, const GstCaps * caps)
|
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
|
|
|
GstFaad *faad = GST_FAAD (gst_pad_get_parent (pad));
|
|
|
|
GstStructure *str = gst_caps_get_structure (caps, 0);
|
|
|
|
const GValue *value;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// Assume raw stream
|
2005-02-21 18:58:46 +00:00
|
|
|
faad->packetised = FALSE;
|
|
|
|
|
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 ((value = gst_structure_get_value (str, "codec_data"))) {
|
|
|
|
gulong samplerate;
|
|
|
|
guchar channels;
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// We have codec data, means packetised stream
|
2005-02-21 18:58:46 +00:00
|
|
|
faad->packetised = TRUE;
|
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
|
|
|
buf = g_value_get_boxed (value);
|
2005-02-21 18:58:46 +00:00
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// someone forgot that char can be unsigned when writing the API
|
2004-05-08 00:20:18 +00:00
|
|
|
if ((gint8) faacDecInit2 (faad->handle, GST_BUFFER_DATA (buf),
|
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
|
|
|
GST_BUFFER_SIZE (buf), &samplerate, &channels) < 0)
|
|
|
|
return GST_PAD_LINK_REFUSED;
|
|
|
|
|
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->samplerate = samplerate;
|
|
|
|
//faad->channels = channels;
|
|
|
|
faad->init = TRUE;
|
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
|
|
|
|
2004-10-01 13:00:41 +00:00
|
|
|
if (faad->tempbuf) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
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
|
|
|
} else {
|
|
|
|
faad->init = FALSE;
|
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
|
|
|
}
|
|
|
|
|
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;
|
|
|
|
|
2005-07-19 20:51:15 +00:00
|
|
|
// if there's no decoderspecificdata, it's all fine. We cannot know
|
|
|
|
// * much more at this point...
|
2003-11-21 21:20:42 +00:00
|
|
|
return GST_PAD_LINK_OK;
|
|
|
|
}
|
2005-07-19 20:51:15 +00:00
|
|
|
*/
|
2005-08-08 19:20:02 +00:00
|
|
|
|
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;
|
|
|
|
|
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;
|
|
|
|
}
|
2005-01-17 23:01:43 +00:00
|
|
|
supported_positions = gst_faad_chanpos_to_gst (supported_fpos,
|
|
|
|
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
|
|
|
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
|
|
|
|
|
|
|
if (faad->samplerate != -1) {
|
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
|
|
|
}
|
|
|
|
|
|
|
|
if (faad->channels != -1) {
|
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;
|
|
|
|
|
|
|
|
pos = gst_faad_chanpos_to_gst (faad->channel_positions,
|
|
|
|
faad->channels);
|
|
|
|
if (!pos) {
|
|
|
|
gst_structure_free (str);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
gst_audio_set_channel_positions (str, pos);
|
|
|
|
g_free (pos);
|
|
|
|
} 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-07-19 20:51:15 +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
|
|
|
}*/
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_faad_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
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));
|
|
|
|
|
2005-10-20 15:08:14 +00:00
|
|
|
GST_LOG ("Handling %s event", GST_EVENT_TYPE_NAME (event));
|
2005-07-19 20:51:15 +00:00
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
/* FIXME: we should probably handle FLUSH and also
|
|
|
|
* SEEK in the case where we are not in a container
|
|
|
|
* (when our newsegment was in BYTES) */
|
2005-07-19 20:51:15 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_EOS:
|
2005-10-20 15:08:14 +00:00
|
|
|
GST_STREAM_LOCK (pad);
|
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);
|
|
|
|
GST_STREAM_UNLOCK (pad);
|
|
|
|
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-10-11 23:03:09 +00:00
|
|
|
gst_event_parse_newsegment (event, &is_update, &rate, &fmt, &start,
|
|
|
|
&end, &base);
|
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));
|
|
|
|
} else if (fmt == GST_FORMAT_BYTES) {
|
|
|
|
GstEvent *new_ev;
|
|
|
|
guint64 new_start = 0;
|
|
|
|
guint64 new_end = GST_CLOCK_TIME_NONE;
|
|
|
|
|
|
|
|
GST_DEBUG ("Got NEWSEGMENT event in GST_FORMAT_BYTES (%"
|
|
|
|
G_GUINT64_FORMAT " - %" G_GUINT64_FORMAT ")", start, end);
|
|
|
|
|
|
|
|
if (faad->bytes_in > 0 && faad->sum_dur_out > 0) {
|
|
|
|
/* try to convert based on the average bitrate so far */
|
|
|
|
new_start = (faad->sum_dur_out * start) / faad->bytes_in;
|
|
|
|
if (new_end != (guint64) - 1) {
|
|
|
|
new_end = (faad->sum_dur_out * end) / faad->bytes_in;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_DEBUG
|
|
|
|
("no average bitrate yet, sending newsegment with start at 0");
|
|
|
|
}
|
|
|
|
new_ev =
|
2005-10-11 23:03:09 +00:00
|
|
|
gst_event_new_newsegment (is_update, rate, GST_FORMAT_TIME,
|
|
|
|
new_start, new_end, base);
|
2005-08-08 19:20:02 +00:00
|
|
|
gst_event_unref (event);
|
|
|
|
event = new_ev;
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_STREAM_LOCK (pad);
|
|
|
|
res = gst_pad_push_event (faad->srcpad, event);
|
|
|
|
GST_STREAM_UNLOCK (pad);
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
2003-11-21 21:20:42 +00:00
|
|
|
}
|
|
|
|
|
2005-08-08 19:20:02 +00:00
|
|
|
static gboolean
|
|
|
|
gst_faad_update_caps (GstFaad * faad, faacDecFrameInfo * info,
|
|
|
|
GstCaps ** p_caps)
|
|
|
|
{
|
|
|
|
GstAudioChannelPosition *pos;
|
|
|
|
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;
|
|
|
|
|
|
|
|
pos = gst_faad_chanpos_to_gst (faad->channel_positions, faad->channels);
|
|
|
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
|
|
|
g_free (pos);
|
|
|
|
|
|
|
|
GST_DEBUG ("New output caps: %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
if (!gst_pad_set_caps (faad->srcpad, caps)) {
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
*p_caps = caps;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
GstCaps *caps = NULL;
|
|
|
|
faacDecFrameInfo info;
|
2003-11-21 21:20:42 +00:00
|
|
|
void *out;
|
2005-02-21 18:58:46 +00:00
|
|
|
gboolean run_loop = TRUE;
|
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
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
GST_DEBUG ("Timestamp on incoming buffer: %" GST_TIME_FORMAT
|
|
|
|
", 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
|
|
|
|
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) {
|
2003-11-21 21:20:42 +00:00
|
|
|
gulong samplerate;
|
|
|
|
guchar channels;
|
2005-02-21 18:58:46 +00:00
|
|
|
glong init_res;
|
2003-11-21 21:20:42 +00:00
|
|
|
|
2005-02-21 18:58:46 +00:00
|
|
|
init_res = faacDecInit (faad->handle,
|
2005-07-19 20:51:15 +00:00
|
|
|
GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), &samplerate,
|
|
|
|
&channels);
|
2005-02-21 18:58:46 +00:00
|
|
|
if (init_res < 0) {
|
|
|
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
|
|
|
("Failed to init decoder from stream"));
|
2005-10-20 15:08:14 +00:00
|
|
|
gst_object_unref (faad);
|
2005-07-19 20:51:15 +00:00
|
|
|
return GST_FLOW_UNEXPECTED;
|
2005-02-21 18:58:46 +00:00
|
|
|
}
|
|
|
|
skip_bytes = init_res;
|
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;
|
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-07-19 20:51:15 +00:00
|
|
|
input_data = GST_BUFFER_DATA (buffer);
|
|
|
|
input_size = GST_BUFFER_SIZE (buffer);
|
2005-08-08 19:20:02 +00:00
|
|
|
info.bytesconsumed = input_size - skip_bytes;
|
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);
|
2005-08-08 19:20:02 +00:00
|
|
|
if (info.error) {
|
2004-10-01 13:00:41 +00:00
|
|
|
GST_ELEMENT_ERROR (faad, STREAM, DECODE, (NULL),
|
2005-08-08 19:20:02 +00:00
|
|
|
("Failed to decode buffer: %s", faacDecGetErrorMessage (info.error)));
|
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
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;
|
|
|
|
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) {
|
2005-08-08 19:20:02 +00:00
|
|
|
if (!gst_faad_update_caps (faad, &info, &caps)) {
|
|
|
|
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
|
|
|
}
|
|
|
|
|
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 */
|
2005-08-08 19:20:02 +00:00
|
|
|
if (info.samples > 0 && GST_PAD_PEER (faad->srcpad)) {
|
|
|
|
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
|
|
|
|
|
|
|
/* note: info.samples is total samples, not per channel */
|
2005-10-20 15:08:14 +00:00
|
|
|
ret = gst_pad_alloc_buffer (faad->srcpad, 0, bufsize, caps, &outbuf);
|
|
|
|
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
|
|
|
|
|
|
|
faad->next_ts += GST_BUFFER_DURATION (outbuf);
|
|
|
|
faad->sum_dur_out += GST_BUFFER_DURATION (outbuf);
|
|
|
|
|
|
|
|
GST_DEBUG ("pushing buffer, off=%" G_GUINT64_FORMAT ", ts=%"
|
|
|
|
GST_TIME_FORMAT, GST_BUFFER_OFFSET (outbuf),
|
|
|
|
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)));
|
2005-08-16 09:54:10 +00:00
|
|
|
if ((ret = gst_pad_push (faad->srcpad, outbuf)) != GST_FLOW_OK &&
|
|
|
|
ret != GST_FLOW_NOT_LINKED)
|
|
|
|
goto out;
|
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
|
|
|
|
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
|
|
|
faad->bytes_in += input_size;
|
|
|
|
|
|
|
|
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
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
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;
|
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:
|
2005-08-08 19:20:02 +00:00
|
|
|
{
|
2003-11-21 21:20:42 +00:00
|
|
|
if (!(faad->handle = faacDecOpen ()))
|
2005-09-05 15:10:18 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2004-03-10 05:45:23 +00:00
|
|
|
else {
|
2004-03-15 19:32:27 +00:00
|
|
|
faacDecConfiguration *conf;
|
2004-03-10 05:45:23 +00:00
|
|
|
|
2004-03-15 19:32:27 +00:00
|
|
|
conf = faacDecGetCurrentConfiguration (faad->handle);
|
|
|
|
conf->defObjectType = LC;
|
2005-08-08 19:20:02 +00:00
|
|
|
/* conf->dontUpSampleImplicitSBR = 1; */
|
|
|
|
conf->outputFormat = FAAD_FMT_16BIT;
|
|
|
|
if (faacDecSetConfiguration (faad->handle, conf) == 0)
|
2005-09-05 15:10:18 +00:00
|
|
|
return GST_STATE_CHANGE_FAILURE;
|
2004-03-10 05:45:23 +00:00
|
|
|
}
|
2003-11-21 21:20:42 +00:00
|
|
|
break;
|
2005-08-08 19:20:02 +00:00
|
|
|
}
|
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;
|
2003-11-21 21:20:42 +00:00
|
|
|
break;
|
2005-09-05 15:10:18 +00:00
|
|
|
case GST_STATE_CHANGE_READY_TO_NULL:
|
2003-11-21 21:20:42 +00:00
|
|
|
faacDecClose (faad->handle);
|
|
|
|
faad->handle = NULL;
|
2004-10-01 13:00:41 +00:00
|
|
|
if (faad->tempbuf) {
|
|
|
|
gst_buffer_unref (faad->tempbuf);
|
|
|
|
faad->tempbuf = NULL;
|
|
|
|
}
|
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)",
|
|
|
|
plugin_init, VERSION, "GPL", GST_PACKAGE, GST_ORIGIN)
|