ext/theora/: Copy seqnum.

Original commit message from CVS:
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_type_packet):
Copy seqnum.
Keep events in a pending list, like vorbisdec, instead of trying
to construct a segment event ourselves.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Copy seqnum.
This commit is contained in:
Wim Taymans 2008-11-04 18:17:24 +00:00
parent 7f347c61c0
commit 68eb1421af
5 changed files with 39 additions and 15 deletions

View file

@ -1,3 +1,18 @@
2008-11-04 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/theora/gsttheoradec.h:
* ext/theora/theoradec.c: (gst_theora_dec_init),
(gst_theora_dec_reset), (theora_dec_src_event),
(theora_dec_sink_event), (theora_handle_type_packet):
Copy seqnum.
Keep events in a pending list, like vorbisdec, instead of trying
to construct a segment event ourselves.
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_reset),
(vorbis_dec_src_event), (vorbis_dec_sink_event):
* ext/vorbis/vorbisdec.h:
Copy seqnum.
2008-11-04 Wim Taymans <wim.taymans@collabora.co.uk> 2008-11-04 Wim Taymans <wim.taymans@collabora.co.uk>
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet), * ext/ogg/gstoggdemux.c: (gst_ogg_pad_submit_packet),

View file

@ -63,7 +63,6 @@ struct _GstTheoraDec
theora_comment comment; theora_comment comment;
gboolean have_header; gboolean have_header;
gboolean sent_newsegment;
gboolean is_old_bitstream; gboolean is_old_bitstream;
guint64 granulepos; guint64 granulepos;
guint64 granule_shift; guint64 granule_shift;
@ -83,12 +82,14 @@ struct _GstTheoraDec
/* gather/decode queues for reverse playback */ /* gather/decode queues for reverse playback */
GList *gather; GList *gather;
GList *decode; GList *decode;
GList *pendingevents;
GstTagList *tags; GstTagList *tags;
/* segment info */ /* with STREAM_LOCK */ /* segment info */ /* with STREAM_LOCK */
GstSegment segment; GstSegment segment;
gboolean discont; gboolean discont;
guint32 seqnum;
/* QoS stuff */ /* with LOCK*/ /* QoS stuff */ /* with LOCK*/
gdouble proportion; gdouble proportion;

View file

@ -164,17 +164,18 @@ gst_theora_dec_init (GstTheoraDec * dec, GstTheoraDecClass * g_class)
dec->gather = NULL; dec->gather = NULL;
dec->decode = NULL; dec->decode = NULL;
dec->queued = NULL; dec->queued = NULL;
dec->pendingevents = NULL;
} }
static void static void
gst_theora_dec_reset (GstTheoraDec * dec) gst_theora_dec_reset (GstTheoraDec * dec)
{ {
dec->need_keyframe = TRUE; dec->need_keyframe = TRUE;
dec->sent_newsegment = FALSE;
dec->last_timestamp = -1; dec->last_timestamp = -1;
dec->granulepos = -1; dec->granulepos = -1;
dec->discont = TRUE; dec->discont = TRUE;
dec->frame_nr = -1; dec->frame_nr = -1;
dec->seqnum = gst_util_seqnum_next ();
gst_segment_init (&dec->segment, GST_FORMAT_TIME); gst_segment_init (&dec->segment, GST_FORMAT_TIME);
GST_OBJECT_LOCK (dec); GST_OBJECT_LOCK (dec);
@ -191,6 +192,9 @@ gst_theora_dec_reset (GstTheoraDec * dec)
g_list_foreach (dec->decode, (GFunc) gst_mini_object_unref, NULL); g_list_foreach (dec->decode, (GFunc) gst_mini_object_unref, NULL);
g_list_free (dec->decode); g_list_free (dec->decode);
dec->decode = NULL; dec->decode = NULL;
g_list_foreach (dec->pendingevents, (GFunc) gst_mini_object_unref, NULL);
g_list_free (dec->pendingevents);
dec->pendingevents = NULL;
if (dec->tags) { if (dec->tags) {
gst_tag_list_free (dec->tags); gst_tag_list_free (dec->tags);
@ -599,9 +603,11 @@ theora_dec_src_event (GstPad * pad, GstEvent * event)
GstSeekType cur_type, stop_type; GstSeekType cur_type, stop_type;
gint64 cur, stop; gint64 cur, stop;
gint64 tcur, tstop; gint64 tcur, tstop;
guint32 seqnum;
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop); &stop_type, &stop);
seqnum = gst_event_get_seqnum (event);
gst_event_unref (event); gst_event_unref (event);
/* we have to ask our peer to seek to time here as we know /* we have to ask our peer to seek to time here as we know
@ -619,6 +625,7 @@ theora_dec_src_event (GstPad * pad, GstEvent * event)
/* then seek with time on the peer */ /* then seek with time on the peer */
real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
flags, cur_type, tcur, stop_type, tstop); flags, cur_type, tcur, stop_type, tstop);
gst_event_set_seqnum (real_seek, seqnum);
res = gst_pad_push_event (dec->sinkpad, real_seek); res = gst_pad_push_event (dec->sinkpad, real_seek);
break; break;
@ -700,13 +707,13 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
/* now configure the values */ /* now configure the values */
gst_segment_set_newsegment_full (&dec->segment, update, gst_segment_set_newsegment_full (&dec->segment, update,
rate, arate, format, start, stop, time); rate, arate, format, start, stop, time);
dec->seqnum = gst_event_get_seqnum (event);
/* We don't forward this unless/until the decoder is initialised */ /* We don't forward this unless/until the decoder is initialised */
if (dec->have_header) { if (dec->have_header) {
ret = gst_pad_push_event (dec->srcpad, event); ret = gst_pad_push_event (dec->srcpad, event);
dec->sent_newsegment = TRUE;
} else { } else {
gst_event_unref (event); dec->pendingevents = g_list_append (dec->pendingevents, event);
ret = TRUE; ret = TRUE;
} }
break; break;
@ -796,9 +803,8 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
GstCaps *caps; GstCaps *caps;
gint par_num, par_den; gint par_num, par_den;
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
gboolean eret;
GstEvent *event;
guint32 bitstream_version; guint32 bitstream_version;
GList *walk;
GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d", GST_DEBUG_OBJECT (dec, "fps %d/%d, PAR %d/%d",
dec->info.fps_numerator, dec->info.fps_denominator, dec->info.fps_numerator, dec->info.fps_denominator,
@ -886,15 +892,12 @@ theora_handle_type_packet (GstTheoraDec * dec, ogg_packet * packet)
gst_caps_unref (caps); gst_caps_unref (caps);
dec->have_header = TRUE; dec->have_header = TRUE;
if (!dec->sent_newsegment) {
GST_DEBUG_OBJECT (dec, "Sending newsegment event");
event = gst_event_new_new_segment_full (FALSE, if (dec->pendingevents) {
dec->segment.rate, dec->segment.applied_rate, for (walk = dec->pendingevents; walk; walk = g_list_next (walk))
dec->segment.format, dec->segment.start, dec->segment.stop, gst_pad_push_event (dec->srcpad, GST_EVENT_CAST (walk->data));
dec->segment.time); g_list_free (dec->pendingevents);
eret = gst_pad_push_event (dec->srcpad, event); dec->pendingevents = NULL;
dec->sent_newsegment = TRUE;
} }
if (dec->tags) { if (dec->tags) {

View file

@ -188,6 +188,7 @@ gst_vorbis_dec_reset (GstVorbisDec * dec)
dec->prev_timestamp = GST_CLOCK_TIME_NONE; dec->prev_timestamp = GST_CLOCK_TIME_NONE;
dec->granulepos = -1; dec->granulepos = -1;
dec->discont = TRUE; dec->discont = TRUE;
dec->seqnum = gst_util_seqnum_next ();
gst_segment_init (&dec->segment, GST_FORMAT_TIME); gst_segment_init (&dec->segment, GST_FORMAT_TIME);
g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL); g_list_foreach (dec->queued, (GFunc) gst_mini_object_unref, NULL);
@ -443,9 +444,11 @@ vorbis_dec_src_event (GstPad * pad, GstEvent * event)
GstSeekType cur_type, stop_type; GstSeekType cur_type, stop_type;
gint64 cur, stop; gint64 cur, stop;
gint64 tcur, tstop; gint64 tcur, tstop;
guint32 seqnum;
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur, gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop); &stop_type, &stop);
seqnum = gst_event_get_seqnum (event);
gst_event_unref (event); gst_event_unref (event);
/* we have to ask our peer to seek to time here as we know /* we have to ask our peer to seek to time here as we know
@ -463,9 +466,9 @@ vorbis_dec_src_event (GstPad * pad, GstEvent * event)
/* then seek with time on the peer */ /* then seek with time on the peer */
real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME, real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
flags, cur_type, tcur, stop_type, tstop); flags, cur_type, tcur, stop_type, tstop);
gst_event_set_seqnum (real_seek, seqnum);
res = gst_pad_push_event (dec->sinkpad, real_seek); res = gst_pad_push_event (dec->sinkpad, real_seek);
break; break;
} }
default: default:
@ -532,6 +535,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
/* now configure the values */ /* now configure the values */
gst_segment_set_newsegment_full (&dec->segment, update, gst_segment_set_newsegment_full (&dec->segment, update,
rate, arate, format, start, stop, time); rate, arate, format, start, stop, time);
dec->seqnum = gst_event_get_seqnum (event);
if (dec->initialized) if (dec->initialized)
/* and forward */ /* and forward */

View file

@ -71,6 +71,7 @@ struct _GstVorbisDec {
GstSegment segment; GstSegment segment;
gboolean discont; gboolean discont;
guint32 seqnum;
GstClockTime cur_timestamp; /* only used with non-ogg container formats */ GstClockTime cur_timestamp; /* only used with non-ogg container formats */
GstClockTime prev_timestamp; /* only used with non-ogg container formats */ GstClockTime prev_timestamp; /* only used with non-ogg container formats */