2005-04-28 Wim Taymans <wim@fluendo.com>
+ * 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 Wim Taymans <wim@fluendo.com>
+
* examples/seeking/seek.c: (make_mod_pipeline), (make_dv_pipeline),
(make_wav_pipeline), (make_flac_pipeline), (make_sid_pipeline),
(make_vorbis_pipeline), (make_vorbis_theora_pipeline),
GstElementClass parent_class;
};
+static GstStaticPadTemplate internaltemplate =
+GST_STATIC_PAD_TEMPLATE ("internal",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_STATIC_CAPS_ANY);
+
static gboolean gst_ogg_demux_perform_seek (GstOggDemux * ogg, gint64 pos);
static void gst_ogg_pad_class_init (GstOggPadClass * klass);
/* FIXME, it might not be named "sink" */
pad->elem_pad = gst_element_get_pad (element, "sink");
gst_element_set_state (element, GST_STATE_PAUSED);
- pad->elem_out = gst_pad_new ("internal", GST_PAD_SINK);
+ pad->elem_out =
+ gst_pad_new_from_template (gst_static_pad_template_get
+ (&internaltemplate), "internal");
gst_pad_set_chain_function (pad->elem_out,
gst_ogg_pad_internal_chain);
gst_pad_set_element_private (pad->elem_out, pad);
bisect = (target - begintime) / GST_MSECOND * rate + begin - CHUNKSIZE;
if (bisect <= begin)
- bisect = begin + 1;
+ bisect = begin;
}
gst_ogg_demux_seek (ogg, bisect);
GstVorbisDec *dec;
guint64 scale = 1;
- dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
+ dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
if (dec->packetno < 1)
return FALSE;
gint64 * value)
{
gint64 granulepos = 0;
- GstVorbisDec *dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
+ GstVorbisDec *dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
if (query == GST_QUERY_POSITION) {
granulepos = dec->granulepos;
vorbis_dec_src_event (GstPad * pad, GstEvent * event)
{
gboolean res = TRUE;
- GstVorbisDec *dec = GST_VORBIS_DEC (gst_pad_get_parent (pad));
+ GstVorbisDec *dec = GST_VORBIS_DEC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:{
if (gst_event_discont_get_value (event, GST_FORMAT_TIME,
(gint64 *) & start_value, &end_value)) {
dec->granulepos = start_value * dec->vi.rate / GST_SECOND;
+ GST_DEBUG_OBJECT (dec,
+ "setting granuleposition to %" G_GUINT64_FORMAT " after discont",
+ dec->granulepos);
} else {
GST_WARNING_OBJECT (dec,
"discont event didn't include offset, we might set it wrong now");
{
GstFlowReturn res;
- if (packet->packet[0] / 2 != packet->packetno)
- goto unexpected_packet;
-
GST_DEBUG ("parsing header packet");
/* Packetno = 0 if the first byte is exactly 0x01 */
return res;
/* ERRORS */
-unexpected_packet:
- {
- /* FIXME: just skip? */
- GST_WARNING_OBJECT (GST_ELEMENT (vd),
- "unexpected packet type %d, expected %d",
- (gint) packet->packet[0], (gint) packet->packetno);
- return GST_FLOW_UNEXPECTED;
- }
header_read_error:
{
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
/* switch depending on packet type */
if (packet.packet[0] & 1) {
- if (packet.packetno > 3) {
+ if (vd->initialized) {
GST_WARNING_OBJECT (vd, "Ignoring header");
goto done;
}