2002-03-20 21:45:03 +00:00
|
|
|
/* GStreamer
|
2001-12-22 23:22:05 +00:00
|
|
|
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
* Copyright (C) <2006> Tim-Philipp Müller <tim centricular net>
|
2001-12-22 23:22:05 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-auparse
|
|
|
|
* @short_description: .au file parser
|
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <para>
|
|
|
|
* Parses .au files.
|
|
|
|
* </para>
|
|
|
|
* </refsect2>
|
2001-12-22 23:22:05 +00:00
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-12-12 10:30:20 +00:00
|
|
|
|
2001-12-22 23:22:05 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2004-07-26 22:11:21 +00:00
|
|
|
#include "gstauparse.h"
|
2003-12-22 01:47:09 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (auparse_debug);
|
|
|
|
#define GST_CAT_DEFAULT (auparse_debug)
|
|
|
|
|
Define GstElementDetails as const and also static (when defined as global)
Original commit message from CVS:
* ext/aalib/gstaasink.c:
* ext/annodex/gstcmmldec.c:
* ext/annodex/gstcmmlenc.c:
* ext/cairo/gsttextoverlay.c:
* ext/cairo/gsttimeoverlay.c:
* ext/cdio/gstcdiocddasrc.c:
* ext/dv/gstdvdec.c:
* ext/dv/gstdvdemux.c:
* ext/esd/esdmon.c:
* ext/esd/esdsink.c:
* ext/flac/gstflacenc.c:
* ext/flac/gstflactag.c:
* ext/gconf/gstgconfaudiosink.c: (gst_gconf_audio_sink_base_init):
* ext/gconf/gstgconfaudiosrc.c: (gst_gconf_audio_src_base_init):
* ext/gconf/gstgconfvideosink.c: (gst_gconf_video_sink_base_init):
* ext/gconf/gstgconfvideosrc.c: (gst_gconf_video_src_base_init):
* ext/gdk_pixbuf/pixbufscale.c:
* ext/hal/gsthalaudiosink.c: (gst_hal_audio_sink_base_init):
* ext/hal/gsthalaudiosrc.c: (gst_hal_audio_src_base_init):
* ext/jpeg/gstjpegdec.c:
* ext/jpeg/gstjpegenc.c:
* ext/jpeg/gstsmokedec.c:
* ext/jpeg/gstsmokeenc.c:
* ext/libcaca/gstcacasink.c:
* ext/libmng/gstmngdec.c:
* ext/libmng/gstmngenc.c:
* ext/libpng/gstpngdec.c:
* ext/libpng/gstpngenc.c:
* ext/mikmod/gstmikmod.c:
* ext/raw1394/gstdv1394src.c:
* ext/shout2/gstshout2.c: (gst_shout2send_init):
* ext/shout2/gstshout2.h:
* ext/speex/gstspeexdec.c:
* ext/speex/gstspeexenc.c:
* gst/alpha/gstalpha.c:
* gst/alpha/gstalphacolor.c:
* gst/apetag/gstapedemux.c:
* gst/auparse/gstauparse.c:
* gst/autodetect/gstautoaudiosink.c:
(gst_auto_audio_sink_base_init):
* gst/autodetect/gstautovideosink.c:
(gst_auto_video_sink_base_init):
* gst/avi/gstavidemux.c: (gst_avi_demux_base_init):
* gst/avi/gstavimux.c: (gst_avimux_base_init):
* gst/cutter/gstcutter.c:
* gst/debug/breakmydata.c:
* gst/debug/efence.c:
* gst/debug/gstnavigationtest.c:
* gst/debug/gstnavseek.c:
* gst/debug/negotiation.c:
* gst/debug/progressreport.c:
* gst/debug/testplugin.c:
* gst/effectv/gstaging.c:
* gst/effectv/gstdice.c:
* gst/effectv/gstedge.c:
* gst/effectv/gstquark.c:
* gst/effectv/gstrev.c:
* gst/effectv/gstshagadelic.c:
* gst/effectv/gstvertigo.c:
* gst/effectv/gstwarp.c:
* gst/flx/gstflxdec.c:
* gst/goom/gstgoom.c:
* gst/icydemux/gsticydemux.c:
* gst/id3demux/gstid3demux.c:
* gst/interleave/deinterleave.c:
* gst/interleave/interleave.c:
* gst/law/alaw-decode.c: (gst_alawdec_base_init):
* gst/law/alaw-encode.c: (gst_alawenc_base_init):
* gst/law/mulaw-decode.c: (gst_mulawdec_base_init):
* gst/law/mulaw-encode.c: (gst_mulawenc_base_init):
* gst/level/gstlevel.c:
* gst/matroska/matroska-demux.c: (gst_matroska_demux_base_init):
* gst/matroska/matroska-mux.c: (gst_matroska_mux_base_init):
* gst/median/gstmedian.c:
* gst/monoscope/gstmonoscope.c:
* gst/multipart/multipartdemux.c:
* gst/multipart/multipartmux.c:
* gst/oldcore/gstaggregator.c:
* gst/oldcore/gstfdsink.c:
* gst/oldcore/gstmd5sink.c:
* gst/oldcore/gstmultifilesrc.c:
* gst/oldcore/gstpipefilter.c:
* gst/oldcore/gstshaper.c:
* gst/oldcore/gststatistics.c:
* gst/rtp/gstasteriskh263.c:
* gst/rtp/gstrtpL16depay.c:
* gst/rtp/gstrtpL16pay.c:
* gst/rtp/gstrtpamrdepay.c:
* gst/rtp/gstrtpamrpay.c:
* gst/rtp/gstrtpdepay.c:
* gst/rtp/gstrtpgsmpay.c:
* gst/rtp/gstrtph263pay.c:
* gst/rtp/gstrtph263pdepay.c:
* gst/rtp/gstrtph263ppay.c:
* gst/rtp/gstrtpilbcdepay.c:
* gst/rtp/gstrtpmp4gpay.c:
* gst/rtp/gstrtpmp4vdepay.c:
* gst/rtp/gstrtpmp4vpay.c:
* gst/rtp/gstrtpmpadepay.c:
* gst/rtp/gstrtpmpapay.c:
* gst/rtp/gstrtppcmadepay.c:
* gst/rtp/gstrtppcmapay.c:
* gst/rtp/gstrtppcmudepay.c:
* gst/rtp/gstrtppcmupay.c:
* gst/rtp/gstrtpspeexdepay.c:
* gst/rtp/gstrtpspeexpay.c:
* gst/rtsp/gstrtpdec.c:
* gst/rtsp/gstrtspsrc.c:
* gst/smpte/gstsmpte.c:
* gst/udp/gstdynudpsink.c:
* gst/udp/gstmultiudpsink.c:
* gst/udp/gstudpsink.c:
* gst/udp/gstudpsrc.c:
* gst/videobox/gstvideobox.c:
* gst/videofilter/gstgamma.c: (gst_gamma_base_init):
* gst/videofilter/gstvideobalance.c:
* gst/videofilter/gstvideoflip.c:
* gst/videofilter/gstvideotemplate.c:
(gst_videotemplate_base_init):
* gst/videomixer/videomixer.c:
* gst/wavparse/gstwavparse.c: (gst_wavparse_base_init),
(gst_wavparse_class_init), (gst_wavparse_dispose),
(gst_wavparse_reset), (gst_wavparse_init),
(gst_wavparse_perform_seek), (gst_wavparse_peek_chunk_info),
(gst_wavparse_peek_chunk), (gst_wavparse_stream_headers),
(gst_wavparse_parse_stream_init), (gst_wavparse_send_event),
(gst_wavparse_add_src_pad), (gst_wavparse_stream_data),
(gst_wavparse_chain), (gst_wavparse_srcpad_event),
(gst_wavparse_sink_activate), (gst_wavparse_sink_activate_pull),
(gst_wavparse_change_state):
* gst/wavparse/gstwavparse.h:
* sys/oss/gstossmixerelement.c:
* sys/oss/gstosssink.c:
* sys/oss/gstosssrc.c:
* sys/osxaudio/gstosxaudioelement.c:
* sys/osxaudio/gstosxaudiosink.c:
* sys/osxaudio/gstosxaudiosrc.c:
* sys/sunaudio/gstsunaudiomixer.c:
* sys/sunaudio/gstsunaudiosink.c:
Define GstElementDetails as const and also static (when defined as
global)
2006-04-25 21:39:46 +00:00
|
|
|
static const GstElementDetails gst_au_parse_details =
|
2006-03-30 15:37:05 +00:00
|
|
|
GST_ELEMENT_DETAILS ("AU audio demuxer",
|
2004-05-13 21:42:13 +00:00
|
|
|
"Codec/Demuxer/Audio",
|
2004-03-14 22:34:33 +00:00
|
|
|
"Parse an .au file into raw audio",
|
|
|
|
"Erik Walthinsen <omega@cse.ogi.edu>");
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +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,
|
|
|
|
GST_STATIC_CAPS ("audio/x-au")
|
|
|
|
);
|
2001-12-22 23:22:05 +00:00
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
#define GST_AU_PARSE_ALAW_PAD_TEMPLATE_CAPS \
|
|
|
|
"audio/x-alaw, " \
|
|
|
|
"rate = (int) [ 8000, 192000 ], " \
|
|
|
|
"channels = (int) [ 1, 2 ]"
|
|
|
|
|
|
|
|
#define GST_AU_PARSE_MULAW_PAD_TEMPLATE_CAPS \
|
|
|
|
"audio/x-mulaw, " \
|
|
|
|
"rate = (int) [ 8000, 192000 ], " \
|
|
|
|
"channels = (int) [ 1, 2 ]"
|
|
|
|
|
|
|
|
/* Nothing to decode those ADPCM streams for now */
|
|
|
|
#define GST_AU_PARSE_ADPCM_PAD_TEMPLATE_CAPS \
|
|
|
|
"audio/x-adpcm, " \
|
|
|
|
"layout = (string) { g721, g722, g723_3, g723_5 }"
|
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PAD_SRC,
|
2005-12-12 10:30:20 +00:00
|
|
|
GST_PAD_SOMETIMES,
|
2004-12-19 16:54:46 +00:00
|
|
|
GST_STATIC_CAPS (GST_AUDIO_INT_PAD_TEMPLATE_CAPS "; "
|
2005-12-12 10:30:20 +00:00
|
|
|
GST_AUDIO_FLOAT_PAD_TEMPLATE_CAPS ";"
|
|
|
|
GST_AU_PARSE_ALAW_PAD_TEMPLATE_CAPS ";"
|
|
|
|
GST_AU_PARSE_MULAW_PAD_TEMPLATE_CAPS ";"
|
|
|
|
GST_AU_PARSE_ADPCM_PAD_TEMPLATE_CAPS));
|
2001-12-22 23:22:05 +00:00
|
|
|
|
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
static void gst_au_parse_dispose (GObject * object);
|
|
|
|
static GstFlowReturn gst_au_parse_chain (GstPad * pad, GstBuffer * buf);
|
|
|
|
static GstStateChangeReturn gst_au_parse_change_state (GstElement * element,
|
2005-09-02 15:44:50 +00:00
|
|
|
GstStateChange transition);
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static void gst_au_parse_reset (GstAuParse * auparse);
|
|
|
|
static gboolean gst_au_parse_remove_srcpad (GstAuParse * auparse);
|
|
|
|
static gboolean gst_au_parse_add_srcpad (GstAuParse * auparse, GstCaps * caps);
|
|
|
|
static gboolean gst_au_parse_src_query (GstPad * pad, GstQuery * query);
|
|
|
|
static gboolean gst_au_parse_src_event (GstPad * pad, GstEvent * event);
|
|
|
|
static gboolean gst_au_parse_sink_event (GstPad * pad, GstEvent * event);
|
2004-05-11 00:20:02 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
GST_BOILERPLATE (GstAuParse, gst_au_parse, GstElement, GST_TYPE_ELEMENT);
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static void
|
|
|
|
gst_au_parse_base_init (gpointer g_class)
|
2003-11-01 01:32:29 +00:00
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_static_pad_template_get (&sink_template));
|
2003-11-01 01:32:29 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_static_pad_template_get (&src_template));
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_element_class_set_details (element_class, &gst_au_parse_details);
|
2003-11-01 01:32:29 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (auparse_debug, "auparse", 0, ".au parser");
|
2003-11-01 01:32:29 +00:00
|
|
|
}
|
|
|
|
|
2001-12-22 23:22:05 +00:00
|
|
|
static void
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_au_parse_class_init (GstAuParseClass * klass)
|
2001-12-22 23:22:05 +00:00
|
|
|
{
|
2005-11-21 17:18:01 +00:00
|
|
|
GObjectClass *gobject_class;
|
2001-12-22 23:22:05 +00:00
|
|
|
GstElementClass *gstelement_class;
|
|
|
|
|
2005-11-21 17:18:01 +00:00
|
|
|
gobject_class = (GObjectClass *) klass;
|
2004-03-14 22:34:33 +00:00
|
|
|
gstelement_class = (GstElementClass *) klass;
|
2001-12-22 23:22:05 +00:00
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
gobject_class->dispose = gst_au_parse_dispose;
|
2005-11-21 17:18:01 +00:00
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
gstelement_class->change_state =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_change_state);
|
2001-12-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
static void
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_au_parse_init (GstAuParse * auparse, GstAuParseClass * klass)
|
2001-12-22 23:22:05 +00:00
|
|
|
{
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
auparse->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
|
|
|
gst_pad_set_chain_function (auparse->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_chain));
|
|
|
|
gst_pad_set_event_function (auparse->sinkpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_sink_event));
|
2006-03-30 15:37:05 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (auparse), auparse->sinkpad);
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
auparse->srcpad = NULL;
|
2005-11-21 17:18:01 +00:00
|
|
|
auparse->adapter = gst_adapter_new ();
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_au_parse_reset (auparse);
|
2001-12-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2005-11-21 17:18:01 +00:00
|
|
|
static void
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_au_parse_dispose (GObject * object)
|
2005-11-21 17:18:01 +00:00
|
|
|
{
|
2005-12-12 10:30:20 +00:00
|
|
|
GstAuParse *au = GST_AU_PARSE (object);
|
2005-11-21 17:18:01 +00:00
|
|
|
|
|
|
|
if (au->adapter != NULL) {
|
2005-12-29 11:26:12 +00:00
|
|
|
g_object_unref (au->adapter);
|
2005-11-21 17:18:01 +00:00
|
|
|
au->adapter = NULL;
|
|
|
|
}
|
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
|
|
}
|
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static void
|
|
|
|
gst_au_parse_reset (GstAuParse * auparse)
|
|
|
|
{
|
|
|
|
gst_au_parse_remove_srcpad (auparse);
|
|
|
|
|
|
|
|
auparse->offset = 0;
|
|
|
|
auparse->buffer_offset = 0;
|
|
|
|
auparse->encoding = 0;
|
|
|
|
auparse->samplerate = 0;
|
|
|
|
auparse->channels = 0;
|
|
|
|
auparse->float_swap = 0;
|
|
|
|
|
|
|
|
gst_adapter_clear (auparse->adapter);
|
|
|
|
|
|
|
|
/* gst_segment_init (&auparse->segment, GST_FORMAT_TIME); */
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_au_parse_add_srcpad (GstAuParse * auparse, GstCaps * new_caps)
|
|
|
|
{
|
|
|
|
GstPad *srcpad = NULL;
|
|
|
|
|
|
|
|
if (auparse->src_caps && gst_caps_is_equal (new_caps, auparse->src_caps)) {
|
|
|
|
GST_LOG_OBJECT (auparse, "same caps, nothing to do");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_replace (&auparse->src_caps, new_caps);
|
|
|
|
if (auparse->srcpad != NULL) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "Changing src pad caps to %" GST_PTR_FORMAT,
|
|
|
|
auparse->src_caps);
|
|
|
|
gst_pad_set_caps (auparse->srcpad, auparse->src_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (auparse->srcpad == NULL) {
|
|
|
|
srcpad = auparse->srcpad =
|
|
|
|
gst_pad_new_from_static_template (&src_template, "src");
|
|
|
|
g_return_val_if_fail (auparse->srcpad != NULL, FALSE);
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
gst_pad_set_query_type_function (auparse->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_src_get_query_types));
|
|
|
|
#endif
|
|
|
|
gst_pad_set_query_function (auparse->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_src_query));
|
|
|
|
gst_pad_set_event_function (auparse->srcpad,
|
|
|
|
GST_DEBUG_FUNCPTR (gst_au_parse_src_event));
|
|
|
|
|
|
|
|
gst_pad_use_fixed_caps (auparse->srcpad);
|
2006-10-06 17:00:14 +00:00
|
|
|
gst_pad_set_active (auparse->srcpad, TRUE);
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
|
|
|
|
if (auparse->src_caps)
|
|
|
|
gst_pad_set_caps (auparse->srcpad, auparse->src_caps);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (auparse, "Adding src pad with caps %" GST_PTR_FORMAT,
|
|
|
|
auparse->src_caps);
|
|
|
|
|
|
|
|
gst_object_ref (auparse->srcpad);
|
|
|
|
if (!gst_element_add_pad (GST_ELEMENT (auparse), auparse->srcpad))
|
|
|
|
return FALSE;
|
|
|
|
gst_element_no_more_pads (GST_ELEMENT (auparse));
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_au_parse_remove_srcpad (GstAuParse * auparse)
|
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
|
|
|
|
|
|
|
if (auparse->srcpad != NULL) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "Removing src pad");
|
|
|
|
res = gst_element_remove_pad (GST_ELEMENT (auparse), auparse->srcpad);
|
|
|
|
g_return_val_if_fail (res != FALSE, FALSE);
|
|
|
|
gst_object_unref (auparse->srcpad);
|
|
|
|
auparse->srcpad = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2005-09-22 22:38:48 +00:00
|
|
|
static GstFlowReturn
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_au_parse_parse_header (GstAuParse * auparse)
|
2001-12-22 23:22:05 +00:00
|
|
|
{
|
2003-12-22 01:47:09 +00:00
|
|
|
GstCaps *tempcaps;
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
guint32 size;
|
|
|
|
guint8 *head;
|
|
|
|
gchar layout[7] = { 0, };
|
2004-05-14 12:36:29 +00:00
|
|
|
gint law = 0, depth = 0, ieee = 0;
|
2004-05-14 10:01:23 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
head = (guint8 *) gst_adapter_peek (auparse->adapter, 24);
|
|
|
|
g_assert (head != NULL);
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (auparse, "[%c%c%c%c]", head[0], head[1], head[2], head[3]);
|
|
|
|
|
|
|
|
switch (GST_READ_UINT32_BE (head)) {
|
|
|
|
/* normal format is big endian (au is a Sparc format) */
|
|
|
|
case 0x2e736e64:{ /* ".snd" */
|
|
|
|
auparse->endianness = G_BIG_ENDIAN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* and of course, someone had to invent a little endian
|
|
|
|
* version. Used by DEC systems. */
|
|
|
|
case 0x646e732e: /* dns. */
|
|
|
|
case 0x0064732e:{ /* other source say it is "dns." */
|
|
|
|
auparse->endianness = G_LITTLE_ENDIAN;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
goto unknown_header;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
auparse->offset = GST_READ_UINT32_BE (head + 4);
|
|
|
|
/* Do not trust size, could be set to -1 : unknown */
|
|
|
|
size = GST_READ_UINT32_BE (head + 8);
|
|
|
|
auparse->encoding = GST_READ_UINT32_BE (head + 12);
|
|
|
|
auparse->samplerate = GST_READ_UINT32_BE (head + 16);
|
|
|
|
auparse->channels = GST_READ_UINT32_BE (head + 20);
|
|
|
|
|
2006-10-05 16:37:33 +00:00
|
|
|
GST_DEBUG_OBJECT (auparse, "offset %" G_GINT64_FORMAT ", size %u, "
|
|
|
|
"encoding %u, frequency %u, channels %u", auparse->offset, size,
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
auparse->encoding, auparse->samplerate, auparse->channels);
|
|
|
|
|
|
|
|
/* Docs:
|
|
|
|
* http://www.opengroup.org/public/pubs/external/auformat.html
|
|
|
|
* http://astronomy.swin.edu.au/~pbourke/dataformats/au/
|
|
|
|
* Solaris headers : /usr/include/audio/au.h
|
|
|
|
* libsndfile : src/au.c
|
|
|
|
*
|
|
|
|
* Samples :
|
|
|
|
* http://www.tsp.ece.mcgill.ca/MMSP/Documents/AudioFormats/AU/Samples.html
|
|
|
|
*/
|
|
|
|
|
|
|
|
auparse->float_swap = 0;
|
|
|
|
|
|
|
|
switch (auparse->encoding) {
|
|
|
|
case 1: /* 8-bit ISDN mu-law G.711 */
|
|
|
|
law = 1;
|
|
|
|
depth = 8;
|
|
|
|
break;
|
|
|
|
case 27: /* 8-bit ISDN A-law G.711 */
|
|
|
|
law = 2;
|
|
|
|
depth = 8;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 2: /* 8-bit linear PCM */
|
|
|
|
depth = 8;
|
|
|
|
break;
|
|
|
|
case 3: /* 16-bit linear PCM */
|
|
|
|
depth = 16;
|
|
|
|
break;
|
|
|
|
case 4: /* 24-bit linear PCM */
|
|
|
|
depth = 24;
|
|
|
|
break;
|
|
|
|
case 5: /* 32-bit linear PCM */
|
|
|
|
depth = 32;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 6: /* 32-bit IEEE floating point */
|
|
|
|
ieee = 1;
|
|
|
|
depth = 32;
|
|
|
|
break;
|
|
|
|
case 7: /* 64-bit IEEE floating point */
|
|
|
|
ieee = 1;
|
|
|
|
depth = 64;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 23: /* 4-bit CCITT G.721 ADPCM 32kbps -> modplug/libsndfile (compressed 8-bit mu-law) */
|
|
|
|
strcpy (layout, "g721");
|
|
|
|
break;
|
|
|
|
case 24: /* 8-bit CCITT G.722 ADPCM -> rtp */
|
|
|
|
strcpy (layout, "g722");
|
|
|
|
break;
|
|
|
|
case 25: /* 3-bit CCITT G.723.3 ADPCM 24kbps -> rtp/xine/modplug/libsndfile */
|
|
|
|
strcpy (layout, "g723_3");
|
|
|
|
break;
|
|
|
|
case 26: /* 5-bit CCITT G.723.5 ADPCM 40kbps -> rtp/xine/modplug/libsndfile */
|
|
|
|
strcpy (layout, "g723_5");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 8: /* Fragmented sample data */
|
|
|
|
case 9: /* AU_ENCODING_NESTED */
|
|
|
|
|
|
|
|
case 10: /* DSP program */
|
|
|
|
case 11: /* DSP 8-bit fixed point */
|
|
|
|
case 12: /* DSP 16-bit fixed point */
|
|
|
|
case 13: /* DSP 24-bit fixed point */
|
|
|
|
case 14: /* DSP 32-bit fixed point */
|
|
|
|
|
|
|
|
case 16: /* AU_ENCODING_DISPLAY : non-audio display data */
|
|
|
|
case 17: /* AU_ENCODING_MULAW_SQUELCH */
|
|
|
|
|
|
|
|
case 18: /* 16-bit linear with emphasis */
|
|
|
|
case 19: /* 16-bit linear compressed (NeXT) */
|
|
|
|
case 20: /* 16-bit linear with emphasis and compression */
|
|
|
|
|
|
|
|
case 21: /* Music kit DSP commands */
|
|
|
|
case 22: /* Music kit DSP commands samples */
|
|
|
|
|
|
|
|
default:
|
|
|
|
goto unknown_format;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (law) {
|
|
|
|
tempcaps =
|
|
|
|
gst_caps_new_simple ((law == 1) ? "audio/x-mulaw" : "audio/x-alaw",
|
|
|
|
"rate", G_TYPE_INT, auparse->samplerate,
|
|
|
|
"channels", G_TYPE_INT, auparse->channels, NULL);
|
|
|
|
auparse->sample_size = auparse->channels;
|
|
|
|
} else if (ieee) {
|
|
|
|
tempcaps = gst_caps_new_simple ("audio/x-raw-float",
|
|
|
|
"rate", G_TYPE_INT, auparse->samplerate,
|
|
|
|
"channels", G_TYPE_INT, auparse->channels,
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
|
|
|
"width", G_TYPE_INT, depth, NULL);
|
|
|
|
auparse->sample_size = auparse->channels * depth / 8;
|
|
|
|
if (auparse->endianness != G_BYTE_ORDER) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "need to swap float byte order ourselves!");
|
|
|
|
auparse->float_swap = depth;
|
|
|
|
}
|
|
|
|
} else if (layout[0]) {
|
|
|
|
tempcaps = gst_caps_new_simple ("audio/x-adpcm",
|
|
|
|
"layout", G_TYPE_STRING, layout, NULL);
|
|
|
|
auparse->sample_size = 0;
|
|
|
|
} else {
|
|
|
|
tempcaps = gst_caps_new_simple ("audio/x-raw-int",
|
|
|
|
"rate", G_TYPE_INT, auparse->samplerate,
|
|
|
|
"channels", G_TYPE_INT, auparse->channels,
|
|
|
|
"endianness", G_TYPE_INT, auparse->endianness,
|
|
|
|
"depth", G_TYPE_INT, depth, "width", G_TYPE_INT, depth,
|
|
|
|
/* FIXME: signed TRUE even for 8-bit PCM? */
|
|
|
|
"signed", G_TYPE_BOOLEAN, TRUE, NULL);
|
|
|
|
auparse->sample_size = auparse->channels * depth / 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (auparse, "sample_size=%d", auparse->sample_size);
|
|
|
|
|
|
|
|
if (!gst_au_parse_add_srcpad (auparse, tempcaps))
|
|
|
|
goto add_pad_failed;
|
|
|
|
|
2006-10-05 16:37:33 +00:00
|
|
|
GST_DEBUG_OBJECT (auparse, "offset=%" G_GINT64_FORMAT, auparse->offset);
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_adapter_flush (auparse->adapter, auparse->offset);
|
|
|
|
|
|
|
|
gst_caps_unref (tempcaps);
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
unknown_header:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (auparse, STREAM, WRONG_TYPE, (NULL), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
unknown_format:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (auparse, STREAM, FORMAT, (NULL), (NULL));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
add_pad_failed:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (auparse, STREAM, FAILED, (NULL),
|
|
|
|
("Failed to add srcpad"));
|
|
|
|
gst_caps_unref (tempcaps);
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#define AU_HEADER_SIZE 24
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
gst_au_parse_chain (GstPad * pad, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
GstFlowReturn ret = GST_FLOW_OK;
|
|
|
|
GstAuParse *auparse;
|
|
|
|
gint avail, sendnow = 0;
|
2001-12-22 23:22:05 +00:00
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
GST_LOG_OBJECT (auparse, "got buffer of size %u", GST_BUFFER_SIZE (buf));
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_adapter_push (auparse->adapter, buf);
|
|
|
|
buf = NULL;
|
2005-12-12 10:30:20 +00:00
|
|
|
|
2001-12-22 23:22:05 +00:00
|
|
|
/* if we haven't seen any data yet... */
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (auparse->srcpad == NULL) {
|
|
|
|
if (gst_adapter_available (auparse->adapter) < AU_HEADER_SIZE) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "need more data to parse header");
|
|
|
|
ret = GST_FLOW_OK;
|
|
|
|
goto out;
|
|
|
|
}
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
ret = gst_au_parse_parse_header (auparse);
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
goto out;
|
|
|
|
|
|
|
|
gst_pad_push_event (auparse->srcpad,
|
|
|
|
gst_event_new_new_segment (FALSE, 1.0, GST_FORMAT_DEFAULT,
|
|
|
|
0, GST_CLOCK_TIME_NONE, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
avail = gst_adapter_available (auparse->adapter);
|
|
|
|
|
|
|
|
if (auparse->sample_size > 0) {
|
|
|
|
/* Ensure we push a buffer that's a multiple of the frame size downstream */
|
|
|
|
sendnow = avail - (avail % auparse->sample_size);
|
|
|
|
} else {
|
|
|
|
/* It's something non-trivial (such as ADPCM), we don't understand it, so
|
|
|
|
* just push downstream and assume it will know what to do with it */
|
|
|
|
sendnow = avail;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sendnow > 0) {
|
|
|
|
GstBuffer *outbuf;
|
|
|
|
const guint8 *data;
|
|
|
|
|
|
|
|
ret = gst_pad_alloc_buffer_and_set_caps (auparse->srcpad,
|
|
|
|
auparse->buffer_offset, sendnow, GST_PAD_CAPS (auparse->srcpad),
|
|
|
|
&outbuf);
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "pad alloc flow: %s", gst_flow_get_name (ret));
|
|
|
|
goto out;
|
2001-12-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
data = gst_adapter_peek (auparse->adapter, sendnow);
|
2004-05-10 23:55:17 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
/* audioconvert only handles floats in native endianness ... */
|
|
|
|
switch (auparse->float_swap) {
|
|
|
|
case 32:{
|
|
|
|
guint32 *indata = (guint32 *) data;
|
|
|
|
guint32 *outdata = (guint32 *) GST_BUFFER_DATA (outbuf);
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < (sendnow / sizeof (guint32)); ++i) {
|
|
|
|
outdata[i] = GUINT32_SWAP_LE_BE (indata[i]);
|
|
|
|
}
|
2004-03-15 19:32:27 +00:00
|
|
|
break;
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
}
|
|
|
|
case 64:{
|
|
|
|
guint64 *indata = (guint64 *) data;
|
|
|
|
guint64 *outdata = (guint64 *) GST_BUFFER_DATA (outbuf);
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < (sendnow / sizeof (guint64)); ++i) {
|
|
|
|
outdata[i] = GUINT64_SWAP_LE_BE (indata[i]);
|
|
|
|
}
|
2004-05-10 23:55:17 +00:00
|
|
|
break;
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
}
|
|
|
|
default:{
|
|
|
|
memcpy (GST_BUFFER_DATA (outbuf), data, sendnow);
|
2004-05-10 23:55:17 +00:00
|
|
|
break;
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
}
|
|
|
|
}
|
2004-05-10 23:55:17 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_adapter_flush (auparse->adapter, sendnow);
|
2004-05-10 23:55:17 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
auparse->buffer_offset += sendnow;
|
2004-05-14 10:01:23 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
ret = gst_pad_push (auparse->srcpad, outbuf);
|
|
|
|
}
|
2004-05-11 22:55:35 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
out:
|
2004-05-11 22:55:35 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_object_unref (auparse);
|
|
|
|
return ret;
|
|
|
|
}
|
2004-05-11 22:55:35 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_au_parse_src_convert (GstAuParse * auparse, GstFormat src_format,
|
|
|
|
gint64 srcval, GstFormat dest_format, gint64 * destval)
|
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
gint64 offset;
|
|
|
|
guint samplesize, rate;
|
2004-05-11 22:55:35 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (dest_format == src_format) {
|
|
|
|
*destval = srcval;
|
|
|
|
return TRUE;
|
|
|
|
}
|
2004-05-11 22:55:35 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
GST_OBJECT_LOCK (auparse);
|
|
|
|
samplesize = auparse->sample_size;
|
|
|
|
offset = auparse->offset;
|
|
|
|
rate = auparse->samplerate;
|
|
|
|
GST_OBJECT_UNLOCK (auparse);
|
|
|
|
|
|
|
|
if (samplesize == 0 || rate == 0) {
|
|
|
|
GST_LOG_OBJECT (auparse, "cannot convert, sample_size or rate unknown");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
switch (src_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
srcval /= samplesize;
|
|
|
|
/* fallthrough */
|
|
|
|
case GST_FORMAT_DEFAULT:{
|
|
|
|
switch (dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*destval = srcval * samplesize;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*destval = gst_util_uint64_scale_int (srcval, GST_SECOND, rate);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_FORMAT_TIME:{
|
|
|
|
switch (dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*destval =
|
|
|
|
gst_util_uint64_scale_int (srcval, rate * samplesize, GST_SECOND);
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*destval = gst_util_uint64_scale_int (srcval, rate, GST_SECOND);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:{
|
|
|
|
ret = FALSE;
|
|
|
|
break;
|
2003-07-06 20:49:52 +00:00
|
|
|
}
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
}
|
2002-01-13 22:27:25 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (!ret) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "could not convert from %s to %s format",
|
|
|
|
gst_format_get_name (src_format), gst_format_get_name (dest_format));
|
|
|
|
}
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_au_parse_src_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstAuParse *auparse;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_DURATION:{
|
|
|
|
GstFormat bformat = GST_FORMAT_BYTES;
|
|
|
|
GstFormat format;
|
|
|
|
gint64 len, val;
|
|
|
|
|
|
|
|
gst_query_parse_duration (query, &format, NULL);
|
|
|
|
if (!gst_pad_query_peer_duration (auparse->sinkpad, &bformat, &len)) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "failed to query upstream length");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_OBJECT_LOCK (auparse);
|
|
|
|
len -= auparse->offset;
|
|
|
|
GST_OBJECT_UNLOCK (auparse);
|
2006-03-30 15:37:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
ret = gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, len,
|
|
|
|
format, &val);
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (ret) {
|
|
|
|
gst_query_set_duration (query, format, val);
|
|
|
|
}
|
|
|
|
break;
|
2006-03-30 15:37:05 +00:00
|
|
|
}
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
case GST_QUERY_POSITION:{
|
|
|
|
GstFormat bformat = GST_FORMAT_BYTES;
|
|
|
|
GstFormat format;
|
|
|
|
gint64 pos, val;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, NULL);
|
|
|
|
if (!gst_pad_query_peer_position (auparse->sinkpad, &bformat, &pos)) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "failed to query upstream position");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
GST_OBJECT_LOCK (auparse);
|
|
|
|
pos -= auparse->offset;
|
|
|
|
GST_OBJECT_UNLOCK (auparse);
|
2004-05-11 00:20:02 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
ret = gst_au_parse_src_convert (auparse, GST_FORMAT_BYTES, pos,
|
|
|
|
format, &val);
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (ret) {
|
|
|
|
gst_query_set_position (query, format, val);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
ret = gst_pad_query_default (pad, query);
|
|
|
|
break;
|
2005-11-21 17:18:01 +00:00
|
|
|
}
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_object_unref (auparse);
|
|
|
|
return ret;
|
|
|
|
}
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_au_parse_handle_seek (GstAuParse * auparse, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstSeekType start_type, stop_type;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstFormat format;
|
|
|
|
gdouble rate;
|
|
|
|
gint64 start, stop;
|
2006-02-01 11:01:04 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags, &start_type, &start,
|
|
|
|
&stop_type, &stop);
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
if (format != GST_FORMAT_TIME) {
|
|
|
|
GST_DEBUG_OBJECT (auparse, "only support seeks in TIME format");
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-09-22 22:38:48 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
/* FIXME: implement seeking */
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-11-21 17:18:01 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_au_parse_sink_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstAuParse *auparse;
|
|
|
|
gboolean ret;
|
2001-12-22 23:22:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
|
2005-11-21 17:18:01 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
default:
|
|
|
|
ret = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
2001-12-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_object_unref (auparse);
|
2005-11-21 17:18:01 +00:00
|
|
|
return ret;
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
}
|
2006-03-30 15:37:05 +00:00
|
|
|
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
static gboolean
|
|
|
|
gst_au_parse_src_event (GstPad * pad, GstEvent * event)
|
|
|
|
{
|
|
|
|
GstAuParse *auparse;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
auparse = GST_AU_PARSE (gst_pad_get_parent (pad));
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
ret = gst_au_parse_handle_seek (auparse, event);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
ret = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
2006-03-30 15:37:05 +00:00
|
|
|
}
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
|
|
|
|
gst_object_unref (auparse);
|
|
|
|
return ret;
|
2001-12-22 23:22:05 +00:00
|
|
|
}
|
|
|
|
|
2005-09-02 15:44:50 +00:00
|
|
|
static GstStateChangeReturn
|
2005-12-12 10:30:20 +00:00
|
|
|
gst_au_parse_change_state (GstElement * element, GstStateChange transition)
|
2004-05-11 00:20:02 +00:00
|
|
|
{
|
2005-12-12 10:30:20 +00:00
|
|
|
GstAuParse *auparse = GST_AU_PARSE (element);
|
2005-10-31 19:08:27 +00:00
|
|
|
GstStateChangeReturn ret = GST_STATE_CHANGE_SUCCESS;
|
|
|
|
|
2005-12-12 10:30:20 +00:00
|
|
|
ret = parent_class->change_state (element, transition);
|
|
|
|
if (ret == GST_STATE_CHANGE_FAILURE)
|
|
|
|
return ret;
|
2005-10-31 19:08:27 +00:00
|
|
|
|
|
|
|
switch (transition) {
|
gst/auparse/gstauparse.*: Rewrite auparse to suck a little bit less: make source pad dynamic, so decodebin/playbin wo...
Original commit message from CVS:
* gst/auparse/gstauparse.c: (gst_au_parse_base_init),
(gst_au_parse_class_init), (gst_au_parse_init),
(gst_au_parse_reset), (gst_au_parse_add_srcpad),
(gst_au_parse_remove_srcpad), (gst_au_parse_parse_header),
(gst_au_parse_chain), (gst_au_parse_src_convert),
(gst_au_parse_src_query), (gst_au_parse_handle_seek),
(gst_au_parse_sink_event), (gst_au_parse_src_event),
(gst_au_parse_change_state):
* gst/auparse/gstauparse.h:
Rewrite auparse to suck a little bit less: make source pad
dynamic, so decodebin/playbin work with non-raw formats
like alaw/mulaw; add query function for duration/position
queries; check whether we have enough data before attempting
to parse the header (instead of crashing when that is not the
case); work around audioconvert sucking by swapping endianness
to the native endianness ourselves for float formats; send
initial newsegment event. Fixes #161712.
2006-04-26 17:08:24 +00:00
|
|
|
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
|
|
gst_au_parse_reset (auparse);
|
2005-10-31 19:08:27 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
2004-05-11 00:20:02 +00:00
|
|
|
|
2005-10-31 19:08:27 +00:00
|
|
|
return ret;
|
2004-05-11 00:20:02 +00:00
|
|
|
}
|
2001-12-22 23:22:05 +00:00
|
|
|
|
|
|
|
static gboolean
|
2004-03-14 22:34:33 +00:00
|
|
|
plugin_init (GstPlugin * plugin)
|
2001-12-22 23:22:05 +00:00
|
|
|
{
|
2003-11-01 01:32:29 +00:00
|
|
|
if (!gst_element_register (plugin, "auparse", GST_RANK_SECONDARY,
|
2005-12-12 10:30:20 +00:00
|
|
|
GST_TYPE_AU_PARSE)) {
|
2003-11-01 01:32:29 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2001-12-22 23:22:05 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-03-14 22:34:33 +00:00
|
|
|
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
|
|
GST_VERSION_MINOR,
|
|
|
|
"auparse",
|
2005-11-14 02:13:35 +00:00
|
|
|
"parses au streams", plugin_init, VERSION, "LGPL", GST_PACKAGE_NAME,
|
|
|
|
GST_PACKAGE_ORIGIN)
|