{
gchar *elem_name;
GstIterator *it;
- gboolean is_sink, is_source;
+ gboolean is_sink, is_source, provides_clock;
GstMessage *clock_message = NULL, *async_message = NULL;
GstStateChangeReturn ret;
elem_name = g_strdup (GST_ELEMENT_NAME (element));
is_sink = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_SINK);
is_source = GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_SOURCE);
+ provides_clock =
+ GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
GST_OBJECT_UNLOCK (element);
GST_OBJECT_LOCK (bin);
elem_name);
GST_OBJECT_FLAG_SET (bin, GST_ELEMENT_FLAG_SOURCE);
}
- if (gst_element_provides_clock (element)) {
+ if (provides_clock) {
GST_DEBUG_OBJECT (bin, "element \"%s\" can provide a clock", elem_name);
clock_message =
gst_message_new_clock_provide (GST_OBJECT_CAST (element), NULL, TRUE);
}
/**
- * gst_element_requires_clock:
- * @element: a #GstElement to query
- *
- * Query if the element requires a clock.
- *
- * Returns: %TRUE if the element requires a clock
- *
- * MT safe.
- */
-gboolean
-gst_element_requires_clock (GstElement * element)
-{
- gboolean result;
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
-
- result = (GST_ELEMENT_GET_CLASS (element)->set_clock != NULL);
-
- return result;
-}
-
-/**
- * gst_element_provides_clock:
- * @element: a #GstElement to query
- *
- * Query if the element provides a clock. A #GstClock provided by an
- * element can be used as the global #GstClock for the pipeline.
- * An element that can provide a clock is only required to do so in the PAUSED
- * state, this means when it is fully negotiated and has allocated the resources
- * to operate the clock.
- *
- * Returns: %TRUE if the element provides a clock
- *
- * MT safe.
- */
-gboolean
-gst_element_provides_clock (GstElement * element)
-{
- gboolean result;
-
- g_return_val_if_fail (GST_IS_ELEMENT (element), FALSE);
-
- result = (GST_ELEMENT_GET_CLASS (element)->provide_clock != NULL);
-
- return result;
-}
-
-/**
* gst_element_provide_clock:
* @element: a #GstElement to query
*
GST_ELEMENT_FLAG_LOCKED_STATE = (GST_OBJECT_FLAG_LAST << 1),
GST_ELEMENT_FLAG_SINK = (GST_OBJECT_FLAG_LAST << 2),
GST_ELEMENT_FLAG_SOURCE = (GST_OBJECT_FLAG_LAST << 3),
+ GST_ELEMENT_FLAG_PROVIDE_CLOCK = (GST_OBJECT_FLAG_LAST << 4),
+ GST_ELEMENT_FLAG_REQUIRE_CLOCK = (GST_OBJECT_FLAG_LAST << 5),
/* padding */
GST_ELEMENT_FLAG_LAST = (GST_OBJECT_FLAG_LAST << 16)
} GstElementFlags;
#define gst_element_set_parent(elem,parent) gst_object_set_parent(GST_OBJECT_CAST(elem),parent)
/* clocking */
-gboolean gst_element_requires_clock (GstElement *element);
-gboolean gst_element_provides_clock (GstElement *element);
GstClock* gst_element_provide_clock (GstElement *element);
GstClock* gst_element_get_clock (GstElement *element);
gboolean gst_element_set_clock (GstElement *element, GstClock *clock);
static void
print_clocking_info (GstElement * element)
{
- if (!gst_element_requires_clock (element) &&
- !(gst_element_provides_clock (element) &&
- gst_element_get_clock (element))) {
+ gboolean requires_clock, provides_clock;
+
+ requires_clock =
+ GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_REQUIRE_CLOCK);
+ provides_clock =
+ GST_OBJECT_FLAG_IS_SET (element, GST_ELEMENT_FLAG_PROVIDE_CLOCK);
+
+ if (!requires_clock && !provides_clock) {
n_print ("\n");
n_print ("Element has no clocking capabilities.");
return;
n_print ("\n");
n_print ("Clocking Interaction:\n");
- if (gst_element_requires_clock (element)) {
+ if (requires_clock) {
n_print (" element requires a clock\n");
}
- if (gst_element_provides_clock (element)) {
+ if (provides_clock) {
GstClock *clock;
clock = gst_element_get_clock (element);
- if (clock)
+ if (clock) {
n_print (" element provides a clock: %s\n", GST_OBJECT_NAME (clock));
- else
+ gst_object_unref (clock);
+ } else
n_print (" element is supposed to provide a clock but returned NULL\n");
}
}