mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-20 13:06:23 +00:00
gst/gstclock.*: deprecate old interface and disable functions that aren't in use anymore.
Original commit message from CVS: 2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de> * gst/gstclock.c: (gst_clock_class_init), (gst_clock_init), (gst_clock_set_speed), (gst_clock_set_active), (gst_clock_is_active), (gst_clock_reset), (gst_clock_handle_discont): * gst/gstclock.h: deprecate old interface and disable functions that aren't in use anymore. * gst/gstelement.h: * gst/gstelement.c: (gst_element_get_time), (gst_element_wait), (gst_element_set_time), (gst_element_adjust_time): add concept of "element time" and functions to get/set this time. * gst/gstelement.c: (gst_element_change_state): update element time correctly. * gst/gstelement.c: (gst_element_get_compatible_pad_filtered): This is a debug message, not a g_critical. * gst/gstpad.c: (gst_pad_event_default): handle discontinuous events right with element time. * gst/gstscheduler.c: (gst_scheduler_state_transition): update to clocking fixes. set clocks on elements in READY=>PAUSED. The old behaviour caused a wrong element time on the first element that started playing. * gst/schedulers/gstbasicscheduler.c: (gst_basic_scheduler_class_init): * gst/schedulers/gstoptimalscheduler.c: (gst_opt_scheduler_class_init): remove code that just implements the default behaviour. * gst/elements/gstfakesink.c: (gst_fakesink_chain): update to use new clocking functions * testsuite/clock/clock1.c: (gst_clock_debug), (main): * testsuite/clock/clock2.c: (gst_clock_debug), (main): update to test new element time. * gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps): use _get_allowed_caps instead of _get_caps. This catches filtered caps correctly. * testsuite/debug/commandline.c: update for new GST_DEBUG syntax. * testsuite/threads/Makefile.am: disable a test that only works sometimes.
This commit is contained in:
parent
e8d8cb81e0
commit
1e82f617e4
20 changed files with 372 additions and 219 deletions
41
ChangeLog
41
ChangeLog
|
@ -1,3 +1,44 @@
|
||||||
|
2004-01-13 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
||||||
|
|
||||||
|
* gst/gstclock.c: (gst_clock_class_init), (gst_clock_init),
|
||||||
|
(gst_clock_set_speed), (gst_clock_set_active),
|
||||||
|
(gst_clock_is_active), (gst_clock_reset),
|
||||||
|
(gst_clock_handle_discont):
|
||||||
|
* gst/gstclock.h:
|
||||||
|
deprecate old interface and disable functions that aren't in use
|
||||||
|
anymore.
|
||||||
|
* gst/gstelement.h:
|
||||||
|
* gst/gstelement.c: (gst_element_get_time), (gst_element_wait),
|
||||||
|
(gst_element_set_time), (gst_element_adjust_time):
|
||||||
|
add concept of "element time" and functions to get/set this time.
|
||||||
|
* gst/gstelement.c: (gst_element_change_state):
|
||||||
|
update element time correctly.
|
||||||
|
* gst/gstelement.c: (gst_element_get_compatible_pad_filtered):
|
||||||
|
This is a debug message, not a g_critical.
|
||||||
|
* gst/gstpad.c: (gst_pad_event_default):
|
||||||
|
handle discontinuous events right with element time.
|
||||||
|
* gst/gstscheduler.c: (gst_scheduler_state_transition):
|
||||||
|
update to clocking fixes.
|
||||||
|
set clocks on elements in READY=>PAUSED. The old behaviour caused
|
||||||
|
a wrong element time on the first element that started playing.
|
||||||
|
* gst/schedulers/gstbasicscheduler.c:
|
||||||
|
(gst_basic_scheduler_class_init):
|
||||||
|
* gst/schedulers/gstoptimalscheduler.c:
|
||||||
|
(gst_opt_scheduler_class_init):
|
||||||
|
remove code that just implements the default behaviour.
|
||||||
|
* gst/elements/gstfakesink.c: (gst_fakesink_chain):
|
||||||
|
update to use new clocking functions
|
||||||
|
* testsuite/clock/clock1.c: (gst_clock_debug), (main):
|
||||||
|
* testsuite/clock/clock2.c: (gst_clock_debug), (main):
|
||||||
|
update to test new element time.
|
||||||
|
* gst/autoplug/gstspideridentity.c: (gst_spider_identity_getcaps):
|
||||||
|
use _get_allowed_caps instead of _get_caps. This catches filtered
|
||||||
|
caps correctly.
|
||||||
|
* testsuite/debug/commandline.c:
|
||||||
|
update for new GST_DEBUG syntax.
|
||||||
|
* testsuite/threads/Makefile.am:
|
||||||
|
disable a test that only works sometimes.
|
||||||
|
|
||||||
2004-01-13 Julien MOUTTE <julien@moutte.net>
|
2004-01-13 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
* po/LINGUAS: Adding fr.
|
* po/LINGUAS: Adding fr.
|
||||||
|
|
|
@ -251,10 +251,8 @@ gst_spider_identity_getcaps (GstPad *pad)
|
||||||
otherpad = ident->src;
|
otherpad = ident->src;
|
||||||
|
|
||||||
if (otherpad != NULL) {
|
if (otherpad != NULL) {
|
||||||
GstPad *peer = GST_PAD_PEER (otherpad);
|
if (GST_PAD_PEER (otherpad)) {
|
||||||
|
GstCaps *ret = gst_pad_get_allowed_caps (otherpad);
|
||||||
if (peer) {
|
|
||||||
GstCaps *ret = gst_pad_get_caps (peer);
|
|
||||||
if (ident->caps) {
|
if (ident->caps) {
|
||||||
GstCaps *ret2 = gst_caps_intersect (ident->caps, ret);
|
GstCaps *ret2 = gst_caps_intersect (ident->caps, ret);
|
||||||
gst_caps_free (ret);
|
gst_caps_free (ret);
|
||||||
|
|
|
@ -312,7 +312,7 @@ gst_fakesink_chain (GstPad *pad, GstData *_data)
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
if (fakesink->sync && fakesink->clock) {
|
if (fakesink->sync && fakesink->clock) {
|
||||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||||
gst_clock_handle_discont (fakesink->clock, value);
|
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
gst_pad_event_default (pad, event);
|
gst_pad_event_default (pad, event);
|
||||||
|
@ -322,10 +322,7 @@ gst_fakesink_chain (GstPad *pad, GstData *_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fakesink->sync && fakesink->clock) {
|
if (fakesink->sync && fakesink->clock) {
|
||||||
GstClockID id = gst_clock_new_single_shot_id (fakesink->clock, GST_BUFFER_TIMESTAMP (buf));
|
gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf));
|
||||||
|
|
||||||
gst_element_clock_wait (GST_ELEMENT (fakesink), id, NULL);
|
|
||||||
gst_clock_id_free (id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fakesink->silent) {
|
if (!fakesink->silent) {
|
||||||
|
|
134
gst/gstclock.c
134
gst/gstclock.c
|
@ -34,16 +34,21 @@
|
||||||
static GstAllocTrace *_gst_clock_entry_trace;
|
static GstAllocTrace *_gst_clock_entry_trace;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_EVENT_DIFF (GST_SECOND / 10)
|
||||||
#define DEFAULT_MAX_DIFF (2 * GST_SECOND)
|
#define DEFAULT_MAX_DIFF (2 * GST_SECOND)
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
ARG_0,
|
ARG_0,
|
||||||
ARG_STATS,
|
ARG_STATS,
|
||||||
ARG_MAX_DIFF
|
ARG_MAX_DIFF,
|
||||||
|
ARG_EVENT_DIFF
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstMemChunk *_gst_clock_entries_chunk;
|
static GstMemChunk *_gst_clock_entries_chunk;
|
||||||
|
|
||||||
|
void gst_clock_id_unlock (GstClockID id);
|
||||||
|
|
||||||
|
|
||||||
static void gst_clock_class_init (GstClockClass *klass);
|
static void gst_clock_class_init (GstClockClass *klass);
|
||||||
static void gst_clock_init (GstClock *clock);
|
static void gst_clock_init (GstClock *clock);
|
||||||
static void gst_clock_dispose (GObject *object);
|
static void gst_clock_dispose (GObject *object);
|
||||||
|
@ -381,6 +386,10 @@ gst_clock_class_init (GstClockClass *klass)
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF,
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF,
|
||||||
g_param_spec_int64 ("max-diff", "Max diff", "The maximum amount of time to wait in nanoseconds",
|
g_param_spec_int64 ("max-diff", "Max diff", "The maximum amount of time to wait in nanoseconds",
|
||||||
0, G_MAXINT64, DEFAULT_MAX_DIFF, G_PARAM_READWRITE));
|
0, G_MAXINT64, DEFAULT_MAX_DIFF, G_PARAM_READWRITE));
|
||||||
|
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAX_DIFF,
|
||||||
|
g_param_spec_uint64 ("event-diff", "event diff",
|
||||||
|
"The amount of time that may elapse until 2 events are treated as happening at different times",
|
||||||
|
0, G_MAXUINT64, DEFAULT_EVENT_DIFF, G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -389,7 +398,7 @@ gst_clock_init (GstClock *clock)
|
||||||
clock->max_diff = DEFAULT_MAX_DIFF;
|
clock->max_diff = DEFAULT_MAX_DIFF;
|
||||||
|
|
||||||
clock->speed = 1.0;
|
clock->speed = 1.0;
|
||||||
clock->active = FALSE;
|
clock->active = TRUE;
|
||||||
clock->start_time = 0;
|
clock->start_time = 0;
|
||||||
clock->last_time = 0;
|
clock->last_time = 0;
|
||||||
clock->entries = NULL;
|
clock->entries = NULL;
|
||||||
|
@ -424,15 +433,9 @@ gst_clock_dispose (GObject *object)
|
||||||
gdouble
|
gdouble
|
||||||
gst_clock_set_speed (GstClock *clock, gdouble speed)
|
gst_clock_set_speed (GstClock *clock, gdouble speed)
|
||||||
{
|
{
|
||||||
GstClockClass *cclass;
|
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_CLOCK (clock), 0.0);
|
g_return_val_if_fail (GST_IS_CLOCK (clock), 0.0);
|
||||||
|
|
||||||
cclass = GST_CLOCK_GET_CLASS (clock);
|
GST_WARNING_OBJECT (clock, "called deprecated function");
|
||||||
|
|
||||||
if (cclass->change_speed)
|
|
||||||
clock->speed = cclass->change_speed (clock, clock->speed, speed);
|
|
||||||
|
|
||||||
return clock->speed;
|
return clock->speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -449,6 +452,7 @@ gst_clock_get_speed (GstClock *clock)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_CLOCK (clock), 0.0);
|
g_return_val_if_fail (GST_IS_CLOCK (clock), 0.0);
|
||||||
|
|
||||||
|
GST_WARNING_OBJECT (clock, "called deprecated function");
|
||||||
return clock->speed;
|
return clock->speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,34 +515,11 @@ gst_clock_get_resolution (GstClock *clock)
|
||||||
void
|
void
|
||||||
gst_clock_set_active (GstClock *clock, gboolean active)
|
gst_clock_set_active (GstClock *clock, gboolean active)
|
||||||
{
|
{
|
||||||
GstClockTime time = G_GINT64_CONSTANT (0);
|
|
||||||
GstClockClass *cclass;
|
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_CLOCK (clock));
|
g_return_if_fail (GST_IS_CLOCK (clock));
|
||||||
|
|
||||||
clock->active = active;
|
GST_ERROR_OBJECT (clock, "called deprecated function that does nothing now.");
|
||||||
|
|
||||||
cclass = GST_CLOCK_GET_CLASS (clock);
|
return;
|
||||||
|
|
||||||
if (cclass->get_internal_time) {
|
|
||||||
time = cclass->get_internal_time (clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_LOCK (clock);
|
|
||||||
if (active) {
|
|
||||||
clock->start_time = time - clock->last_time;
|
|
||||||
clock->accept_discont = TRUE;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
clock->last_time = time - clock->start_time;
|
|
||||||
clock->accept_discont = FALSE;
|
|
||||||
}
|
|
||||||
g_list_foreach (clock->entries, (GFunc) gst_clock_reschedule_func, NULL);
|
|
||||||
GST_UNLOCK (clock);
|
|
||||||
|
|
||||||
g_mutex_lock (clock->active_mutex);
|
|
||||||
g_cond_broadcast (clock->active_cond);
|
|
||||||
g_mutex_unlock (clock->active_mutex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -554,7 +535,9 @@ gst_clock_is_active (GstClock *clock)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (GST_IS_CLOCK (clock), FALSE);
|
g_return_val_if_fail (GST_IS_CLOCK (clock), FALSE);
|
||||||
|
|
||||||
return clock->active;
|
GST_WARNING_OBJECT (clock, "called deprecated function.");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -571,6 +554,8 @@ gst_clock_reset (GstClock *clock)
|
||||||
|
|
||||||
g_return_if_fail (GST_IS_CLOCK (clock));
|
g_return_if_fail (GST_IS_CLOCK (clock));
|
||||||
|
|
||||||
|
GST_ERROR_OBJECT (clock, "called deprecated function.");
|
||||||
|
|
||||||
cclass = GST_CLOCK_GET_CLASS (clock);
|
cclass = GST_CLOCK_GET_CLASS (clock);
|
||||||
|
|
||||||
if (cclass->get_internal_time) {
|
if (cclass->get_internal_time) {
|
||||||
|
@ -578,7 +563,7 @@ gst_clock_reset (GstClock *clock)
|
||||||
}
|
}
|
||||||
|
|
||||||
GST_LOCK (clock);
|
GST_LOCK (clock);
|
||||||
clock->active = FALSE;
|
//clock->active = FALSE;
|
||||||
clock->start_time = time;
|
clock->start_time = time;
|
||||||
clock->last_time = G_GINT64_CONSTANT (0);
|
clock->last_time = G_GINT64_CONSTANT (0);
|
||||||
g_list_foreach (clock->entries, (GFunc) gst_clock_reschedule_func, NULL);
|
g_list_foreach (clock->entries, (GFunc) gst_clock_reschedule_func, NULL);
|
||||||
|
@ -599,35 +584,9 @@ gst_clock_reset (GstClock *clock)
|
||||||
gboolean
|
gboolean
|
||||||
gst_clock_handle_discont (GstClock *clock, guint64 time)
|
gst_clock_handle_discont (GstClock *clock, guint64 time)
|
||||||
{
|
{
|
||||||
GstClockTime itime = G_GINT64_CONSTANT (0);
|
GST_ERROR_OBJECT (clock, "called deprecated function.");
|
||||||
GstClockClass *cclass = GST_CLOCK_GET_CLASS (clock);;
|
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "clock discont %" G_GUINT64_FORMAT
|
return FALSE;
|
||||||
" %" G_GUINT64_FORMAT " %d",
|
|
||||||
time, clock->start_time, clock->accept_discont);
|
|
||||||
|
|
||||||
if (! GST_CLOCK_TIME_IS_VALID (time))
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
GST_LOCK (clock);
|
|
||||||
if (cclass->get_internal_time) {
|
|
||||||
itime = cclass->get_internal_time (clock);
|
|
||||||
}
|
|
||||||
|
|
||||||
clock->start_time = itime - time;
|
|
||||||
clock->last_time = time;
|
|
||||||
clock->accept_discont = FALSE;
|
|
||||||
g_list_foreach (clock->entries, (GFunc) gst_clock_reschedule_func, NULL);
|
|
||||||
GST_UNLOCK (clock);
|
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "new time %" G_GUINT64_FORMAT,
|
|
||||||
gst_clock_get_time (clock));
|
|
||||||
|
|
||||||
g_mutex_lock (clock->active_mutex);
|
|
||||||
g_cond_broadcast (clock->active_cond);
|
|
||||||
g_mutex_unlock (clock->active_mutex);
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -646,11 +605,6 @@ gst_clock_get_time (GstClock *clock)
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_CLOCK (clock), G_GINT64_CONSTANT (0));
|
g_return_val_if_fail (GST_IS_CLOCK (clock), G_GINT64_CONSTANT (0));
|
||||||
|
|
||||||
if (!clock->active) {
|
|
||||||
/* clock is not active return previous time */
|
|
||||||
ret = clock->last_time;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
GstClockClass *cclass;
|
GstClockClass *cclass;
|
||||||
|
|
||||||
cclass = GST_CLOCK_GET_CLASS (clock);
|
cclass = GST_CLOCK_GET_CLASS (clock);
|
||||||
|
@ -665,11 +619,42 @@ gst_clock_get_time (GstClock *clock)
|
||||||
else {
|
else {
|
||||||
clock->last_time = ret;
|
clock->last_time = ret;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_clock_get_event_time:
|
||||||
|
* @clock: clock to query
|
||||||
|
*
|
||||||
|
* Gets the "event time" of a given clock. An event on the clock happens
|
||||||
|
* whenever this function is called. This ensures that multiple events that
|
||||||
|
* happen shortly after each other are treated as if they happened at the same
|
||||||
|
* time. GStreamer uses to keep state changes of multiple elements in sync.
|
||||||
|
*
|
||||||
|
* Returns: the time of the event
|
||||||
|
*/
|
||||||
|
GstClockTime
|
||||||
|
gst_clock_get_event_time (GstClock *clock)
|
||||||
|
{
|
||||||
|
GstClockTime time;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_CLOCK (clock), GST_CLOCK_TIME_NONE);
|
||||||
|
|
||||||
|
time = gst_clock_get_time (clock);
|
||||||
|
|
||||||
|
if (clock->last_event + clock->max_event_diff >= time) {
|
||||||
|
GST_LOG_OBJECT (clock, "reporting last event time %"G_GUINT64_FORMAT,
|
||||||
|
clock->last_event);
|
||||||
|
} else {
|
||||||
|
GST_LOG_OBJECT (clock, "reporting new event time %"G_GUINT64_FORMAT,
|
||||||
|
clock->last_event);
|
||||||
|
clock->last_event = time;
|
||||||
|
}
|
||||||
|
|
||||||
|
return clock->last_event;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gst_clock_get_next_id
|
* gst_clock_get_next_id
|
||||||
* @clock: The clock to query
|
* @clock: The clock to query
|
||||||
|
@ -709,9 +694,15 @@ gst_clock_set_property (GObject *object, guint prop_id,
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case ARG_STATS:
|
case ARG_STATS:
|
||||||
clock->stats = g_value_get_boolean (value);
|
clock->stats = g_value_get_boolean (value);
|
||||||
|
g_object_notify (object, "stats");
|
||||||
break;
|
break;
|
||||||
case ARG_MAX_DIFF:
|
case ARG_MAX_DIFF:
|
||||||
clock->max_diff = g_value_get_int64 (value);
|
clock->max_diff = g_value_get_int64 (value);
|
||||||
|
g_object_notify (object, "max-diff");
|
||||||
|
break;
|
||||||
|
case ARG_EVENT_DIFF:
|
||||||
|
clock->max_event_diff = g_value_get_uint64 (value);
|
||||||
|
g_object_notify (object, "max-event-diff");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
@ -734,6 +725,9 @@ gst_clock_get_property (GObject *object, guint prop_id,
|
||||||
case ARG_MAX_DIFF:
|
case ARG_MAX_DIFF:
|
||||||
g_value_set_int64 (value, clock->max_diff);
|
g_value_set_int64 (value, clock->max_diff);
|
||||||
break;
|
break;
|
||||||
|
case ARG_EVENT_DIFF:
|
||||||
|
g_value_set_uint64 (value, clock->max_event_diff);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -128,16 +128,21 @@ struct _GstClock {
|
||||||
gint64 max_diff;
|
gint64 max_diff;
|
||||||
|
|
||||||
/* --- private --- */
|
/* --- private --- */
|
||||||
gboolean accept_discont;
|
gboolean accept_discont; /* FIXME: REMOVE! */
|
||||||
gdouble speed;
|
gdouble speed; /* FIXME: REMOVE! */
|
||||||
guint64 resolution;
|
guint64 resolution;
|
||||||
gboolean active;
|
gboolean active; /* FIXME: REMOVE! */
|
||||||
GList *entries;
|
GList *entries;
|
||||||
GMutex *active_mutex;
|
GMutex *active_mutex;
|
||||||
GCond *active_cond;
|
GCond *active_cond;
|
||||||
gboolean stats;
|
gboolean stats;
|
||||||
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
GstClockTime last_event;
|
||||||
|
GstClockTime max_event_diff;
|
||||||
|
|
||||||
|
/* weird padding here */
|
||||||
|
guint8 padding[sizeof(gpointer) * GST_PADDING - sizeof (GstClockTime) * 2];
|
||||||
|
/*gpointer _gst_reserved[GST_PADDING];*/
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstClockClass {
|
struct _GstClockClass {
|
||||||
|
@ -158,25 +163,32 @@ struct _GstClockClass {
|
||||||
GstClockEntryStatus (*wait_async) (GstClock *clock, GstClockEntry *entry);
|
GstClockEntryStatus (*wait_async) (GstClock *clock, GstClockEntry *entry);
|
||||||
void (*unschedule) (GstClock *clock, GstClockEntry *entry);
|
void (*unschedule) (GstClock *clock, GstClockEntry *entry);
|
||||||
void (*unlock) (GstClock *clock, GstClockEntry *entry);
|
void (*unlock) (GstClock *clock, GstClockEntry *entry);
|
||||||
|
|
||||||
gpointer _gst_reserved[GST_PADDING];
|
gpointer _gst_reserved[GST_PADDING];
|
||||||
};
|
};
|
||||||
|
|
||||||
GType gst_clock_get_type (void);
|
GType gst_clock_get_type (void);
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_DEPRECATED
|
||||||
gdouble gst_clock_set_speed (GstClock *clock, gdouble speed);
|
gdouble gst_clock_set_speed (GstClock *clock, gdouble speed);
|
||||||
gdouble gst_clock_get_speed (GstClock *clock);
|
gdouble gst_clock_get_speed (GstClock *clock);
|
||||||
|
#endif
|
||||||
|
|
||||||
guint64 gst_clock_set_resolution (GstClock *clock, guint64 resolution);
|
guint64 gst_clock_set_resolution (GstClock *clock, guint64 resolution);
|
||||||
guint64 gst_clock_get_resolution (GstClock *clock);
|
guint64 gst_clock_get_resolution (GstClock *clock);
|
||||||
|
|
||||||
|
#ifndef GST_DISABLE_DEPRECATED
|
||||||
void gst_clock_set_active (GstClock *clock, gboolean active);
|
void gst_clock_set_active (GstClock *clock, gboolean active);
|
||||||
gboolean gst_clock_is_active (GstClock *clock);
|
gboolean gst_clock_is_active (GstClock *clock);
|
||||||
void gst_clock_reset (GstClock *clock);
|
void gst_clock_reset (GstClock *clock);
|
||||||
gboolean gst_clock_handle_discont (GstClock *clock, guint64 time);
|
gboolean gst_clock_handle_discont (GstClock *clock, guint64 time);
|
||||||
|
#endif
|
||||||
|
|
||||||
GstClockTime gst_clock_get_time (GstClock *clock);
|
GstClockTime gst_clock_get_time (GstClock *clock);
|
||||||
|
GstClockTime gst_clock_get_event_time (GstClock *clock);
|
||||||
|
|
||||||
|
|
||||||
|
/* FIXME: deprecate? */
|
||||||
|
#ifndef GST_DISABLE_DEPRECATED
|
||||||
GstClockID gst_clock_get_next_id (GstClock *clock);
|
GstClockID gst_clock_get_next_id (GstClock *clock);
|
||||||
|
|
||||||
/* creating IDs that can be used to get notifications */
|
/* creating IDs that can be used to get notifications */
|
||||||
|
@ -196,6 +208,8 @@ GstClockReturn gst_clock_id_wait_async (GstClockID id,
|
||||||
void gst_clock_id_unschedule (GstClockID id);
|
void gst_clock_id_unschedule (GstClockID id);
|
||||||
void gst_clock_id_unlock (GstClockID id);
|
void gst_clock_id_unlock (GstClockID id);
|
||||||
void gst_clock_id_free (GstClockID id);
|
void gst_clock_id_free (GstClockID id);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
170
gst/gstelement.c
170
gst/gstelement.c
|
@ -792,13 +792,162 @@ gst_element_clock_wait (GstElement *element, GstClockID id, GstClockTimeDiff *ji
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
#undef GST_CAT_DEFAULT
|
||||||
|
#define GST_CAT_DEFAULT GST_CAT_CLOCK
|
||||||
|
/**
|
||||||
|
* gst_element_get_time:
|
||||||
|
* @element: element to query
|
||||||
|
*
|
||||||
|
* Query the element's time. The element must use
|
||||||
|
*
|
||||||
|
* Returns: the current time of the element or #GST_CLOCK_TIME_NONE when there
|
||||||
|
* is no time available.
|
||||||
|
*/
|
||||||
|
GstClockTime
|
||||||
|
gst_element_get_time (GstElement *element)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_CLOCK_TIME_NONE);
|
||||||
|
|
||||||
|
if (element->clock == NULL) {
|
||||||
|
GST_WARNING_OBJECT (element, "element queries time but has no clock");
|
||||||
|
return GST_CLOCK_TIME_NONE;
|
||||||
|
}
|
||||||
|
switch (element->current_state) {
|
||||||
|
case GST_STATE_NULL:
|
||||||
|
case GST_STATE_READY:
|
||||||
|
return GST_CLOCK_TIME_NONE;
|
||||||
|
case GST_STATE_PAUSED:
|
||||||
|
return element->base_time;
|
||||||
|
case GST_STATE_PLAYING:
|
||||||
|
return gst_clock_get_time (element->clock) - element->base_time;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
return GST_CLOCK_TIME_NONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
GstClockID gst_clock_new_single_shot_id (GstClock *clock,
|
||||||
|
GstClockTime time);
|
||||||
|
void gst_clock_id_free (GstClockID id);
|
||||||
|
/**
|
||||||
|
* gst_element_wait:
|
||||||
|
* @element: element that should wait
|
||||||
|
* @timestamp: wait until this time has arrived
|
||||||
|
*
|
||||||
|
* Waits until the given time has arrived. When this function returns successfully,
|
||||||
|
* the time specified in the timestamp has passed.
|
||||||
|
* <note>This function can only be called on elements in #GST_STATE_PLAYING</note>
|
||||||
|
*
|
||||||
|
* Returns: TRUE on success
|
||||||
|
*/
|
||||||
|
gboolean
|
||||||
|
gst_element_wait (GstElement *element, GstClockTime timestamp)
|
||||||
|
{
|
||||||
|
GstClockID id;
|
||||||
|
GstClockReturn ret;
|
||||||
|
|
||||||
|
g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
|
||||||
|
g_return_val_if_fail (GST_IS_CLOCK (element->clock), FALSE);
|
||||||
|
g_return_val_if_fail (element->current_state == GST_STATE_PLAYING, FALSE);
|
||||||
|
g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE);
|
||||||
|
|
||||||
|
/* shortcut when we're already late... */
|
||||||
|
if (gst_element_get_time (element) >= timestamp) {
|
||||||
|
GST_INFO_OBJECT (element, "called gst_element_wait and was late");
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
id = gst_clock_new_single_shot_id (element->clock, element->base_time + timestamp);
|
||||||
|
ret = gst_element_clock_wait (element, id, NULL);
|
||||||
|
gst_clock_id_free (id);
|
||||||
|
|
||||||
|
return ret == GST_CLOCK_STOPPED;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_element_set_time:
|
||||||
|
* @element: element to set time on
|
||||||
|
* @time: time to set
|
||||||
|
*
|
||||||
|
* Sets the current time of the element. This function can be used when handling
|
||||||
|
* discont events. You can only call this function on an element with a clock in
|
||||||
|
* #GST_STATE_PAUSED or #GST_STATE_PLAYING. You might want to have a look at
|
||||||
|
* gst_element_adjust_time(), if you want to adjust by a difference as that is
|
||||||
|
* more accurate.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_element_set_time (GstElement *element, GstClockTime time)
|
||||||
|
{
|
||||||
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||||
|
g_return_if_fail (GST_IS_CLOCK (element->clock));
|
||||||
|
g_return_if_fail (element->current_state >= GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
switch (element->current_state) {
|
||||||
|
case GST_STATE_PAUSED:
|
||||||
|
element->base_time = time;
|
||||||
|
break;
|
||||||
|
case GST_STATE_PLAYING:
|
||||||
|
element->base_time = gst_clock_get_time (element->clock) - time;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_element_adjust_time:
|
||||||
|
* @element: element to adjust time on
|
||||||
|
* @difference: difference to adjust
|
||||||
|
*
|
||||||
|
* Adjusts the current time of the element by the specified difference. This
|
||||||
|
* function can be used when handling discont events. You can only call this
|
||||||
|
* function on an element with a clock in #GST_STATE_PAUSED or
|
||||||
|
* #GST_STATE_PLAYING. It is more accurate than gst_element_set_time().
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_element_adjust_time (GstElement *element, GstClockTimeDiff diff)
|
||||||
|
{
|
||||||
|
GstClockTime time;
|
||||||
|
|
||||||
|
g_return_if_fail (GST_IS_ELEMENT (element));
|
||||||
|
g_return_if_fail (GST_IS_CLOCK (element->clock));
|
||||||
|
g_return_if_fail (element->current_state >= GST_STATE_PAUSED);
|
||||||
|
|
||||||
|
switch (element->current_state) {
|
||||||
|
case GST_STATE_PAUSED:
|
||||||
|
if (diff < 0 && element->base_time < abs (diff)) {
|
||||||
|
g_warning ("attempted to set the current time of element %s below 0",
|
||||||
|
GST_OBJECT_NAME (element));
|
||||||
|
element->base_time = 0;
|
||||||
|
} else {
|
||||||
|
element->base_time += diff;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case GST_STATE_PLAYING:
|
||||||
|
time = gst_clock_get_time (element->clock);
|
||||||
|
if (time < element->base_time - diff) {
|
||||||
|
g_warning ("attempted to set the current time of element %s below 0",
|
||||||
|
GST_OBJECT_NAME (element));
|
||||||
|
element->base_time = time;
|
||||||
|
} else {
|
||||||
|
element->base_time -= diff;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
g_assert_not_reached ();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#undef GST_CAT_DEFAULT
|
||||||
|
|
||||||
#ifndef GST_DISABLE_INDEX
|
#ifndef GST_DISABLE_INDEX
|
||||||
/**
|
/**
|
||||||
* gst_element_is_indexable:
|
* gst_element_is_indexable:
|
||||||
* @element: a #GstElement.
|
* @element: a #GstElement.
|
||||||
*
|
*
|
||||||
* Queries if the element can be indexed/
|
* Queries if the element can be indexed.
|
||||||
*
|
*
|
||||||
* Returns: TRUE if the element can be indexed.
|
* Returns: TRUE if the element can be indexed.
|
||||||
*/
|
*/
|
||||||
|
@ -1496,8 +1645,8 @@ gst_element_get_compatible_pad_filtered (GstElement *element, GstPad *pad,
|
||||||
if (foundpad) return foundpad;
|
if (foundpad) return foundpad;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
g_critical("Could not find a compatible pad on element %s to link to %s:%s",
|
GST_DEBUG_OBJECT (element, "Could not find a compatible pad to link to %s:%s",
|
||||||
GST_ELEMENT_NAME (element), GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -2581,19 +2730,34 @@ gst_element_change_state (GstElement *element)
|
||||||
|
|
||||||
switch (old_transition) {
|
switch (old_transition) {
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
case GST_STATE_PLAYING_TO_PAUSED:
|
||||||
|
if (element->clock) {
|
||||||
|
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||||
|
g_assert (time >= element->base_time);
|
||||||
|
element->base_time = time - element->base_time;
|
||||||
|
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||||
|
G_GINT64_FORMAT, element->base_time);
|
||||||
|
}
|
||||||
gst_element_pads_activate (element, FALSE);
|
gst_element_pads_activate (element, FALSE);
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
case GST_STATE_PAUSED_TO_PLAYING:
|
||||||
gst_element_pads_activate (element, TRUE);
|
gst_element_pads_activate (element, TRUE);
|
||||||
|
if (element->clock) {
|
||||||
|
GstClockTime time = gst_clock_get_event_time (element->clock);
|
||||||
|
element->base_time = time - element->base_time;
|
||||||
|
GST_CAT_LOG_OBJECT (GST_CAT_CLOCK, element, "setting base time to %"
|
||||||
|
G_GINT64_FORMAT, element->base_time);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
/* if we are going to paused, we try to negotiate the pads */
|
/* if we are going to paused, we try to negotiate the pads */
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
|
g_assert (element->base_time == 0);
|
||||||
if (!gst_element_negotiate_pads (element))
|
if (!gst_element_negotiate_pads (element))
|
||||||
goto failure;
|
goto failure;
|
||||||
break;
|
break;
|
||||||
/* going to the READY state clears all pad caps */
|
/* going to the READY state clears all pad caps */
|
||||||
/* FIXME: Why doesn't this happen on READY => NULL? -- Company */
|
/* FIXME: Why doesn't this happen on READY => NULL? -- Company */
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
|
element->base_time = 0;
|
||||||
gst_element_clear_pad_caps (element);
|
gst_element_clear_pad_caps (element);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -159,7 +159,7 @@ struct _GstElement {
|
||||||
|
|
||||||
/* allocated clock */
|
/* allocated clock */
|
||||||
GstClock *clock;
|
GstClock *clock;
|
||||||
GstClockTime base_time;
|
GstClockTimeDiff base_time; /* NULL/READY: 0 - PAUSED: current time - PLAYING: difference to clock */
|
||||||
|
|
||||||
/* element pads */
|
/* element pads */
|
||||||
guint16 numpads;
|
guint16 numpads;
|
||||||
|
@ -275,8 +275,14 @@ gboolean gst_element_requires_clock (GstElement *element);
|
||||||
gboolean gst_element_provides_clock (GstElement *element);
|
gboolean gst_element_provides_clock (GstElement *element);
|
||||||
GstClock* gst_element_get_clock (GstElement *element);
|
GstClock* gst_element_get_clock (GstElement *element);
|
||||||
void gst_element_set_clock (GstElement *element, GstClock *clock);
|
void gst_element_set_clock (GstElement *element, GstClock *clock);
|
||||||
|
#ifndef GST_DEISABLE_DEPRECATED
|
||||||
GstClockReturn gst_element_clock_wait (GstElement *element,
|
GstClockReturn gst_element_clock_wait (GstElement *element,
|
||||||
GstClockID id, GstClockTimeDiff *jitter);
|
GstClockID id, GstClockTimeDiff *jitter);
|
||||||
|
#endif
|
||||||
|
GstClockTime gst_element_get_time (GstElement *element);
|
||||||
|
gboolean gst_element_wait (GstElement *element, GstClockTime timestamp);
|
||||||
|
void gst_element_set_time (GstElement *element, GstClockTime time);
|
||||||
|
void gst_element_adjust_time (GstElement *element, GstClockTimeDiff diff);
|
||||||
|
|
||||||
/* indexs */
|
/* indexs */
|
||||||
gboolean gst_element_is_indexable (GstElement *element);
|
gboolean gst_element_is_indexable (GstElement *element);
|
||||||
|
|
|
@ -3445,7 +3445,7 @@ gst_pad_event_default (GstPad *pad, GstEvent *event)
|
||||||
|
|
||||||
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) {
|
if (gst_event_discont_get_value (event, GST_FORMAT_TIME, &time)) {
|
||||||
if (gst_element_requires_clock (element) && element->clock) {
|
if (gst_element_requires_clock (element) && element->clock) {
|
||||||
gst_clock_handle_discont (element->clock, time);
|
gst_element_set_time (element, time);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -303,38 +303,12 @@ gst_scheduler_state_transition (GstScheduler *sched, GstElement *element, gint t
|
||||||
case GST_STATE_READY_TO_PAUSED:
|
case GST_STATE_READY_TO_PAUSED:
|
||||||
{
|
{
|
||||||
GstClock *clock = gst_scheduler_get_clock (sched);
|
GstClock *clock = gst_scheduler_get_clock (sched);
|
||||||
|
|
||||||
if (clock)
|
|
||||||
gst_clock_reset (clock);
|
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler READY to PAUSED clock is %p (%s)", clock,
|
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler READY to PAUSED clock is %p (%s)", clock,
|
||||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
||||||
|
|
||||||
gst_object_replace ((GstObject **)&sched->current_clock, (GstObject *)clock);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case GST_STATE_PAUSED_TO_PLAYING:
|
|
||||||
{
|
|
||||||
GstClock *clock = gst_scheduler_get_clock (sched);
|
|
||||||
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler PAUSED to PLAYING clock is %p (%s)", clock,
|
|
||||||
(clock ? GST_OBJECT_NAME (clock) : "nil"));
|
|
||||||
|
|
||||||
gst_scheduler_set_clock (sched, clock);
|
gst_scheduler_set_clock (sched, clock);
|
||||||
if (clock) {
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "enabling clock %p (%s)", clock,
|
|
||||||
GST_OBJECT_NAME (clock));
|
|
||||||
gst_clock_set_active (clock, TRUE);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_STATE_PLAYING_TO_PAUSED:
|
|
||||||
if (sched->current_clock) {
|
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "disabling clock %p (%s)", sched->current_clock,
|
|
||||||
GST_OBJECT_NAME (sched->current_clock));
|
|
||||||
gst_clock_set_active (sched->current_clock, FALSE);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -678,6 +652,8 @@ gst_scheduler_auto_clock (GstScheduler *sched)
|
||||||
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using automatic clock");
|
GST_CAT_DEBUG (GST_CAT_CLOCK, "scheduler using automatic clock");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GstClockReturn gst_clock_id_wait (GstClockID id,
|
||||||
|
GstClockTimeDiff *jitter);
|
||||||
/**
|
/**
|
||||||
* gst_scheduler_clock_wait:
|
* gst_scheduler_clock_wait:
|
||||||
* @sched: the scheduler
|
* @sched: the scheduler
|
||||||
|
|
|
@ -131,8 +131,6 @@ static void gst_basic_scheduler_pad_link (GstScheduler *sched, GstPad *src
|
||||||
static void gst_basic_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad,
|
static void gst_basic_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad,
|
||||||
GstPad *sinkpad);
|
GstPad *sinkpad);
|
||||||
static void gst_basic_scheduler_pad_select (GstScheduler *sched, GList *padlist);
|
static void gst_basic_scheduler_pad_select (GstScheduler *sched, GList *padlist);
|
||||||
static GstClockReturn gst_basic_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
|
|
||||||
GstClockID id, GstClockTimeDiff *jitter);
|
|
||||||
static GstSchedulerState
|
static GstSchedulerState
|
||||||
gst_basic_scheduler_iterate (GstScheduler *sched);
|
gst_basic_scheduler_iterate (GstScheduler *sched);
|
||||||
|
|
||||||
|
@ -221,7 +219,7 @@ gst_basic_scheduler_class_init (GstBasicSchedulerClass * klass)
|
||||||
gstscheduler_class->pad_link = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_link);
|
gstscheduler_class->pad_link = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_link);
|
||||||
gstscheduler_class->pad_unlink = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_unlink);
|
gstscheduler_class->pad_unlink = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_unlink);
|
||||||
gstscheduler_class->pad_select = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_select);
|
gstscheduler_class->pad_select = GST_DEBUG_FUNCPTR (gst_basic_scheduler_pad_select);
|
||||||
gstscheduler_class->clock_wait = GST_DEBUG_FUNCPTR (gst_basic_scheduler_clock_wait);
|
gstscheduler_class->clock_wait = NULL;
|
||||||
gstscheduler_class->iterate = GST_DEBUG_FUNCPTR (gst_basic_scheduler_iterate);
|
gstscheduler_class->iterate = GST_DEBUG_FUNCPTR (gst_basic_scheduler_iterate);
|
||||||
|
|
||||||
gstscheduler_class->show = GST_DEBUG_FUNCPTR (gst_basic_scheduler_show);
|
gstscheduler_class->show = GST_DEBUG_FUNCPTR (gst_basic_scheduler_show);
|
||||||
|
@ -1345,13 +1343,6 @@ gst_basic_scheduler_pad_select (GstScheduler * sched, GList * padlist)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstClockReturn
|
|
||||||
gst_basic_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
|
|
||||||
GstClockID id, GstClockTimeDiff *jitter)
|
|
||||||
{
|
|
||||||
return gst_clock_id_wait (id, jitter);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstSchedulerState
|
static GstSchedulerState
|
||||||
gst_basic_scheduler_iterate (GstScheduler * sched)
|
gst_basic_scheduler_iterate (GstScheduler * sched)
|
||||||
{
|
{
|
||||||
|
|
|
@ -245,8 +245,6 @@ static void gst_opt_scheduler_error (GstScheduler *sched, GstElement *eleme
|
||||||
static void gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
static void gst_opt_scheduler_pad_link (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||||
static void gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
static void gst_opt_scheduler_pad_unlink (GstScheduler *sched, GstPad *srcpad, GstPad *sinkpad);
|
||||||
static void gst_opt_scheduler_pad_select (GstScheduler *sched, GList *padlist);
|
static void gst_opt_scheduler_pad_select (GstScheduler *sched, GList *padlist);
|
||||||
static GstClockReturn gst_opt_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
|
|
||||||
GstClockID id, GstClockTimeDiff *jitter);
|
|
||||||
static GstSchedulerState
|
static GstSchedulerState
|
||||||
gst_opt_scheduler_iterate (GstScheduler *sched);
|
gst_opt_scheduler_iterate (GstScheduler *sched);
|
||||||
|
|
||||||
|
@ -319,7 +317,7 @@ gst_opt_scheduler_class_init (GstOptSchedulerClass *klass)
|
||||||
gstscheduler_class->pad_link = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_link);
|
gstscheduler_class->pad_link = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_link);
|
||||||
gstscheduler_class->pad_unlink = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_unlink);
|
gstscheduler_class->pad_unlink = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_unlink);
|
||||||
gstscheduler_class->pad_select = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_select);
|
gstscheduler_class->pad_select = GST_DEBUG_FUNCPTR (gst_opt_scheduler_pad_select);
|
||||||
gstscheduler_class->clock_wait = GST_DEBUG_FUNCPTR (gst_opt_scheduler_clock_wait);
|
gstscheduler_class->clock_wait = NULL;
|
||||||
gstscheduler_class->iterate = GST_DEBUG_FUNCPTR (gst_opt_scheduler_iterate);
|
gstscheduler_class->iterate = GST_DEBUG_FUNCPTR (gst_opt_scheduler_iterate);
|
||||||
gstscheduler_class->show = GST_DEBUG_FUNCPTR (gst_opt_scheduler_show);
|
gstscheduler_class->show = GST_DEBUG_FUNCPTR (gst_opt_scheduler_show);
|
||||||
|
|
||||||
|
@ -2045,13 +2043,6 @@ gst_opt_scheduler_pad_select (GstScheduler *sched, GList *padlist)
|
||||||
g_warning ("pad select, implement me");
|
g_warning ("pad select, implement me");
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstClockReturn
|
|
||||||
gst_opt_scheduler_clock_wait (GstScheduler *sched, GstElement *element,
|
|
||||||
GstClockID id, GstClockTimeDiff *jitter)
|
|
||||||
{
|
|
||||||
return gst_clock_id_wait (id, jitter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* a scheduler iteration is done by looping and scheduling the active chains */
|
/* a scheduler iteration is done by looping and scheduling the active chains */
|
||||||
static GstSchedulerState
|
static GstSchedulerState
|
||||||
gst_opt_scheduler_iterate (GstScheduler *sched)
|
gst_opt_scheduler_iterate (GstScheduler *sched)
|
||||||
|
|
|
@ -312,7 +312,7 @@ gst_fakesink_chain (GstPad *pad, GstData *_data)
|
||||||
case GST_EVENT_DISCONTINUOUS:
|
case GST_EVENT_DISCONTINUOUS:
|
||||||
if (fakesink->sync && fakesink->clock) {
|
if (fakesink->sync && fakesink->clock) {
|
||||||
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
gint64 value = GST_EVENT_DISCONT_OFFSET (event, 0).value;
|
||||||
gst_clock_handle_discont (fakesink->clock, value);
|
gst_element_set_time (GST_ELEMENT (fakesink), value);
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
gst_pad_event_default (pad, event);
|
gst_pad_event_default (pad, event);
|
||||||
|
@ -322,10 +322,7 @@ gst_fakesink_chain (GstPad *pad, GstData *_data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fakesink->sync && fakesink->clock) {
|
if (fakesink->sync && fakesink->clock) {
|
||||||
GstClockID id = gst_clock_new_single_shot_id (fakesink->clock, GST_BUFFER_TIMESTAMP (buf));
|
gst_element_wait (GST_ELEMENT (fakesink), GST_BUFFER_TIMESTAMP (buf));
|
||||||
|
|
||||||
gst_element_clock_wait (GST_ELEMENT (fakesink), id, NULL);
|
|
||||||
gst_clock_id_free (id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fakesink->silent) {
|
if (!fakesink->silent) {
|
||||||
|
|
|
@ -10,11 +10,8 @@
|
||||||
void
|
void
|
||||||
gst_clock_debug (GstClock *clock)
|
gst_clock_debug (GstClock *clock)
|
||||||
{
|
{
|
||||||
g_print ("Clock info: speed %f, active %s, time %d\n",
|
g_print ("Clock info: time %"G_GUINT64_FORMAT"\n",
|
||||||
gst_clock_get_speed (clock),
|
gst_clock_get_time (clock));
|
||||||
gst_clock_is_active (clock) ? "yes" : "no",
|
|
||||||
(gint) gst_clock_get_time (clock)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -53,12 +50,7 @@ main (int argc, char *argv[])
|
||||||
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
||||||
g_assert (clock != NULL);
|
g_assert (clock != NULL);
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock);
|
||||||
//gst_clock_set_active (clock, TRUE);
|
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock);
|
||||||
//clock = gst_clock_new ("clock");
|
|
||||||
//gst_element_set_clock (src, clock);
|
|
||||||
//clock = gst_element_get_clock (src);
|
|
||||||
//g_assert (clock != NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
gst_bin_iterate (GST_BIN (pipeline));
|
||||||
|
|
|
@ -8,46 +8,46 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
void
|
void
|
||||||
gst_clock_debug (GstClock *clock)
|
gst_clock_debug (GstClock *clock, GstElement *fakesink)
|
||||||
{
|
{
|
||||||
g_print ("Clock info: speed %f, active %s, time %d\n",
|
g_print ("Clock info: time %"G_GUINT64_FORMAT" - Element info: time %"G_GUINT64_FORMAT"\n",
|
||||||
gst_clock_get_speed (clock),
|
gst_clock_get_time (clock), gst_element_get_time (fakesink));
|
||||||
gst_clock_is_active (clock) ? "yes" : "no",
|
|
||||||
(gint) gst_clock_get_time (clock)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstClock *clock = NULL;
|
GstClock *clock = NULL;
|
||||||
GstClockID id;
|
GstElement *pipeline, *fakesrc, *fakesink;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
clock = gst_system_clock_obtain ();
|
clock = gst_system_clock_obtain ();
|
||||||
g_assert (clock != NULL);
|
g_assert (clock != NULL);
|
||||||
|
|
||||||
gst_clock_debug (clock);
|
/* we check the time on an element */
|
||||||
g_usleep (G_USEC_PER_SEC);
|
fakesrc = gst_element_factory_make ("fakesrc", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (fakesrc);
|
||||||
gst_clock_set_active (clock, TRUE);
|
fakesink = gst_element_factory_make ("fakesink", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (fakesink);
|
||||||
g_usleep (G_USEC_PER_SEC);
|
pipeline = gst_element_factory_make ("pipeline", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (pipeline);
|
||||||
|
gst_bin_add_many (GST_BIN (pipeline), fakesink, fakesrc, NULL);
|
||||||
|
gst_element_link (fakesrc, fakesink);
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2);
|
gst_clock_debug (clock, fakesink);
|
||||||
gst_clock_id_wait (id, NULL);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
|
|
||||||
id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2);
|
|
||||||
gst_clock_id_wait (id, NULL);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
|
|
||||||
gst_clock_set_active (clock, FALSE);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
g_usleep (G_USEC_PER_SEC);
|
g_usleep (G_USEC_PER_SEC);
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
gst_element_wait (fakesink, 2 * GST_SECOND);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
gst_element_wait (fakesink, 5 * GST_SECOND);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
g_usleep (G_USEC_PER_SEC);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -30,8 +30,8 @@ static const gchar* lines[] = {
|
||||||
"--gst-disable-debug",
|
"--gst-disable-debug",
|
||||||
"--gst-debug-no-color",
|
"--gst-debug-no-color",
|
||||||
"--gst-debug-level=4",
|
"--gst-debug-level=4",
|
||||||
"--gst-debug=cat=4:cat_*=3",
|
"--gst-debug=cat:4,cat_*:3",
|
||||||
"--gst-debug-level=4 --gst-debug=cat_*=5"
|
"--gst-debug-level=4 --gst-debug=cat_*:5"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
tests_pass = thread1 thread2 thread3 thread4 threadf
|
tests_pass = thread1 thread2 thread3 thread4 threadf
|
||||||
tests_fail = thread5 threadd threade queue
|
tests_fail = thread5 threadd queue
|
||||||
# tests which unexpectedly pass: threadb threadc
|
# tests which unexpectedly pass: threade threadb threadc
|
||||||
|
|
||||||
queue_SOURCES = queue.c
|
queue_SOURCES = queue.c
|
||||||
queue_CFLAGS = $(AM_CFLAGS)
|
queue_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
|
@ -10,11 +10,8 @@
|
||||||
void
|
void
|
||||||
gst_clock_debug (GstClock *clock)
|
gst_clock_debug (GstClock *clock)
|
||||||
{
|
{
|
||||||
g_print ("Clock info: speed %f, active %s, time %d\n",
|
g_print ("Clock info: time %"G_GUINT64_FORMAT"\n",
|
||||||
gst_clock_get_speed (clock),
|
gst_clock_get_time (clock));
|
||||||
gst_clock_is_active (clock) ? "yes" : "no",
|
|
||||||
(gint) gst_clock_get_time (clock)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -53,12 +50,7 @@ main (int argc, char *argv[])
|
||||||
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
clock = gst_bin_get_clock (GST_BIN (pipeline));
|
||||||
g_assert (clock != NULL);
|
g_assert (clock != NULL);
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock);
|
||||||
//gst_clock_set_active (clock, TRUE);
|
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock);
|
||||||
//clock = gst_clock_new ("clock");
|
|
||||||
//gst_element_set_clock (src, clock);
|
|
||||||
//clock = gst_element_get_clock (src);
|
|
||||||
//g_assert (clock != NULL);
|
|
||||||
|
|
||||||
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);
|
||||||
gst_bin_iterate (GST_BIN (pipeline));
|
gst_bin_iterate (GST_BIN (pipeline));
|
||||||
|
|
|
@ -8,46 +8,46 @@
|
||||||
|
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
void
|
void
|
||||||
gst_clock_debug (GstClock *clock)
|
gst_clock_debug (GstClock *clock, GstElement *fakesink)
|
||||||
{
|
{
|
||||||
g_print ("Clock info: speed %f, active %s, time %d\n",
|
g_print ("Clock info: time %"G_GUINT64_FORMAT" - Element info: time %"G_GUINT64_FORMAT"\n",
|
||||||
gst_clock_get_speed (clock),
|
gst_clock_get_time (clock), gst_element_get_time (fakesink));
|
||||||
gst_clock_is_active (clock) ? "yes" : "no",
|
|
||||||
(gint) gst_clock_get_time (clock)
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
GstClock *clock = NULL;
|
GstClock *clock = NULL;
|
||||||
GstClockID id;
|
GstElement *pipeline, *fakesrc, *fakesink;
|
||||||
|
|
||||||
gst_init (&argc, &argv);
|
gst_init (&argc, &argv);
|
||||||
|
|
||||||
clock = gst_system_clock_obtain ();
|
clock = gst_system_clock_obtain ();
|
||||||
g_assert (clock != NULL);
|
g_assert (clock != NULL);
|
||||||
|
|
||||||
gst_clock_debug (clock);
|
/* we check the time on an element */
|
||||||
g_usleep (G_USEC_PER_SEC);
|
fakesrc = gst_element_factory_make ("fakesrc", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (fakesrc);
|
||||||
gst_clock_set_active (clock, TRUE);
|
fakesink = gst_element_factory_make ("fakesink", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (fakesink);
|
||||||
g_usleep (G_USEC_PER_SEC);
|
pipeline = gst_element_factory_make ("pipeline", NULL);
|
||||||
gst_clock_debug (clock);
|
g_assert (pipeline);
|
||||||
|
gst_bin_add_many (GST_BIN (pipeline), fakesink, fakesrc, NULL);
|
||||||
|
gst_element_link (fakesrc, fakesink);
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
|
||||||
id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2);
|
gst_clock_debug (clock, fakesink);
|
||||||
gst_clock_id_wait (id, NULL);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
|
|
||||||
id = gst_clock_new_single_shot_id (clock, GST_SECOND * 2);
|
|
||||||
gst_clock_id_wait (id, NULL);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
|
|
||||||
gst_clock_set_active (clock, FALSE);
|
|
||||||
gst_clock_debug (clock);
|
|
||||||
g_usleep (G_USEC_PER_SEC);
|
g_usleep (G_USEC_PER_SEC);
|
||||||
gst_clock_debug (clock);
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
gst_element_wait (fakesink, 2 * GST_SECOND);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
gst_element_wait (fakesink, 5 * GST_SECOND);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
|
g_usleep (G_USEC_PER_SEC);
|
||||||
|
gst_clock_debug (clock, fakesink);
|
||||||
|
|
||||||
/* success */
|
/* success */
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -30,8 +30,8 @@ static const gchar* lines[] = {
|
||||||
"--gst-disable-debug",
|
"--gst-disable-debug",
|
||||||
"--gst-debug-no-color",
|
"--gst-debug-no-color",
|
||||||
"--gst-debug-level=4",
|
"--gst-debug-level=4",
|
||||||
"--gst-debug=cat=4:cat_*=3",
|
"--gst-debug=cat:4,cat_*:3",
|
||||||
"--gst-debug-level=4 --gst-debug=cat_*=5"
|
"--gst-debug-level=4 --gst-debug=cat_*:5"
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
include ../Rules
|
include ../Rules
|
||||||
|
|
||||||
tests_pass = thread1 thread2 thread3 thread4 threadf
|
tests_pass = thread1 thread2 thread3 thread4 threadf
|
||||||
tests_fail = thread5 threadd threade queue
|
tests_fail = thread5 threadd queue
|
||||||
# tests which unexpectedly pass: threadb threadc
|
# tests which unexpectedly pass: threade threadb threadc
|
||||||
|
|
||||||
queue_SOURCES = queue.c
|
queue_SOURCES = queue.c
|
||||||
queue_CFLAGS = $(AM_CFLAGS)
|
queue_CFLAGS = $(AM_CFLAGS)
|
||||||
|
|
Loading…
Reference in a new issue