Commit 4dd6c2a5 authored by Wim Taymans's avatar Wim Taymans

gst/gstbin.*: Prepare to make current EOS message queue more generic.

Original commit message from CVS:
* gst/gstbin.c: (gst_bin_init), (gst_bin_provide_clock_func),
(is_eos), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
Prepare to make current EOS message queue more generic.
Fix some typos.

* gst/gstevent.c: (gst_event_new_newsegment),
(gst_event_parse_newsegment):
* gst/gstevent.h:
Rename base to stream_time.

* gst/gstmessage.h:
Fix typo in docs.
parent fc5dc6de
2005-10-11 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_init), (gst_bin_provide_clock_func),
(is_eos), (gst_bin_add_func), (gst_bin_remove_func),
(gst_bin_recalc_state), (gst_bin_change_state_func),
(gst_bin_dispose), (bin_bus_handler):
* gst/gstbin.h:
Prepare to make current EOS message queue more generic.
Fix some typos.
* gst/gstevent.c: (gst_event_new_newsegment),
(gst_event_parse_newsegment):
* gst/gstevent.h:
Rename base to stream_time.
* gst/gstmessage.h:
Fix typo in docs.
2005-10-11 Wim Taymans <wim@fluendo.com> 2005-10-11 Wim Taymans <wim@fluendo.com>
* gst/gstbin.c: (gst_bin_init), (gst_bin_provide_clock_func), * gst/gstbin.c: (gst_bin_init), (gst_bin_provide_clock_func),
......
...@@ -286,7 +286,7 @@ gst_bin_init (GstBin * bin) ...@@ -286,7 +286,7 @@ gst_bin_init (GstBin * bin)
bin->numchildren = 0; bin->numchildren = 0;
bin->children = NULL; bin->children = NULL;
bin->children_cookie = 0; bin->children_cookie = 0;
bin->eosed = NULL; bin->messages = NULL;
bin->polling = FALSE; bin->polling = FALSE;
bin->state_dirty = FALSE; bin->state_dirty = FALSE;
bin->provided_clock = NULL; bin->provided_clock = NULL;
...@@ -423,7 +423,7 @@ is_eos (GstBin * bin) ...@@ -423,7 +423,7 @@ is_eos (GstBin * bin)
element = GST_ELEMENT_CAST (walk->data); element = GST_ELEMENT_CAST (walk->data);
if (bin_element_is_sink (element, bin) == 0) { if (bin_element_is_sink (element, bin) == 0) {
if (!g_list_find (bin->eosed, element)) { if (!g_list_find (bin->messages, element)) {
GST_DEBUG ("element did not post EOS yet"); GST_DEBUG ("element did not post EOS yet");
result = FALSE; result = FALSE;
break; break;
...@@ -1362,12 +1362,12 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition) ...@@ -1362,12 +1362,12 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
bin = GST_BIN_CAST (element); bin = GST_BIN_CAST (element);
/* Clear eosed element list on next PAUSED */ /* Clear message list on next PAUSED */
if (next == GST_STATE_PAUSED) { if (next == GST_STATE_PAUSED) {
GST_LOCK (bin); GST_LOCK (bin);
GST_DEBUG_OBJECT (element, "clearing EOS elements"); GST_DEBUG_OBJECT (element, "clearing EOS elements");
g_list_free (bin->eosed); g_list_free (bin->messages);
bin->eosed = NULL; bin->messages = NULL;
GST_UNLOCK (bin); GST_UNLOCK (bin);
} }
...@@ -1474,8 +1474,8 @@ gst_bin_dispose (GObject * object) ...@@ -1474,8 +1474,8 @@ gst_bin_dispose (GObject * object)
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose"); GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
g_list_free (bin->eosed); g_list_free (bin->messages);
bin->eosed = NULL; bin->messages = NULL;
gst_object_unref (bin->child_bus); gst_object_unref (bin->child_bus);
bin->child_bus = NULL; bin->child_bus = NULL;
...@@ -1549,16 +1549,17 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin) ...@@ -1549,16 +1549,17 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
GstObject *src = GST_MESSAGE_SRC (message); GstObject *src = GST_MESSAGE_SRC (message);
if (src) { if (src) {
gchar *name;
gboolean eos; gboolean eos;
name = gst_object_get_name (src); /* silly if we're not debugging.. */
GST_DEBUG_OBJECT (bin, "got EOS message from %s", name); GST_LOCK (src);
g_free (name); GST_DEBUG_OBJECT (bin, "got EOS message from %s",
GST_ELEMENT_NAME (src));
GST_UNLOCK (src);
/* collect all eos messages from the children */ /* collect all eos messages from the children */
GST_LOCK (bin); GST_LOCK (bin);
bin->eosed = g_list_prepend (bin->eosed, src); bin->messages = g_list_prepend (bin->messages, src);
eos = is_eos (bin); eos = is_eos (bin);
GST_UNLOCK (bin); GST_UNLOCK (bin);
......
...@@ -90,7 +90,7 @@ struct _GstBin { ...@@ -90,7 +90,7 @@ struct _GstBin {
guint32 children_cookie; guint32 children_cookie;
GstBus *child_bus; /* Bus we set on our children */ GstBus *child_bus; /* Bus we set on our children */
GList *eosed; /* list of elements that posted EOS */ GList *messages; /* list of queued messages */
gboolean polling; gboolean polling;
gboolean state_dirty; gboolean state_dirty;
......
...@@ -358,7 +358,7 @@ gst_event_new_eos (void) ...@@ -358,7 +358,7 @@ gst_event_new_eos (void)
* @format: The format of the segment values * @format: The format of the segment values
* @start_value: the start value of the segment * @start_value: the start value of the segment
* @stop_value: the stop value of the segment * @stop_value: the stop value of the segment
* @base: base value for buffer timestamps. * @stream_time: stream time for buffer timestamps.
* *
* Allocate a new newsegment event with the given format/values tripplets. * Allocate a new newsegment event with the given format/values tripplets.
* *
...@@ -367,7 +367,7 @@ gst_event_new_eos (void) ...@@ -367,7 +367,7 @@ gst_event_new_eos (void)
* used intelligently by plugins to use more efficient methods of skipping * used intelligently by plugins to use more efficient methods of skipping
* unneeded packets. * unneeded packets.
* *
* The base time of the segment is also used to convert the buffer timestamps * The stream time of the segment is also used to convert the buffer timestamps
* into the stream time again. * into the stream time again.
* *
* The @start_value cannot be -1, the @stop_value can be -1. If there * The @start_value cannot be -1, the @stop_value can be -1. If there
...@@ -375,26 +375,26 @@ gst_event_new_eos (void) ...@@ -375,26 +375,26 @@ gst_event_new_eos (void)
* *
* After a newsegment event, the buffer stream time is calculated with: * After a newsegment event, the buffer stream time is calculated with:
* *
* TIMESTAMP(buf) - start_time + base * stream_time + (TIMESTAMP(buf) - start_value) * ABS (rate)
* *
* Returns: A new newsegment event. * Returns: A new newsegment event.
*/ */
GstEvent * GstEvent *
gst_event_new_newsegment (gdouble rate, GstFormat format, gst_event_new_newsegment (gdouble rate, GstFormat format,
gint64 start_value, gint64 stop_value, gint64 base) gint64 start_value, gint64 stop_value, gint64 stream_time)
{ {
if (format == GST_FORMAT_TIME) { if (format == GST_FORMAT_TIME) {
GST_CAT_INFO (GST_CAT_EVENT, GST_CAT_INFO (GST_CAT_EVENT,
"creating newsegment rate %lf, format GST_FORMAT_TIME, " "creating newsegment rate %lf, format GST_FORMAT_TIME, "
"start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT "start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT
", base %" GST_TIME_FORMAT, ", stream_time %" GST_TIME_FORMAT,
rate, GST_TIME_ARGS (start_value), rate, GST_TIME_ARGS (start_value),
GST_TIME_ARGS (stop_value), GST_TIME_ARGS (base)); GST_TIME_ARGS (stop_value), GST_TIME_ARGS (stream_time));
} else { } else {
GST_CAT_INFO (GST_CAT_EVENT, GST_CAT_INFO (GST_CAT_EVENT,
"creating newsegment rate %lf, format %d, " "creating newsegment rate %lf, format %d, "
"start %lld, stop %lld, base %lld", "start %lld, stop %lld, stream_time %lld",
rate, format, start_value, stop_value, base); rate, format, start_value, stop_value, stream_time);
} }
if (start_value == -1) if (start_value == -1)
g_return_val_if_fail (start_value != -1, NULL); g_return_val_if_fail (start_value != -1, NULL);
...@@ -407,7 +407,7 @@ gst_event_new_newsegment (gdouble rate, GstFormat format, ...@@ -407,7 +407,7 @@ gst_event_new_newsegment (gdouble rate, GstFormat format,
"format", GST_TYPE_FORMAT, format, "format", GST_TYPE_FORMAT, format,
"start_val", G_TYPE_INT64, start_value, "start_val", G_TYPE_INT64, start_value,
"stop_val", G_TYPE_INT64, stop_value, "stop_val", G_TYPE_INT64, stop_value,
"base", G_TYPE_INT64, base, NULL)); "stream_time", G_TYPE_INT64, stream_time, NULL));
} }
/** /**
...@@ -417,14 +417,14 @@ gst_event_new_newsegment (gdouble rate, GstFormat format, ...@@ -417,14 +417,14 @@ gst_event_new_newsegment (gdouble rate, GstFormat format,
* @format: A pointer to the format of the newsegment values * @format: A pointer to the format of the newsegment values
* @start_value: A pointer to store the start value in * @start_value: A pointer to store the start value in
* @stop_value: A pointer to store the stop value in * @stop_value: A pointer to store the stop value in
* @base: A pointer to store the base time in * @stream_time: A pointer to store the stream time in
* *
* Get the start, stop and format in the newsegment event. * Get the start, stop and format in the newsegment event.
*/ */
void void
gst_event_parse_newsegment (GstEvent * event, gdouble * rate, gst_event_parse_newsegment (GstEvent * event, gdouble * rate,
GstFormat * format, gint64 * start_value, gint64 * stop_value, GstFormat * format, gint64 * start_value, gint64 * stop_value,
gint64 * base) gint64 * stream_time)
{ {
const GstStructure *structure; const GstStructure *structure;
...@@ -442,8 +442,9 @@ gst_event_parse_newsegment (GstEvent * event, gdouble * rate, ...@@ -442,8 +442,9 @@ gst_event_parse_newsegment (GstEvent * event, gdouble * rate,
if (stop_value) if (stop_value)
*stop_value = *stop_value =
g_value_get_int64 (gst_structure_get_value (structure, "stop_val")); g_value_get_int64 (gst_structure_get_value (structure, "stop_val"));
if (base) if (stream_time)
*base = g_value_get_int64 (gst_structure_get_value (structure, "base")); *stream_time =
g_value_get_int64 (gst_structure_get_value (structure, "stream_time"));
} }
/** /**
......
...@@ -261,9 +261,9 @@ GstEvent * gst_event_new_eos (void); ...@@ -261,9 +261,9 @@ GstEvent * gst_event_new_eos (void);
/* newsegment events */ /* newsegment events */
GstEvent* gst_event_new_newsegment (gdouble rate, GstFormat format, GstEvent* gst_event_new_newsegment (gdouble rate, GstFormat format,
gint64 start_value, gint64 stop_value, gint64 start_value, gint64 stop_value,
gint64 base); gint64 stream_time);
void gst_event_parse_newsegment (GstEvent *event, gdouble *rate, GstFormat *format, void gst_event_parse_newsegment (GstEvent *event, gdouble *rate, GstFormat *format,
gint64 *start_value, gint64 *stop_value, gint64 *base); gint64 *start_value, gint64 *stop_value, gint64 *stream_time);
/* tag event */ /* tag event */
GstEvent* gst_event_new_tag (GstTagList *taglist); GstEvent* gst_event_new_tag (GstTagList *taglist);
void gst_event_parse_tag (GstEvent *event, GstTagList **taglist); void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
......
...@@ -38,7 +38,7 @@ typedef struct _GstMessageClass GstMessageClass; ...@@ -38,7 +38,7 @@ typedef struct _GstMessageClass GstMessageClass;
* @GST_MESSAGE_BUFFERING: the pipeline is buffering * @GST_MESSAGE_BUFFERING: the pipeline is buffering
* @GST_MESSAGE_STATE_CHANGED: a state change happened * @GST_MESSAGE_STATE_CHANGED: a state change happened
* @GST_MESSAGE_STEP_DONE: a framestep finished. * @GST_MESSAGE_STEP_DONE: a framestep finished.
* @GST_MESSAGE_CLOCK_PROVIDE: an element notifies it capability of providing * @GST_MESSAGE_CLOCK_PROVIDE: an element notifies its capability of providing
* a clock. * a clock.
* @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became * @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
* unusable. The pipeline will select a new clock on * unusable. The pipeline will select a new clock on
......
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