mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
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.
This commit is contained in:
parent
fc5dc6de66
commit
4dd6c2a587
6 changed files with 49 additions and 29 deletions
18
ChangeLog
18
ChangeLog
|
@ -1,3 +1,21 @@
|
|||
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>
|
||||
|
||||
* gst/gstbin.c: (gst_bin_init), (gst_bin_provide_clock_func),
|
||||
|
|
25
gst/gstbin.c
25
gst/gstbin.c
|
@ -286,7 +286,7 @@ gst_bin_init (GstBin * bin)
|
|||
bin->numchildren = 0;
|
||||
bin->children = NULL;
|
||||
bin->children_cookie = 0;
|
||||
bin->eosed = NULL;
|
||||
bin->messages = NULL;
|
||||
bin->polling = FALSE;
|
||||
bin->state_dirty = FALSE;
|
||||
bin->provided_clock = NULL;
|
||||
|
@ -423,7 +423,7 @@ is_eos (GstBin * bin)
|
|||
|
||||
element = GST_ELEMENT_CAST (walk->data);
|
||||
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");
|
||||
result = FALSE;
|
||||
break;
|
||||
|
@ -1362,12 +1362,12 @@ gst_bin_change_state_func (GstElement * element, GstStateChange transition)
|
|||
|
||||
bin = GST_BIN_CAST (element);
|
||||
|
||||
/* Clear eosed element list on next PAUSED */
|
||||
/* Clear message list on next PAUSED */
|
||||
if (next == GST_STATE_PAUSED) {
|
||||
GST_LOCK (bin);
|
||||
GST_DEBUG_OBJECT (element, "clearing EOS elements");
|
||||
g_list_free (bin->eosed);
|
||||
bin->eosed = NULL;
|
||||
g_list_free (bin->messages);
|
||||
bin->messages = NULL;
|
||||
GST_UNLOCK (bin);
|
||||
}
|
||||
|
||||
|
@ -1474,8 +1474,8 @@ gst_bin_dispose (GObject * object)
|
|||
|
||||
GST_CAT_DEBUG_OBJECT (GST_CAT_REFCOUNTING, object, "dispose");
|
||||
|
||||
g_list_free (bin->eosed);
|
||||
bin->eosed = NULL;
|
||||
g_list_free (bin->messages);
|
||||
bin->messages = NULL;
|
||||
gst_object_unref (bin->child_bus);
|
||||
bin->child_bus = NULL;
|
||||
|
||||
|
@ -1549,16 +1549,17 @@ bin_bus_handler (GstBus * bus, GstMessage * message, GstBin * bin)
|
|||
GstObject *src = GST_MESSAGE_SRC (message);
|
||||
|
||||
if (src) {
|
||||
gchar *name;
|
||||
gboolean eos;
|
||||
|
||||
name = gst_object_get_name (src);
|
||||
GST_DEBUG_OBJECT (bin, "got EOS message from %s", name);
|
||||
g_free (name);
|
||||
/* silly if we're not debugging.. */
|
||||
GST_LOCK (src);
|
||||
GST_DEBUG_OBJECT (bin, "got EOS message from %s",
|
||||
GST_ELEMENT_NAME (src));
|
||||
GST_UNLOCK (src);
|
||||
|
||||
/* collect all eos messages from the children */
|
||||
GST_LOCK (bin);
|
||||
bin->eosed = g_list_prepend (bin->eosed, src);
|
||||
bin->messages = g_list_prepend (bin->messages, src);
|
||||
eos = is_eos (bin);
|
||||
GST_UNLOCK (bin);
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ struct _GstBin {
|
|||
guint32 children_cookie;
|
||||
|
||||
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 state_dirty;
|
||||
|
|
|
@ -358,7 +358,7 @@ gst_event_new_eos (void)
|
|||
* @format: The format of the segment values
|
||||
* @start_value: the start 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.
|
||||
*
|
||||
|
@ -367,7 +367,7 @@ gst_event_new_eos (void)
|
|||
* used intelligently by plugins to use more efficient methods of skipping
|
||||
* 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.
|
||||
*
|
||||
* The @start_value cannot be -1, the @stop_value can be -1. If there
|
||||
|
@ -375,26 +375,26 @@ gst_event_new_eos (void)
|
|||
*
|
||||
* 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.
|
||||
*/
|
||||
GstEvent *
|
||||
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) {
|
||||
GST_CAT_INFO (GST_CAT_EVENT,
|
||||
"creating newsegment rate %lf, format GST_FORMAT_TIME, "
|
||||
"start %" GST_TIME_FORMAT ", stop %" GST_TIME_FORMAT
|
||||
", base %" GST_TIME_FORMAT,
|
||||
", stream_time %" GST_TIME_FORMAT,
|
||||
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 {
|
||||
GST_CAT_INFO (GST_CAT_EVENT,
|
||||
"creating newsegment rate %lf, format %d, "
|
||||
"start %lld, stop %lld, base %lld",
|
||||
rate, format, start_value, stop_value, base);
|
||||
"start %lld, stop %lld, stream_time %lld",
|
||||
rate, format, start_value, stop_value, stream_time);
|
||||
}
|
||||
if (start_value == -1)
|
||||
g_return_val_if_fail (start_value != -1, NULL);
|
||||
|
@ -407,7 +407,7 @@ gst_event_new_newsegment (gdouble rate, GstFormat format,
|
|||
"format", GST_TYPE_FORMAT, format,
|
||||
"start_val", G_TYPE_INT64, start_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,
|
|||
* @format: A pointer to the format of the newsegment values
|
||||
* @start_value: A pointer to store the start 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.
|
||||
*/
|
||||
void
|
||||
gst_event_parse_newsegment (GstEvent * event, gdouble * rate,
|
||||
GstFormat * format, gint64 * start_value, gint64 * stop_value,
|
||||
gint64 * base)
|
||||
gint64 * stream_time)
|
||||
{
|
||||
const GstStructure *structure;
|
||||
|
||||
|
@ -442,8 +442,9 @@ gst_event_parse_newsegment (GstEvent * event, gdouble * rate,
|
|||
if (stop_value)
|
||||
*stop_value =
|
||||
g_value_get_int64 (gst_structure_get_value (structure, "stop_val"));
|
||||
if (base)
|
||||
*base = g_value_get_int64 (gst_structure_get_value (structure, "base"));
|
||||
if (stream_time)
|
||||
*stream_time =
|
||||
g_value_get_int64 (gst_structure_get_value (structure, "stream_time"));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -261,9 +261,9 @@ GstEvent * gst_event_new_eos (void);
|
|||
/* newsegment events */
|
||||
GstEvent* gst_event_new_newsegment (gdouble rate, GstFormat format,
|
||||
gint64 start_value, gint64 stop_value,
|
||||
gint64 base);
|
||||
gint64 stream_time);
|
||||
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 */
|
||||
GstEvent* gst_event_new_tag (GstTagList *taglist);
|
||||
void gst_event_parse_tag (GstEvent *event, GstTagList **taglist);
|
||||
|
|
|
@ -38,7 +38,7 @@ typedef struct _GstMessageClass GstMessageClass;
|
|||
* @GST_MESSAGE_BUFFERING: the pipeline is buffering
|
||||
* @GST_MESSAGE_STATE_CHANGED: a state change happened
|
||||
* @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.
|
||||
* @GST_MESSAGE_CLOCK_LOST: The current clock as selected by the pipeline became
|
||||
* unusable. The pipeline will select a new clock on
|
||||
|
|
Loading…
Reference in a new issue