2001-12-26 21:51:41 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2001> David I. Lehn <dlehn@users.sourceforge.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
|
2012-11-03 20:40:37 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2001-12-26 21:51:41 +00:00
|
|
|
*/
|
|
|
|
|
2008-05-28 11:43:01 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-a52dec
|
|
|
|
*
|
|
|
|
* Dolby Digital (AC-3) audio decoder.
|
2011-12-13 13:52:26 +00:00
|
|
|
*
|
2008-05-28 11:43:01 +00:00
|
|
|
* <refsect2>
|
|
|
|
* <title>Example launch line</title>
|
2008-06-13 06:57:21 +00:00
|
|
|
* |[
|
2015-05-10 10:34:33 +00:00
|
|
|
* gst-launch-1.0 dvdreadsrc title=1 ! mpegpsdemux ! a52dec ! audioconvert ! audioresample ! autoaudiosink
|
|
|
|
* ]| Play audio part of a dvd title.
|
2008-06-13 06:57:21 +00:00
|
|
|
* |[
|
2015-05-10 10:34:33 +00:00
|
|
|
* gst-launch-1.0 filesrc location=abc.ac3 ! ac3parse ! a52dec ! audioconvert ! audioresample ! autoaudiosink
|
|
|
|
* ]| Decode and play a stand alone AC-3 file.
|
2008-05-28 11:43:01 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
2003-01-31 00:18:23 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2016-08-12 16:11:39 +00:00
|
|
|
#ifdef HAVE_STDINT_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#endif
|
2003-04-04 20:46:06 +00:00
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
#include <gst/gst.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
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
#include <a52dec/a52.h>
|
2012-04-15 19:39:48 +00:00
|
|
|
#if !defined(A52_ACCEL_DETECT)
|
|
|
|
# include <a52dec/mm_accel.h>
|
|
|
|
#endif
|
2001-12-26 21:51:41 +00:00
|
|
|
#include "gsta52dec.h"
|
|
|
|
|
2010-06-14 12:34:25 +00:00
|
|
|
#if HAVE_ORC
|
|
|
|
#include <orc/orc.h>
|
|
|
|
#endif
|
2005-10-20 09:51:58 +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
|
|
|
#ifdef LIBA52_DOUBLE
|
|
|
|
#define SAMPLE_WIDTH 64
|
2011-09-26 17:03:13 +00:00
|
|
|
#define SAMPLE_FORMAT GST_AUDIO_NE(F64)
|
2012-02-01 15:17:57 +00:00
|
|
|
#define SAMPLE_TYPE GST_AUDIO_FORMAT_F64
|
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
|
|
|
|
#define SAMPLE_WIDTH 32
|
2011-09-26 17:03:13 +00:00
|
|
|
#define SAMPLE_FORMAT GST_AUDIO_NE(F32)
|
2012-02-01 15:17:57 +00:00
|
|
|
#define SAMPLE_TYPE GST_AUDIO_FORMAT_F32
|
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-04-01 11:48:27 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (a52dec_debug);
|
|
|
|
#define GST_CAT_DEFAULT (a52dec_debug)
|
2001-12-26 21:51:41 +00:00
|
|
|
|
2005-10-20 09:00:30 +00:00
|
|
|
/* A52Dec args */
|
2001-12-26 21:51:41 +00:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
ARG_0,
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
ARG_DRC,
|
|
|
|
ARG_MODE,
|
|
|
|
ARG_LFE,
|
2001-12-26 21:51:41 +00:00
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
2005-11-25 14:50:19 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-ac3; audio/ac3; audio/x-private1-ac3")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2011-09-26 17:03:13 +00:00
|
|
|
GST_STATIC_CAPS ("audio/x-raw, "
|
|
|
|
"format = (string) " SAMPLE_FORMAT ", "
|
2012-01-04 15:05:59 +00:00
|
|
|
"layout = (string) interleaved, "
|
2005-10-20 09:00:30 +00:00
|
|
|
"rate = (int) [ 4000, 96000 ], " "channels = (int) [ 1, 6 ]")
|
2004-03-14 22:34:30 +00:00
|
|
|
);
|
|
|
|
|
2011-09-26 17:03:13 +00:00
|
|
|
#define gst_a52dec_parent_class parent_class
|
2012-01-10 14:17:11 +00:00
|
|
|
G_DEFINE_TYPE (GstA52Dec, gst_a52dec, GST_TYPE_AUDIO_DECODER);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
static gboolean gst_a52dec_start (GstAudioDecoder * dec);
|
|
|
|
static gboolean gst_a52dec_stop (GstAudioDecoder * dec);
|
|
|
|
static gboolean gst_a52dec_set_format (GstAudioDecoder * bdec, GstCaps * caps);
|
a52dec, amrwbec: fix parse function declaration mismatch
Fixes MSVC compiler warning:
amrwbdec.c(99): warning C4133: '=': incompatible types
- from 'gboolean (__cdecl *)(GstAudioDecoder *,GstAdapter *,gint *,gint *)' to
'GstFlowReturn (__cdecl *)(GstAudioDecoder *,GstAdapter *,gint *,gint *)'
gsta52dec.c(156): warning C4133: '=': incompatible types
- from 'gboolean (__cdecl *)(GstAudioDecoder *,GstAdapter *,gint *,gint *)' to
'GstFlowReturn (__cdecl *)(GstAudioDecoder *,GstAdapter *,gint *,gint *)'
2016-04-15 19:46:37 +00:00
|
|
|
static GstFlowReturn gst_a52dec_parse (GstAudioDecoder * dec,
|
|
|
|
GstAdapter * adapter, gint * offset, gint * length);
|
2011-12-14 16:33:52 +00:00
|
|
|
static GstFlowReturn gst_a52dec_handle_frame (GstAudioDecoder * dec,
|
|
|
|
GstBuffer * buffer);
|
2004-03-14 22:34:30 +00:00
|
|
|
|
2011-11-17 14:25:58 +00:00
|
|
|
static GstFlowReturn gst_a52dec_chain (GstPad * pad, GstObject * parent,
|
|
|
|
GstBuffer * buffer);
|
2004-03-14 22:34:30 +00:00
|
|
|
static void gst_a52dec_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_a52dec_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2001-12-26 21:51:41 +00:00
|
|
|
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
#define GST_TYPE_A52DEC_MODE (gst_a52dec_mode_get_type())
|
|
|
|
static GType
|
|
|
|
gst_a52dec_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static GType a52dec_mode_type = 0;
|
|
|
|
static const GEnumValue a52dec_modes[] = {
|
|
|
|
{A52_MONO, "Mono", "mono"},
|
|
|
|
{A52_STEREO, "Stereo", "stereo"},
|
|
|
|
{A52_3F, "3 Front", "3f"},
|
|
|
|
{A52_2F1R, "2 Front, 1 Rear", "2f1r"},
|
|
|
|
{A52_3F1R, "3 Front, 1 Rear", "3f1r"},
|
|
|
|
{A52_2F2R, "2 Front, 2 Rear", "2f2r"},
|
|
|
|
{A52_3F2R, "3 Front, 2 Rear", "3f2r"},
|
|
|
|
{A52_DOLBY, "Dolby", "dolby"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
if (!a52dec_mode_type) {
|
|
|
|
a52dec_mode_type = g_enum_register_static ("GstA52DecMode", a52dec_modes);
|
|
|
|
}
|
|
|
|
return a52dec_mode_type;
|
|
|
|
}
|
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
static void
|
|
|
|
gst_a52dec_class_init (GstA52DecClass * klass)
|
|
|
|
{
|
|
|
|
GObjectClass *gobject_class;
|
|
|
|
GstElementClass *gstelement_class;
|
2011-12-14 16:33:52 +00:00
|
|
|
GstAudioDecoderClass *gstbase_class;
|
2012-04-15 19:39:48 +00:00
|
|
|
guint cpuflags = 0;
|
2001-12-26 21:51:41 +00:00
|
|
|
|
|
|
|
gobject_class = (GObjectClass *) klass;
|
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2011-12-14 16:33:52 +00:00
|
|
|
gstbase_class = (GstAudioDecoderClass *) klass;
|
2001-12-26 21:51:41 +00:00
|
|
|
|
|
|
|
gobject_class->set_property = gst_a52dec_set_property;
|
|
|
|
gobject_class->get_property = gst_a52dec_get_property;
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
gstbase_class->start = GST_DEBUG_FUNCPTR (gst_a52dec_start);
|
|
|
|
gstbase_class->stop = GST_DEBUG_FUNCPTR (gst_a52dec_stop);
|
|
|
|
gstbase_class->set_format = GST_DEBUG_FUNCPTR (gst_a52dec_set_format);
|
|
|
|
gstbase_class->parse = GST_DEBUG_FUNCPTR (gst_a52dec_parse);
|
|
|
|
gstbase_class->handle_frame = GST_DEBUG_FUNCPTR (gst_a52dec_handle_frame);
|
2005-10-20 09:00:30 +00:00
|
|
|
|
2009-05-18 23:51:49 +00:00
|
|
|
/**
|
|
|
|
* GstA52Dec::drc
|
|
|
|
*
|
|
|
|
* Set to true to apply the recommended Dolby Digital dynamic range compression
|
|
|
|
* to the audio stream. Dynamic range compression makes loud sounds
|
|
|
|
* softer and soft sounds louder, so you can more easily listen
|
|
|
|
* to the stream without disturbing other people.
|
|
|
|
*/
|
2005-10-20 09:00:30 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DRC,
|
|
|
|
g_param_spec_boolean ("drc", "Dynamic Range Compression",
|
2010-10-19 07:06:33 +00:00
|
|
|
"Use Dynamic Range Compression", FALSE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-05-18 23:51:49 +00:00
|
|
|
/**
|
|
|
|
* GstA52Dec::mode
|
|
|
|
*
|
|
|
|
* Force a particular output channel configuration from the decoder. By default,
|
|
|
|
* the channel downmix (if any) is chosen automatically based on the downstream
|
2011-12-13 13:52:26 +00:00
|
|
|
* capabilities of the pipeline.
|
2009-05-18 23:51:49 +00:00
|
|
|
*/
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MODE,
|
|
|
|
g_param_spec_enum ("mode", "Decoder Mode", "Decoding Mode (default 3f2r)",
|
2010-10-19 07:06:33 +00:00
|
|
|
GST_TYPE_A52DEC_MODE, A52_3F2R,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2009-05-18 23:51:49 +00:00
|
|
|
/**
|
|
|
|
* GstA52Dec::lfe
|
|
|
|
*
|
|
|
|
* Whether to output the LFE (Low Frequency Emitter) channel of the audio stream.
|
|
|
|
*/
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LFE,
|
2010-10-19 07:06:33 +00:00
|
|
|
g_param_spec_boolean ("lfe", "LFE", "LFE", TRUE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
2005-10-20 09:51:58 +00:00
|
|
|
|
2016-03-04 07:14:44 +00:00
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &sink_factory);
|
|
|
|
gst_element_class_add_static_pad_template (gstelement_class, &src_factory);
|
2012-04-09 23:47:44 +00:00
|
|
|
gst_element_class_set_static_metadata (gstelement_class,
|
2011-09-26 17:03:13 +00:00
|
|
|
"ATSC A/52 audio decoder", "Codec/Decoder/Audio",
|
|
|
|
"Decodes ATSC A/52 encoded audio streams",
|
|
|
|
"David I. Lehn <dlehn@users.sourceforge.net>");
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (a52dec_debug, "a52dec", 0,
|
|
|
|
"AC3/A52 software decoder");
|
|
|
|
|
2009-08-23 11:34:32 +00:00
|
|
|
/* If no CPU instruction based acceleration is available, end up using the
|
|
|
|
* generic software djbfft based one when available in the used liba52 */
|
2009-08-23 11:35:46 +00:00
|
|
|
#ifdef MM_ACCEL_DJBFFT
|
2009-08-23 11:34:32 +00:00
|
|
|
klass->a52_cpuflags = MM_ACCEL_DJBFFT;
|
2012-04-15 19:39:48 +00:00
|
|
|
#elif defined(A52_ACCEL_DETECT)
|
|
|
|
klass->a52_cpuflags = A52_ACCEL_DETECT;
|
2009-08-23 11:35:46 +00:00
|
|
|
#else
|
|
|
|
klass->a52_cpuflags = 0;
|
|
|
|
#endif
|
2010-06-14 12:34:25 +00:00
|
|
|
|
2012-04-15 19:39:48 +00:00
|
|
|
#if HAVE_ORC && !defined(A52_ACCEL_DETECT)
|
2010-06-14 12:34:25 +00:00
|
|
|
cpuflags = orc_target_get_default_flags (orc_target_get_by_name ("mmx"));
|
|
|
|
if (cpuflags & ORC_TARGET_MMX_MMX)
|
2005-10-20 09:51:58 +00:00
|
|
|
klass->a52_cpuflags |= MM_ACCEL_X86_MMX;
|
2010-06-14 12:34:25 +00:00
|
|
|
if (cpuflags & ORC_TARGET_MMX_3DNOW)
|
2005-10-20 09:51:58 +00:00
|
|
|
klass->a52_cpuflags |= MM_ACCEL_X86_3DNOW;
|
2010-06-14 12:34:25 +00:00
|
|
|
if (cpuflags & ORC_TARGET_MMX_MMXEXT)
|
2005-10-20 09:51:58 +00:00
|
|
|
klass->a52_cpuflags |= MM_ACCEL_X86_MMXEXT;
|
2010-06-14 12:34:25 +00:00
|
|
|
#endif
|
|
|
|
|
2012-04-15 19:39:48 +00:00
|
|
|
GST_LOG ("CPU flags: a52=%08x, orc=%08x", klass->a52_cpuflags, cpuflags);
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2011-09-26 17:03:13 +00:00
|
|
|
gst_a52dec_init (GstA52Dec * a52dec)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
a52dec->request_channels = A52_CHANNEL;
|
2001-12-26 21:51:41 +00:00
|
|
|
a52dec->dynamic_range_compression = FALSE;
|
2009-05-18 23:51:49 +00:00
|
|
|
|
2011-12-13 13:52:26 +00:00
|
|
|
a52dec->state = NULL;
|
|
|
|
a52dec->samples = NULL;
|
|
|
|
|
2015-08-15 14:46:13 +00:00
|
|
|
gst_audio_decoder_set_use_default_pad_acceptcaps (GST_AUDIO_DECODER_CAST
|
|
|
|
(a52dec), TRUE);
|
|
|
|
GST_PAD_SET_ACCEPT_TEMPLATE (GST_AUDIO_DECODER_SINK_PAD (a52dec));
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
/* retrieve and intercept base class chain.
|
|
|
|
* Quite HACKish, but that's dvd specs/caps for you,
|
|
|
|
* since one buffer needs to be split into 2 frames */
|
|
|
|
a52dec->base_chain = GST_PAD_CHAINFUNC (GST_AUDIO_DECODER_SINK_PAD (a52dec));
|
|
|
|
gst_pad_set_chain_function (GST_AUDIO_DECODER_SINK_PAD (a52dec),
|
2005-10-20 09:00:30 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_a52dec_chain));
|
2011-12-14 16:33:52 +00:00
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
static gboolean
|
|
|
|
gst_a52dec_start (GstAudioDecoder * dec)
|
|
|
|
{
|
|
|
|
GstA52Dec *a52dec = GST_A52DEC (dec);
|
|
|
|
GstA52DecClass *klass;
|
2015-04-02 16:24:05 +00:00
|
|
|
static GMutex init_mutex;
|
2001-12-26 21:51:41 +00:00
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "start");
|
|
|
|
|
|
|
|
klass = GST_A52DEC_CLASS (G_OBJECT_GET_CLASS (a52dec));
|
2015-04-02 16:24:05 +00:00
|
|
|
g_mutex_lock (&init_mutex);
|
2012-04-15 19:39:48 +00:00
|
|
|
#if defined(A52_ACCEL_DETECT)
|
|
|
|
a52dec->state = a52_init ();
|
|
|
|
/* This line is just to avoid being accused of not using klass */
|
|
|
|
a52_accel (klass->a52_cpuflags & A52_ACCEL_DETECT);
|
|
|
|
#else
|
2011-12-14 16:33:52 +00:00
|
|
|
a52dec->state = a52_init (klass->a52_cpuflags);
|
2012-04-15 19:39:48 +00:00
|
|
|
#endif
|
2015-04-02 16:24:05 +00:00
|
|
|
g_mutex_unlock (&init_mutex);
|
2011-12-20 10:54:38 +00:00
|
|
|
|
|
|
|
if (!a52dec->state) {
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (a52dec), LIBRARY, INIT, (NULL),
|
|
|
|
("failed to initialize a52 state"));
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
a52dec->samples = a52_samples (a52dec->state);
|
|
|
|
a52dec->bit_rate = -1;
|
|
|
|
a52dec->sample_rate = -1;
|
|
|
|
a52dec->stream_channels = A52_CHANNEL;
|
|
|
|
a52dec->using_channels = A52_CHANNEL;
|
|
|
|
a52dec->level = 1;
|
|
|
|
a52dec->bias = 0;
|
|
|
|
a52dec->flag_update = TRUE;
|
2009-05-18 23:51:49 +00:00
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
/* call upon legacy upstream byte support (e.g. seeking) */
|
2012-03-30 09:52:48 +00:00
|
|
|
gst_audio_decoder_set_estimate_rate (dec, TRUE);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_a52dec_stop (GstAudioDecoder * dec)
|
|
|
|
{
|
|
|
|
GstA52Dec *a52dec = GST_A52DEC (dec);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (dec, "stop");
|
|
|
|
|
|
|
|
a52dec->samples = NULL;
|
|
|
|
if (a52dec->state) {
|
|
|
|
a52_free (a52dec->state);
|
|
|
|
a52dec->state = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_a52dec_parse (GstAudioDecoder * bdec, GstAdapter * adapter,
|
|
|
|
gint * _offset, gint * len)
|
|
|
|
{
|
|
|
|
GstA52Dec *a52dec;
|
2012-01-10 14:17:11 +00:00
|
|
|
const guint8 *data;
|
2011-12-14 16:33:52 +00:00
|
|
|
gint av, size;
|
|
|
|
gint length = 0, flags, sample_rate, bit_rate;
|
2012-01-10 14:17:11 +00:00
|
|
|
GstFlowReturn result = GST_FLOW_EOS;
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
a52dec = GST_A52DEC (bdec);
|
|
|
|
|
|
|
|
size = av = gst_adapter_available (adapter);
|
2012-01-10 14:17:11 +00:00
|
|
|
data = (const guint8 *) gst_adapter_map (adapter, av);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
/* find and read header */
|
|
|
|
bit_rate = a52dec->bit_rate;
|
|
|
|
sample_rate = a52dec->sample_rate;
|
|
|
|
flags = 0;
|
2012-01-19 15:26:25 +00:00
|
|
|
while (size >= 7) {
|
2012-01-10 14:17:11 +00:00
|
|
|
length = a52_syncinfo ((guint8 *) data, &flags, &sample_rate, &bit_rate);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
if (length == 0) {
|
|
|
|
/* shift window to re-find sync */
|
|
|
|
data++;
|
|
|
|
size--;
|
|
|
|
} else if (length <= size) {
|
|
|
|
GST_LOG_OBJECT (a52dec, "Sync: frame size %d", length);
|
|
|
|
result = GST_FLOW_OK;
|
|
|
|
break;
|
|
|
|
} else {
|
|
|
|
GST_LOG_OBJECT (a52dec, "Not enough data available (needed %d had %d)",
|
|
|
|
length, size);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2012-01-10 14:17:11 +00:00
|
|
|
gst_adapter_unmap (adapter);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
*_offset = av - size;
|
|
|
|
*len = length;
|
|
|
|
|
|
|
|
return result;
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
|
|
|
|
2009-05-18 23:51:49 +00:00
|
|
|
static gint
|
2012-01-04 15:05:59 +00:00
|
|
|
gst_a52dec_channels (int flags, GstAudioChannelPosition * pos)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2009-05-18 23:51:49 +00:00
|
|
|
gint chans = 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
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
if (flags & A52_LFE) {
|
|
|
|
chans += 1;
|
2004-11-27 19:41:26 +00:00
|
|
|
if (pos) {
|
2012-01-04 15:05:59 +00:00
|
|
|
pos[0] = GST_AUDIO_CHANNEL_POSITION_LFE1;
|
2004-11-27 19:41:26 +00:00
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
|
|
|
flags &= A52_CHANNEL_MASK;
|
|
|
|
switch (flags) {
|
|
|
|
case A52_3F2R:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
|
|
|
pos[2 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
pos[3 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
|
|
|
|
pos[4 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
|
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
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
chans += 5;
|
|
|
|
break;
|
|
|
|
case A52_2F2R:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
pos[2 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_LEFT;
|
|
|
|
pos[3 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT;
|
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
|
|
|
}
|
|
|
|
chans += 4;
|
|
|
|
break;
|
2001-12-26 21:51:41 +00:00
|
|
|
case A52_3F1R:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
|
|
|
pos[2 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
pos[3 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_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
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
chans += 4;
|
|
|
|
break;
|
|
|
|
case A52_2F1R:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
pos[2 + chans] = GST_AUDIO_CHANNEL_POSITION_REAR_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
|
|
|
}
|
|
|
|
chans += 3;
|
|
|
|
break;
|
2001-12-26 21:51:41 +00:00
|
|
|
case A52_3F:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER;
|
|
|
|
pos[2 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
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
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
chans += 3;
|
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;
|
2006-06-23 09:28:28 +00:00
|
|
|
case A52_CHANNEL: /* Dual mono. Should really be handled as 2 src pads */
|
2001-12-26 21:51:41 +00:00
|
|
|
case A52_STEREO:
|
|
|
|
case A52_DOLBY:
|
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 (pos) {
|
2004-11-27 19:41:26 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
pos[1 + chans] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
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
|
|
|
}
|
2001-12-26 21:51:41 +00:00
|
|
|
chans += 2;
|
|
|
|
break;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
case A52_MONO:
|
|
|
|
if (pos) {
|
2012-01-04 15:05:59 +00:00
|
|
|
pos[0 + chans] = GST_AUDIO_CHANNEL_POSITION_MONO;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
}
|
|
|
|
chans += 1;
|
|
|
|
break;
|
2001-12-26 21:51:41 +00:00
|
|
|
default:
|
2006-08-07 14:01:33 +00:00
|
|
|
/* error, caller should post error message */
|
2001-12-26 21:51:41 +00:00
|
|
|
return 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
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
return chans;
|
|
|
|
}
|
|
|
|
|
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 gboolean
|
2012-01-10 14:17:11 +00:00
|
|
|
gst_a52dec_reneg (GstA52Dec * a52dec)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2012-01-04 15:05:59 +00:00
|
|
|
gint channels;
|
2005-10-20 09:00:30 +00:00
|
|
|
gboolean result = FALSE;
|
2012-01-10 14:17:11 +00:00
|
|
|
GstAudioChannelPosition from[6], to[6];
|
2012-02-01 15:17:57 +00:00
|
|
|
GstAudioInfo info;
|
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
|
|
|
|
2012-01-10 14:17:11 +00:00
|
|
|
channels = gst_a52dec_channels (a52dec->using_channels, from);
|
2012-01-04 15:05:59 +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 (!channels)
|
2005-10-20 09:00:30 +00:00
|
|
|
goto done;
|
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
|
|
|
|
2006-08-07 14:01:33 +00:00
|
|
|
GST_INFO_OBJECT (a52dec, "reneg channels:%d rate:%d",
|
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
|
|
|
channels, a52dec->sample_rate);
|
|
|
|
|
2012-01-10 14:17:11 +00:00
|
|
|
memcpy (to, from, sizeof (GstAudioChannelPosition) * channels);
|
|
|
|
gst_audio_channel_positions_to_valid_order (to, channels);
|
|
|
|
gst_audio_get_channel_reorder_map (channels, from, to,
|
|
|
|
a52dec->channel_reorder_map);
|
2012-01-04 15:05:59 +00:00
|
|
|
|
2012-02-01 15:17:57 +00:00
|
|
|
gst_audio_info_init (&info);
|
|
|
|
gst_audio_info_set_format (&info,
|
|
|
|
SAMPLE_TYPE, a52dec->sample_rate, channels, (channels > 1 ? to : NULL));
|
2012-01-04 15:05:59 +00:00
|
|
|
|
2012-02-01 15:17:57 +00:00
|
|
|
if (!gst_audio_decoder_set_output_format (GST_AUDIO_DECODER (a52dec), &info))
|
2005-10-20 09:00:30 +00:00
|
|
|
goto done;
|
|
|
|
|
|
|
|
result = TRUE;
|
|
|
|
|
|
|
|
done:
|
|
|
|
return result;
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
static void
|
|
|
|
gst_a52dec_update_streaminfo (GstA52Dec * a52dec)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2011-12-14 16:33:52 +00:00
|
|
|
GstTagList *taglist;
|
2011-09-26 17:03:13 +00:00
|
|
|
|
2012-01-10 14:17:11 +00:00
|
|
|
taglist = gst_tag_list_new_empty ();
|
2011-12-14 16:33:52 +00:00
|
|
|
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_BITRATE,
|
|
|
|
(guint) a52dec->bit_rate, NULL);
|
2009-09-15 23:00:28 +00:00
|
|
|
|
2012-03-06 15:08:23 +00:00
|
|
|
gst_audio_decoder_merge_tags (GST_AUDIO_DECODER (a52dec), taglist,
|
|
|
|
GST_TAG_MERGE_REPLACE);
|
2012-08-04 15:13:36 +00:00
|
|
|
gst_tag_list_unref (taglist);
|
2002-12-31 17:03:29 +00:00
|
|
|
}
|
|
|
|
|
2005-10-20 09:00:30 +00:00
|
|
|
static GstFlowReturn
|
2011-12-14 16:33:52 +00:00
|
|
|
gst_a52dec_handle_frame (GstAudioDecoder * bdec, GstBuffer * buffer)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2011-12-14 16:33:52 +00:00
|
|
|
GstA52Dec *a52dec;
|
2004-12-06 10:28:13 +00:00
|
|
|
gint channels, i;
|
|
|
|
gboolean need_reneg = FALSE;
|
2012-01-10 14:17:11 +00:00
|
|
|
gint chans;
|
2011-12-14 16:33:52 +00:00
|
|
|
gint length = 0, flags, sample_rate, bit_rate;
|
2012-01-25 06:24:59 +00:00
|
|
|
GstMapInfo map;
|
2011-12-14 16:33:52 +00:00
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
const gint num_blocks = 6;
|
|
|
|
|
|
|
|
a52dec = GST_A52DEC (bdec);
|
|
|
|
|
|
|
|
/* no fancy draining */
|
|
|
|
if (G_UNLIKELY (!buffer))
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* parsed stuff already, so this should work out fine */
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_map (buffer, &map, GST_MAP_READ);
|
|
|
|
g_assert (map.size >= 7);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
|
|
|
/* re-obtain some sync header info,
|
|
|
|
* should be same as during _parse and could also be cached there,
|
|
|
|
* but anyway ... */
|
|
|
|
bit_rate = a52dec->bit_rate;
|
|
|
|
sample_rate = a52dec->sample_rate;
|
|
|
|
flags = 0;
|
2012-01-25 06:24:59 +00:00
|
|
|
length = a52_syncinfo (map.data, &flags, &sample_rate, &bit_rate);
|
|
|
|
g_assert (length == map.size);
|
2001-12-26 21:51:41 +00:00
|
|
|
|
2004-12-06 10:28:13 +00:00
|
|
|
/* update stream information, renegotiate or re-streaminfo if needed */
|
2002-09-21 12:07:43 +00:00
|
|
|
need_reneg = FALSE;
|
|
|
|
if (a52dec->sample_rate != sample_rate) {
|
2012-05-17 10:40:05 +00:00
|
|
|
GST_DEBUG_OBJECT (a52dec, "sample rate changed");
|
2002-09-21 12:07:43 +00:00
|
|
|
need_reneg = TRUE;
|
2001-12-26 21:51:41 +00:00
|
|
|
a52dec->sample_rate = sample_rate;
|
|
|
|
}
|
|
|
|
|
2004-11-29 11:16:47 +00:00
|
|
|
if (flags) {
|
2012-05-17 10:40:05 +00:00
|
|
|
if (a52dec->stream_channels != (flags & (A52_CHANNEL_MASK | A52_LFE))) {
|
|
|
|
GST_DEBUG_OBJECT (a52dec, "stream channel flags changed, marking update");
|
|
|
|
a52dec->flag_update = TRUE;
|
|
|
|
}
|
2004-11-29 11:16:47 +00:00
|
|
|
a52dec->stream_channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
|
|
|
}
|
2002-09-21 12:07:43 +00:00
|
|
|
|
2002-12-31 17:03:29 +00:00
|
|
|
if (bit_rate != a52dec->bit_rate) {
|
|
|
|
a52dec->bit_rate = bit_rate;
|
2004-04-01 11:48:27 +00:00
|
|
|
gst_a52dec_update_streaminfo (a52dec);
|
2002-12-31 17:03:29 +00:00
|
|
|
}
|
2002-09-21 12:07:43 +00:00
|
|
|
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
/* If we haven't had an explicit number of channels chosen through properties
|
2011-12-13 13:52:26 +00:00
|
|
|
* at this point, choose what to downmix to now, based on what the peer will
|
|
|
|
* accept - this allows a52dec to do downmixing in preference to a
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
* downstream element such as audioconvert.
|
|
|
|
*/
|
2008-09-27 00:20:48 +00:00
|
|
|
if (a52dec->request_channels != A52_CHANNEL) {
|
|
|
|
flags = a52dec->request_channels;
|
|
|
|
} else if (a52dec->flag_update) {
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
|
2008-09-27 00:20:48 +00:00
|
|
|
a52dec->flag_update = FALSE;
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (a52dec));
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
if (caps && gst_caps_get_size (caps) > 0) {
|
|
|
|
GstCaps *copy = gst_caps_copy_nth (caps, 0);
|
|
|
|
GstStructure *structure = gst_caps_get_structure (copy, 0);
|
2012-05-21 12:57:44 +00:00
|
|
|
gint orig_channels = flags ? gst_a52dec_channels (flags, NULL) : 6;
|
|
|
|
gint fixed_channels = 0;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
const int a52_channels[6] = {
|
|
|
|
A52_MONO,
|
|
|
|
A52_STEREO,
|
|
|
|
A52_STEREO | A52_LFE,
|
|
|
|
A52_2F2R,
|
|
|
|
A52_2F2R | A52_LFE,
|
|
|
|
A52_3F2R | A52_LFE,
|
|
|
|
};
|
|
|
|
|
2011-12-13 13:52:26 +00:00
|
|
|
/* Prefer the original number of channels, but fixate to something
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
* preferred (first in the caps) downstream if possible.
|
|
|
|
*/
|
|
|
|
gst_structure_fixate_field_nearest_int (structure, "channels",
|
2012-05-21 12:57:44 +00:00
|
|
|
orig_channels);
|
|
|
|
|
|
|
|
if (gst_structure_get_int (structure, "channels", &fixed_channels)
|
|
|
|
&& fixed_channels <= 6) {
|
|
|
|
if (fixed_channels < orig_channels)
|
|
|
|
flags = a52_channels[fixed_channels - 1];
|
|
|
|
} else {
|
2008-09-27 00:20:48 +00:00
|
|
|
flags = a52_channels[5];
|
2012-05-21 12:57:44 +00:00
|
|
|
}
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
|
|
|
|
gst_caps_unref (copy);
|
|
|
|
} else if (flags)
|
2008-09-27 00:20:48 +00:00
|
|
|
flags = a52dec->stream_channels;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
else
|
2008-09-27 00:20:48 +00:00
|
|
|
flags = A52_3F2R | A52_LFE;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
|
|
|
|
if (caps)
|
|
|
|
gst_caps_unref (caps);
|
2008-09-27 00:20:48 +00:00
|
|
|
} else {
|
|
|
|
flags = a52dec->using_channels;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
}
|
2011-12-14 16:33:52 +00:00
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
/* process */
|
2009-05-18 23:51:49 +00:00
|
|
|
flags |= A52_ADJUST_LEVEL;
|
2001-12-26 21:51:41 +00:00
|
|
|
a52dec->level = 1;
|
2012-01-25 06:24:59 +00:00
|
|
|
if (a52_frame (a52dec->state, map.data, &flags, &a52dec->level, a52dec->bias)) {
|
|
|
|
gst_buffer_unmap (buffer, &map);
|
2011-12-14 16:33:52 +00:00
|
|
|
GST_AUDIO_DECODER_ERROR (a52dec, 1, STREAM, DECODE, (NULL),
|
|
|
|
("a52_frame error"), result);
|
|
|
|
goto exit;
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_unmap (buffer, &map);
|
2011-12-14 16:33:52 +00:00
|
|
|
|
2004-11-27 20:27:18 +00:00
|
|
|
channels = flags & (A52_CHANNEL_MASK | A52_LFE);
|
2002-09-21 12:07:43 +00:00
|
|
|
if (a52dec->using_channels != channels) {
|
|
|
|
need_reneg = TRUE;
|
|
|
|
a52dec->using_channels = channels;
|
|
|
|
}
|
|
|
|
|
2004-12-06 10:28:13 +00:00
|
|
|
/* negotiate if required */
|
2009-05-18 23:51:49 +00:00
|
|
|
if (need_reneg) {
|
2011-12-14 16:33:52 +00:00
|
|
|
GST_DEBUG_OBJECT (a52dec,
|
|
|
|
"a52dec reneg: sample_rate:%d stream_chans:%d using_chans:%d",
|
2004-03-15 19:32:25 +00:00
|
|
|
a52dec->sample_rate, a52dec->stream_channels, a52dec->using_channels);
|
2012-01-10 14:17:11 +00:00
|
|
|
if (!gst_a52dec_reneg (a52dec))
|
2011-12-14 16:33:52 +00:00
|
|
|
goto failed_negotiation;
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (a52dec->dynamic_range_compression == FALSE) {
|
|
|
|
a52_dynrng (a52dec->state, NULL, NULL);
|
|
|
|
}
|
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
flags &= (A52_CHANNEL_MASK | A52_LFE);
|
|
|
|
chans = gst_a52dec_channels (flags, NULL);
|
|
|
|
if (!chans)
|
|
|
|
goto invalid_flags;
|
2005-10-20 09:00:30 +00:00
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
/* handle decoded data;
|
|
|
|
* each frame has 6 blocks, one block is 256 samples, ea */
|
2012-01-10 14:17:11 +00:00
|
|
|
outbuf =
|
|
|
|
gst_buffer_new_and_alloc (256 * chans * (SAMPLE_WIDTH / 8) * num_blocks);
|
2005-10-20 09:00:30 +00:00
|
|
|
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_map (outbuf, &map, GST_MAP_WRITE);
|
2012-01-10 14:17:11 +00:00
|
|
|
{
|
2012-01-25 06:24:59 +00:00
|
|
|
guint8 *ptr = map.data;
|
2012-01-10 14:17:11 +00:00
|
|
|
for (i = 0; i < num_blocks; i++) {
|
|
|
|
if (a52_block (a52dec->state)) {
|
|
|
|
/* also marks discont */
|
|
|
|
GST_AUDIO_DECODER_ERROR (a52dec, 1, STREAM, DECODE, (NULL),
|
|
|
|
("error decoding block %d", i), result);
|
|
|
|
if (result != GST_FLOW_OK) {
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_unmap (outbuf, &map);
|
2012-01-10 14:17:11 +00:00
|
|
|
goto exit;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
gint n, c;
|
|
|
|
gint *reorder_map = a52dec->channel_reorder_map;
|
|
|
|
|
|
|
|
for (n = 0; n < 256; n++) {
|
|
|
|
for (c = 0; c < chans; c++) {
|
2012-01-10 14:25:12 +00:00
|
|
|
((sample_t *) ptr)[n * chans + reorder_map[c]] =
|
2012-01-10 14:17:11 +00:00
|
|
|
a52dec->samples[c * 256 + n];
|
|
|
|
}
|
2011-12-14 16:33:52 +00:00
|
|
|
}
|
|
|
|
}
|
2012-01-10 14:17:11 +00:00
|
|
|
ptr += 256 * chans * (SAMPLE_WIDTH / 8);
|
2001-12-26 21:51:41 +00:00
|
|
|
}
|
2004-12-06 10:28:13 +00:00
|
|
|
}
|
2012-01-25 06:24:59 +00:00
|
|
|
gst_buffer_unmap (outbuf, &map);
|
2004-04-01 11:48:27 +00:00
|
|
|
|
2011-12-14 16:33:52 +00:00
|
|
|
result = gst_audio_decoder_finish_frame (bdec, outbuf, 1);
|
|
|
|
|
|
|
|
exit:
|
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
failed_negotiation:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (a52dec, CORE, NEGOTIATION, (NULL), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
invalid_flags:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (a52dec), STREAM, DECODE, (NULL),
|
|
|
|
("Invalid channel flags: %d", flags));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2004-12-06 10:28:13 +00:00
|
|
|
}
|
2004-04-01 11:48:27 +00:00
|
|
|
|
2005-11-25 14:50:19 +00:00
|
|
|
static gboolean
|
2011-12-14 16:33:52 +00:00
|
|
|
gst_a52dec_set_format (GstAudioDecoder * bdec, GstCaps * caps)
|
2005-11-25 14:50:19 +00:00
|
|
|
{
|
2011-12-14 16:33:52 +00:00
|
|
|
GstA52Dec *a52dec = GST_A52DEC (bdec);
|
2005-11-25 14:50:19 +00:00
|
|
|
GstStructure *structure;
|
|
|
|
|
|
|
|
structure = gst_caps_get_structure (caps, 0);
|
|
|
|
|
|
|
|
if (structure && gst_structure_has_name (structure, "audio/x-private1-ac3"))
|
|
|
|
a52dec->dvdmode = TRUE;
|
|
|
|
else
|
|
|
|
a52dec->dvdmode = FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
2004-12-06 10:28:13 +00:00
|
|
|
}
|
2004-04-01 11:48:27 +00:00
|
|
|
|
2005-10-20 09:00:30 +00:00
|
|
|
static GstFlowReturn
|
2011-11-17 14:25:58 +00:00
|
|
|
gst_a52dec_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
2005-11-25 14:50:19 +00:00
|
|
|
{
|
2011-11-17 14:25:58 +00:00
|
|
|
GstA52Dec *a52dec = GST_A52DEC (parent);
|
2011-12-14 16:33:52 +00:00
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
2006-08-07 14:01:33 +00:00
|
|
|
gint first_access;
|
2005-11-25 14:50:19 +00:00
|
|
|
|
|
|
|
if (a52dec->dvdmode) {
|
2011-09-26 17:03:13 +00:00
|
|
|
gsize size;
|
|
|
|
guint8 data[2];
|
2005-11-25 14:50:19 +00:00
|
|
|
gint offset;
|
|
|
|
gint len;
|
|
|
|
GstBuffer *subbuf;
|
|
|
|
|
2012-04-02 17:31:20 +00:00
|
|
|
size = gst_buffer_get_size (buf);
|
2006-08-07 14:01:33 +00:00
|
|
|
if (size < 2)
|
|
|
|
goto not_enough_data;
|
2005-11-25 14:50:19 +00:00
|
|
|
|
2012-04-02 17:31:20 +00:00
|
|
|
gst_buffer_extract (buf, 0, data, 2);
|
2005-11-25 14:50:19 +00:00
|
|
|
first_access = (data[0] << 8) | data[1];
|
|
|
|
|
|
|
|
/* Skip the first_access header */
|
|
|
|
offset = 2;
|
|
|
|
|
|
|
|
if (first_access > 1) {
|
|
|
|
/* Length of data before first_access */
|
|
|
|
len = first_access - 1;
|
|
|
|
|
2006-08-07 14:01:33 +00:00
|
|
|
if (len <= 0 || offset + len > size)
|
|
|
|
goto bad_first_access_parameter;
|
2005-11-25 14:50:19 +00:00
|
|
|
|
2011-09-26 17:03:13 +00:00
|
|
|
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset, len);
|
2005-11-25 14:50:19 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_CLOCK_TIME_NONE;
|
2012-01-10 14:17:11 +00:00
|
|
|
ret = a52dec->base_chain (pad, parent, subbuf);
|
2011-12-14 16:33:52 +00:00
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
gst_buffer_unref (buf);
|
2005-11-25 14:50:19 +00:00
|
|
|
goto done;
|
2011-12-14 16:33:52 +00:00
|
|
|
}
|
2005-11-25 14:50:19 +00:00
|
|
|
|
|
|
|
offset += len;
|
|
|
|
len = size - offset;
|
|
|
|
|
|
|
|
if (len > 0) {
|
2011-09-26 17:03:13 +00:00
|
|
|
subbuf = gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset, len);
|
2005-11-25 14:50:19 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
|
|
|
|
2012-01-10 14:17:11 +00:00
|
|
|
ret = a52dec->base_chain (pad, parent, subbuf);
|
2005-11-25 14:50:19 +00:00
|
|
|
}
|
2011-12-14 16:33:52 +00:00
|
|
|
gst_buffer_unref (buf);
|
2005-11-25 14:50:19 +00:00
|
|
|
} else {
|
2006-08-07 16:18:33 +00:00
|
|
|
/* first_access = 0 or 1, so if there's a timestamp it applies to the first byte */
|
2011-09-26 17:03:13 +00:00
|
|
|
subbuf =
|
|
|
|
gst_buffer_copy_region (buf, GST_BUFFER_COPY_ALL, offset,
|
|
|
|
size - offset);
|
2006-08-07 16:18:33 +00:00
|
|
|
GST_BUFFER_TIMESTAMP (subbuf) = GST_BUFFER_TIMESTAMP (buf);
|
2012-01-12 12:20:26 +00:00
|
|
|
gst_buffer_unref (buf);
|
2012-01-10 14:17:11 +00:00
|
|
|
ret = a52dec->base_chain (pad, parent, subbuf);
|
2005-11-25 14:50:19 +00:00
|
|
|
}
|
|
|
|
} else {
|
2012-01-10 14:17:11 +00:00
|
|
|
ret = a52dec->base_chain (pad, parent, buf);
|
2005-11-25 14:50:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
return ret;
|
2006-08-07 14:01:33 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_enough_data:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (a52dec), STREAM, DECODE, (NULL),
|
|
|
|
("Insufficient data in buffer. Can't determine first_acess"));
|
2009-10-13 12:05:32 +00:00
|
|
|
gst_buffer_unref (buf);
|
2006-08-07 14:01:33 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
bad_first_access_parameter:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (a52dec), STREAM, DECODE, (NULL),
|
|
|
|
("Bad first_access parameter (%d) in buffer", first_access));
|
2009-10-13 12:05:32 +00:00
|
|
|
gst_buffer_unref (buf);
|
2006-08-07 14:01:33 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-11-25 14:50:19 +00:00
|
|
|
}
|
|
|
|
|
2001-12-26 21:51:41 +00:00
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_a52dec_set_property (GObject * object, guint prop_id, const GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2005-10-20 09:00:30 +00:00
|
|
|
GstA52Dec *src = GST_A52DEC (object);
|
2001-12-26 21:51:41 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DRC:
|
2005-11-21 16:36:44 +00:00
|
|
|
GST_OBJECT_LOCK (src);
|
2001-12-26 21:51:41 +00:00
|
|
|
src->dynamic_range_compression = g_value_get_boolean (value);
|
2005-11-21 16:36:44 +00:00
|
|
|
GST_OBJECT_UNLOCK (src);
|
2001-12-26 21:51:41 +00:00
|
|
|
break;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
case ARG_MODE:
|
|
|
|
GST_OBJECT_LOCK (src);
|
|
|
|
src->request_channels &= ~A52_CHANNEL_MASK;
|
|
|
|
src->request_channels |= g_value_get_enum (value);
|
|
|
|
GST_OBJECT_UNLOCK (src);
|
|
|
|
break;
|
|
|
|
case ARG_LFE:
|
|
|
|
GST_OBJECT_LOCK (src);
|
|
|
|
src->request_channels &= ~A52_LFE;
|
|
|
|
src->request_channels |= g_value_get_boolean (value) ? A52_LFE : 0;
|
|
|
|
GST_OBJECT_UNLOCK (src);
|
|
|
|
break;
|
2001-12-26 21:51:41 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:30 +00:00
|
|
|
gst_a52dec_get_property (GObject * object, guint prop_id, GValue * value,
|
|
|
|
GParamSpec * pspec)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2005-10-20 09:00:30 +00:00
|
|
|
GstA52Dec *src = GST_A52DEC (object);
|
2001-12-26 21:51:41 +00:00
|
|
|
|
|
|
|
switch (prop_id) {
|
|
|
|
case ARG_DRC:
|
2005-11-21 16:36:44 +00:00
|
|
|
GST_OBJECT_LOCK (src);
|
2002-03-21 23:45:58 +00:00
|
|
|
g_value_set_boolean (value, src->dynamic_range_compression);
|
2005-11-21 16:36:44 +00:00
|
|
|
GST_OBJECT_UNLOCK (src);
|
2001-12-26 21:51:41 +00:00
|
|
|
break;
|
ext/a52dec/gsta52dec.*: Add two things to a52dec: configure the exact output format for ac3 decoding through properti...
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_mode_get_type),
(gst_a52dec_class_init), (gst_a52dec_init), (gst_a52dec_channels),
(gst_a52dec_handle_frame), (gst_a52dec_change_state),
(gst_a52dec_set_property), (gst_a52dec_get_property):
* ext/a52dec/gsta52dec.h:
Patch from from Michal Benes <michal.benes@itonis.tv>:
Add two things to a52dec: configure the exact output format for ac3
decoding through properties, if desired.
By default, configure an output format preferred by downstream. Now
that audioconvert lists caps by preference, this means that a52dec
can do downmixing (iff required) rather than audioconvert, so it can
use the ac3 downmix levels from the bitstream.
2006-09-01 16:21:43 +00:00
|
|
|
case ARG_MODE:
|
|
|
|
GST_OBJECT_LOCK (src);
|
|
|
|
g_value_set_enum (value, src->request_channels & A52_CHANNEL_MASK);
|
|
|
|
GST_OBJECT_UNLOCK (src);
|
|
|
|
break;
|
|
|
|
case ARG_LFE:
|
|
|
|
GST_OBJECT_LOCK (src);
|
|
|
|
g_value_set_boolean (value, src->request_channels & A52_LFE);
|
|
|
|
GST_OBJECT_UNLOCK (src);
|
|
|
|
break;
|
2001-12-26 21:51:41 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2003-11-01 01:32:03 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-26 21:51:41 +00:00
|
|
|
{
|
2010-06-14 13:33:14 +00:00
|
|
|
#if HAVE_ORC
|
|
|
|
orc_init ();
|
|
|
|
#endif
|
|
|
|
|
2006-06-23 09:28:28 +00:00
|
|
|
if (!gst_element_register (plugin, "a52dec", GST_RANK_SECONDARY,
|
2004-03-15 19:32:25 +00:00
|
|
|
GST_TYPE_A52DEC))
|
2003-11-01 01:32:03 +00:00
|
|
|
return FALSE;
|
2001-12-26 21:51:41 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:30 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
2012-04-05 15:40:12 +00:00
|
|
|
a52dec,
|
2004-03-14 22:34:30 +00:00
|
|
|
"Decodes ATSC A/52 encoded audio streams",
|
2006-04-01 09:54:39 +00:00
|
|
|
plugin_init, VERSION, "GPL", GST_PACKAGE_NAME, GST_PACKAGE_ORIGIN);
|