+2004-06-18 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * gst/elements/gstidentity.c: (gst_identity_class_init),
+ (gst_identity_init), (gst_identity_set_clock),
+ (gst_identity_chain), (gst_identity_set_property),
+ (gst_identity_get_property):
+ * gst/elements/gstidentity.h:
+ * gst/gstclock.c: (gst_clock_id_wait):
+ add a "sync" property to sync to the clock
+
2004-06-16 Benjamin Otte <in7y118@public.uni-hamburg.de>
* gst/gstelementfactory.c: (gst_element_factory_create):
ARG_DROP_PROBABILITY,
ARG_SILENT,
ARG_LAST_MESSAGE,
- ARG_DUMP
+ ARG_DUMP,
+ ARG_SYNC
};
GValue * value, GParamSpec * pspec);
static void gst_identity_chain (GstPad * pad, GstData * _data);
+static void gst_identity_set_clock (GstElement * element, GstClock * clock);
+
static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
gst_identity_class_init (GstIdentityClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = G_OBJECT_CLASS (klass);
-
+ gstelement_class = GST_ELEMENT_CLASS (klass);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop-based", "Loop-based",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
g_param_spec_boolean ("dump", "Dump", "Dump buffer contents", FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
+ g_param_spec_boolean ("sync", "Synchronize",
+ "Synchronize to pipeline clock", FALSE, G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
+
+ gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_identity_set_clock);
+
}
static void
identity->error_after = -1;
identity->drop_probability = 0.0;
identity->silent = FALSE;
+ identity->sync = FALSE;
identity->dump = FALSE;
identity->last_message = NULL;
identity->srccaps = NULL;
}
static void
+gst_identity_set_clock (GstElement * element, GstClock * clock)
+{
+ GstIdentity *identity = GST_IDENTITY (element);
+
+ gst_object_replace ((GstObject **) & identity->clock, (GstObject *) clock);
+}
+
+
+static void
gst_identity_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
if (i > 1)
gst_buffer_ref (buf);
+ if (identity->sync) {
+ if (identity->clock) {
+ gst_element_wait (GST_ELEMENT (identity), GST_BUFFER_TIMESTAMP (buf));
+ }
+ }
gst_pad_push (identity->srcpad, GST_DATA (buf));
if (identity->sleep_time)
case ARG_DROP_PROBABILITY:
identity->drop_probability = g_value_get_float (value);
break;
+ case ARG_SYNC:
+ identity->sync = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case ARG_LAST_MESSAGE:
g_value_set_string (value, identity->last_message);
break;
+ case ARG_SYNC:
+ g_value_set_boolean (value, identity->sync);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
guint sleep_time;
gboolean silent;
gboolean dump;
+ gboolean sync;
+ GstClock *clock;
gchar *last_message;
GstCaps *srccaps;
};
ARG_DROP_PROBABILITY,
ARG_SILENT,
ARG_LAST_MESSAGE,
- ARG_DUMP
+ ARG_DUMP,
+ ARG_SYNC
};
GValue * value, GParamSpec * pspec);
static void gst_identity_chain (GstPad * pad, GstData * _data);
+static void gst_identity_set_clock (GstElement * element, GstClock * clock);
+
static guint gst_identity_signals[LAST_SIGNAL] = { 0 };
gst_identity_class_init (GstIdentityClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = G_OBJECT_CLASS (klass);
-
+ gstelement_class = GST_ELEMENT_CLASS (klass);
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop-based", "Loop-based",
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUMP,
g_param_spec_boolean ("dump", "Dump", "Dump buffer contents", FALSE,
G_PARAM_READWRITE));
+ g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SYNC,
+ g_param_spec_boolean ("sync", "Synchronize",
+ "Synchronize to pipeline clock", FALSE, G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_new ("handoff", G_TYPE_FROM_CLASS (klass), G_SIGNAL_RUN_LAST,
gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_identity_finalize);
gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_identity_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_identity_get_property);
+
+ gstelement_class->set_clock = GST_DEBUG_FUNCPTR (gst_identity_set_clock);
+
}
static void
identity->error_after = -1;
identity->drop_probability = 0.0;
identity->silent = FALSE;
+ identity->sync = FALSE;
identity->dump = FALSE;
identity->last_message = NULL;
identity->srccaps = NULL;
}
static void
+gst_identity_set_clock (GstElement * element, GstClock * clock)
+{
+ GstIdentity *identity = GST_IDENTITY (element);
+
+ gst_object_replace ((GstObject **) & identity->clock, (GstObject *) clock);
+}
+
+
+static void
gst_identity_chain (GstPad * pad, GstData * _data)
{
GstBuffer *buf = GST_BUFFER (_data);
if (i > 1)
gst_buffer_ref (buf);
+ if (identity->sync) {
+ if (identity->clock) {
+ gst_element_wait (GST_ELEMENT (identity), GST_BUFFER_TIMESTAMP (buf));
+ }
+ }
gst_pad_push (identity->srcpad, GST_DATA (buf));
if (identity->sleep_time)
case ARG_DROP_PROBABILITY:
identity->drop_probability = g_value_get_float (value);
break;
+ case ARG_SYNC:
+ identity->sync = g_value_get_boolean (value);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
case ARG_LAST_MESSAGE:
g_value_set_string (value, identity->last_message);
break;
+ case ARG_SYNC:
+ g_value_set_boolean (value, identity->sync);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
guint sleep_time;
gboolean silent;
gboolean dump;
+ gboolean sync;
+ GstClock *clock;
gchar *last_message;
GstCaps *srccaps;
};