mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-16 19:25:18 +00:00
add sync to identity
Original commit message from CVS: add sync to identity
This commit is contained in:
parent
2f391173fc
commit
6f0d62ebdd
5 changed files with 80 additions and 4 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
|||
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):
|
||||
|
|
|
@ -58,7 +58,8 @@ enum
|
|||
ARG_DROP_PROBABILITY,
|
||||
ARG_SILENT,
|
||||
ARG_LAST_MESSAGE,
|
||||
ARG_DUMP
|
||||
ARG_DUMP,
|
||||
ARG_SYNC
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,6 +76,8 @@ static void gst_identity_get_property (GObject * object, guint prop_id,
|
|||
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 };
|
||||
|
||||
|
@ -102,9 +105,10 @@ static void
|
|||
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",
|
||||
|
@ -133,6 +137,9 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
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,
|
||||
|
@ -142,6 +149,9 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
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
|
||||
|
@ -165,6 +175,7 @@ gst_identity_init (GstIdentity * identity)
|
|||
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;
|
||||
|
@ -172,6 +183,15 @@ gst_identity_init (GstIdentity * identity)
|
|||
GST_FLAG_SET (identity, GST_ELEMENT_EVENT_AWARE);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -251,6 +271,11 @@ gst_identity_chain (GstPad * pad, GstData * _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)
|
||||
|
@ -324,6 +349,9 @@ gst_identity_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -366,6 +394,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
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;
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _GstIdentity {
|
|||
guint sleep_time;
|
||||
gboolean silent;
|
||||
gboolean dump;
|
||||
gboolean sync;
|
||||
GstClock *clock;
|
||||
gchar *last_message;
|
||||
GstCaps *srccaps;
|
||||
};
|
||||
|
|
|
@ -58,7 +58,8 @@ enum
|
|||
ARG_DROP_PROBABILITY,
|
||||
ARG_SILENT,
|
||||
ARG_LAST_MESSAGE,
|
||||
ARG_DUMP
|
||||
ARG_DUMP,
|
||||
ARG_SYNC
|
||||
};
|
||||
|
||||
|
||||
|
@ -75,6 +76,8 @@ static void gst_identity_get_property (GObject * object, guint prop_id,
|
|||
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 };
|
||||
|
||||
|
@ -102,9 +105,10 @@ static void
|
|||
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",
|
||||
|
@ -133,6 +137,9 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
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,
|
||||
|
@ -142,6 +149,9 @@ gst_identity_class_init (GstIdentityClass * klass)
|
|||
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
|
||||
|
@ -165,6 +175,7 @@ gst_identity_init (GstIdentity * identity)
|
|||
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;
|
||||
|
@ -172,6 +183,15 @@ gst_identity_init (GstIdentity * identity)
|
|||
GST_FLAG_SET (identity, GST_ELEMENT_EVENT_AWARE);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -251,6 +271,11 @@ gst_identity_chain (GstPad * pad, GstData * _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)
|
||||
|
@ -324,6 +349,9 @@ gst_identity_set_property (GObject * object, guint prop_id,
|
|||
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;
|
||||
|
@ -366,6 +394,9 @@ gst_identity_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
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;
|
||||
|
|
|
@ -57,6 +57,8 @@ struct _GstIdentity {
|
|||
guint sleep_time;
|
||||
gboolean silent;
|
||||
gboolean dump;
|
||||
gboolean sync;
|
||||
GstClock *clock;
|
||||
gchar *last_message;
|
||||
GstCaps *srccaps;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue