mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-25 01:30:38 +00:00
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:
parent
6a20c8af5a
commit
c50893f784
6 changed files with 122 additions and 82 deletions
25
ChangeLog
25
ChangeLog
|
@ -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>
|
||||
|
||||
|
||||
|
|
|
@ -783,36 +783,36 @@ gst_dvdec_handle_sink_event (GstPad * pad, GstEvent * event)
|
|||
gboolean res = TRUE;
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_FLUSH:
|
||||
if (!GST_EVENT_FLUSH_DONE (event)) {
|
||||
/* we are not blocking on anything exect the push() calls
|
||||
* to the peer which will be unblocked by forwarding the
|
||||
* event.*/
|
||||
res = gst_dvdec_send_event (dvdec, event);
|
||||
case GST_EVENT_FLUSH_START:
|
||||
/* we are not blocking on anything exect the push() calls
|
||||
* to the peer which will be unblocked by forwarding the
|
||||
* event.*/
|
||||
res = gst_dvdec_send_event (dvdec, event);
|
||||
|
||||
/* and wait till streaming stops, not strictly needed as
|
||||
* the peer calling us will do the same. */
|
||||
GST_STREAM_LOCK (pad);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
} else {
|
||||
GST_STREAM_LOCK (pad);
|
||||
gst_adapter_clear (dvdec->adapter);
|
||||
GST_DEBUG ("cleared adapter");
|
||||
res = gst_dvdec_send_event (dvdec, event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
}
|
||||
break;
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
{
|
||||
/* and wait till streaming stops, not strictly needed as
|
||||
* the peer calling us will do the same. */
|
||||
GST_STREAM_LOCK (pad);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_FLUSH_STOP:
|
||||
GST_STREAM_LOCK (pad);
|
||||
gst_adapter_clear (dvdec->adapter);
|
||||
GST_DEBUG ("cleared adapter");
|
||||
res = gst_dvdec_send_event (dvdec, event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
{
|
||||
GstFormat format;
|
||||
|
||||
GST_STREAM_LOCK (pad);
|
||||
|
||||
/* parse byte start and stop positions */
|
||||
if (!(res = gst_event_discont_get_value (event,
|
||||
GST_FORMAT_BYTES, &dvdec->start_byte, &dvdec->stop_byte)))
|
||||
goto done;
|
||||
gst_event_parse_newsegment (event, NULL, &format,
|
||||
&dvdec->start_byte, &dvdec->stop_byte, NULL);
|
||||
|
||||
/* and queue a DISCONT before sending the next set of buffers */
|
||||
dvdec->need_discont = TRUE;
|
||||
done:
|
||||
gst_event_unref (event);
|
||||
GST_STREAM_UNLOCK (pad);
|
||||
break;
|
||||
|
@ -846,25 +846,30 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEEK:
|
||||
{
|
||||
gint64 start_position, end_position;
|
||||
GstFormat format;
|
||||
GstEvent *newevent;
|
||||
gint64 offset;
|
||||
GstFormat format, conv;
|
||||
gint64 cur, stop;
|
||||
gdouble rate;
|
||||
GstSeekType cur_type, stop_type;
|
||||
GstSeekFlags flags;
|
||||
gint64 start_position, end_position;
|
||||
|
||||
if ((offset = GST_EVENT_SEEK_OFFSET (event)) != -1) {
|
||||
gst_event_parse_seek (event, &rate, &format, &flags,
|
||||
&cur_type, &cur, &stop_type, &stop);
|
||||
|
||||
if ((offset = cur) != -1) {
|
||||
/* bring the format to time on srcpad. */
|
||||
format = GST_FORMAT_TIME;
|
||||
conv = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_query_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
offset, &format, &start_position))) {
|
||||
format, offset, &conv, &start_position))) {
|
||||
/* could not convert seek format to time offset */
|
||||
break;
|
||||
}
|
||||
/* and convert to bytes on sinkpad. */
|
||||
format = GST_FORMAT_BYTES;
|
||||
conv = GST_FORMAT_BYTES;
|
||||
if (!(res = gst_pad_query_convert (dvdec->sinkpad,
|
||||
GST_FORMAT_TIME,
|
||||
start_position, &format, &start_position))) {
|
||||
GST_FORMAT_TIME, start_position, &conv, &start_position))) {
|
||||
/* could not convert time format to bytes offset */
|
||||
break;
|
||||
}
|
||||
|
@ -872,18 +877,18 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
start_position = -1;
|
||||
}
|
||||
|
||||
if ((offset = GST_EVENT_SEEK_ENDOFFSET (event)) != -1) {
|
||||
if ((offset = stop) != -1) {
|
||||
/* bring the format to time on srcpad. */
|
||||
format = GST_FORMAT_TIME;
|
||||
conv = GST_FORMAT_TIME;
|
||||
if (!(res = gst_pad_query_convert (pad,
|
||||
GST_EVENT_SEEK_FORMAT (event),
|
||||
offset, &format, &end_position))) {
|
||||
format, offset, &conv, &end_position))) {
|
||||
/* could not convert seek format to time offset */
|
||||
break;
|
||||
}
|
||||
conv = GST_FORMAT_BYTES;
|
||||
/* and convert to bytes on sinkpad. */
|
||||
if (!(res = gst_pad_query_convert (dvdec->sinkpad,
|
||||
GST_FORMAT_TIME, end_position, &format, &end_position))) {
|
||||
GST_FORMAT_TIME, end_position, &conv, &end_position))) {
|
||||
/* could not convert seek format to bytes offset */
|
||||
break;
|
||||
}
|
||||
|
@ -891,9 +896,8 @@ gst_dvdec_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
end_position = -1;
|
||||
}
|
||||
/* now this is the updated seek event on bytes */
|
||||
newevent = gst_event_new_segment_seek (
|
||||
(GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) |
|
||||
GST_FORMAT_BYTES, start_position, end_position);
|
||||
newevent = gst_event_new_seek (rate, GST_FORMAT_BYTES, flags,
|
||||
cur_type, start_position, stop_type, end_position);
|
||||
|
||||
res = gst_pad_push_event (dvdec->sinkpad, newevent);
|
||||
break;
|
||||
|
@ -1227,8 +1231,8 @@ gst_dvdec_decode_frame (GstDVDec * dvdec, const guint8 * data)
|
|||
goto discont_error;
|
||||
}
|
||||
|
||||
event = gst_event_new_discontinuous (1.0, GST_FORMAT_TIME,
|
||||
dvdec->start_timestamp, dvdec->stop_timestamp, NULL);
|
||||
event = gst_event_new_newsegment (1.0, GST_FORMAT_TIME,
|
||||
dvdec->start_timestamp, dvdec->stop_timestamp, 0);
|
||||
gst_dvdec_send_event (dvdec, event);
|
||||
|
||||
dvdec->need_discont = FALSE;
|
||||
|
|
|
@ -328,9 +328,12 @@ gst_shout2send_event (GstBaseSink * sink, GstEvent * event)
|
|||
GST_DEBUG ("tag event received");
|
||||
/* vorbis audio doesnt need metadata setting on the icecast level, only mp3 */
|
||||
if (shout2send->tags && shout2send->audio_format == SHOUT_FORMAT_MP3) {
|
||||
GstTagList *list;
|
||||
|
||||
gst_event_parse_tag (event, &list);
|
||||
|
||||
gst_tag_list_insert (shout2send->tags,
|
||||
gst_event_tag_get_list (event),
|
||||
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (shout2send)));
|
||||
list, gst_tag_setter_get_merge_mode (GST_TAG_SETTER (shout2send)));
|
||||
/* lets get the artist and song tags */
|
||||
tempmetadata = NULL;
|
||||
gst_tag_list_foreach ((GstTagList *) shout2send->tags,
|
||||
|
|
|
@ -460,22 +460,30 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_SEEK:
|
||||
GST_DEBUG_OBJECT (avi, "seek format %d, %08x",
|
||||
GST_EVENT_SEEK_FORMAT (event), stream->strh->type);
|
||||
{
|
||||
GstFormat format;
|
||||
GstSeekFlags flags;
|
||||
gint64 cur, stop;
|
||||
|
||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||
gst_event_parse_seek (event, NULL, &format, &flags, NULL, &cur, NULL,
|
||||
&stop);
|
||||
|
||||
GST_DEBUG_OBJECT (avi, "seek format %d, %08x",
|
||||
format, stream->strh->type);
|
||||
|
||||
switch (format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
case GST_FORMAT_DEFAULT:
|
||||
case GST_FORMAT_TIME:{
|
||||
gst_avi_index_entry *entry = NULL, *real;
|
||||
gint64 desired_offset = GST_EVENT_SEEK_OFFSET (event);
|
||||
gint64 desired_offset = cur;
|
||||
guint32 flags;
|
||||
|
||||
GST_DEBUG_OBJECT (avi, "seeking to %" G_GINT64_FORMAT,
|
||||
desired_offset);
|
||||
|
||||
flags = GST_RIFF_IF_KEYFRAME;
|
||||
switch (GST_EVENT_SEEK_FORMAT (event)) {
|
||||
switch (format) {
|
||||
case GST_FORMAT_BYTES:
|
||||
entry = gst_avi_demux_index_entry_for_byte (avi, 0, //stream->num,
|
||||
desired_offset, flags);
|
||||
|
@ -494,6 +502,8 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
real = gst_avi_demux_index_entry_for_time (avi, stream->num,
|
||||
desired_offset, 0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(flags & GST_SEEK_FLAG_ACCURATE))
|
||||
|
@ -502,14 +512,13 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
if (entry) {
|
||||
avi->seek_offset = entry->offset + avi->index_offset;
|
||||
avi->last_seek = real->ts;
|
||||
avi->seek_flush =
|
||||
(GST_EVENT_SEEK_FLAGS (event) & GST_SEEK_FLAG_FLUSH);
|
||||
avi->seek_flush = flags & GST_SEEK_FLAG_FLUSH;
|
||||
avi->seek_entry = entry->index_nr;
|
||||
GST_DEBUG_OBJECT (avi, "Will seek to entry %d", avi->seek_entry);
|
||||
res = gst_avi_demux_handle_seek (avi);
|
||||
} else {
|
||||
GST_DEBUG_OBJECT (avi, "no index entry found for format=%d value=%"
|
||||
G_GINT64_FORMAT, GST_EVENT_SEEK_FORMAT (event), desired_offset);
|
||||
G_GINT64_FORMAT, format, desired_offset);
|
||||
res = FALSE;
|
||||
}
|
||||
GST_LOG ("seek done");
|
||||
|
@ -520,6 +529,7 @@ gst_avi_demux_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
res = FALSE;
|
||||
break;
|
||||
|
@ -1912,11 +1922,11 @@ done:
|
|||
}
|
||||
|
||||
/* send initial discont */
|
||||
avi->seek_event = gst_event_new_discontinuous (1.0,
|
||||
avi->seek_event = gst_event_new_newsegment (1.0,
|
||||
GST_FORMAT_TIME, (gint64) 0,
|
||||
(gint64) (((gfloat) avi->stream[0].strh->scale) *
|
||||
avi->stream[0].strh->length /
|
||||
avi->stream[0].strh->rate) * GST_SECOND, NULL);
|
||||
avi->stream[0].strh->rate) * GST_SECOND, 0);
|
||||
|
||||
/* at this point we know all the streams and we can signal the no more
|
||||
* pads signal */
|
||||
|
@ -1938,18 +1948,18 @@ gst_avi_demux_handle_seek (GstAviDemux * avi)
|
|||
|
||||
GST_LOG ("Seeking to entry %d", avi->seek_entry);
|
||||
|
||||
gst_avi_demux_send_event (avi, gst_event_new_flush (FALSE));
|
||||
gst_avi_demux_send_event (avi, gst_event_new_flush_start ());
|
||||
|
||||
GST_STREAM_LOCK (avi->sinkpad);
|
||||
|
||||
avi->current_entry = avi->seek_entry;
|
||||
avi->seek_event = gst_event_new_discontinuous (1.0,
|
||||
avi->seek_event = gst_event_new_newsegment (1.0,
|
||||
GST_FORMAT_TIME, avi->last_seek,
|
||||
(gint64) (((gfloat) avi->stream[0].strh->scale) *
|
||||
avi->stream[0].strh->length /
|
||||
avi->stream[0].strh->rate) * GST_SECOND, NULL);
|
||||
avi->stream[0].strh->rate) * GST_SECOND, 0);
|
||||
|
||||
gst_avi_demux_send_event (avi, gst_event_new_flush (TRUE));
|
||||
gst_avi_demux_send_event (avi, gst_event_new_flush_stop ());
|
||||
|
||||
gst_pad_start_task (avi->sinkpad, (GstTaskFunction) gst_avi_demux_loop,
|
||||
avi->sinkpad);
|
||||
|
@ -1969,7 +1979,7 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
|
|||
if (avi->current_entry >= avi->index_size) {
|
||||
GST_LOG_OBJECT (avi, "Handled last index entry, setting EOS (%d > %d)",
|
||||
avi->current_entry, avi->index_size);
|
||||
gst_avi_demux_send_event (avi, gst_event_new (GST_EVENT_EOS));
|
||||
gst_avi_demux_send_event (avi, gst_event_new_eos ());
|
||||
return GST_FLOW_WRONG_STATE;
|
||||
} else {
|
||||
GstBuffer *buf;
|
||||
|
|
|
@ -315,11 +315,12 @@ gst_goom_event (GstPad * pad, GstEvent * event)
|
|||
goom = GST_GOOM (GST_PAD_PARENT (pad));
|
||||
|
||||
switch (GST_EVENT_TYPE (event)) {
|
||||
case GST_EVENT_DISCONTINUOUS:
|
||||
case GST_EVENT_NEWSEGMENT:
|
||||
{
|
||||
gint64 start = 0, stop = 0;
|
||||
GstFormat format;
|
||||
|
||||
gst_event_discont_get_value (event, GST_FORMAT_TIME, &start, &stop);
|
||||
gst_event_parse_newsegment (event, NULL, &format, &start, &stop, NULL);
|
||||
gst_adapter_clear (goom->adapter);
|
||||
goom->audio_basetime = start;
|
||||
goom->samples_consumed = 0;
|
||||
|
|
|
@ -697,7 +697,7 @@ gst_wavparse_other (GstWavParse * wav)
|
|||
static gboolean
|
||||
gst_wavparse_handle_seek (GstWavParse * wav)
|
||||
{
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_flush (FALSE));
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_flush_start ());
|
||||
|
||||
GST_STREAM_LOCK (wav->sinkpad);
|
||||
|
||||
|
@ -707,12 +707,12 @@ gst_wavparse_handle_seek (GstWavParse * wav)
|
|||
/*
|
||||
FIXME : currently the seek/discont doesn't care about the stop value !
|
||||
*/
|
||||
wav->seek_event = gst_event_new_discontinuous (1.0,
|
||||
wav->seek_event = gst_event_new_newsegment (1.0,
|
||||
GST_FORMAT_TIME,
|
||||
GST_SECOND *
|
||||
wav->seek_offset / wav->bps, GST_SECOND * wav->datasize / wav->bps, NULL);
|
||||
wav->seek_offset / wav->bps, GST_SECOND * wav->datasize / wav->bps, 0);
|
||||
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_flush (TRUE));
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_flush_stop ());
|
||||
|
||||
gst_pad_start_task (wav->sinkpad, (GstTaskFunction) gst_wavparse_loop,
|
||||
wav->sinkpad);
|
||||
|
@ -817,9 +817,9 @@ gst_wavparse_stream_headers (GstWavParse * wav)
|
|||
|
||||
GST_DEBUG ("Finished parsing headers");
|
||||
/* Initial discont */
|
||||
wav->seek_event = gst_event_new_discontinuous (1.0,
|
||||
wav->seek_event = gst_event_new_newsegment (1.0,
|
||||
GST_FORMAT_TIME,
|
||||
(gint64) 0, (gint64) GST_SECOND * wav->datasize / wav->bps, NULL);
|
||||
(gint64) 0, (gint64) GST_SECOND * wav->datasize / wav->bps, 0);
|
||||
|
||||
return GST_FLOW_OK;
|
||||
}
|
||||
|
@ -836,10 +836,7 @@ gst_wavparse_stream_data (GstWavParse * wav)
|
|||
GST_DEBUG ("stream data !!!");
|
||||
/* Get the next n bytes and output them */
|
||||
if (wav->dataleft == 0) {
|
||||
if ((res =
|
||||
gst_pad_push_event (wav->srcpad,
|
||||
gst_event_new (GST_EVENT_EOS))) != GST_FLOW_OK)
|
||||
return res;
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
|
||||
return GST_FLOW_WRONG_STATE;
|
||||
}
|
||||
|
||||
|
@ -921,7 +918,7 @@ pause:
|
|||
GST_ELEMENT_ERROR (wav, STREAM, STOPPED,
|
||||
("streaming stopped, reason %d", ret),
|
||||
("streaming stopped, reason %d", ret));
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new (GST_EVENT_EOS));
|
||||
gst_pad_push_event (wav->srcpad, gst_event_new_eos ());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1105,22 +1102,22 @@ gst_wavparse_srcpad_event (GstPad * pad, GstEvent * event)
|
|||
gint64 bseek_start, bseek_stop;
|
||||
GstFormat format;
|
||||
GstFormat dformat = GST_FORMAT_BYTES;
|
||||
gint64 cur, stop;
|
||||
|
||||
format = GST_EVENT_SEEK_FORMAT (event);
|
||||
gst_event_parse_seek (event, NULL, &format, NULL,
|
||||
NULL, &cur, NULL, &stop);
|
||||
|
||||
GST_DEBUG ("seek format %d", format);
|
||||
|
||||
/* find the corresponding bytestream position */
|
||||
if (format == GST_FORMAT_BYTES) {
|
||||
bseek_start = GST_EVENT_SEEK_OFFSET (event);
|
||||
bseek_stop = GST_EVENT_SEEK_ENDOFFSET (event);
|
||||
bseek_start = cur;
|
||||
bseek_stop = stop;
|
||||
} else {
|
||||
res &=
|
||||
gst_wavparse_pad_convert (pad, format,
|
||||
GST_EVENT_SEEK_OFFSET (event), &dformat, &bseek_start);
|
||||
res &=
|
||||
gst_wavparse_pad_convert (pad, format,
|
||||
GST_EVENT_SEEK_ENDOFFSET (event), &dformat, &bseek_stop);
|
||||
res &= gst_wavparse_pad_convert (pad, format,
|
||||
cur, &dformat, &bseek_start);
|
||||
res &= gst_wavparse_pad_convert (pad, format,
|
||||
stop, &dformat, &bseek_stop);
|
||||
if (!res)
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue