examples/seeking/seek.c: Update seek example.

Original commit message from CVS:
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.

* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
This commit is contained in:
Wim Taymans 2005-07-27 18:34:29 +00:00
parent 9df508faaa
commit ee8ed3a89d
16 changed files with 178 additions and 85 deletions

View File

@ -1,3 +1,42 @@
2005-07-27 Wim Taymans <wim@fluendo.com>
* examples/seeking/seek.c: (setup_dynamic_link),
(make_dv_pipeline), (make_vorbis_theora_pipeline), (query_rates),
(query_positions_elems), (query_positions_pads), (do_seek):
Update seek example.
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_event),
(gst_ogg_pad_typefind), (gst_ogg_demux_chain_elem_pad),
(gst_ogg_demux_queue_data), (gst_ogg_demux_chain_peer),
(gst_ogg_pad_submit_packet), (gst_ogg_pad_submit_page),
(gst_ogg_demux_handle_event),
(gst_ogg_demux_deactivate_current_chain),
(gst_ogg_demux_activate_chain), (gst_ogg_demux_perform_seek),
(gst_ogg_demux_collect_chain_info), (gst_ogg_demux_collect_info),
(gst_ogg_demux_chain), (gst_ogg_demux_send_event),
(gst_ogg_demux_loop):
* ext/ogg/gstoggmux.c: (gst_ogg_mux_collected):
* ext/theora/theoradec.c: (theora_dec_src_event),
(theora_dec_src_getcaps), (theora_dec_sink_event),
(theora_dec_push), (theora_dec_chain):
* ext/vorbis/Makefile.am:
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_event),
(vorbis_dec_sink_event), (vorbis_dec_push),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/playback/gststreaminfo.c: (cb_probe):
* gst/subparse/gstsubparse.c: (gst_subparse_src_event):
* gst/videorate/gstvideorate.c: (gst_videorate_event):
* gst/videoscale/gstvideoscale.c:
(gst_videoscale_handle_src_event):
* gst/videotestsrc/gstvideotestsrc.c: (gst_videotestsrc_event):
* sys/ximage/ximagesink.c: (gst_ximagesink_show_frame),
(gst_ximagesink_navigation_send_event):
* sys/xvimage/xvimagesink.c:
(gst_xvimagesink_navigation_send_event):
Various event updates and cleanups
2005-07-27 Ronald S. Bultje <rbultje@ronald.bitfreak.net> 2005-07-27 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/videoscale/gstvideoscale.c: (gst_videoscale_prepare_images): * gst/videoscale/gstvideoscale.c: (gst_videoscale_prepare_images):

View File

@ -86,7 +86,7 @@ setup_dynamic_link (GstElement * element, const gchar * padname,
connect->target = target; connect->target = target;
connect->bin = bin; connect->bin = bin;
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
connect); connect);
} }
@ -158,7 +158,6 @@ make_dv_pipeline (const gchar * location)
rate_pads = g_list_prepend (rate_pads, seekable); rate_pads = g_list_prepend (rate_pads, seekable);
seekable = gst_element_get_pad (decoder, "audio"); seekable = gst_element_get_pad (decoder, "audio");
seekable_pads = g_list_prepend (seekable_pads, seekable);
rate_pads = g_list_prepend (rate_pads, seekable); rate_pads = g_list_prepend (rate_pads, seekable);
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink")); rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
@ -976,9 +975,11 @@ do_seek (GtkWidget * widget)
g_print ("seek to %" GST_TIME_FORMAT " on pad %s:%s\n", g_print ("seek to %" GST_TIME_FORMAT " on pad %s:%s\n",
GST_TIME_ARGS (real), GST_DEBUG_PAD_NAME (seekable)); GST_TIME_ARGS (real), GST_DEBUG_PAD_NAME (seekable));
s_event =
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real); s_event = gst_event_new_seek (1.0,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
res = gst_pad_send_event (seekable, s_event); res = gst_pad_send_event (seekable, s_event);
@ -993,9 +994,9 @@ do_seek (GtkWidget * widget)
g_print ("seek to %" GST_TIME_FORMAT " on element %s\n", g_print ("seek to %" GST_TIME_FORMAT " on element %s\n",
GST_TIME_ARGS (real), GST_ELEMENT_NAME (seekable)); GST_TIME_ARGS (real), GST_ELEMENT_NAME (seekable));
s_event = s_event = gst_event_new_seek (1.0,
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, real); GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
res = gst_element_send_event (seekable, s_event); res = gst_element_send_event (seekable, s_event);

View File

@ -389,6 +389,10 @@ gst_ogg_pad_event (GstPad * pad, GstEvent * event)
{ {
gboolean running; gboolean running;
gboolean flush; gboolean flush;
GstFormat format;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
/* can't seek if we are not seekable, FIXME could pass the /* can't seek if we are not seekable, FIXME could pass the
* seek query upstream after converting it to bytes using * seek query upstream after converting it to bytes using
@ -398,17 +402,19 @@ gst_ogg_pad_event (GstPad * pad, GstEvent * event)
GST_DEBUG ("seek on non seekable stream"); GST_DEBUG ("seek on non seekable stream");
goto done_unref; goto done_unref;
} }
gst_event_parse_seek (event, NULL, &format, &flags,
&cur_type, &cur, &stop_type, &stop);
/* we can only seek on time */ /* we can only seek on time */
if (GST_EVENT_SEEK_FORMAT (event) != GST_FORMAT_TIME) { if (format != GST_FORMAT_TIME) {
res = FALSE; res = FALSE;
GST_DEBUG ("can only seek on TIME"); GST_DEBUG ("can only seek on TIME");
goto done_unref; goto done_unref;
} }
ogg->segment_start = GST_EVENT_SEEK_OFFSET (event); ogg->segment_start = cur;
ogg->segment_stop = GST_EVENT_SEEK_ENDOFFSET (event); ogg->segment_stop = stop;
ogg->segment_play = ogg->segment_play = !!(flags & GST_SEEK_FLAG_SEGMENT);
!!(GST_EVENT_SEEK_TYPE (event) & GST_SEEK_FLAG_SEGMENT_LOOP); flush = !!(flags & GST_SEEK_FLAG_FLUSH);
flush = !!(GST_EVENT_SEEK_TYPE (event) & GST_SEEK_FLAG_FLUSH);
gst_event_unref (event); gst_event_unref (event);
GST_DEBUG ("segment positions set to %" GST_TIME_FORMAT "-%" GST_DEBUG ("segment positions set to %" GST_TIME_FORMAT "-%"
@ -774,9 +780,9 @@ gst_ogg_pad_submit_packet (GstOggPad * pad, ogg_packet * packet)
GstEvent *event; GstEvent *event;
/* create the discont event we are going to send out */ /* create the discont event we are going to send out */
event = gst_event_new_discontinuous (1.0, event = gst_event_new_newsegment (1.0,
GST_FORMAT_TIME, (gint64) chain->start_time - chain->begin_time, GST_FORMAT_TIME, (gint64) chain->start_time - chain->begin_time,
(gint64) chain->last_time - chain->begin_time, NULL); (gint64) chain->last_time - chain->begin_time, (gint64) 0);
gst_ogg_demux_activate_chain (ogg, chain, event); gst_ogg_demux_activate_chain (ogg, chain, event);
@ -1082,8 +1088,8 @@ gst_ogg_demux_handle_event (GstPad * pad, GstEvent * event)
GstOggDemux *ogg = GST_OGG_DEMUX (GST_PAD_PARENT (pad)); GstOggDemux *ogg = GST_OGG_DEMUX (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_NEWSEGMENT:
GST_DEBUG_OBJECT (ogg, "got a discont event"); GST_DEBUG_OBJECT (ogg, "got a new segment event");
ogg_sync_reset (&ogg->sync); ogg_sync_reset (&ogg->sync);
gst_event_unref (event); gst_event_unref (event);
break; break;
@ -1266,7 +1272,7 @@ gst_ogg_demux_deactivate_current_chain (GstOggDemux * ogg)
for (i = 0; i < chain->streams->len; i++) { for (i = 0; i < chain->streams->len; i++) {
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i); GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, i);
gst_pad_push_event (GST_PAD (pad), gst_event_new (GST_EVENT_EOS)); gst_pad_push_event (GST_PAD (pad), gst_event_new_eos ());
gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD (pad)); gst_element_remove_pad (GST_ELEMENT (ogg), GST_PAD (pad));
} }
/* if we cannot seek back to the chain, we can destroy the chain /* if we cannot seek back to the chain, we can destroy the chain
@ -1361,7 +1367,7 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gboolean flush)
if (flush) { if (flush) {
gint i; gint i;
gst_pad_push_event (ogg->sinkpad, gst_event_new_flush (FALSE)); gst_pad_push_event (ogg->sinkpad, gst_event_new_flush_start ());
GST_CHAIN_LOCK (ogg); GST_CHAIN_LOCK (ogg);
for (i = 0; i < ogg->chains->len; i++) { for (i = 0; i < ogg->chains->len; i++) {
@ -1371,7 +1377,7 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gboolean flush)
for (j = 0; j < chain->streams->len; j++) { for (j = 0; j < chain->streams->len; j++) {
GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, j); GstOggPad *pad = g_array_index (chain->streams, GstOggPad *, j);
gst_pad_push_event (GST_PAD (pad), gst_event_new_flush (FALSE)); gst_pad_push_event (GST_PAD (pad), gst_event_new_flush_start ());
} }
} }
GST_CHAIN_UNLOCK (ogg); GST_CHAIN_UNLOCK (ogg);
@ -1386,7 +1392,7 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gboolean flush)
/* we need to stop flushing on the srcpad as we're going to use it /* we need to stop flushing on the srcpad as we're going to use it
* next. We can do this as we have the STREAM lock now. */ * next. We can do this as we have the STREAM lock now. */
gst_pad_push_event (ogg->sinkpad, gst_event_new_flush (TRUE)); gst_pad_push_event (ogg->sinkpad, gst_event_new_flush_stop ());
{ {
gint i; gint i;
@ -1543,12 +1549,12 @@ gst_ogg_demux_perform_seek (GstOggDemux * ogg, gboolean flush)
/* we have to send the flush to the old chain, not the new one */ /* we have to send the flush to the old chain, not the new one */
if (flush) if (flush)
gst_ogg_demux_send_event (ogg, gst_event_new_flush (TRUE)); gst_ogg_demux_send_event (ogg, gst_event_new_flush_stop ());
/* create the discont event we are going to send out */ /* create the discont event we are going to send out */
event = gst_event_new_discontinuous (1.0, event = gst_event_new_newsegment (1.0,
GST_FORMAT_TIME, (gint64) ogg->segment_start, GST_FORMAT_TIME, (gint64) ogg->segment_start,
(gint64) ogg->segment_stop, NULL); (gint64) ogg->segment_stop, 0);
if (chain != ogg->current_chain) { if (chain != ogg->current_chain) {
/* switch to different chain, send discont on new chain */ /* switch to different chain, send discont on new chain */
@ -2177,7 +2183,7 @@ gst_ogg_demux_loop (GstOggPad * pad)
gst_element_post_message (GST_ELEMENT (ogg), gst_element_post_message (GST_ELEMENT (ogg),
gst_message_new_segment_done (GST_OBJECT (ogg), ogg->total_time)); gst_message_new_segment_done (GST_OBJECT (ogg), ogg->total_time));
} else { } else {
gst_ogg_demux_send_event (ogg, gst_event_new (GST_EVENT_EOS)); gst_ogg_demux_send_event (ogg, gst_event_new_eos ());
} }
goto pause; goto pause;
} }
@ -2207,7 +2213,7 @@ pause:
GST_LOG_OBJECT (ogg, "pausing task, reason %d", ret); GST_LOG_OBJECT (ogg, "pausing task, reason %d", ret);
gst_pad_pause_task (ogg->sinkpad); gst_pad_pause_task (ogg->sinkpad);
if (GST_FLOW_IS_FATAL (ret)) { if (GST_FLOW_IS_FATAL (ret)) {
gst_ogg_demux_send_event (ogg, gst_event_new (GST_EVENT_EOS)); gst_ogg_demux_send_event (ogg, gst_event_new_eos ());
GST_ELEMENT_ERROR (ogg, STREAM, STOPPED, GST_ELEMENT_ERROR (ogg, STREAM, STOPPED,
("stream stopped, reason %d", ret), ("stream stopped, reason %d", ret),
("stream stopped, reason %d", ret)); ("stream stopped, reason %d", ret));

View File

@ -935,7 +935,7 @@ gst_ogg_mux_collected (GstCollectPads * pads, GstOggMux * ogg_mux)
ogg_mux->next_ts = GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer); ogg_mux->next_ts = GST_BUFFER_TIMESTAMP (ogg_mux->pulling->buffer);
} else { } else {
/* no pad to pull on, send EOS */ /* no pad to pull on, send EOS */
gst_pad_push_event (ogg_mux->srcpad, gst_event_new (GST_EVENT_EOS)); gst_pad_push_event (ogg_mux->srcpad, gst_event_new_eos ());
return GST_FLOW_WRONG_STATE; return GST_FLOW_WRONG_STATE;
} }
} }

View File

@ -523,14 +523,21 @@ theora_dec_src_event (GstPad * pad, GstEvent * event)
{ {
gboolean res = TRUE; gboolean res = TRUE;
GstTheoraDec *dec; GstTheoraDec *dec;
GstFormat format;
dec = GST_THEORA_DEC (GST_PAD_PARENT (pad)); dec = GST_THEORA_DEC (GST_PAD_PARENT (pad));
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:{ case GST_EVENT_SEEK:{
gint64 value; GstFormat format, tformat;
gdouble rate;
GstEvent *real_seek; GstEvent *real_seek;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gint64 tcur, tstop;
gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
&stop_type, &stop);
/* 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
* nothing about how to generate a granulepos from the src * nothing about how to generate a granulepos from the src
@ -538,17 +545,17 @@ theora_dec_src_event (GstPad * pad, GstEvent * event)
* *
* First bring the requested format to time * First bring the requested format to time
*/ */
format = GST_FORMAT_TIME; tformat = GST_FORMAT_TIME;
if (!(res = theora_dec_src_convert (pad, GST_EVENT_SEEK_FORMAT (event), if (!(res = theora_dec_src_convert (pad, format, cur, &tformat, &tcur)))
GST_EVENT_SEEK_OFFSET (event), &format, &value))) goto error;
if (!(res = theora_dec_src_convert (pad, format, stop, &tformat, &tstop)))
goto error; goto error;
/* then seek with time on the peer */ /* then seek with time on the peer */
real_seek = gst_event_new_seek ( real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
(GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | flags, cur_type, tcur, stop_type, tstop);
format, value);
res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek); res = gst_pad_push_event (dec->sinkpad, real_seek);
gst_event_unref (event); gst_event_unref (event);
break; break;
@ -594,7 +601,7 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
ret = gst_pad_push_event (dec->srcpad, event); ret = gst_pad_push_event (dec->srcpad, event);
GST_STREAM_UNLOCK (pad); GST_STREAM_UNLOCK (pad);
break; break;
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_NEWSEGMENT:
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
dec->need_keyframe = TRUE; dec->need_keyframe = TRUE;
dec->granulepos = -1; dec->granulepos = -1;

View File

@ -3,11 +3,13 @@ plugin_LTLIBRARIES = libgstvorbis.la
libgstvorbis_la_SOURCES = vorbis.c \ libgstvorbis_la_SOURCES = vorbis.c \
vorbisdec.c vorbisenc.c vorbisparse.c vorbisdec.c vorbisenc.c vorbisparse.c
libgstvorbis_la_CFLAGS = $(GST_CFLAGS) $(VORBIS_CFLAGS) libgstvorbis_la_CFLAGS = $(GST_CFLAGS) $(VORBIS_CFLAGS)
## AM_PATH_VORBIS also sets VORBISENC_LIBS ## AM_PATH_VORBIS also sets VORBISENC_LIBS
libgstvorbis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstvorbis_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvorbis_la_LIBADD = \ libgstvorbis_la_LIBADD = \
$(top_builddir)/gst-libs/gst/tag/libgsttagedit-@GST_MAJORMINOR@.la \ $(top_builddir)/gst-libs/gst/tag/libgsttagedit-@GST_MAJORMINOR@.la \
$(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \ $(top_builddir)/gst-libs/gst/audio/libgstaudio-@GST_MAJORMINOR@.la \
$(top_builddir)/gst-libs/gst/oggmapper/libgstoggmapper-@GST_MAJORMINOR@.la \
$(GST_LIBS) \ $(GST_LIBS) \
$(VORBIS_LIBS) $(VORBISENC_LIBS) $(VORBIS_LIBS) $(VORBISENC_LIBS)

View File

@ -341,19 +341,35 @@ vorbis_dec_src_event (GstPad * pad, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK:{ case GST_EVENT_SEEK:{
gint64 value; GstFormat format, tformat;
GstFormat my_format = GST_FORMAT_TIME; gdouble rate;
GstEvent *real_seek;
GstSeekFlags flags;
GstSeekType cur_type, stop_type;
gint64 cur, stop;
gint64 tcur, tstop;
/* convert to time */ gst_event_parse_seek (event, &rate, &format, &flags, &cur_type, &cur,
res = vorbis_dec_convert (pad, GST_EVENT_SEEK_FORMAT (event), &stop_type, &stop);
GST_EVENT_SEEK_OFFSET (event), &my_format, &value);
if (res) { /* we have to ask our peer to seek to time here as we know
GstEvent *real_seek = gst_event_new_seek ( * nothing about how to generate a granulepos from the src
(GST_EVENT_SEEK_TYPE (event) & ~GST_SEEK_FORMAT_MASK) | * formats or anything.
GST_FORMAT_TIME, value); *
* First bring the requested format to time
*/
tformat = GST_FORMAT_TIME;
if (!(res = vorbis_dec_convert (pad, format, cur, &tformat, &tcur)))
goto error;
if (!(res = vorbis_dec_convert (pad, format, stop, &tformat, &tstop)))
goto error;
/* then seek with time on the peer */
real_seek = gst_event_new_seek (rate, GST_FORMAT_TIME,
flags, cur_type, tcur, stop_type, tstop);
res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek);
res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek);
}
gst_event_unref (event); gst_event_unref (event);
break; break;
} }
@ -363,6 +379,10 @@ vorbis_dec_src_event (GstPad * pad, GstEvent * event)
} }
return res; return res;
error:
gst_event_unref (event);
return res;
} }
static gboolean static gboolean
@ -380,7 +400,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
ret = gst_pad_push_event (dec->srcpad, event); ret = gst_pad_push_event (dec->srcpad, event);
GST_STREAM_UNLOCK (pad); GST_STREAM_UNLOCK (pad);
break; break;
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_NEWSEGMENT:
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
dec->granulepos = -1; dec->granulepos = -1;
#ifdef HAVE_VORBIS_SYNTHESIS_RESTART #ifdef HAVE_VORBIS_SYNTHESIS_RESTART

View File

@ -838,7 +838,10 @@ gst_vorbisenc_sink_event (GstPad * pad, GstEvent * event)
break; break;
case GST_EVENT_TAG: case GST_EVENT_TAG:
if (vorbisenc->tags) { if (vorbisenc->tags) {
gst_tag_list_insert (vorbisenc->tags, gst_event_tag_get_list (event), GstTagList *list;
gst_event_parse_tag (event, &list);
gst_tag_list_insert (vorbisenc->tags, list,
gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc))); gst_tag_setter_get_merge_mode (GST_TAG_SETTER (vorbisenc)));
} else { } else {
g_assert_not_reached (); g_assert_not_reached ();
@ -959,7 +962,7 @@ gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
vorbis_block_clear (&vorbisenc->vb); vorbis_block_clear (&vorbisenc->vb);
vorbis_dsp_clear (&vorbisenc->vd); vorbis_dsp_clear (&vorbisenc->vd);
vorbis_info_clear (&vorbisenc->vi); vorbis_info_clear (&vorbisenc->vi);
gst_pad_push_event (vorbisenc->srcpad, gst_event_new (GST_EVENT_EOS)); gst_pad_push_event (vorbisenc->srcpad, gst_event_new_eos ());
//gst_element_set_eos (GST_ELEMENT (vorbisenc)); //gst_element_set_eos (GST_ELEMENT (vorbisenc));
} }
return GST_FLOW_OK; return GST_FLOW_OK;

View File

@ -179,7 +179,9 @@ cb_probe (GstPad * pad, GstEvent * e, gpointer user_data)
if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) { if (GST_EVENT_TYPE (e) == GST_EVENT_TAG) {
gchar *codec; //, *lang; gchar *codec; //, *lang;
GstTagList *list = gst_event_tag_get_list (e); GstTagList *list;
gst_event_parse_tag (e, &list);
if (gst_tag_list_get_string (list, GST_TAG_VIDEO_CODEC, &codec)) { if (gst_tag_list_get_string (list, GST_TAG_VIDEO_CODEC, &codec)) {
g_free (info->codec); g_free (info->codec);

View File

@ -172,13 +172,18 @@ static gboolean
gst_subparse_src_event (GstPad * pad, GstEvent * event) gst_subparse_src_event (GstPad * pad, GstEvent * event)
{ {
GstSubparse *self = GST_SUBPARSE (gst_pad_get_parent (pad)); GstSubparse *self = GST_SUBPARSE (gst_pad_get_parent (pad));
GstFormat format;
GstSeekType type;
#define grvif(x,y) g_return_val_if_fail (x, y) #define grvif(x,y) g_return_val_if_fail (x, y)
/* we guaranteed these with the eventmask */
grvif (GST_EVENT_TYPE (event) == GST_EVENT_SEEK, FALSE); grvif (GST_EVENT_TYPE (event) == GST_EVENT_SEEK, FALSE);
grvif (GST_EVENT_SEEK_FORMAT (event) == GST_FORMAT_TIME, FALSE);
grvif (GST_EVENT_SEEK_METHOD (event) == GST_SEEK_METHOD_SET, FALSE); gst_event_parse_seek (event, NULL, &format, NULL, &type, NULL, NULL, NULL);
/* we guaranteed these with the eventmask */
grvif (format == GST_FORMAT_TIME, FALSE);
grvif (type == GST_SEEK_TYPE_SET, FALSE);
gst_event_unref (event); gst_event_unref (event);
@ -190,6 +195,8 @@ gst_subparse_src_event (GstPad * pad, GstEvent * event)
GST_STREAM_UNLOCK (self->sinkpad); GST_STREAM_UNLOCK (self->sinkpad);
gst_object_unref (self);
return TRUE; return TRUE;
} }

View File

@ -380,15 +380,18 @@ gst_videorate_event (GstPad * pad, GstEvent * event)
goto done; goto done;
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_DISCONTINUOUS: case GST_EVENT_NEWSEGMENT:
{ {
gint64 start, end; gint64 start, stop;
GstFormat format;
GST_STREAM_LOCK (pad); GST_STREAM_LOCK (pad);
if (!(gst_event_discont_get_value (event, GST_FORMAT_TIME, &start, &end))) gst_event_parse_newsegment (event, NULL, &format, &start, &stop, NULL);
if (format != GST_FORMAT_TIME) {
GST_WARNING ("Got discont but doesn't have GST_FORMAT_TIME value"); GST_WARNING ("Got discont but doesn't have GST_FORMAT_TIME value");
else { } else {
gst_videorate_blank_data (videorate); gst_videorate_blank_data (videorate);
videorate->first_ts = start; videorate->first_ts = start;
} }

View File

@ -603,7 +603,8 @@ gst_videoscale_handle_src_event (GstPad * pad, GstEvent * event)
case GST_EVENT_NAVIGATION: case GST_EVENT_NAVIGATION:
event = event =
GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event))); GST_EVENT (gst_mini_object_make_writable (GST_MINI_OBJECT (event)));
structure = event->event_data.structure.structure;
structure = (GstStructure *) gst_event_get_structure (event);
if (gst_structure_get_double (structure, "pointer_x", &a)) { if (gst_structure_get_double (structure, "pointer_x", &a)) {
gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE, gst_structure_set (structure, "pointer_x", G_TYPE_DOUBLE,
a * videoscale->from_width / videoscale->to_width, NULL); a * videoscale->from_width / videoscale->to_width, NULL);

View File

@ -340,24 +340,27 @@ gst_videotestsrc_event (GstBaseSrc * bsrc, GstEvent * event)
switch (GST_EVENT_TYPE (event)) { switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_SEEK: case GST_EVENT_SEEK:
{ {
switch (GST_EVENT_SEEK_FORMAT (event)) { GstFormat format;
GstSeekType cur_type, stop_type;
GstSeekFlags flags;
gint64 cur, stop;
gst_event_parse_seek (event, NULL, &format, &flags, &cur_type, &cur,
&stop_type, &stop);
switch (format) {
case GST_FORMAT_TIME: case GST_FORMAT_TIME:
new_n_frames = new_n_frames = cur * (double) videotestsrc->rate / GST_SECOND;
GST_EVENT_SEEK_OFFSET (event) * (double) videotestsrc->rate /
GST_SECOND;
videotestsrc->segment_start_frame = new_n_frames; videotestsrc->segment_start_frame = new_n_frames;
videotestsrc->segment_end_frame = videotestsrc->segment_end_frame =
GST_EVENT_SEEK_ENDOFFSET (event) * (double) videotestsrc->rate / stop * (double) videotestsrc->rate / GST_SECOND;
GST_SECOND; videotestsrc->segment = flags & GST_SEEK_FLAG_SEGMENT;
videotestsrc->segment =
GST_EVENT_SEEK_TYPE (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
break; break;
case GST_FORMAT_DEFAULT: case GST_FORMAT_DEFAULT:
new_n_frames = GST_EVENT_SEEK_OFFSET (event); new_n_frames = cur;
videotestsrc->segment_start_frame = new_n_frames; videotestsrc->segment_start_frame = new_n_frames;
videotestsrc->segment_end_frame = GST_EVENT_SEEK_ENDOFFSET (event); videotestsrc->segment_end_frame = stop;
videotestsrc->segment = videotestsrc->segment = flags & GST_SEEK_FLAG_SEGMENT;
GST_EVENT_SEEK_TYPE (event) & GST_SEEK_FLAG_SEGMENT_LOOP;
break; break;
default: default:
res = FALSE; res = FALSE;

View File

@ -1447,8 +1447,7 @@ gst_ximagesink_navigation_send_event (GstNavigation * navigation,
GstXImageSink *ximagesink = GST_XIMAGESINK (navigation); GstXImageSink *ximagesink = GST_XIMAGESINK (navigation);
GstEvent *event; GstEvent *event;
event = gst_event_new (GST_EVENT_NAVIGATION); event = gst_event_new_custom (GST_EVENT_NAVIGATION, structure);
event->event_data.structure.structure = structure;
g_mutex_lock (ximagesink->nav_lock); g_mutex_lock (ximagesink->nav_lock);
ximagesink->pend_nav_events = ximagesink->pend_nav_events =

View File

@ -1702,8 +1702,7 @@ gst_xvimagesink_navigation_send_event (GstNavigation * navigation,
GstEvent *event; GstEvent *event;
double x, y; double x, y;
event = gst_event_new (GST_EVENT_NAVIGATION); event = gst_event_new_custom (GST_EVENT_NAVIGATION, structure);
event->event_data.structure.structure = structure;
/* Converting pointer coordinates to the non scaled geometry */ /* Converting pointer coordinates to the non scaled geometry */
if (gst_structure_get_double (structure, "pointer_x", &x)) { if (gst_structure_get_double (structure, "pointer_x", &x)) {

View File

@ -86,7 +86,7 @@ setup_dynamic_link (GstElement * element, const gchar * padname,
connect->target = target; connect->target = target;
connect->bin = bin; connect->bin = bin;
g_signal_connect (G_OBJECT (element), "new_pad", G_CALLBACK (dynamic_link), g_signal_connect (G_OBJECT (element), "pad-added", G_CALLBACK (dynamic_link),
connect); connect);
} }
@ -158,7 +158,6 @@ make_dv_pipeline (const gchar * location)
rate_pads = g_list_prepend (rate_pads, seekable); rate_pads = g_list_prepend (rate_pads, seekable);
seekable = gst_element_get_pad (decoder, "audio"); seekable = gst_element_get_pad (decoder, "audio");
seekable_pads = g_list_prepend (seekable_pads, seekable);
rate_pads = g_list_prepend (rate_pads, seekable); rate_pads = g_list_prepend (rate_pads, seekable);
rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink")); rate_pads = g_list_prepend (rate_pads, gst_element_get_pad (decoder, "sink"));
@ -976,9 +975,11 @@ do_seek (GtkWidget * widget)
g_print ("seek to %" GST_TIME_FORMAT " on pad %s:%s\n", g_print ("seek to %" GST_TIME_FORMAT " on pad %s:%s\n",
GST_TIME_ARGS (real), GST_DEBUG_PAD_NAME (seekable)); GST_TIME_ARGS (real), GST_DEBUG_PAD_NAME (seekable));
s_event =
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET |
GST_SEEK_FLAG_FLUSH, real); s_event = gst_event_new_seek (1.0,
GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
res = gst_pad_send_event (seekable, s_event); res = gst_pad_send_event (seekable, s_event);
@ -993,9 +994,9 @@ do_seek (GtkWidget * widget)
g_print ("seek to %" GST_TIME_FORMAT " on element %s\n", g_print ("seek to %" GST_TIME_FORMAT " on element %s\n",
GST_TIME_ARGS (real), GST_ELEMENT_NAME (seekable)); GST_TIME_ARGS (real), GST_ELEMENT_NAME (seekable));
s_event = s_event = gst_event_new_seek (1.0,
gst_event_new_seek (GST_FORMAT_TIME | GST_SEEK_METHOD_SET | GST_FORMAT_TIME,
GST_SEEK_FLAG_FLUSH, real); GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, real, GST_SEEK_TYPE_NONE, 0);
res = gst_element_send_event (seekable, s_event); res = gst_element_send_event (seekable, s_event);