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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "vorbisdec.h"
|
|
|
|
#include <string.h>
|
|
|
|
#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
|
|
|
|
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 GstElementDetails vorbis_dec_details = {
|
|
|
|
"VorbisDec",
|
2004-02-20 15:49:27 +00:00
|
|
|
"Codec/Decoder/Audio",
|
2004-01-29 02:50:20 +00:00
|
|
|
"decode raw vorbis streams to float audio",
|
|
|
|
"Benjamin Otte <in7y118@public.uni-hamburg.de>",
|
|
|
|
};
|
|
|
|
|
|
|
|
/* Filter signals and args */
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-29 02:50:20 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2004-01-29 02:50:20 +00:00
|
|
|
ARG_0
|
|
|
|
};
|
|
|
|
|
|
|
|
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,
|
|
|
|
GST_STATIC_CAPS ("audio/x-raw-float, "
|
2004-10-14 09:16:32 +00:00
|
|
|
"rate = (int) [ 8000, 50000 ], "
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
"channels = (int) [ 1, 6 ], " "endianness = (int) BYTE_ORDER, "
|
2004-01-30 03:59:03 +00:00
|
|
|
/* no ifdef in macros, please
|
2004-01-29 02:50:20 +00:00
|
|
|
#ifdef GST_VORBIS_DEC_SEQUENTIAL
|
|
|
|
"layout = \"sequential\", "
|
|
|
|
#endif
|
2004-01-30 03:59:03 +00:00
|
|
|
*/
|
2004-03-15 19:32:28 +00:00
|
|
|
"width = (int) 32, " "buffer-frames = (int) 0")
|
2004-03-14 22:34:34 +00:00
|
|
|
);
|
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
|
|
|
|
|
|
|
GST_BOILERPLATE (GstVorbisDec, gst_vorbis_dec, GstElement, GST_TYPE_ELEMENT);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean vorbis_dec_sink_event (GstPad * pad, GstEvent * event);
|
|
|
|
static GstFlowReturn vorbis_dec_chain (GstPad * pad, GstBuffer * buffer);
|
2004-03-14 22:34:34 +00:00
|
|
|
static GstElementStateReturn vorbis_dec_change_state (GstElement * element);
|
2005-05-09 10:56:13 +00:00
|
|
|
|
|
|
|
#if 0
|
2004-03-14 22:34:34 +00:00
|
|
|
static const GstFormat *vorbis_dec_get_formats (GstPad * pad);
|
2005-05-09 10:56:13 +00:00
|
|
|
#endif
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
static gboolean vorbis_dec_src_event (GstPad * pad, GstEvent * event);
|
2005-05-09 10:56:13 +00:00
|
|
|
static gboolean vorbis_dec_src_query (GstPad * pad, GstQuery * query);
|
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
|
|
|
static gboolean vorbis_dec_convert (GstPad * pad,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
static gboolean vorbis_dec_sink_query (GstPad * pad, GstQuery * query);
|
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);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
2004-01-29 02:50:20 +00:00
|
|
|
gst_static_pad_template_get (&vorbis_dec_src_factory));
|
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&vorbis_dec_sink_factory));
|
|
|
|
gst_element_class_set_details (element_class, &vorbis_dec_details);
|
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
{
|
|
|
|
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
|
|
|
gstelement_class->change_state = vorbis_dec_change_state;
|
|
|
|
}
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
#if 0
|
2004-03-06 16:41:39 +00:00
|
|
|
static const GstFormat *
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_dec_get_formats (GstPad * pad)
|
2004-03-06 16:41:39 +00:00
|
|
|
{
|
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
|
|
|
static GstFormat src_formats[] = {
|
2004-03-06 16:41:39 +00:00
|
|
|
GST_FORMAT_BYTES,
|
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
|
|
|
GST_FORMAT_DEFAULT, /* samples in the audio case */
|
2004-03-06 16:41:39 +00:00
|
|
|
GST_FORMAT_TIME,
|
|
|
|
0
|
|
|
|
};
|
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
|
|
|
static GstFormat sink_formats[] = {
|
2004-10-20 16:24:18 +00:00
|
|
|
/*GST_FORMAT_BYTES, */
|
2004-03-06 16:41:39 +00:00
|
|
|
GST_FORMAT_TIME,
|
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
|
|
|
GST_FORMAT_DEFAULT, /* granulepos or samples */
|
2004-03-06 16:41:39 +00:00
|
|
|
0
|
|
|
|
};
|
2004-03-15 19:32:28 +00:00
|
|
|
|
2004-03-06 16:41:39 +00:00
|
|
|
return (GST_PAD_IS_SRC (pad) ? src_formats : sink_formats);
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
#endif
|
2004-03-06 16:41:39 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
#if 0
|
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
|
|
|
static const GstEventMask *
|
|
|
|
vorbis_get_event_masks (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstEventMask vorbis_dec_src_event_masks[] = {
|
|
|
|
{GST_EVENT_SEEK, GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH},
|
|
|
|
{0,}
|
|
|
|
};
|
|
|
|
|
|
|
|
return vorbis_dec_src_event_masks;
|
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
#endif
|
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
|
|
|
|
|
|
|
static const GstQueryType *
|
|
|
|
vorbis_get_query_types (GstPad * pad)
|
|
|
|
{
|
|
|
|
static const GstQueryType vorbis_dec_src_query_types[] = {
|
|
|
|
GST_QUERY_POSITION,
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
|
|
|
return vorbis_dec_src_query_types;
|
|
|
|
}
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_vorbis_dec_init (GstVorbisDec * dec)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
2004-03-14 22:34:34 +00:00
|
|
|
dec->sinkpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&vorbis_dec_sink_factory), "sink");
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_set_event_function (dec->sinkpad, vorbis_dec_sink_event);
|
2004-01-29 02:50:20 +00:00
|
|
|
gst_pad_set_chain_function (dec->sinkpad, vorbis_dec_chain);
|
2005-05-09 10:56:13 +00:00
|
|
|
gst_pad_set_query_function (dec->sinkpad, vorbis_dec_sink_query);
|
2004-01-29 02:50:20 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (dec), dec->sinkpad);
|
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
dec->srcpad =
|
|
|
|
gst_pad_new_from_template (gst_static_pad_template_get
|
|
|
|
(&vorbis_dec_src_factory), "src");
|
2004-01-29 02:50:20 +00:00
|
|
|
gst_pad_set_event_function (dec->srcpad, vorbis_dec_src_event);
|
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
|
|
|
gst_pad_set_query_type_function (dec->srcpad, vorbis_get_query_types);
|
2004-01-30 03:51:04 +00:00
|
|
|
gst_pad_set_query_function (dec->srcpad, vorbis_dec_src_query);
|
2004-01-29 02:50:20 +00:00
|
|
|
gst_element_add_pad (GST_ELEMENT (dec), dec->srcpad);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
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
|
|
|
vorbis_dec_convert (GstPad * pad,
|
|
|
|
GstFormat src_format, gint64 src_value,
|
|
|
|
GstFormat * dest_format, gint64 * dest_value)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
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
|
|
|
gboolean res = TRUE;
|
|
|
|
GstVorbisDec *dec;
|
|
|
|
guint64 scale = 1;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
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
|
|
|
dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
if (dec->packetno < 1)
|
|
|
|
return FALSE;
|
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
if (src_format == *dest_format) {
|
|
|
|
*dest_value = src_value;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-10-20 16:24:18 +00:00
|
|
|
if (dec->sinkpad == pad &&
|
|
|
|
(src_format == GST_FORMAT_BYTES || *dest_format == GST_FORMAT_BYTES))
|
|
|
|
return FALSE;
|
|
|
|
|
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
|
|
|
switch (src_format) {
|
2004-01-30 03:51:04 +00:00
|
|
|
case GST_FORMAT_TIME:
|
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
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
scale = sizeof (float) * dec->vi.channels;
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = scale * (src_value * dec->vi.rate / GST_SECOND);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-01-30 03:51:04 +00:00
|
|
|
case GST_FORMAT_DEFAULT:
|
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
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_BYTES:
|
|
|
|
*dest_value = src_value * sizeof (float) * dec->vi.channels;
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*dest_value = src_value * GST_SECOND / dec->vi.rate;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-01-30 03:51:04 +00:00
|
|
|
case GST_FORMAT_BYTES:
|
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
|
|
|
switch (*dest_format) {
|
|
|
|
case GST_FORMAT_DEFAULT:
|
|
|
|
*dest_value = src_value / (sizeof (float) * dec->vi.channels);
|
|
|
|
break;
|
|
|
|
case GST_FORMAT_TIME:
|
|
|
|
*dest_value = src_value * GST_SECOND /
|
|
|
|
(dec->vi.rate * sizeof (float) * dec->vi.channels);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
}
|
|
|
|
break;
|
2004-01-30 03:51:04 +00:00
|
|
|
default:
|
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
|
|
|
res = FALSE;
|
2004-01-30 03:51:04 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
return res;
|
|
|
|
}
|
2004-01-30 03:51:04 +00:00
|
|
|
|
|
|
|
static gboolean
|
2005-05-09 10:56:13 +00:00
|
|
|
vorbis_dec_src_query (GstPad * pad, GstQuery * query)
|
2004-01-30 03:51:04 +00:00
|
|
|
{
|
2005-05-09 10:56:13 +00:00
|
|
|
gint64 granulepos;
|
|
|
|
GstVorbisDec *dec;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
|
|
|
|
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_POSITION:
|
|
|
|
{
|
|
|
|
GstFormat format;
|
|
|
|
gint64 value, total;
|
|
|
|
|
|
|
|
/* query peer for total length */
|
|
|
|
if (!(res = gst_pad_query (GST_PAD_PEER (dec->sinkpad), query)))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
granulepos = dec->granulepos;
|
|
|
|
|
|
|
|
gst_query_parse_position (query, &format, NULL, &total);
|
|
|
|
|
|
|
|
/* and convert to the final format */
|
|
|
|
if (!(res =
|
|
|
|
vorbis_dec_convert (pad, GST_FORMAT_DEFAULT, granulepos, &format,
|
|
|
|
&value)))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
gst_query_set_position (query, format, value, total);
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (dec,
|
|
|
|
"query %u: peer returned granulepos: %llu - we return %llu (format %u)",
|
|
|
|
query, granulepos, value, format);
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
|
|
|
if (!(res =
|
|
|
|
vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
|
|
|
|
goto error;
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
2004-01-30 03:51:04 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
error:
|
|
|
|
{
|
|
|
|
GST_DEBUG ("error handling event");
|
|
|
|
return res;
|
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
|
|
|
}
|
2005-05-09 10:56:13 +00:00
|
|
|
}
|
2004-01-30 03:51:04 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
static gboolean
|
|
|
|
vorbis_dec_sink_query (GstPad * pad, GstQuery * query)
|
|
|
|
{
|
|
|
|
GstVorbisDec *dec;
|
|
|
|
gboolean res;
|
|
|
|
|
|
|
|
dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
2004-01-30 03:51:04 +00:00
|
|
|
|
2005-05-09 10:56:13 +00:00
|
|
|
switch (GST_QUERY_TYPE (query)) {
|
|
|
|
case GST_QUERY_CONVERT:
|
|
|
|
{
|
|
|
|
GstFormat src_fmt, dest_fmt;
|
|
|
|
gint64 src_val, dest_val;
|
|
|
|
|
|
|
|
gst_query_parse_convert (query, &src_fmt, &src_val, &dest_fmt, &dest_val);
|
|
|
|
if (!(res =
|
|
|
|
vorbis_dec_convert (pad, src_fmt, src_val, &dest_fmt, &dest_val)))
|
|
|
|
goto error;
|
|
|
|
gst_query_set_convert (query, src_fmt, src_val, dest_fmt, dest_val);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = FALSE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
error:
|
|
|
|
return res;
|
2004-01-30 03:51:04 +00:00
|
|
|
}
|
|
|
|
|
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/: 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
|
|
|
GstVorbisDec *dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
2004-03-14 22:34:34 +00:00
|
|
|
case GST_EVENT_SEEK:{
|
ext/: ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek) (gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain) ext...
Original commit message from CVS:
2005-05-09 Andy Wingo <wingo@pobox.com>
* ext/alsa/gstalsasink.h:
* ext/gnomevfs/gstgnomevfssrc.c:
(gst_gnomevfssrc_get_icy_metadata):
* ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek)
(gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain)
* ext/theora/theoradec.c (theora_dec_src_query)
(theora_dec_src_event, theora_dec_sink_event)
(theora_handle_comment_packet, theora_handle_data_packet):
* ext/theora/theoraenc.c (theora_enc_chain):
* ext/vorbis/vorbisdec.c (vorbis_dec_src_event)
(vorbis_dec_sink_event, vorbis_handle_comment_packet):
* gst/audioconvert/gstaudioconvert.c (gst_audio_convert_getcaps):
* gst/typefind/gsttypefindfunctions.c (mp3_type_find)
(qt_type_find):
* gst/videotestsrc/videotestsrc.c (paint_setup_I420)
(paint_setup_YV12, paint_setup_YUY2, paint_setup_UYVY)
(paint_setup_YVYU, paint_setup_IYU2, paint_setup_Y41B)
(paint_setup_Y42B, paint_setup_Y800, paint_setup_IMC1)
(paint_setup_IMC2, paint_setup_IMC3, paint_setup_IMC4)
(paint_setup_YVU9, paint_setup_YUV9, paint_setup_xRGB8888)
(paint_setup_xBGR8888, paint_setup_RGBx8888)
(paint_setup_BGRx8888, paint_setup_RGB888, paint_setup_BGR888)
(paint_setup_RGB565, paint_setup_xRGB1555):
* gst/videotestsrc/videotestsrc.h:
* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c (gst_xvimagesink_get_xv_support)
(gst_xvimagesink_setcaps, gst_xvimagesink_buffer_alloc):
GCC4 fixes.
* ext/ogg/gstoggdemux.c (gst_ogg_demux_find_chains): Use the new
gst_pad_query_position. Fixes oggdemux.
2005-05-09 07:03:13 +00:00
|
|
|
gint64 value;
|
2005-03-31 09:43:49 +00:00
|
|
|
GstFormat my_format = GST_FORMAT_TIME;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
/* convert to time */
|
2005-05-09 10:56:13 +00:00
|
|
|
res = vorbis_dec_convert (pad, GST_EVENT_SEEK_FORMAT (event),
|
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
|
|
|
GST_EVENT_SEEK_OFFSET (event), &my_format, &value);
|
2004-01-29 02:50:20 +00:00
|
|
|
if (res) {
|
2004-03-15 19:32:28 +00:00
|
|
|
GstEvent *real_seek = gst_event_new_seek (
|
|
|
|
(GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) |
|
2005-03-31 09:43:49 +00:00
|
|
|
GST_FORMAT_TIME, value);
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek);
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
2004-01-31 11:24:18 +00:00
|
|
|
gst_event_unref (event);
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
res = gst_pad_event_default (pad, event);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return res;
|
|
|
|
}
|
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
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
static gboolean
|
|
|
|
vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
ext/: ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek) (gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain) ext...
Original commit message from CVS:
2005-05-09 Andy Wingo <wingo@pobox.com>
* ext/alsa/gstalsasink.h:
* ext/gnomevfs/gstgnomevfssrc.c:
(gst_gnomevfssrc_get_icy_metadata):
* ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek)
(gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain)
* ext/theora/theoradec.c (theora_dec_src_query)
(theora_dec_src_event, theora_dec_sink_event)
(theora_handle_comment_packet, theora_handle_data_packet):
* ext/theora/theoraenc.c (theora_enc_chain):
* ext/vorbis/vorbisdec.c (vorbis_dec_src_event)
(vorbis_dec_sink_event, vorbis_handle_comment_packet):
* gst/audioconvert/gstaudioconvert.c (gst_audio_convert_getcaps):
* gst/typefind/gsttypefindfunctions.c (mp3_type_find)
(qt_type_find):
* gst/videotestsrc/videotestsrc.c (paint_setup_I420)
(paint_setup_YV12, paint_setup_YUY2, paint_setup_UYVY)
(paint_setup_YVYU, paint_setup_IYU2, paint_setup_Y41B)
(paint_setup_Y42B, paint_setup_Y800, paint_setup_IMC1)
(paint_setup_IMC2, paint_setup_IMC3, paint_setup_IMC4)
(paint_setup_YVU9, paint_setup_YUV9, paint_setup_xRGB8888)
(paint_setup_xBGR8888, paint_setup_RGBx8888)
(paint_setup_BGRx8888, paint_setup_RGB888, paint_setup_BGR888)
(paint_setup_RGB565, paint_setup_xRGB1555):
* gst/videotestsrc/videotestsrc.h:
* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c (gst_xvimagesink_get_xv_support)
(gst_xvimagesink_setcaps, gst_xvimagesink_buffer_alloc):
GCC4 fixes.
* ext/ogg/gstoggdemux.c (gst_ogg_demux_find_chains): Use the new
gst_pad_query_position. Fixes oggdemux.
2005-05-09 07:03:13 +00:00
|
|
|
gint64 start_value, end_value, time, bytes;
|
2005-03-31 09:43:49 +00:00
|
|
|
gboolean ret = TRUE;
|
|
|
|
GstVorbisDec *dec;
|
|
|
|
|
|
|
|
dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
GST_LOG_OBJECT (dec, "handling event");
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_DISCONTINUOUS:
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
GST_STREAM_LOCK (pad);
|
2004-06-02 11:47:10 +00:00
|
|
|
if (gst_event_discont_get_value (event, GST_FORMAT_DEFAULT,
|
2005-03-31 09:43:49 +00:00
|
|
|
(gint64 *) & start_value, &end_value)) {
|
|
|
|
dec->granulepos = start_value;
|
2004-03-15 19:32:28 +00:00
|
|
|
GST_DEBUG_OBJECT (dec,
|
|
|
|
"setting granuleposition to %" G_GUINT64_FORMAT " after discont",
|
2005-03-31 09:43:49 +00:00
|
|
|
start_value);
|
2004-01-29 02:50:20 +00:00
|
|
|
} else {
|
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 (gst_event_discont_get_value (event, GST_FORMAT_TIME,
|
|
|
|
(gint64 *) & start_value, &end_value)) {
|
|
|
|
dec->granulepos = start_value * dec->vi.rate / GST_SECOND;
|
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
|
|
|
GST_DEBUG_OBJECT (dec,
|
|
|
|
"setting granuleposition to %" G_GUINT64_FORMAT " after discont",
|
|
|
|
dec->granulepos);
|
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
|
|
|
} else {
|
|
|
|
GST_WARNING_OBJECT (dec,
|
|
|
|
"discont event didn't include offset, we might set it wrong now");
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
dec->granulepos = -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
|
|
|
}
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
GST_DEBUG ("vd: discont %lld", dec->granulepos);
|
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/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
dec->granulepos = -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
|
|
|
|
2004-01-31 17:19:21 +00:00
|
|
|
if (dec->packetno < 3) {
|
2004-03-15 19:32:28 +00:00
|
|
|
if (dec->granulepos != 0)
|
|
|
|
GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL),
|
|
|
|
("can't handle discont before parsing first 3 packets"));
|
|
|
|
dec->packetno = 0;
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
#if 0
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_pad_push_event (dec->srcpad, gst_event_new_discontinuous (FALSE,
|
|
|
|
GST_FORMAT_TIME, (guint64) 0, GST_FORMAT_DEFAULT,
|
|
|
|
(guint64) 0, GST_FORMAT_BYTES, (guint64) 0, 0));
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
#endif
|
|
|
|
gst_event_ref (event);
|
|
|
|
gst_pad_push_event (dec->srcpad, event);
|
2004-01-31 17:19:21 +00:00
|
|
|
} else {
|
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
|
|
|
GstFormat time_format, default_format, bytes_format;
|
|
|
|
|
|
|
|
time_format = GST_FORMAT_TIME;
|
|
|
|
default_format = GST_FORMAT_DEFAULT;
|
|
|
|
bytes_format = GST_FORMAT_BYTES;
|
|
|
|
|
2004-03-15 19:32:28 +00:00
|
|
|
dec->packetno = 3;
|
|
|
|
/* if one of them works, all of them work */
|
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
|
|
|
if (vorbis_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT,
|
|
|
|
dec->granulepos, &time_format, &time)
|
|
|
|
&& vorbis_dec_convert (dec->srcpad, GST_FORMAT_DEFAULT,
|
|
|
|
dec->granulepos, &bytes_format, &bytes)) {
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
|
|
|
|
gst_event_ref (event);
|
|
|
|
gst_pad_push_event (dec->srcpad, event);
|
|
|
|
/*
|
|
|
|
gst_pad_push_event (dec->srcpad,
|
|
|
|
gst_event_new_discontinuous (FALSE, GST_FORMAT_TIME,
|
|
|
|
time, GST_FORMAT_DEFAULT, dec->granulepos,
|
|
|
|
GST_FORMAT_BYTES, bytes, 0));
|
|
|
|
*/
|
2004-03-15 19:32:28 +00:00
|
|
|
} else {
|
|
|
|
GST_ERROR_OBJECT (dec,
|
|
|
|
"failed to parse data for DISCONT event, not sending any");
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
gst_event_ref (event);
|
|
|
|
gst_pad_push_event (dec->srcpad, event);
|
2004-03-15 19:32:28 +00:00
|
|
|
}
|
2004-02-01 19:21:01 +00:00
|
|
|
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART
|
2004-03-15 19:32:28 +00:00
|
|
|
vorbis_synthesis_restart (&dec->vd);
|
2004-02-01 19:21:01 +00:00
|
|
|
#endif
|
2004-01-31 17:19:21 +00:00
|
|
|
}
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
GST_STREAM_UNLOCK (pad);
|
Port from GstData to GstMiniObject.
Original commit message from CVS:
Port from GstData to GstMiniObject.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page),
(gst_ogg_mux_queue_pads), (gst_ogg_mux_set_header_on_caps),
(gst_ogg_mux_collected):
* ext/ogg/gstogmparse.c: (gst_ogm_parse_chain):
* ext/theora/theoradec.c: (theora_handle_comment_packet),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_set_header_on_caps), (theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_comment_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_set_header_on_caps):
* ext/vorbis/vorbisparse.c: (vorbis_parse_set_header_on_caps):
* gst-libs/gst/audio/gstaudiofilter.c: (gst_audiofilter_chain):
* gst-libs/gst/tag/gstvorbistag.c: (gst_vorbis_tag_chain):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_get_buffer):
* gst/playback/gstdecodebin.c: (gst_decode_bin_class_init):
* gst/playback/gstplaybasebin.c: (check_queue), (probe_triggered),
(mute_stream), (silence_stream):
* gst/playback/gstplaybin.c: (gst_play_bin_class_init):
* gst/volume/gstvolume.c: (volume_transform):
* sys/ximage/ximagesink.c: (gst_ximage_buffer_finalize),
(gst_ximage_buffer_init), (gst_ximage_buffer_class_init),
(gst_ximage_buffer_get_type), (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new), (gst_ximagesink_ximage_destroy),
(gst_ximagesink_ximage_put), (gst_ximagesink_imagepool_clear),
(gst_ximagesink_show_frame), (gst_ximagesink_buffer_free),
(gst_ximagesink_buffer_alloc):
* sys/ximage/ximagesink.h:
2005-05-16 15:35:52 +00:00
|
|
|
gst_event_unref (event);
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
default:
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
ret = gst_pad_event_default (pad, event);
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
return ret;
|
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
|
|
|
|
vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
gchar *encoder = NULL;
|
2005-05-11 03:20:15 +00:00
|
|
|
GstMessage *message;
|
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
|
|
|
GstTagList *list;
|
|
|
|
GstBuffer *buf;
|
|
|
|
|
|
|
|
GST_DEBUG ("parsing comment packet");
|
|
|
|
|
|
|
|
buf = gst_buffer_new_and_alloc (packet->bytes);
|
|
|
|
GST_BUFFER_DATA (buf) = packet->packet;
|
|
|
|
|
ext/: ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek) (gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain) ext...
Original commit message from CVS:
2005-05-09 Andy Wingo <wingo@pobox.com>
* ext/alsa/gstalsasink.h:
* ext/gnomevfs/gstgnomevfssrc.c:
(gst_gnomevfssrc_get_icy_metadata):
* ext/ogg/gstoggdemux.c (gst_ogg_demux_perform_seek)
(gst_ogg_demux_read_chain, gst_ogg_demux_read_end_chain)
* ext/theora/theoradec.c (theora_dec_src_query)
(theora_dec_src_event, theora_dec_sink_event)
(theora_handle_comment_packet, theora_handle_data_packet):
* ext/theora/theoraenc.c (theora_enc_chain):
* ext/vorbis/vorbisdec.c (vorbis_dec_src_event)
(vorbis_dec_sink_event, vorbis_handle_comment_packet):
* gst/audioconvert/gstaudioconvert.c (gst_audio_convert_getcaps):
* gst/typefind/gsttypefindfunctions.c (mp3_type_find)
(qt_type_find):
* gst/videotestsrc/videotestsrc.c (paint_setup_I420)
(paint_setup_YV12, paint_setup_YUY2, paint_setup_UYVY)
(paint_setup_YVYU, paint_setup_IYU2, paint_setup_Y41B)
(paint_setup_Y42B, paint_setup_Y800, paint_setup_IMC1)
(paint_setup_IMC2, paint_setup_IMC3, paint_setup_IMC4)
(paint_setup_YVU9, paint_setup_YUV9, paint_setup_xRGB8888)
(paint_setup_xBGR8888, paint_setup_RGBx8888)
(paint_setup_BGRx8888, paint_setup_RGB888, paint_setup_BGR888)
(paint_setup_RGB565, paint_setup_xRGB1555):
* gst/videotestsrc/videotestsrc.h:
* sys/ximage/ximagesink.c (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c (gst_xvimagesink_get_xv_support)
(gst_xvimagesink_setcaps, gst_xvimagesink_buffer_alloc):
GCC4 fixes.
* ext/ogg/gstoggdemux.c (gst_ogg_demux_find_chains): Use the new
gst_pad_query_position. Fixes oggdemux.
2005-05-09 07:03:13 +00:00
|
|
|
list =
|
|
|
|
gst_tag_list_from_vorbiscomment_buffer (buf, (guint8 *) "\003vorbis", 7,
|
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
|
|
|
&encoder);
|
|
|
|
|
|
|
|
gst_buffer_unref (buf);
|
|
|
|
|
|
|
|
if (!list) {
|
|
|
|
GST_ERROR_OBJECT (vd, "couldn't decode comments");
|
|
|
|
list = gst_tag_list_new ();
|
|
|
|
}
|
|
|
|
if (encoder) {
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_ENCODER, encoder, NULL);
|
|
|
|
g_free (encoder);
|
|
|
|
}
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_ENCODER_VERSION, vd->vi.version,
|
|
|
|
GST_TAG_AUDIO_CODEC, "Vorbis", NULL);
|
|
|
|
if (vd->vi.bitrate_upper > 0)
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);
|
|
|
|
if (vd->vi.bitrate_nominal > 0)
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
|
|
|
|
if (vd->vi.bitrate_lower > 0)
|
|
|
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
|
|
|
GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);
|
|
|
|
|
2005-05-11 03:20:15 +00:00
|
|
|
message = gst_message_new_tag ((GstObject *) vd, list);
|
|
|
|
gst_element_post_message (GST_ELEMENT (vd), message);
|
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_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_type_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
const GstAudioChannelPosition *pos = NULL;
|
|
|
|
|
|
|
|
/* done */
|
|
|
|
vorbis_synthesis_init (&vd->vd, &vd->vi);
|
|
|
|
vorbis_block_init (&vd->vd, &vd->vb);
|
|
|
|
caps = gst_caps_new_simple ("audio/x-raw-float",
|
|
|
|
"rate", G_TYPE_INT, vd->vi.rate,
|
|
|
|
"channels", G_TYPE_INT, vd->vi.channels,
|
|
|
|
"endianness", G_TYPE_INT, G_BYTE_ORDER,
|
|
|
|
"width", G_TYPE_INT, 32, "buffer-frames", G_TYPE_INT, 0, NULL);
|
|
|
|
|
|
|
|
switch (vd->vi.channels) {
|
|
|
|
case 1:
|
|
|
|
case 2:
|
|
|
|
/* nothing */
|
|
|
|
break;
|
|
|
|
case 3:{
|
|
|
|
static GstAudioChannelPosition pos3[] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
|
|
|
|
};
|
|
|
|
pos = pos3;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 4:{
|
|
|
|
static GstAudioChannelPosition pos4[] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT
|
|
|
|
};
|
|
|
|
pos = pos4;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 5:{
|
|
|
|
static GstAudioChannelPosition pos5[] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT
|
|
|
|
};
|
|
|
|
pos = pos5;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case 6:{
|
|
|
|
static GstAudioChannelPosition pos6[] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE
|
|
|
|
};
|
|
|
|
pos = pos6;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
goto channel_count_error;
|
|
|
|
}
|
|
|
|
if (pos) {
|
|
|
|
gst_audio_set_channel_positions (gst_caps_get_structure (caps, 0), pos);
|
|
|
|
}
|
|
|
|
gst_pad_set_caps (vd->srcpad, caps);
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
|
|
|
|
vd->initialized = TRUE;
|
|
|
|
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
|
|
|
/* ERROR */
|
|
|
|
channel_count_error:
|
|
|
|
{
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
GST_ELEMENT_ERROR (vd, STREAM, NOT_IMPLEMENTED, (NULL),
|
|
|
|
("Unsupported channel count %d", vd->vi.channels));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_header_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
GstFlowReturn res;
|
|
|
|
|
|
|
|
GST_DEBUG ("parsing header packet");
|
|
|
|
|
|
|
|
/* Packetno = 0 if the first byte is exactly 0x01 */
|
|
|
|
packet->b_o_s = (packet->packet[0] == 0x1) ? 1 : 0;
|
|
|
|
|
|
|
|
if (vorbis_synthesis_headerin (&vd->vi, &vd->vc, packet))
|
|
|
|
goto header_read_error;
|
|
|
|
|
|
|
|
switch (packet->packetno) {
|
|
|
|
case 1:
|
|
|
|
res = vorbis_handle_comment_packet (vd, packet);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
res = vorbis_handle_type_packet (vd, packet);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* ignore */
|
|
|
|
res = GST_FLOW_OK;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return res;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
header_read_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("couldn't read header packet"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
copy_samples (float *out, float **in, guint samples, gint channels)
|
|
|
|
{
|
|
|
|
gint i, j;
|
|
|
|
|
|
|
|
#ifdef GST_VORBIS_DEC_SEQUENTIAL
|
|
|
|
for (i = 0; i < channels; i++) {
|
|
|
|
memcpy (out, in[i], samples * sizeof (float));
|
|
|
|
out += samples;
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
for (j = 0; j < samples; j++) {
|
|
|
|
for (i = 0; i < channels; i++) {
|
|
|
|
*out++ = in[i][j];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet)
|
|
|
|
{
|
|
|
|
float **pcm;
|
|
|
|
guint sample_count;
|
|
|
|
GstFlowReturn result;
|
|
|
|
|
|
|
|
if (!vd->initialized)
|
|
|
|
goto not_initialized;
|
|
|
|
|
|
|
|
/* normal data packet */
|
|
|
|
if (vorbis_synthesis (&vd->vb, packet))
|
|
|
|
goto could_not_read;
|
|
|
|
|
|
|
|
if (vorbis_synthesis_blockin (&vd->vd, &vd->vb) < 0)
|
|
|
|
goto not_accepted;
|
|
|
|
|
|
|
|
sample_count = vorbis_synthesis_pcmout (&vd->vd, &pcm);
|
|
|
|
if (sample_count > 0) {
|
|
|
|
GstBuffer *out;
|
|
|
|
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
result = gst_pad_alloc_buffer (vd->srcpad, GST_BUFFER_OFFSET_NONE,
|
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
|
|
|
sample_count * vd->vi.channels * sizeof (float),
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
GST_PAD_CAPS (vd->srcpad), &out);
|
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
|
|
|
|
Cleanups and buffer alloc.
Original commit message from CVS:
* ext/ogg/README:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_clear_chains):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_buffer_from_page):
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_handle_data_packet):
* ext/theora/theoraenc.c: (theora_buffer_from_packet),
(theora_enc_chain):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet):
* gst/audioconvert/bufferframesconvert.c:
(buffer_frames_convert_chain):
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_getcaps), (gst_ffmpegcsp_configure_context),
(gst_ffmpegcsp_setcaps), (gst_ffmpegcsp_bufferalloc),
(gst_ffmpegcsp_chain):
* gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
(gst_videorate_getcaps), (gst_videorate_setcaps),
(gst_videorate_event), (gst_videorate_chain):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_activate),
(gst_videotestsrc_src_query), (gst_videotestsrc_loop):
* sys/ximage/ximagesink.c: (gst_ximagesink_ximage_new),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
* sys/xvimage/xvimagesink.c: (gst_xvimage_buffer_destroy),
(gst_xvimage_buffer_finalize), (gst_xvimage_buffer_free),
(gst_xvimage_buffer_class_init), (gst_xvimage_buffer_get_type),
(gst_xvimagesink_xvimage_new), (gst_xvimagesink_xvimage_put),
(gst_xvimagesink_show_frame), (gst_xvimagesink_buffer_alloc):
Cleanups and buffer alloc.
2005-06-02 09:46:40 +00:00
|
|
|
if (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
|
|
|
float *out_data = (float *) GST_BUFFER_DATA (out);
|
|
|
|
|
|
|
|
copy_samples (out_data, pcm, sample_count, vd->vi.channels);
|
|
|
|
|
|
|
|
GST_BUFFER_OFFSET (out) = vd->granulepos;
|
|
|
|
GST_BUFFER_OFFSET_END (out) = vd->granulepos + sample_count;
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
if (vd->granulepos != -1)
|
|
|
|
GST_BUFFER_TIMESTAMP (out) = vd->granulepos * GST_SECOND / vd->vi.rate;
|
|
|
|
else
|
|
|
|
GST_BUFFER_TIMESTAMP (out) = -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
|
|
|
GST_BUFFER_DURATION (out) = sample_count * GST_SECOND / vd->vi.rate;
|
|
|
|
|
|
|
|
result = gst_pad_push (vd->srcpad, out);
|
|
|
|
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
if (vd->granulepos != -1)
|
|
|
|
vd->granulepos += sample_count;
|
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
|
|
|
} else {
|
|
|
|
/* no buffer.. */
|
|
|
|
result = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
vorbis_synthesis_read (&vd->vd, sample_count);
|
|
|
|
} else {
|
|
|
|
/* no samples.. */
|
|
|
|
result = GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
not_initialized:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
|
|
|
|
(NULL), ("no header sent yet (packet no is %d)", packet->packetno));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
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-03-31 09:43:49 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
vorbis_dec_chain (GstPad * pad, GstBuffer * buffer)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
|
|
|
GstVorbisDec *vd;
|
2005-03-31 09:43:49 +00:00
|
|
|
ogg_packet packet;
|
|
|
|
GstFlowReturn result = GST_FLOW_OK;
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
vd = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
|
2004-01-29 02:50:20 +00:00
|
|
|
|
|
|
|
/* make ogg_packet out of the buffer */
|
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
|
|
|
packet.packet = GST_BUFFER_DATA (buffer);
|
|
|
|
packet.bytes = GST_BUFFER_SIZE (buffer);
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
packet.granulepos = vd->granulepos;
|
2004-03-14 22:34:34 +00:00
|
|
|
packet.packetno = vd->packetno++;
|
2004-05-31 04:56:55 +00:00
|
|
|
/*
|
|
|
|
* FIXME. Is there anyway to know that this is the last packet and
|
|
|
|
* set e_o_s??
|
|
|
|
*/
|
|
|
|
packet.e_o_s = 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
|
|
|
GST_DEBUG ("vorbis granule: %lld", packet.granulepos);
|
|
|
|
|
2004-01-29 02:50:20 +00:00
|
|
|
/* switch depending on packet type */
|
|
|
|
if (packet.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) {
|
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_WARNING_OBJECT (vd, "Ignoring header");
|
|
|
|
goto done;
|
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
|
|
|
result = vorbis_handle_header_packet (vd, &packet);
|
2004-01-29 02:50:20 +00:00
|
|
|
} else {
|
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
|
|
|
result = vorbis_handle_data_packet (vd, &packet);
|
|
|
|
}
|
2005-03-31 09:43:49 +00:00
|
|
|
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
GST_DEBUG ("offset end: %lld", GST_BUFFER_OFFSET_END (buffer));
|
|
|
|
|
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
|
|
|
/* granulepos is the last sample in the packet */
|
|
|
|
if (GST_BUFFER_OFFSET_END_IS_VALID (buffer))
|
|
|
|
vd->granulepos = GST_BUFFER_OFFSET_END (buffer);;
|
|
|
|
|
|
|
|
done:
|
2005-03-31 09:43:49 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
|
|
|
|
return result;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GstElementStateReturn
|
2004-03-14 22:34:34 +00:00
|
|
|
vorbis_dec_change_state (GstElement * element)
|
2004-01-29 02:50:20 +00:00
|
|
|
{
|
|
|
|
GstVorbisDec *vd = GST_VORBIS_DEC (element);
|
2005-03-31 09:43:49 +00:00
|
|
|
GstElementState transition;
|
|
|
|
GstElementStateReturn res;
|
|
|
|
|
|
|
|
transition = GST_STATE_TRANSITION (element);
|
2004-01-29 02:50:20 +00:00
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
switch (transition) {
|
2004-01-29 02:50:20 +00:00
|
|
|
case GST_STATE_NULL_TO_READY:
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_PAUSED:
|
|
|
|
vorbis_info_init (&vd->vi);
|
|
|
|
vorbis_comment_init (&vd->vc);
|
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
|
|
|
vd->initialized = FALSE;
|
ext/: Remove STREAM locks as they are taken in core now.
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_dispose),
(gst_ogg_pad_typefind), (gst_ogg_pad_submit_packet),
(gst_ogg_chain_new_stream), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_chain), (gst_ogg_demux_loop),
(gst_ogg_demux_sink_activate):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_handle_comment_packet), (theora_dec_chain),
(theora_dec_change_state):
* ext/vorbis/vorbisdec.c: (vorbis_dec_sink_event),
(vorbis_handle_data_packet), (vorbis_dec_chain),
(vorbis_dec_change_state):
Remove STREAM locks as they are taken in core now.
Never set bogus granulepos on vorbis/theora.
Fix leaks in theoradec tag parsing.
2005-05-25 12:04:37 +00:00
|
|
|
vd->granulepos = -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
|
|
|
vd->packetno = 0;
|
2004-01-29 02:50:20 +00:00
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_PLAYING:
|
|
|
|
break;
|
2005-03-31 09:43:49 +00:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
res = parent_class->change_state (element);
|
|
|
|
|
|
|
|
switch (transition) {
|
2004-01-29 02:50:20 +00:00
|
|
|
case GST_STATE_PLAYING_TO_PAUSED:
|
|
|
|
break;
|
|
|
|
case GST_STATE_PAUSED_TO_READY:
|
|
|
|
vorbis_block_clear (&vd->vb);
|
|
|
|
vorbis_dsp_clear (&vd->vd);
|
|
|
|
vorbis_comment_clear (&vd->vc);
|
|
|
|
vorbis_info_clear (&vd->vi);
|
|
|
|
break;
|
|
|
|
case GST_STATE_READY_TO_NULL:
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2005-03-31 09:43:49 +00:00
|
|
|
return res;
|
2004-01-29 02:50:20 +00:00
|
|
|
}
|