Commit c97e237a authored by Wim Taymans's avatar Wim Taymans

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.
parent 5706cb69
2005-10-11 Wim Taymans <wim@fluendo.com>
* 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 <julien@moutte.net>
* gst/base/gstcollectpads.c: (gst_collectpads_init),
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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,
......
......@@ -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);
......
......@@ -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)
......
......@@ -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);
......
......@@ -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;
......
......@@ -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);
......
......@@ -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,
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment