Various event updates and cleanups.

Original commit message from CVS:
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
This commit is contained in:
Wim Taymans 2005-07-27 18:37:25 +00:00
parent 03846ac272
commit a9166d4c28
7 changed files with 221 additions and 108 deletions

View file

@ -1,3 +1,28 @@
2005-07-27 Wim Taymans <wim@fluendo.com>
* ext/amrnb/amrnbparse.c: (gst_amrnbparse_event),
(gst_amrnbparse_loop):
* ext/dv/gstdvdec.c: (gst_dvdec_handle_sink_event),
(gst_dvdec_handle_src_event), (gst_dvdec_decode_frame):
* ext/mad/gstid3tag.c: (gst_id3_tag_src_event),
(gst_id3_tag_sink_event), (gst_id3_tag_chain):
* ext/mad/gstmad.c: (gst_mad_src_query), (index_seek),
(normal_seek), (gst_mad_sink_event), (gst_mad_chain):
* ext/mpeg2dec/gstmpeg2dec.c:
* ext/shout2/gstshout2.c: (gst_shout2send_event):
* ext/sidplay/gstsiddec.cc:
* gst/avi/gstavidemux.c: (gst_avi_demux_handle_src_event),
(gst_avi_demux_send_event), (gst_avi_demux_stream_header),
(gst_avi_demux_handle_seek), (gst_avi_demux_process_next_entry):
* gst/goom/gstgoom.c: (gst_goom_event):
* gst/realmedia/rmdemux.c: (gst_rmdemux_sink_event),
(gst_rmdemux_chain), (gst_rmdemux_send_event),
(gst_rmdemux_add_stream):
* gst/wavparse/gstwavparse.c: (gst_wavparse_handle_seek),
(gst_wavparse_stream_headers), (gst_wavparse_stream_data),
(gst_wavparse_loop), (gst_wavparse_srcpad_event):
Various event updates and cleanups.
2005-07-25 Christian Schaller <uraeus@gnome.org>

View file

@ -243,7 +243,6 @@ gst_amrnbparse_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
case GST_EVENT_DISCONTINUOUS:
default:
break;
}
@ -430,7 +429,7 @@ need_pause:
eos:
{
GST_LOG_OBJECT (amrnbparse, "pausing task");
gst_pad_push_event (amrnbparse->srcpad, gst_event_new (GST_EVENT_EOS));
gst_pad_push_event (amrnbparse->srcpad, gst_event_new_eos ());
gst_pad_pause_task (pad);
return;
}

View file

@ -466,44 +466,56 @@ static gboolean
gst_id3_tag_src_event (GstPad * pad, GstEvent * event)
{
GstID3Tag *tag;
gboolean res = FALSE;
tag = GST_ID3_TAG (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:
if (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_BYTES &&
{
gdouble rate;
GstFormat format;
GstSeekType cur_type, stop_type;
GstSeekFlags flags;
gint64 cur, stop;
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
if (format == GST_FORMAT_BYTES &&
tag->state == GST_ID3_TAG_STATE_NORMAL &&
GST_PAD_PEER (tag->sinkpad)) {
gst_pad_is_linked (tag->sinkpad)) {
GstEvent *new;
gint diff = 0;
switch (GST_EVENT_SEEK_METHOD (event)) {
case GST_SEEK_METHOD_SET:
switch (cur_type) {
case GST_SEEK_TYPE_SET:
diff = tag->v2tag_size - tag->v2tag_size_new;
break;
case GST_SEEK_METHOD_CUR:
case GST_SEEK_TYPE_CUR:
break;
case GST_SEEK_METHOD_END:
diff =
GST_EVENT_SEEK_OFFSET (event) ? tag->v1tag_size_new -
tag->v1tag_size : 0;
case GST_SEEK_TYPE_END:
diff = cur ? tag->v1tag_size_new - tag->v1tag_size : 0;
break;
default:
g_assert_not_reached ();
break;
}
new = gst_event_new_seek (GST_EVENT_SEEK_TYPE (event),
GST_EVENT_SEEK_OFFSET (event) + diff);
gst_event_unref (event);
return gst_pad_push_event (tag->sinkpad, new);
new = gst_event_new_seek (rate, format, flags,
cur_type, cur + diff, stop_type, stop);
gst_pad_push_event (tag->sinkpad, new);
res = TRUE;
}
break;
}
default:
break;
}
gst_event_unref (event);
return FALSE;
gst_object_unref (tag);
return res;
}
GstTagList *
@ -773,7 +785,8 @@ gst_id3_tag_sink_event (GstPad * pad, GstEvent * event)
GstID3Tag *tag = GST_ID3_TAG (gst_pad_get_parent (pad));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
case GST_EVENT_NEWSEGMENT:
#if 0
switch (tag->state) {
case GST_ID3_TAG_STATE_READING_V2_TAG:{
gint64 value, end_value;
@ -844,16 +857,22 @@ gst_id3_tag_sink_event (GstPad * pad, GstEvent * event)
default:
g_assert_not_reached ();
}
#endif
break;
case GST_EVENT_TAG:
{
GstTagList *list;
gst_event_parse_tag (event, &list);
if (tag->event_tags) {
gst_tag_list_insert (tag->event_tags, gst_event_tag_get_list (event),
GST_TAG_MERGE_PREPEND);
gst_tag_list_insert (tag->event_tags, list, GST_TAG_MERGE_PREPEND);
} else {
tag->event_tags = gst_tag_list_copy (gst_event_tag_get_list (event));
tag->event_tags = gst_tag_list_copy (list);
}
gst_event_unref (event);
break;
}
case GST_EVENT_EOS:
if (tag->v1tag_render && IS_MUXER (tag)) {
GstTagList *merged;
@ -1088,19 +1107,21 @@ gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer)
/* seek to beginning */
GST_LOG_OBJECT (tag, "seeking back to beginning");
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_SEEKING_TO_NORMAL);
#if 0
if (!gst_pad_push_event (tag->sinkpad,
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, tag->v2tag_size))) {
GST_ELEMENT_ERROR (tag, CORE, SEEK, (NULL),
("can't seek back to beginning from reading ID3v1 tag"));
}
#endif
} else {
gst_id3_tag_send_tag_event (tag);
/* set eos, we're done parsing tags */
GST_LOG_OBJECT (tag, "setting EOS after reading ID3v1 tag");
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_NORMAL);
//gst_element_set_eos (GST_ELEMENT (tag));
gst_pad_push_event (tag->srcpad, gst_event_new (GST_EVENT_EOS));
gst_pad_push_event (tag->srcpad, gst_event_new_eos ());
}
return GST_FLOW_OK;
case GST_ID3_TAG_STATE_READING_V2_TAG:
@ -1164,12 +1185,14 @@ gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer)
return GST_FLOW_OK;
/* seek to ID3v1 tag */
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_SEEKING_TO_V1_TAG);
#if 0
if (gst_pad_push_event (tag->sinkpad,
gst_event_new_seek (GST_FORMAT_BYTES | GST_SEEK_METHOD_END |
GST_SEEK_FLAG_FLUSH, -128))) {
gst_buffer_unref (buffer);
return GST_FLOW_OK;
}
#endif
gst_id3_tag_set_state (tag, GST_ID3_TAG_STATE_NORMAL_START);
/* fall through */
case GST_ID3_TAG_STATE_NORMAL_START:
@ -1212,7 +1235,7 @@ gst_id3_tag_chain (GstPad * pad, GstBuffer * buffer)
if (tag->parse_mode == GST_ID3_TAG_PARSE_ANY) {
gst_buffer_unref (buffer);
//gst_element_set_eos (GST_ELEMENT (tag));
gst_pad_push_event (tag->srcpad, gst_event_new (GST_EVENT_EOS));
gst_pad_push_event (tag->srcpad, gst_event_new_eos ());
} else {
if (GST_BUFFER_OFFSET_IS_VALID (buffer)) {
if (buffer->offset >= tag->v1tag_offset) {

View file

@ -638,6 +638,12 @@ error:
static gboolean
index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
{
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
/* since we know the exact byteoffset of the frame,
make sure to try bytes first */
@ -649,10 +655,12 @@ index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
const GstFormat *try_formats = try_all_formats;
const GstFormat *peer_formats;
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
GstIndexEntry *entry = gst_index_get_assoc_entry (mad->index, mad->index_id,
GST_INDEX_LOOKUP_BEFORE, 0,
GST_EVENT_SEEK_FORMAT (event),
GST_EVENT_SEEK_OFFSET (event));
format, cur);
GST_DEBUG ("index seek");
@ -674,18 +682,17 @@ index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
GST_DEBUG ("index %s %" G_GINT64_FORMAT
" -> %s %" G_GINT64_FORMAT,
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
GST_EVENT_SEEK_OFFSET (event),
gst_format_get_details (*try_formats)->nick, value);
gst_format_get_details (format)->nick,
cur, gst_format_get_details (*try_formats)->nick, value);
seek_event = gst_event_new_seek (*try_formats |
GST_SEEK_METHOD_SET | GST_SEEK_FLAG_FLUSH, value);
seek_event = gst_event_new_seek (rate, *try_formats, flags,
cur_type, value, stop_type, stop);
if (gst_pad_send_event (GST_PAD_PEER (mad->sinkpad), seek_event)) {
/* seek worked, we're done, loop will exit */
mad->restart = TRUE;
g_assert (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_TIME);
mad->segment_start = GST_EVENT_SEEK_OFFSET (event);
g_assert (format == GST_FORMAT_TIME);
mad->segment_start = cur;
return TRUE;
}
}
@ -698,8 +705,13 @@ index_seek (GstMad * mad, GstPad * pad, GstEvent * event)
static gboolean
normal_seek (GstMad * mad, GstPad * pad, GstEvent * event)
{
gint64 time_offset, bytes_offset;
GstFormat format;
gdouble rate;
GstFormat format, conv;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gint64 time_cur, time_stop;
gint64 bytes_cur, bytes_stop;
guint flush;
/* const GstFormat *peer_formats; */
@ -707,39 +719,46 @@ normal_seek (GstMad * mad, GstPad * pad, GstEvent * event)
GST_DEBUG ("normal seek");
format = GST_FORMAT_TIME;
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_TIME) {
if (!gst_mad_convert_src (pad, GST_EVENT_SEEK_FORMAT (event),
GST_EVENT_SEEK_OFFSET (event), &format, &time_offset)) {
/* probably unsupported seek format */
GST_DEBUG ("failed to convert format %u into GST_FORMAT_TIME",
GST_EVENT_SEEK_FORMAT (event));
return FALSE;
}
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
if (format != GST_FORMAT_TIME) {
conv = GST_FORMAT_TIME;
if (!gst_mad_convert_src (pad, format, cur, &conv, &time_cur))
goto convert_error;
if (!gst_mad_convert_src (pad, format, stop, &conv, &time_stop))
goto convert_error;
} else {
time_offset = GST_EVENT_SEEK_OFFSET (event);
time_cur = cur;
time_stop = stop;
}
GST_DEBUG ("seek to time %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
GST_DEBUG ("seek to time %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
GST_TIME_ARGS (time_cur), GST_TIME_ARGS (time_stop));
/* shave off the flush flag, we'll need it later */
flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
flush = flags & GST_SEEK_FLAG_FLUSH;
/* assume the worst */
res = FALSE;
format = GST_FORMAT_BYTES;
if (gst_mad_convert_sink (pad, GST_FORMAT_TIME, time_offset,
&format, &bytes_offset)) {
conv = GST_FORMAT_BYTES;
if (!gst_mad_convert_sink (pad, GST_FORMAT_TIME, time_cur, &conv, &bytes_cur))
goto convert_error;
if (!gst_mad_convert_sink (pad, GST_FORMAT_TIME, time_stop, &conv,
&bytes_stop))
goto convert_error;
{
GstEvent *seek_event;
/* conversion succeeded, create the seek */
seek_event =
gst_event_new_seek (format | GST_EVENT_SEEK_METHOD (event) | flush,
bytes_offset);
gst_event_new_seek (rate, GST_FORMAT_BYTES, flags, cur_type,
bytes_cur, stop_type, bytes_stop);
/* do the seek */
res = gst_pad_send_event (GST_PAD_PEER (mad->sinkpad), seek_event);
res = gst_pad_push_event (mad->sinkpad, seek_event);
}
#if 0
peer_formats = gst_pad_get_formats (GST_PAD_PEER (mad->sinkpad));
@ -774,6 +793,14 @@ normal_seek (GstMad * mad, GstPad * pad, GstEvent * event)
#endif
return res;
/* ERRORS */
convert_error:
{
/* probably unsupported seek format */
GST_DEBUG ("failed to convert format %u into GST_FORMAT_TIME", format);
return FALSE;
}
}
static gboolean
@ -934,16 +961,20 @@ gst_mad_sink_event (GstPad * pad, GstEvent * event)
GST_DEBUG ("handling event %d", GST_EVENT_TYPE (event));
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
case GST_EVENT_NEWSEGMENT:
/* this isn't really correct? */
GST_STREAM_LOCK (pad);
result = gst_pad_push_event (mad->srcpad, event);
mad->tempsize = 0;
/* we don't need to restart when we get here */
mad->restart = FALSE;
GST_STREAM_UNLOCK (pad);
break;
case GST_EVENT_EOS:
GST_STREAM_LOCK (pad);
mad->caps_set = FALSE; /* could be a new stream */
result = gst_pad_push_event (mad->srcpad, event);
GST_STREAM_UNLOCK (pad);
break;
default:
result = gst_pad_push_event (mad->srcpad, event);

View file

@ -1024,9 +1024,10 @@ gst_mpeg2dec_chain (GstPad * pad, GstBuffer * buf)
}
if (mpeg2dec->pending_event) {
done =
GST_EVENT_SEEK_FLAGS (mpeg2dec->
pending_event) & GST_SEEK_FLAG_FLUSH;
done = TRUE;
#if 0
GST_EVENT_SEEK_FLAGS (mpeg2dec->pending_event) & GST_SEEK_FLAG_FLUSH;
#endif
gst_mpeg2dec_src_event (mpeg2dec->srcpad, mpeg2dec->pending_event);
mpeg2dec->pending_event = NULL;
@ -1116,15 +1117,18 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
gboolean ret = TRUE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
case GST_EVENT_NEWSEGMENT:
{
#if 0
gint64 time;
gint64 end_time; /* 0.9 just to call
gst_event_discont_get_value, non
used anywhere else */
#endif
GST_STREAM_LOCK (pad);
#if 0
if (!gst_event_discont_get_value (event, GST_FORMAT_TIME, &time,
&end_time)
|| !GST_CLOCK_TIME_IS_VALID (time)) {
@ -1137,6 +1141,7 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
GST_TIME_FORMAT ")", mpeg2dec->next_time,
GST_TIME_ARGS (mpeg2dec->next_time));
}
#endif
// what's hell is that
/*
@ -1151,24 +1156,27 @@ gst_mpeg2dec_sink_event (GstPad * pad, GstEvent * event)
}
*/
GST_STREAM_UNLOCK (pad);
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
break;
}
case GST_EVENT_FLUSH:
{
case GST_EVENT_FLUSH_START:
ret = gst_pad_event_default (pad, event);
break;
case GST_EVENT_FLUSH_STOP:
GST_STREAM_LOCK (pad);
mpeg2dec->discont_state = MPEG2DEC_DISC_NEW_PICTURE;
gst_mpeg2dec_flush_decoder (mpeg2dec);
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
break;
}
case GST_EVENT_EOS:
GST_STREAM_LOCK (pad);
if (mpeg2dec->index && mpeg2dec->closed) {
gst_index_commit (mpeg2dec->index, mpeg2dec->index_id);
}
GST_STREAM_UNLOCK (pad);
ret = gst_pad_event_default (pad, event);
GST_STREAM_UNLOCK (pad);
break;
default:
@ -1445,14 +1453,21 @@ index_seek (GstPad * pad, GstEvent * event)
{
GstIndexEntry *entry;
GstMpeg2dec *mpeg2dec;
gdouble rate;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
mpeg2dec = GST_MPEG2DEC (GST_PAD_PARENT (pad));
entry = gst_index_get_assoc_entry (mpeg2dec->index, mpeg2dec->index_id,
GST_INDEX_LOOKUP_BEFORE, GST_ASSOCIATION_FLAG_KEY_UNIT,
GST_EVENT_SEEK_FORMAT (event), GST_EVENT_SEEK_OFFSET (event));
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
if ((entry) && GST_PAD_PEER (mpeg2dec->sinkpad)) {
entry = gst_index_get_assoc_entry (mpeg2dec->index, mpeg2dec->index_id,
GST_INDEX_LOOKUP_BEFORE, GST_ASSOCIATION_FLAG_KEY_UNIT, format, cur);
if ((entry) && gst_pad_is_linked (mpeg2dec->sinkpad)) {
const GstFormat *peer_formats, *try_formats;
/* since we know the exact byteoffset of the frame, make sure to seek on bytes first */
@ -1478,16 +1493,15 @@ index_seek (GstPad * pad, GstEvent * event)
GST_CAT_DEBUG (GST_CAT_SEEK, "index %s %" G_GINT64_FORMAT
" -> %s %" G_GINT64_FORMAT,
gst_format_get_details (GST_EVENT_SEEK_FORMAT (event))->nick,
GST_EVENT_SEEK_OFFSET (event),
gst_format_get_details (*try_formats)->nick, value);
gst_format_get_details (format)->nick,
cur, gst_format_get_details (*try_formats)->nick, value);
/* lookup succeeded, create the seek */
seek_event =
gst_event_new_seek (*try_formats | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, value);
gst_event_new_seek (rate, *try_formats, flags, cur_type, value,
stop_type, stop);
/* do the seek */
if (gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), seek_event)) {
if (gst_pad_push_event (mpeg2dec->sinkpad, seek_event)) {
/* seek worked, we're done, loop will exit */
#if 0
mpeg2dec->segment_start = GST_EVENT_SEEK_OFFSET (event);
@ -1505,9 +1519,14 @@ index_seek (GstPad * pad, GstEvent * event)
static gboolean
normal_seek (GstPad * pad, GstEvent * event)
{
gint64 time_offset, bytes_offset;
GstFormat format;
guint flush;
gdouble rate;
GstFormat format, conv;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gint64 time_cur, bytes_cur;
gint64 time_stop, bytes_stop;
GstMpeg2dec *mpeg2dec;
@ -1518,39 +1537,48 @@ normal_seek (GstPad * pad, GstEvent * event)
GST_DEBUG ("normal seek");
format = GST_FORMAT_TIME;
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_TIME) {
if (!gst_mpeg2dec_src_convert (pad, GST_EVENT_SEEK_FORMAT (event),
GST_EVENT_SEEK_OFFSET (event), &format, &time_offset)) {
/* probably unsupported seek format */
GST_DEBUG ("failed to convert format %u into GST_FORMAT_TIME",
GST_EVENT_SEEK_FORMAT (event));
return FALSE;
}
gst_event_parse_seek (event, &rate, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
conv = GST_FORMAT_TIME;
if (format != GST_FORMAT_TIME) {
if (!gst_mpeg2dec_src_convert (pad, format, cur, &conv, &time_cur))
goto convert_failed;
if (!gst_mpeg2dec_src_convert (pad, format, stop, &conv, &time_stop))
goto convert_failed;
} else {
time_offset = GST_EVENT_SEEK_OFFSET (event);
time_cur = cur;
time_stop = stop;
}
GST_DEBUG ("seek to time %" GST_TIME_FORMAT, GST_TIME_ARGS (time_offset));
GST_DEBUG ("seek to time %" GST_TIME_FORMAT "-%" GST_TIME_FORMAT,
GST_TIME_ARGS (time_cur), GST_TIME_ARGS (time_stop));
/* shave off the flush flag, we'll need it later */
flush = GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH;
flush = flags & GST_SEEK_FLAG_FLUSH;
/* assume the worst */
res = FALSE;
format = GST_FORMAT_BYTES;
if (gst_mpeg2dec_sink_convert (pad, GST_FORMAT_TIME, time_offset,
&format, &bytes_offset)) {
conv = GST_FORMAT_BYTES;
if (!gst_mpeg2dec_sink_convert (pad, GST_FORMAT_TIME, time_cur,
&format, &bytes_cur))
goto convert_failed;
if (!gst_mpeg2dec_sink_convert (pad, GST_FORMAT_TIME, time_stop,
&format, &bytes_stop))
goto convert_failed;
{
GstEvent *seek_event;
/* conversion succeeded, create the seek */
seek_event =
gst_event_new_seek (format | GST_EVENT_SEEK_METHOD (event) | flush,
bytes_offset);
gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
cur_type, bytes_cur, stop_type, bytes_stop);
/* do the seek */
res = gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), seek_event);
res = gst_pad_push_event (mpeg2dec->sinkpad, seek_event);
}
#if 0
@ -1591,6 +1619,14 @@ normal_seek (GstPad * pad, GstEvent * event)
#endif
return res;
/* ERRORS */
convert_failed:
{
/* probably unsupported seek format */
GST_DEBUG ("failed to convert format %u into GST_FORMAT_TIME", format);
return FALSE;
}
}
@ -1623,11 +1659,7 @@ gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event)
break;
case GST_EVENT_NAVIGATION:
/* Forward a navigation event unchanged */
if (GST_PAD_PEER (mpeg2dec->sinkpad))
return gst_pad_send_event (GST_PAD_PEER (mpeg2dec->sinkpad), event);
res = FALSE;
break;
return gst_pad_push_event (mpeg2dec->sinkpad, event);
default:
res = FALSE;
break;
@ -1639,20 +1671,24 @@ gst_mpeg2dec_src_event (GstPad * pad, GstEvent * event)
static GstElementStateReturn
gst_mpeg2dec_change_state (GstElement * element)
{
GstElementStateReturn ret;
GstMpeg2dec *mpeg2dec = GST_MPEG2DEC (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
break;
case GST_STATE_READY_TO_PAUSED:
{
mpeg2dec->next_time = 0;
gst_mpeg2dec_reset (mpeg2dec);
break;
}
case GST_STATE_PAUSED_TO_PLAYING:
default:
break;
}
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element);
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_PLAYING_TO_PAUSED:
break;
case GST_STATE_PAUSED_TO_READY:
@ -1663,8 +1699,7 @@ gst_mpeg2dec_change_state (GstElement * element)
default:
break;
}
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return ret;
}
static void

View file

@ -466,7 +466,7 @@ gst_siddec_sink_event (GstPad * pad, GstEvent * event)
res = start_play_tune (siddec);
GST_STREAM_UNLOCK (pad);
break;
case GST_EVENT_DISCONTINUOUS:
case GST_EVENT_NEWSEGMENT:
res = FALSE;
break;
default:

View file

@ -268,8 +268,8 @@ GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_LOG_OBJECT (rmdemux, "handling event");
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS:
GST_DEBUG_OBJECT (rmdemux, "discontinuous event");
case GST_EVENT_NEWSEGMENT:
GST_DEBUG_OBJECT (rmdemux, "newsegment event");
gst_event_unref (event);
break;
default:
@ -465,8 +465,8 @@ gst_rmdemux_chain (GstPad * pad, GstBuffer * buffer)
rmdemux->have_pads = TRUE;
gst_rmdemux_send_event (rmdemux,
gst_event_new_discontinuous (1.0, GST_FORMAT_TIME, (gint64) 0,
(gint64) - 1, NULL));
gst_event_new_newsegment (1.0, GST_FORMAT_TIME, (gint64) 0,
(gint64) - 1, 0));
}
/* The actual header is only 8 bytes */
@ -720,8 +720,8 @@ gst_rmdemux_add_stream (GstRMDemux * rmdemux, GstRMDemuxStream * stream)
gst_element_add_pad (GST_ELEMENT (rmdemux), stream->pad);
gst_pad_push_event (stream->pad,
gst_event_new_discontinuous (1.0, GST_FORMAT_TIME, (gint64) 0,
(gint64) - 1, NULL));
gst_event_new_newsegment (1.0, GST_FORMAT_TIME, (gint64) 0,
(gint64) - 1, 0));
/* If there's some extra data then send it as the first packet */
if (stream->extra_data_size > 0) {