From: Wim Taymans Date: Tue, 11 Oct 2005 16:28:49 +0000 (+0000) Subject: Added extra flag to newsegment for future API freeze. X-Git-Tag: RELEASE-0_9_4~132 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c97e237a14df1c12b19855ae558475c6bf59ed8f;p=platform%2Fupstream%2Fgstreamer.git Added extra flag to newsegment for future API freeze. Original commit message from CVS: * check/gst/gstevent.c: (GST_START_TEST): * gst/base/gstbasesink.c: (gst_base_sink_handle_object), (gst_base_sink_change_state): * gst/base/gstbasesrc.c: (gst_base_src_default_newsegment): * gst/base/gstbasetransform.c: (gst_base_transform_event): * gst/elements/gstfilesink.c: (gst_file_sink_event): * gst/gstevent.c: (gst_event_new_newsegment), (gst_event_parse_newsegment): * gst/gstevent.h: Added extra flag to newsegment for future API freeze. Updated check and base elements. --- diff --git a/ChangeLog b/ChangeLog index 1c05230..86bddf1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-10-11 Wim Taymans + + * check/gst/gstevent.c: (GST_START_TEST): + * gst/base/gstbasesink.c: (gst_base_sink_handle_object), + (gst_base_sink_change_state): + * gst/base/gstbasesrc.c: (gst_base_src_default_newsegment): + * gst/base/gstbasetransform.c: (gst_base_transform_event): + * gst/elements/gstfilesink.c: (gst_file_sink_event): + * gst/gstevent.c: (gst_event_new_newsegment), + (gst_event_parse_newsegment): + * gst/gstevent.h: + Added extra flag to newsegment for future API freeze. + Updated check and base elements. + 2005-10-11 Julien MOUTTE * gst/base/gstcollectpads.c: (gst_collectpads_init), diff --git a/check/gst/gstevent.c b/check/gst/gstevent.c index 326bcab..5960630 100644 --- a/check/gst/gstevent.c +++ b/check/gst/gstevent.c @@ -62,8 +62,10 @@ GST_START_TEST (create_custom_events) gdouble rate; GstFormat format; gint64 start, end, base; + gboolean update; - event = gst_event_new_newsegment (0.5, GST_FORMAT_TIME, 1, G_MAXINT64, + event = + gst_event_new_newsegment (FALSE, 0.5, GST_FORMAT_TIME, 1, G_MAXINT64, 0xdeadbeef); fail_if (event == NULL); fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); @@ -71,7 +73,9 @@ GST_START_TEST (create_custom_events) fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); fail_unless (GST_EVENT_IS_SERIALIZED (event)); - gst_event_parse_newsegment (event, &rate, &format, &start, &end, &base); + gst_event_parse_newsegment (event, &update, &rate, &format, &start, &end, + &base); + fail_unless (update == FALSE); fail_unless (rate == 0.5); fail_unless (format == GST_FORMAT_TIME); fail_unless (start == 1); diff --git a/gst/base/gstbasesink.c b/gst/base/gstbasesink.c index f66b83e..64a67cc 100644 --- a/gst/base/gstbasesink.c +++ b/gst/base/gstbasesink.c @@ -469,11 +469,12 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, GstFormat format; gint64 segment_start; gint64 segment_stop; + gboolean update; /* the newsegment event is needed to bring the buffer timestamps to the * stream time and to drop samples outside of the playback segment. */ - gst_event_parse_newsegment (event, &basesink->segment_rate, &format, - &segment_start, &segment_stop, &basesink->segment_base); + gst_event_parse_newsegment (event, &update, &basesink->segment_rate, + &format, &segment_start, &segment_stop, &basesink->segment_base); basesink->have_newsegment = TRUE; diff --git a/gst/base/gstbasesrc.c b/gst/base/gstbasesrc.c index d0ea047..1ec7b35 100644 --- a/gst/base/gstbasesrc.c +++ b/gst/base/gstbasesrc.c @@ -374,7 +374,7 @@ gst_base_src_default_newsegment (GstBaseSrc * src) GST_DEBUG_OBJECT (src, "Sending newsegment from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT, (gint64) src->segment_start, (gint64) src->segment_end); - event = gst_event_new_newsegment (1.0, + event = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_BYTES, (gint64) src->segment_start, (gint64) src->segment_end, (gint64) 0); diff --git a/gst/base/gstbasetransform.c b/gst/base/gstbasetransform.c index cb13bad..1007b2e 100644 --- a/gst/base/gstbasetransform.c +++ b/gst/base/gstbasetransform.c @@ -1025,9 +1025,11 @@ gst_base_transform_event (GstPad * pad, GstEvent * event) GstFormat format; gdouble rate; gint64 start, stop, base; + gboolean update; GST_STREAM_LOCK (pad); - gst_event_parse_newsegment (event, &rate, &format, &start, &stop, &base); + gst_event_parse_newsegment (event, &update, &rate, &format, &start, &stop, + &base); if (format == GST_FORMAT_TIME) { GST_DEBUG_OBJECT (trans, "received NEW_SEGMENT %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT, diff --git a/gst/elements/gstfilesink.c b/gst/elements/gstfilesink.c index ec99bdd..d81c744 100644 --- a/gst/elements/gstfilesink.c +++ b/gst/elements/gstfilesink.c @@ -334,8 +334,8 @@ gst_file_sink_event (GstBaseSink * sink, GstEvent * event) gint64 soffset, eoffset; GstFormat format; - gst_event_parse_newsegment (event, NULL, &format, &soffset, &eoffset, - NULL); + gst_event_parse_newsegment (event, NULL, NULL, &format, &soffset, + &eoffset, NULL); if (format == GST_FORMAT_BYTES) { gst_file_sink_do_seek (filesink, (guint64) soffset); diff --git a/gst/gstevent.c b/gst/gstevent.c index 4349735..c5d23f7 100644 --- a/gst/gstevent.c +++ b/gst/gstevent.c @@ -354,6 +354,7 @@ gst_event_new_eos (void) /** * gst_event_new_newsegment: + * @update: is this segment an update to a previous one * @rate: a new rate for playback * @format: The format of the segment values * @start_value: the start value of the segment @@ -380,21 +381,21 @@ gst_event_new_eos (void) * Returns: A new newsegment event. */ GstEvent * -gst_event_new_newsegment (gdouble rate, GstFormat format, +gst_event_new_newsegment (gboolean update, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value, gint64 stream_time) { if (format == GST_FORMAT_TIME) { GST_CAT_INFO (GST_CAT_EVENT, - "creating newsegment rate %lf, format GST_FORMAT_TIME, " + "creating newsegment update %d, rate %lf, format GST_FORMAT_TIME, " "start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT ", stream_time %" GST_TIME_FORMAT, - rate, GST_TIME_ARGS (start_value), + update, rate, GST_TIME_ARGS (start_value), GST_TIME_ARGS (stop_value), GST_TIME_ARGS (stream_time)); } else { GST_CAT_INFO (GST_CAT_EVENT, - "creating newsegment rate %lf, format %d, " + "creating newsegment update %d, rate %lf, format %d, " "start %lld, stop %lld, stream_time %lld", - rate, format, start_value, stop_value, stream_time); + update, rate, format, start_value, stop_value, stream_time); } if (start_value == -1) g_return_val_if_fail (start_value != -1, NULL); @@ -403,7 +404,9 @@ gst_event_new_newsegment (gdouble rate, GstFormat format, g_return_val_if_fail (start_value <= stop_value, NULL); return gst_event_new_custom (GST_EVENT_NEWSEGMENT, - gst_structure_new ("GstEventNewsegment", "rate", G_TYPE_DOUBLE, rate, + gst_structure_new ("GstEventNewsegment", + "update", G_TYPE_BOOLEAN, update, + "rate", G_TYPE_DOUBLE, rate, "format", GST_TYPE_FORMAT, format, "start_val", G_TYPE_INT64, start_value, "stop_val", G_TYPE_INT64, stop_value, @@ -413,6 +416,7 @@ gst_event_new_newsegment (gdouble rate, GstFormat format, /** * gst_event_parse_newsegment: * @event: The event to query + * @update: A pointer to the update flag of the segment * @rate: A pointer to the rate of the segment * @format: A pointer to the format of the newsegment values * @start_value: A pointer to store the start value in @@ -422,7 +426,7 @@ gst_event_new_newsegment (gdouble rate, GstFormat format, * Get the start, stop and format in the newsegment event. */ void -gst_event_parse_newsegment (GstEvent * event, gdouble * rate, +gst_event_parse_newsegment (GstEvent * event, gboolean * update, gdouble * rate, GstFormat * format, gint64 * start_value, gint64 * stop_value, gint64 * stream_time) { @@ -432,6 +436,9 @@ gst_event_parse_newsegment (GstEvent * event, gdouble * rate, g_return_if_fail (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); structure = gst_event_get_structure (event); + if (update) + *update = + g_value_get_boolean (gst_structure_get_value (structure, "update")); if (rate) *rate = g_value_get_double (gst_structure_get_value (structure, "rate")); if (format) diff --git a/gst/gstevent.h b/gst/gstevent.h index c4a7ba6..d6711bf 100644 --- a/gst/gstevent.h +++ b/gst/gstevent.h @@ -259,11 +259,12 @@ GstEvent * gst_event_new_flush_stop (void); GstEvent * gst_event_new_eos (void); /* newsegment events */ -GstEvent* gst_event_new_newsegment (gdouble rate, GstFormat format, +GstEvent* gst_event_new_newsegment (gboolean update, gdouble rate, GstFormat format, gint64 start_value, gint64 stop_value, gint64 stream_time); -void gst_event_parse_newsegment (GstEvent *event, gdouble *rate, GstFormat *format, - gint64 *start_value, gint64 *stop_value, gint64 *stream_time); +void gst_event_parse_newsegment (GstEvent *event, gboolean *update, gdouble *rate, + GstFormat *format, gint64 *start_value, gint64 *stop_value, + gint64 *stream_time); /* tag event */ GstEvent* gst_event_new_tag (GstTagList *taglist); void gst_event_parse_tag (GstEvent *event, GstTagList **taglist); diff --git a/libs/gst/base/gstbasesink.c b/libs/gst/base/gstbasesink.c index f66b83e..64a67cc 100644 --- a/libs/gst/base/gstbasesink.c +++ b/libs/gst/base/gstbasesink.c @@ -469,11 +469,12 @@ gst_base_sink_handle_object (GstBaseSink * basesink, GstPad * pad, GstFormat format; gint64 segment_start; gint64 segment_stop; + gboolean update; /* the newsegment event is needed to bring the buffer timestamps to the * stream time and to drop samples outside of the playback segment. */ - gst_event_parse_newsegment (event, &basesink->segment_rate, &format, - &segment_start, &segment_stop, &basesink->segment_base); + gst_event_parse_newsegment (event, &update, &basesink->segment_rate, + &format, &segment_start, &segment_stop, &basesink->segment_base); basesink->have_newsegment = TRUE; diff --git a/libs/gst/base/gstbasesrc.c b/libs/gst/base/gstbasesrc.c index d0ea047..1ec7b35 100644 --- a/libs/gst/base/gstbasesrc.c +++ b/libs/gst/base/gstbasesrc.c @@ -374,7 +374,7 @@ gst_base_src_default_newsegment (GstBaseSrc * src) GST_DEBUG_OBJECT (src, "Sending newsegment from %" G_GINT64_FORMAT " to %" G_GINT64_FORMAT, (gint64) src->segment_start, (gint64) src->segment_end); - event = gst_event_new_newsegment (1.0, + event = gst_event_new_newsegment (FALSE, 1.0, GST_FORMAT_BYTES, (gint64) src->segment_start, (gint64) src->segment_end, (gint64) 0); diff --git a/libs/gst/base/gstbasetransform.c b/libs/gst/base/gstbasetransform.c index cb13bad..1007b2e 100644 --- a/libs/gst/base/gstbasetransform.c +++ b/libs/gst/base/gstbasetransform.c @@ -1025,9 +1025,11 @@ gst_base_transform_event (GstPad * pad, GstEvent * event) GstFormat format; gdouble rate; gint64 start, stop, base; + gboolean update; GST_STREAM_LOCK (pad); - gst_event_parse_newsegment (event, &rate, &format, &start, &stop, &base); + gst_event_parse_newsegment (event, &update, &rate, &format, &start, &stop, + &base); if (format == GST_FORMAT_TIME) { GST_DEBUG_OBJECT (trans, "received NEW_SEGMENT %" GST_TIME_FORMAT " -- %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT, diff --git a/plugins/elements/gstfilesink.c b/plugins/elements/gstfilesink.c index ec99bdd..d81c744 100644 --- a/plugins/elements/gstfilesink.c +++ b/plugins/elements/gstfilesink.c @@ -334,8 +334,8 @@ gst_file_sink_event (GstBaseSink * sink, GstEvent * event) gint64 soffset, eoffset; GstFormat format; - gst_event_parse_newsegment (event, NULL, &format, &soffset, &eoffset, - NULL); + gst_event_parse_newsegment (event, NULL, NULL, &format, &soffset, + &eoffset, NULL); if (format == GST_FORMAT_BYTES) { gst_file_sink_do_seek (filesink, (guint64) soffset); diff --git a/tests/check/gst/gstevent.c b/tests/check/gst/gstevent.c index 326bcab..5960630 100644 --- a/tests/check/gst/gstevent.c +++ b/tests/check/gst/gstevent.c @@ -62,8 +62,10 @@ GST_START_TEST (create_custom_events) gdouble rate; GstFormat format; gint64 start, end, base; + gboolean update; - event = gst_event_new_newsegment (0.5, GST_FORMAT_TIME, 1, G_MAXINT64, + event = + gst_event_new_newsegment (FALSE, 0.5, GST_FORMAT_TIME, 1, G_MAXINT64, 0xdeadbeef); fail_if (event == NULL); fail_unless (GST_EVENT_TYPE (event) == GST_EVENT_NEWSEGMENT); @@ -71,7 +73,9 @@ GST_START_TEST (create_custom_events) fail_unless (GST_EVENT_IS_DOWNSTREAM (event)); fail_unless (GST_EVENT_IS_SERIALIZED (event)); - gst_event_parse_newsegment (event, &rate, &format, &start, &end, &base); + gst_event_parse_newsegment (event, &update, &rate, &format, &start, &end, + &base); + fail_unless (update == FALSE); fail_unless (rate == 0.5); fail_unless (format == GST_FORMAT_TIME); fail_unless (start == 1);