2004-01-29 02:50:20 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2004 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
|
2006-03-01 17:39:28 +00:00
|
|
|
/**
|
|
|
|
* SECTION:element-vorbisdec
|
|
|
|
* @see_also: vorbisenc, oggdemux
|
|
|
|
*
|
|
|
|
* This element decodes a Vorbis stream to raw float audio.
|
|
|
|
* <ulink url="http://www.vorbis.com/">Vorbis</ulink> is a royalty-free
|
|
|
|
* audio codec maintained by the <ulink url="http://www.xiph.org/">Xiph.org
|
|
|
|
* Foundation</ulink>.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
2006-03-01 17:39:28 +00:00
|
|
|
* <title>Example pipelines</title>
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2006-03-01 17:39:28 +00:00
|
|
|
* gst-launch -v filesrc location=sine.ogg ! oggdemux ! vorbisdec ! audioconvert ! alsasink
|
2008-07-10 21:06:06 +00:00
|
|
|
* ]| Decode an Ogg/Vorbis. To create an Ogg/Vorbis file refer to the documentation of vorbisenc.
|
2006-03-01 17:39:28 +00:00
|
|
|
* </refsect2>
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-01 (0.10.4)
|
|
|
|
*/
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
2009-02-24 13:36:39 +00:00
|
|
|
#include "gstvorbisdec.h"
|
2004-01-29 02:50:20 +00:00
|
|
|
#include <string.h>
|
2005-10-20 16:01:43 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2004-01-29 02:50:20 +00:00
|
|
|
#include <gst/tag/tag.h>
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
#include <gst/audio/multichannel.h>
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2010-01-14 09:05:35 +00:00
|
|
|
#include "gstvorbiscommon.h"
|
|
|
|
|
2004-03-06 16:41:39 +00:00
|
|
|
GST_DEBUG_CATEGORY_EXTERN (vorbisdec_debug);
|
|
|
|
#define GST_CAT_DEFAULT vorbisdec_debug
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static GstStaticPadTemplate vorbis_dec_src_factory =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
2010-02-15 11:09:53 +00:00
|
|
|
GST_VORBIS_DEC_SRC_CAPS);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
static GstStaticPadTemplate vorbis_dec_sink_factory =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("audio/x-vorbis")
|
|
|
|
);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
GST_BOILERPLATE (GstVorbisDec, gst_vorbis_dec, GstAudioDecoder,
|
|
|
|
GST_TYPE_AUDIO_DECODER);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
static void vorbis_dec_finalize (GObject * object);
|
2011-10-07 12:52:33 +00:00
|
|
|
|
|
|
|
static gboolean vorbis_dec_start (GstAudioDecoder * dec);
|
|
|
|
static gboolean vorbis_dec_stop (GstAudioDecoder * dec);
|
|
|
|
static GstFlowReturn vorbis_dec_handle_frame (GstAudioDecoder * dec,
|
|
|
|
GstBuffer * buffer);
|
|
|
|
static void vorbis_dec_flush (GstAudioDecoder * dec, gboolean hard);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
static void
|
|
|
|
gst_vorbis_dec_base_init (gpointer g_class)
|
|
|
|
{
|
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
|
2005-11-15 19:34:39 +00:00
|
|
|
|
2011-11-28 12:51:22 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&vorbis_dec_src_factory);
|
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&vorbis_dec_sink_factory);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2010-03-16 14:45:23 +00:00
|
|
|
gst_element_class_set_details_simple (element_class,
|
|
|
|
"Vorbis audio decoder", "Codec/Decoder/Audio",
|
|
|
|
GST_VORBIS_DEC_DESCRIPTION,
|
|
|
|
"Benjamin Otte <otte@gnome.org>, Chris Lord <chris@openedhand.com>");
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_vorbis_dec_class_init (GstVorbisDecClass * klass)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2005-08-26 10:50:56 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2011-10-07 12:52:33 +00:00
|
|
|
GstAudioDecoderClass *base_class = GST_AUDIO_DECODER_CLASS (klass);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
gobject_class->finalize = vorbis_dec_finalize;
|
2005-08-26 10:50:56 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
base_class->start = GST_DEBUG_FUNCPTR (vorbis_dec_start);
|
|
|
|
base_class->stop = GST_DEBUG_FUNCPTR (vorbis_dec_stop);
|
|
|
|
base_class->handle_frame = GST_DEBUG_FUNCPTR (vorbis_dec_handle_frame);
|
|
|
|
base_class->flush = GST_DEBUG_FUNCPTR (vorbis_dec_flush);
|
ext/: Added query/convert/formats functions to vorbis and theora decoders so that the outside world can use them too....
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(theora_get_formats), (theora_get_event_masks),
(theora_get_query_types), (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_event), (theora_dec_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_get_formats),
(vorbis_get_event_masks), (vorbis_get_query_types),
(gst_vorbis_dec_init), (vorbis_dec_convert),
(vorbis_dec_src_query), (vorbis_dec_src_event), (vorbis_dec_event):
Added query/convert/formats functions to vorbis and theora decoders
so that the outside world can use them too. Fixed seeking on an
ogg/theora/vorbis file by disabling the seeking on the
theora srcpad.
2004-07-21 13:28:23 +00:00
|
|
|
}
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static void
|
2005-08-28 17:52:45 +00:00
|
|
|
gst_vorbis_dec_init (GstVorbisDec * dec, GstVorbisDecClass * g_class)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2005-08-26 10:50:56 +00:00
|
|
|
static void
|
ext/vorbis/: Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make vorbisenc adhere to the official nomenclature; u...
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_class_init),
(gst_vorbis_dec_init), (vorbis_dec_finalize):
* ext/vorbis/vorbisdec.h:
* ext/vorbis/vorbisenc.c: (gst_vorbis_enc_add_interfaces),
(gst_vorbis_enc_base_init), (gst_vorbis_enc_class_init),
(gst_vorbis_enc_sink_setcaps), (gst_vorbis_enc_convert_src),
(gst_vorbis_enc_convert_sink), (gst_vorbis_enc_get_query_types),
(gst_vorbis_enc_src_query), (gst_vorbis_enc_sink_query),
(gst_vorbis_enc_init), (gst_vorbis_enc_get_tag_value),
(gst_vorbis_enc_metadata_set1), (gst_vorbis_enc_set_metadata),
(gst_vorbis_enc_setup), (gst_vorbis_enc_clear),
(gst_vorbis_enc_buffer_from_packet),
(gst_vorbis_enc_buffer_from_header_packet),
(gst_vorbis_enc_push_buffer), (gst_vorbis_enc_push_packet),
(gst_vorbis_enc_set_header_on_caps), (gst_vorbis_enc_sink_event),
(gst_vorbis_enc_chain), (gst_vorbis_enc_output_buffers),
(gst_vorbis_enc_get_property), (gst_vorbis_enc_set_property),
(gst_vorbis_enc_change_state):
* ext/vorbis/vorbisenc.h:
Remove left-over 0.8 cruft; use GST_DEBUG_FUNCPTR; make
vorbisenc adhere to the official nomenclature; use boilerplate
macro.
2006-04-05 13:05:25 +00:00
|
|
|
vorbis_dec_finalize (GObject * object)
|
2005-08-26 10:50:56 +00:00
|
|
|
{
|
2005-09-19 16:12:09 +00:00
|
|
|
/* Release any possibly allocated libvorbis data.
|
2005-08-26 10:50:56 +00:00
|
|
|
* _clear functions can safely be called multiple times
|
|
|
|
*/
|
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (object);
|
|
|
|
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifndef USE_TREMOLO
|
2005-08-26 10:50:56 +00:00
|
|
|
vorbis_block_clear (&vd->vb);
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
2005-08-26 10:50:56 +00:00
|
|
|
vorbis_dsp_clear (&vd->vd);
|
|
|
|
vorbis_comment_clear (&vd->vc);
|
|
|
|
vorbis_info_clear (&vd->vi);
|
2005-09-19 16:12:09 +00:00
|
|
|
|
|
|
|
G_OBJECT_CLASS (parent_class)->finalize (object);
|
2005-08-26 10:50:56 +00:00
|
|
|
}
|
|
|
|
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
static void
|
|
|
|
gst_vorbis_dec_reset (GstVorbisDec * dec)
|
|
|
|
{
|
2006-07-12 10:37:18 +00:00
|
|
|
if (dec->taglist)
|
|
|
|
gst_tag_list_free (dec->taglist);
|
|
|
|
dec->taglist = NULL;
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
}
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static gboolean
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_dec_start (GstAudioDecoder * dec)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2011-10-07 12:52:33 +00:00
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
|
2005-05-09 10:56:13 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "start");
|
|
|
|
vorbis_info_init (&vd->vi);
|
|
|
|
vorbis_comment_init (&vd->vc);
|
|
|
|
vd->initialized = FALSE;
|
|
|
|
gst_vorbis_dec_reset (vd);
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
return TRUE;
|
ext/: Added query/convert/formats functions to vorbis and theora decoders so that the outside world can use them too....
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(theora_get_formats), (theora_get_event_masks),
(theora_get_query_types), (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_event), (theora_dec_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_get_formats),
(vorbis_get_event_masks), (vorbis_get_query_types),
(gst_vorbis_dec_init), (vorbis_dec_convert),
(vorbis_dec_src_query), (vorbis_dec_src_event), (vorbis_dec_event):
Added query/convert/formats functions to vorbis and theora decoders
so that the outside world can use them too. Fixed seeking on an
ogg/theora/vorbis file by disabling the seeking on the
theora srcpad.
2004-07-21 13:28:23 +00:00
|
|
|
}
|
2004-01-30 03:51:04 +00:00
|
|
|
|
|
|
|
static gboolean
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_dec_stop (GstAudioDecoder * dec)
|
2004-01-30 03:51:04 +00:00
|
|
|
{
|
2011-10-07 12:52:33 +00:00
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
|
2005-05-09 10:56:13 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
GST_DEBUG_OBJECT (dec, "stop");
|
|
|
|
vd->initialized = FALSE;
|
|
|
|
#ifndef USE_TREMOLO
|
|
|
|
vorbis_block_clear (&vd->vb);
|
|
|
|
#endif
|
|
|
|
vorbis_dsp_clear (&vd->vd);
|
|
|
|
vorbis_comment_clear (&vd->vc);
|
|
|
|
vorbis_info_clear (&vd->vi);
|
|
|
|
gst_vorbis_dec_reset (vd);
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
return TRUE;
|
2004-01-30 03:51:04 +00:00
|
|
|
}
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
#if 0
|
2004-01-29 02:50:20 +00:00
|
|
|
static gboolean
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_dec_src_event (GstPad * pad, GstEvent * event)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
|
|
|
gboolean res = TRUE;
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
GstVorbisDec *dec;
|
|
|
|
|
|
|
|
dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2006-05-26 15:52:23 +00:00
|
|
|
case GST_EVENT_SEEK:
|
|
|
|
{
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
GstFormat format, tformat;
|
|
|
|
gdouble rate;
|
|
|
|
GstEvent *real_seek;
|
|
|
|
GstSeekFlags flags;
|
|
|
|
GstSeekType cur_type, stop_type;
|
|
|
|
gint64 cur, stop;
|
|
|
|
gint64 tcur, tstop;
|
2008-11-04 18:17:24 +00:00
|
|
|
guint32 seqnum;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
|
|
|
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
|
|
|
|
&stop_type, &stop);
|
2008-11-04 18:17:24 +00:00
|
|
|
seqnum = gst_event_get_seqnum (event);
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
gst_event_unref (event);
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
2009-12-09 18:03:16 +00:00
|
|
|
/* First bring the requested format to time */
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
tformat = GST_FORMAT_TIME;
|
|
|
|
if (!(res = vorbis_dec_convert (pad, format, cur, &tformat, &tcur)))
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
goto convert_error;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
if (!(res = vorbis_dec_convert (pad, format, stop, &tformat, &tstop)))
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
goto convert_error;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
|
|
|
/* then seek with time on the peer */
|
|
|
|
real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
|
|
|
|
flags, cur_type, tcur, stop_type, tstop);
|
2008-11-04 18:17:24 +00:00
|
|
|
gst_event_set_seqnum (real_seek, seqnum);
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
ext/ogg/gstoggdemux.c: Parse seeking events better.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_src_query),
(gst_ogg_pad_event), (gst_ogg_demux_factory_filter),
(gst_ogg_pad_submit_packet), (gst_ogg_chain_new),
(gst_ogg_demux_init), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_loop), (gst_ogg_print):
Parse seeking events better.
Unref static caps.
Generate correct newsegment events, fixes seeking in live oggs.
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_src_event), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_dec_push), (theora_dec_chain):
Use newsegment values to report correct play time.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Parse and use newsegment values to report correct play time.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Clear ringbuffer on flush.
Use newsegment values to calculate playback time.
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Basesink does newsegment calculations for us now.
2005-08-24 18:04:45 +00:00
|
|
|
res = gst_pad_push_event (dec->sinkpad, real_seek);
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
res = gst_pad_push_event (dec->sinkpad, event);
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
}
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
done:
|
|
|
|
gst_object_unref (dec);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
return res;
|
examples/seeking/seek.c: Update seek example.
Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 18:34:29 +00:00
|
|
|
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
/* ERRORS */
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
convert_error:
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
{
|
|
|
|
GST_DEBUG_OBJECT (dec, "cannot convert start/stop for seek");
|
|
|
|
goto done;
|
|
|
|
}
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
#endif
|
2004-01-29 02:50:20 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
static GstFlowReturn
|
2005-08-21 10:43:45 +00:00
|
|
|
vorbis_handle_identification_packet (GstVorbisDec * vd)
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
const GstAudioChannelPosition *pos = NULL;
|
2010-02-15 11:09:53 +00:00
|
|
|
gint width = GST_VORBIS_DEC_DEFAULT_SAMPLE_WIDTH;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
|
|
|
switch (vd->vi.channels) {
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
/* nothing */
|
|
|
|
break;
|
2010-01-14 09:05:35 +00:00
|
|
|
case 3:
|
|
|
|
case 4:
|
|
|
|
case 5:
|
|
|
|
case 6:
|
|
|
|
case 7:
|
|
|
|
case 8:
|
|
|
|
pos = gst_vorbis_channel_positions[vd->vi.channels - 1];
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
break;
|
2008-05-29 07:02:50 +00:00
|
|
|
default:{
|
|
|
|
gint i;
|
|
|
|
GstAudioChannelPosition *posn =
|
|
|
|
g_new (GstAudioChannelPosition, vd->vi.channels);
|
|
|
|
|
|
|
|
GST_ELEMENT_WARNING (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("Using NONE channel layout for more than 8 channels"));
|
|
|
|
|
|
|
|
for (i = 0; i < vd->vi.channels; i++)
|
|
|
|
posn[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
|
|
|
|
|
|
|
|
pos = posn;
|
|
|
|
}
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
}
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
|
2010-02-15 11:09:53 +00:00
|
|
|
/* negotiate width with downstream */
|
2011-10-07 12:52:33 +00:00
|
|
|
caps = gst_pad_get_allowed_caps (GST_AUDIO_DECODER_SRC_PAD (vd));
|
2010-02-15 11:09:53 +00:00
|
|
|
if (caps) {
|
|
|
|
if (!gst_caps_is_empty (caps)) {
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
/* template ensures 16 or 32 */
|
|
|
|
gst_structure_get_int (s, "width", &width);
|
2010-05-06 05:20:10 +00:00
|
|
|
|
|
|
|
GST_INFO_OBJECT (vd, "using %s with %d channels and %d bit audio depth",
|
|
|
|
gst_structure_get_name (s), vd->vi.channels, width);
|
2010-02-15 11:09:53 +00:00
|
|
|
}
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
vd->width = width >> 3;
|
2010-02-03 13:37:43 +00:00
|
|
|
|
2010-05-06 05:20:10 +00:00
|
|
|
/* select a copy_samples function, this way we can have specialized versions
|
|
|
|
* for mono/stereo and avoid the depth switch in tremor case */
|
|
|
|
vd->copy_samples = get_copy_sample_func (vd->vi.channels, vd->width);
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
caps =
|
|
|
|
gst_caps_copy (gst_pad_get_pad_template_caps
|
|
|
|
(GST_AUDIO_DECODER_SRC_PAD (vd)));
|
|
|
|
gst_caps_set_simple (caps, "rate", G_TYPE_INT, vd->vi.rate, "channels",
|
|
|
|
G_TYPE_INT, vd->vi.channels, "width", G_TYPE_INT, width, NULL);
|
ext/vorbis/vorbisdec.c: Cleanups. Use refcounting and DEBUG_OBJECT.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_get_query_types),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_sink_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_dec_clean_queued), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_change_state):
Cleanups. Use refcounting and DEBUG_OBJECT.
Reset segment on flush, use code methods instead of our
own wrong version.
Fix potential memleak.
2006-05-15 16:49:31 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
if (pos) {
|
|
|
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
|
|
|
}
|
2008-05-29 07:02:50 +00:00
|
|
|
|
|
|
|
if (vd->vi.channels > 8) {
|
|
|
|
g_free ((GstAudioChannelPosition *) pos);
|
|
|
|
}
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
gst_pad_set_caps (GST_AUDIO_DECODER_SRC_PAD (vd), caps);
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
2005-08-21 10:43:45 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
guint bitrate = 0;
|
|
|
|
gchar *encoder = NULL;
|
2008-08-05 15:38:06 +00:00
|
|
|
GstTagList *list, *old_list;
|
2005-08-21 10:43:45 +00:00
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (vd, "parsing comment packet");
|
|
|
|
|
2009-03-13 11:49:10 +00:00
|
|
|
buf = gst_buffer_new ();
|
2010-02-15 11:09:53 +00:00
|
|
|
GST_BUFFER_DATA (buf) = gst_ogg_packet_data (packet);
|
|
|
|
GST_BUFFER_SIZE (buf) = gst_ogg_packet_size (packet);
|
2005-08-21 10:43:45 +00:00
|
|
|
|
2006-07-12 14:20:43 +00:00
|
|
|
list =
|
2005-08-21 10:43:45 +00:00
|
|
|
gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\003vorbis", 7,
|
2006-07-12 14:20:43 +00:00
|
|
|
&encoder);
|
|
|
|
|
2008-08-05 15:38:06 +00:00
|
|
|
old_list = vd->taglist;
|
2006-07-12 14:20:43 +00:00
|
|
|
vd->taglist = gst_tag_list_merge (vd->taglist, list, GST_TAG_MERGE_REPLACE);
|
2005-08-21 10:43:45 +00:00
|
|
|
|
2008-08-05 15:38:06 +00:00
|
|
|
if (old_list)
|
|
|
|
gst_tag_list_free (old_list);
|
2006-07-12 14:20:43 +00:00
|
|
|
gst_tag_list_free (list);
|
2005-08-21 10:43:45 +00:00
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
2006-07-12 10:37:18 +00:00
|
|
|
if (!vd->taglist) {
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_ERROR_OBJECT (vd, "couldn't decode comments");
|
2006-07-12 10:37:18 +00:00
|
|
|
vd->taglist = gst_tag_list_new ();
|
2005-08-21 10:43:45 +00:00
|
|
|
}
|
|
|
|
if (encoder) {
|
2009-07-16 07:32:46 +00:00
|
|
|
if (encoder[0])
|
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_ENCODER, encoder, NULL);
|
2005-08-21 10:43:45 +00:00
|
|
|
g_free (encoder);
|
|
|
|
}
|
2006-07-12 10:37:18 +00:00
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_TAG_ENCODER_VERSION, vd->vi.version,
|
|
|
|
GST_TAG_AUDIO_CODEC, "Vorbis", NULL);
|
2009-06-03 19:42:39 +00:00
|
|
|
if (vd->vi.bitrate_nominal > 0 && vd->vi.bitrate_nominal <= 0x7FFFFFFF) {
|
2006-07-12 10:37:18 +00:00
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
|
|
|
|
bitrate = vd->vi.bitrate_nominal;
|
|
|
|
}
|
2009-06-03 19:42:39 +00:00
|
|
|
if (vd->vi.bitrate_upper > 0 && vd->vi.bitrate_upper <= 0x7FFFFFFF) {
|
2006-07-12 10:37:18 +00:00
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);
|
|
|
|
if (!bitrate)
|
|
|
|
bitrate = vd->vi.bitrate_upper;
|
|
|
|
}
|
2009-06-03 19:42:39 +00:00
|
|
|
if (vd->vi.bitrate_lower > 0 && vd->vi.bitrate_lower <= 0x7FFFFFFF) {
|
2006-07-12 10:37:18 +00:00
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);
|
|
|
|
if (!bitrate)
|
|
|
|
bitrate = vd->vi.bitrate_lower;
|
|
|
|
}
|
|
|
|
if (bitrate) {
|
2006-07-12 10:37:18 +00:00
|
|
|
gst_tag_list_add (vd->taglist, GST_TAG_MERGE_REPLACE,
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_TAG_BITRATE, (guint) bitrate, NULL);
|
|
|
|
}
|
|
|
|
|
2006-07-12 10:37:18 +00:00
|
|
|
if (vd->initialized) {
|
2011-10-07 12:52:33 +00:00
|
|
|
gst_element_found_tags_for_pad (GST_ELEMENT_CAST (vd),
|
|
|
|
GST_AUDIO_DECODER_SRC_PAD (vd), vd->taglist);
|
2006-07-12 10:37:18 +00:00
|
|
|
vd->taglist = NULL;
|
2006-07-12 13:04:15 +00:00
|
|
|
} else {
|
|
|
|
/* Only post them as messages for the time being. *
|
|
|
|
* They will be pushed on the pad once the decoder is initialized */
|
|
|
|
gst_element_post_message (GST_ELEMENT_CAST (vd),
|
|
|
|
gst_message_new_tag (GST_OBJECT (vd), gst_tag_list_copy (vd->taglist)));
|
2006-07-12 10:37:18 +00:00
|
|
|
}
|
2005-08-21 10:43:45 +00:00
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_type_packet (GstVorbisDec * vd)
|
|
|
|
{
|
2009-05-22 15:41:50 +00:00
|
|
|
gint res;
|
2006-07-12 10:37:18 +00:00
|
|
|
|
2005-08-26 10:50:56 +00:00
|
|
|
g_assert (vd->initialized == FALSE);
|
|
|
|
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifdef USE_TREMOLO
|
|
|
|
if (G_UNLIKELY ((res = vorbis_dsp_init (&vd->vd, &vd->vi))))
|
|
|
|
goto synthesis_init_error;
|
|
|
|
#else
|
2009-05-22 15:41:50 +00:00
|
|
|
if (G_UNLIKELY ((res = vorbis_synthesis_init (&vd->vd, &vd->vi))))
|
|
|
|
goto synthesis_init_error;
|
|
|
|
|
|
|
|
if (G_UNLIKELY ((res = vorbis_block_init (&vd->vd, &vd->vb))))
|
|
|
|
goto block_init_error;
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
2009-05-22 15:41:50 +00:00
|
|
|
|
2005-08-21 10:43:45 +00:00
|
|
|
vd->initialized = TRUE;
|
|
|
|
|
2006-07-12 10:37:18 +00:00
|
|
|
if (vd->taglist) {
|
2006-07-12 13:04:15 +00:00
|
|
|
/* The tags have already been sent on the bus as messages. */
|
2011-10-07 12:52:33 +00:00
|
|
|
gst_pad_push_event (GST_AUDIO_DECODER_SRC_PAD (vd),
|
|
|
|
gst_event_new_tag (vd->taglist));
|
2006-07-12 10:37:18 +00:00
|
|
|
vd->taglist = NULL;
|
|
|
|
}
|
2005-08-21 10:43:45 +00:00
|
|
|
return GST_FLOW_OK;
|
2009-05-22 15:41:50 +00:00
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
synthesis_init_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("couldn't initialize synthesis (%d)", res));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
block_init_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("couldn't initialize block (%d)", res));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-08-21 10:43:45 +00:00
|
|
|
}
|
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_header_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
2009-05-22 15:41:50 +00:00
|
|
|
gint ret;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2005-08-21 10:43:45 +00:00
|
|
|
GST_DEBUG_OBJECT (vd, "parsing header packet");
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
|
|
|
/* Packetno = 0 if the first byte is exactly 0x01 */
|
2010-02-15 11:09:53 +00:00
|
|
|
packet->b_o_s = ((gst_ogg_packet_data (packet))[0] == 0x1) ? 1 : 0;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
#ifdef USE_TREMELO
|
2011-03-31 17:56:00 +00:00
|
|
|
if ((ret = vorbis_dsp_headerin (&vd->vi, &vd->vc, packet)))
|
|
|
|
#else
|
2009-05-22 15:41:50 +00:00
|
|
|
if ((ret = vorbis_synthesis_headerin (&vd->vi, &vd->vc, packet)))
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
goto header_read_error;
|
|
|
|
|
2010-02-15 11:09:53 +00:00
|
|
|
switch ((gst_ogg_packet_data (packet))[0]) {
|
2006-01-31 19:25:10 +00:00
|
|
|
case 0x01:
|
2005-08-21 10:43:45 +00:00
|
|
|
res = vorbis_handle_identification_packet (vd);
|
|
|
|
break;
|
2006-01-31 19:25:10 +00:00
|
|
|
case 0x03:
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
res = vorbis_handle_comment_packet (vd, packet);
|
|
|
|
break;
|
2006-01-31 19:25:10 +00:00
|
|
|
case 0x05:
|
2005-08-21 10:43:45 +00:00
|
|
|
res = vorbis_handle_type_packet (vd);
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* ignore */
|
2006-01-31 19:25:10 +00:00
|
|
|
g_warning ("unknown vorbis header packet found");
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
res = GST_FLOW_OK;
|
|
|
|
break;
|
|
|
|
}
|
2011-10-07 12:52:33 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
return res;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
header_read_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
2009-05-22 15:41:50 +00:00
|
|
|
(NULL), ("couldn't read header packet (%d)", ret));
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
static GstFlowReturn
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_dec_handle_header_buffer (GstVorbisDec * vd, GstBuffer * buffer)
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
{
|
2011-10-07 12:52:33 +00:00
|
|
|
ogg_packet *packet;
|
|
|
|
ogg_packet_wrapper packet_wrapper;
|
2006-11-24 15:39:03 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
|
|
|
|
packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
return vorbis_handle_header_packet (vd, packet);
|
Updated seek example.
Original commit message from CVS:
* docs/libs/tmpl/gstringbuffer.sgml:
* examples/seeking/seek.c: (make_vorbis_theora_pipeline),
(query_rates), (query_positions_elems), (query_positions_pads),
(update_scale), (do_seek):
Updated seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_pad_submit_page), (gst_ogg_demux_activate_chain),
(gst_ogg_demux_find_chains), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
Push out correct discont values.
* ext/theora/theoradec.c: (theora_dec_src_convert),
(theora_dec_sink_convert), (theora_dec_src_getcaps),
(theora_dec_sink_event), (theora_handle_type_packet),
(theora_handle_header_packet), (theora_dec_push),
(theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Better timestamping.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain):
* ext/vorbis/vorbisdec.h:
Better timestamping.
* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_get_time), (gst_base_audio_sink_get_times),
(gst_base_audio_sink_event), (gst_base_audio_sink_render):
Handle syncing on timestamps instead of sample offsets. Make
use of DISCONT values as described in design docs.
* gst-libs/gst/audio/gstbaseaudiosrc.c:
(gst_base_audio_src_get_time):
* gst-libs/gst/audio/gstringbuffer.c: (gst_ring_buffer_acquire),
(gst_ring_buffer_set_sample), (gst_ring_buffer_commit),
(gst_ring_buffer_read):
* gst-libs/gst/audio/gstringbuffer.h:
* sys/ximage/ximagesink.c: (gst_ximagesink_get_times),
(gst_ximagesink_show_frame):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_get_times):
Correcly convert buffer timestamp to stream time.
2005-07-16 14:47:27 +00:00
|
|
|
}
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
#define MIN_NUM_HEADERS 3
|
2006-11-13 18:14:48 +00:00
|
|
|
static GstFlowReturn
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_dec_handle_header_caps (GstVorbisDec * vd)
|
2006-11-13 18:14:48 +00:00
|
|
|
{
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
2011-10-07 12:52:33 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *s = NULL;
|
|
|
|
const GValue *array = NULL;
|
2006-11-13 18:14:48 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
caps = GST_PAD_CAPS (GST_AUDIO_DECODER_SINK_PAD (vd));
|
|
|
|
if (caps)
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
if (s)
|
|
|
|
array = gst_structure_get_value (s, "streamheader");
|
2006-11-13 18:14:48 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
if (array && (gst_value_array_get_size (array) >= MIN_NUM_HEADERS)) {
|
|
|
|
const GValue *value = NULL;
|
|
|
|
GstBuffer *buf = NULL;
|
|
|
|
gint i = 0;
|
2006-11-13 18:14:48 +00:00
|
|
|
|
2011-10-19 14:28:44 +00:00
|
|
|
while (result == GST_FLOW_OK && i < gst_value_array_get_size (array)) {
|
2011-10-07 12:52:33 +00:00
|
|
|
value = gst_value_array_get_value (array, i);
|
|
|
|
buf = gst_value_get_buffer (value);
|
|
|
|
if (!buf)
|
|
|
|
goto null_buffer;
|
|
|
|
result = vorbis_dec_handle_header_buffer (vd, buf);
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
} else
|
|
|
|
goto array_error;
|
|
|
|
|
|
|
|
done:
|
|
|
|
return (result != GST_FLOW_OK ? GST_FLOW_NOT_NEGOTIATED : GST_FLOW_OK);
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
array_error:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (vd, "streamheader array not found");
|
|
|
|
result = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
null_buffer:
|
|
|
|
{
|
|
|
|
GST_WARNING_OBJECT (vd, "streamheader with null buffer received");
|
|
|
|
result = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
2010-12-21 12:37:41 +00:00
|
|
|
}
|
2009-12-09 18:03:16 +00:00
|
|
|
}
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
static GstFlowReturn
|
2009-12-09 18:03:16 +00:00
|
|
|
vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet,
|
|
|
|
GstClockTime timestamp, GstClockTime duration)
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
{
|
2011-10-07 12:52:33 +00:00
|
|
|
#ifdef USE_TREMELO
|
2011-03-31 17:56:00 +00:00
|
|
|
vorbis_sample_t *pcm;
|
|
|
|
#else
|
2010-02-15 11:09:53 +00:00
|
|
|
vorbis_sample_t **pcm;
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
guint sample_count;
|
2010-12-21 12:37:41 +00:00
|
|
|
GstBuffer *out = NULL;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
GstFlowReturn result;
|
2005-12-02 10:47:55 +00:00
|
|
|
gint size;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
if (G_UNLIKELY (!vd->initialized)) {
|
|
|
|
result = vorbis_dec_handle_header_caps (vd);
|
|
|
|
if (result != GST_FLOW_OK)
|
|
|
|
goto not_initialized;
|
|
|
|
}
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
|
|
|
/* normal data packet */
|
2006-05-26 15:52:23 +00:00
|
|
|
/* FIXME, we can skip decoding if the packet is outside of the
|
|
|
|
* segment, this is however not very trivial as we need a previous
|
2011-09-13 19:10:43 +00:00
|
|
|
* packet to decode the current one so we must be careful not to
|
2006-05-26 15:52:23 +00:00
|
|
|
* throw away too much. For now we decode everything and clip right
|
|
|
|
* before pushing data. */
|
2011-03-31 17:56:00 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
#ifdef USE_TREMELO
|
|
|
|
if (G_UNLIKELY (vorbis_dsp_synthesis (&vd->vb, packet, 1)))
|
2011-03-31 17:56:00 +00:00
|
|
|
goto could_not_read;
|
|
|
|
#else
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
if (G_UNLIKELY (vorbis_synthesis (&vd->vb, packet)))
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
goto could_not_read;
|
|
|
|
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
if (G_UNLIKELY (vorbis_synthesis_blockin (&vd->vd, &vd->vb) < 0))
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
goto not_accepted;
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2005-09-29 19:12:44 +00:00
|
|
|
/* assume all goes well here */
|
|
|
|
result = GST_FLOW_OK;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2005-09-29 19:12:44 +00:00
|
|
|
/* count samples ready for reading */
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifdef USE_TREMOLO
|
|
|
|
if ((sample_count = vorbis_dsp_pcmout (&vd->vd, NULL, 0)) == 0)
|
|
|
|
#else
|
2005-09-29 19:12:44 +00:00
|
|
|
if ((sample_count = vorbis_synthesis_pcmout (&vd->vd, NULL)) == 0)
|
|
|
|
goto done;
|
2011-10-07 12:52:33 +00:00
|
|
|
#endif
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2010-02-03 13:37:43 +00:00
|
|
|
size = sample_count * vd->vi.channels * vd->width;
|
2009-12-09 18:03:16 +00:00
|
|
|
GST_LOG_OBJECT (vd, "%d samples ready for reading, size %d", sample_count,
|
|
|
|
size);
|
2005-12-02 10:47:55 +00:00
|
|
|
|
2005-09-29 19:12:44 +00:00
|
|
|
/* alloc buffer for it */
|
2005-12-05 13:02:12 +00:00
|
|
|
result =
|
2011-10-07 12:52:33 +00:00
|
|
|
gst_pad_alloc_buffer_and_set_caps (GST_AUDIO_DECODER_SRC_PAD (vd),
|
|
|
|
GST_BUFFER_OFFSET_NONE, size,
|
|
|
|
GST_PAD_CAPS (GST_AUDIO_DECODER_SRC_PAD (vd)), &out);
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
if (G_UNLIKELY (result != GST_FLOW_OK))
|
2005-09-29 19:12:44 +00:00
|
|
|
goto done;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2005-09-29 19:12:44 +00:00
|
|
|
/* get samples ready for reading now, should be sample_count */
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifdef USE_TREMOLO
|
|
|
|
pcm = GST_BUFFER_DATA (out);
|
2011-10-07 12:52:33 +00:00
|
|
|
if (G_UNLIKELY (vorbis_dsp_pcmout (&vd->vd, pcm, sample_count) !=
|
|
|
|
sample_count))
|
2011-03-31 17:56:00 +00:00
|
|
|
#else
|
2011-10-07 12:52:33 +00:00
|
|
|
if (G_UNLIKELY (vorbis_synthesis_pcmout (&vd->vd, &pcm) != sample_count))
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
2005-09-29 19:12:44 +00:00
|
|
|
goto wrong_samples;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifndef USE_TREMOLO
|
2005-09-29 19:12:44 +00:00
|
|
|
/* copy samples in buffer */
|
2010-05-06 05:20:10 +00:00
|
|
|
vd->copy_samples ((vorbis_sample_t *) GST_BUFFER_DATA (out), pcm,
|
|
|
|
sample_count, vd->vi.channels, vd->width);
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
|
2009-12-09 18:03:16 +00:00
|
|
|
GST_LOG_OBJECT (vd, "setting output size to %d", size);
|
2005-12-02 10:47:55 +00:00
|
|
|
GST_BUFFER_SIZE (out) = size;
|
2006-11-13 18:14:48 +00:00
|
|
|
|
2005-09-29 19:12:44 +00:00
|
|
|
done:
|
2011-10-07 12:52:33 +00:00
|
|
|
/* whether or not data produced, consume one frame and advance time */
|
|
|
|
result = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (vd), out, 1);
|
|
|
|
|
2011-03-31 17:56:00 +00:00
|
|
|
#ifdef USE_TREMOLO
|
|
|
|
vorbis_dsp_read (&vd->vd, sample_count);
|
|
|
|
#else
|
2005-10-24 17:40:37 +00:00
|
|
|
vorbis_synthesis_read (&vd->vd, sample_count);
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
2005-10-24 17:40:37 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_initialized:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
ext/theora/theoradec.c: Cleanups, add some G_LIKELY.
Original commit message from CVS:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_dec_src_query), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_comment_packet),
(theora_handle_data_packet), (theora_dec_change_state):
Cleanups, add some G_LIKELY.
Use segment helpers instead of our own wrong code.
Clear queued buffers on seek and READY.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_convert), (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_sink_event),
(vorbis_handle_comment_packet), (vorbis_dec_push),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Remove old useless packetno variable.
Do position query properly.
Add some G_LIKELY.
Do cleanup of queued buffers in new helper function
and use it.
2006-05-15 17:42:19 +00:00
|
|
|
(NULL), ("no header sent yet"));
|
2011-10-07 12:52:33 +00:00
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
}
|
|
|
|
could_not_read:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("couldn't read data packet"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
not_accepted:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("vorbis decoder did not accept data packet"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2005-09-29 19:12:44 +00:00
|
|
|
wrong_samples:
|
|
|
|
{
|
|
|
|
gst_buffer_unref (out);
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("vorbis decoder reported wrong number of samples"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
}
|
|
|
|
|
2011-05-18 20:07:58 +00:00
|
|
|
static GstFlowReturn
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_dec_handle_frame (GstAudioDecoder * dec, GstBuffer * buffer)
|
2011-05-18 20:07:58 +00:00
|
|
|
{
|
|
|
|
ogg_packet *packet;
|
|
|
|
ogg_packet_wrapper packet_wrapper;
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
2011-10-07 12:52:33 +00:00
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
|
2011-05-18 20:07:58 +00:00
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
/* no draining etc */
|
|
|
|
if (G_UNLIKELY (!buffer))
|
|
|
|
return GST_FLOW_OK;
|
2005-10-20 16:01:43 +00:00
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
/* make ogg_packet out of the buffer */
|
2010-02-15 11:09:53 +00:00
|
|
|
gst_ogg_packet_wrapper_from_buffer (&packet_wrapper, buffer);
|
|
|
|
packet = gst_ogg_packet_from_wrapper (&packet_wrapper);
|
|
|
|
/* set some more stuff */
|
|
|
|
packet->granulepos = -1;
|
|
|
|
packet->packetno = 0; /* we don't care */
|
2009-12-09 18:03:16 +00:00
|
|
|
/* EOS does not matter, it is used in vorbis to implement clipping the last
|
|
|
|
* block of samples based on the granulepos. We clip based on segments. */
|
2010-02-15 11:09:53 +00:00
|
|
|
packet->e_o_s = 0;
|
2004-05-31 04:56:55 +00:00
|
|
|
|
2010-02-15 11:09:53 +00:00
|
|
|
GST_LOG_OBJECT (vd, "decode buffer of size %ld", packet->bytes);
|
2009-12-09 18:03:16 +00:00
|
|
|
|
2007-06-27 10:14:03 +00:00
|
|
|
/* error out on empty header packets, but just skip empty data packets */
|
2010-02-15 11:09:53 +00:00
|
|
|
if (G_UNLIKELY (packet->bytes == 0)) {
|
2007-06-27 10:14:03 +00:00
|
|
|
if (vd->initialized)
|
|
|
|
goto empty_buffer;
|
|
|
|
else
|
|
|
|
goto empty_header;
|
|
|
|
}
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
/* switch depending on packet type */
|
2010-02-15 11:09:53 +00:00
|
|
|
if ((gst_ogg_packet_data (packet))[0] & 1) {
|
ext/: Don't crap out when seeking back to position 0.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind),
(gst_ogg_demux_perform_seek), (gst_ogg_demux_sink_activate):
* ext/vorbis/vorbisdec.c: (vorbis_dec_convert),
(vorbis_dec_src_query), (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain):
Don't crap out when seeking back to position 0.
2005-04-28 17:13:47 +00:00
|
|
|
if (vd->initialized) {
|
2006-07-26 10:54:13 +00:00
|
|
|
GST_WARNING_OBJECT (vd, "Already initialized, so ignoring header packet");
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
goto done;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
2010-02-15 11:09:53 +00:00
|
|
|
result = vorbis_handle_header_packet (vd, packet);
|
2011-10-18 19:40:54 +00:00
|
|
|
/* consumer header packet/frame */
|
|
|
|
gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (vd), NULL, 1);
|
2004-01-29 02:50:20 +00:00
|
|
|
} else {
|
2009-12-09 18:03:16 +00:00
|
|
|
GstClockTime timestamp, duration;
|
|
|
|
|
|
|
|
timestamp = GST_BUFFER_TIMESTAMP (buffer);
|
|
|
|
duration = GST_BUFFER_DURATION (buffer);
|
|
|
|
|
2010-02-15 11:09:53 +00:00
|
|
|
result = vorbis_handle_data_packet (vd, packet, timestamp, duration);
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/vorbis/vorbisdec.*: Refactor, use STREAM_LOCK.
Original commit message from CVS:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_comment_packet),
(vorbis_handle_type_packet), (vorbis_handle_header_packet),
(copy_samples), (vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Refactor, use STREAM_LOCK.
2005-04-28 16:22:47 +00:00
|
|
|
done:
|
2005-03-31 09:43:49 +00:00
|
|
|
return result;
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
|
2007-06-27 10:14:03 +00:00
|
|
|
empty_buffer:
|
ext/ogg/gstoggdemux.c: Mark buffers with DISCONT after seek and after activating new chains.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer),
(gst_ogg_chain_mark_discont), (gst_ogg_chain_new_stream),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek):
Mark buffers with DISCONT after seek and after activating new
chains.
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_reset),
(theora_get_query_types), (theora_dec_sink_event),
(theora_dec_push), (theora_handle_data_packet), (theora_dec_chain),
(theora_dec_change_state):
Fix frame counter.
Detect and mark DISCONT buffers.
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_dec_push), (vorbis_dec_chain),
(vorbis_dec_change_state):
* ext/vorbis/vorbisdec.h:
Use GstSegment.
Detect and mark DISCONT buffers.
Don't crash on 0 sized buffers.
2006-05-03 15:34:48 +00:00
|
|
|
{
|
2007-06-27 10:14:03 +00:00
|
|
|
/* don't error out here, just ignore the buffer, it's invalid for vorbis
|
|
|
|
* but not fatal. */
|
|
|
|
GST_WARNING_OBJECT (vd, "empty buffer received, ignoring");
|
2007-06-27 09:49:51 +00:00
|
|
|
result = GST_FLOW_OK;
|
2007-06-27 10:14:03 +00:00
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
empty_header:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (vd, STREAM, DECODE, (NULL), ("empty header received"));
|
|
|
|
result = GST_FLOW_ERROR;
|
2011-05-18 20:07:58 +00:00
|
|
|
goto done;
|
|
|
|
}
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
static void
|
|
|
|
vorbis_dec_flush (GstAudioDecoder * dec, gboolean hard)
|
2006-11-13 18:14:48 +00:00
|
|
|
{
|
2011-10-07 12:52:33 +00:00
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (dec);
|
2006-11-13 18:14:48 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
|
2011-10-07 12:52:33 +00:00
|
|
|
vorbis_synthesis_restart (&vd->vd);
|
2011-03-31 17:56:00 +00:00
|
|
|
#endif
|
|
|
|
|
2011-10-07 12:52:33 +00:00
|
|
|
if (hard)
|
|
|
|
gst_vorbis_dec_reset (vd);
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|