Some cleanups in output of various test plugins.

Original commit message from CVS:
Some cleanups in output of various test plugins.
Added debug output to tee.
Added buffer duplication to identity.
This commit is contained in:
Wim Taymans 2001-07-11 19:22:20 +00:00
parent bb1cb28921
commit abf2bfc273
12 changed files with 144 additions and 62 deletions

View file

@ -220,7 +220,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
if (!fakesink->silent)
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,

View file

@ -133,7 +133,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
1, G_MAXINT, 1, G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
g_param_spec_boolean("loop_based","loop_based","loop_based",
TRUE,G_PARAM_READWRITE)); // CHECKME
FALSE, G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OUTPUT,
g_param_spec_enum("output","output","output",
GST_TYPE_FAKESRC_OUTPUT,FAKESRC_FIRST_LAST_LOOP,G_PARAM_READWRITE)); // CHECKME!
@ -175,7 +175,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
gst_element_add_pad (GST_ELEMENT (fakesrc), pad);
fakesrc->srcpads = g_slist_append (NULL, pad);
fakesrc->loop_based = TRUE;
fakesrc->loop_based = FALSE;
if (fakesrc->loop_based)
gst_element_set_loop_function (GST_ELEMENT (fakesrc), GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
@ -347,7 +347,7 @@ gst_fakesrc_get(GstPad *pad)
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
if (!src->silent)
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
@ -400,7 +400,7 @@ gst_fakesrc_loop(GstElement *element)
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
if (!src->silent)
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,

View file

@ -45,6 +45,7 @@ enum {
ARG_0,
ARG_LOOP_BASED,
ARG_SLEEP_TIME,
ARG_DUPLICATE,
ARG_SILENT,
};
@ -90,15 +91,18 @@ gst_identity_class_init (GstIdentityClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
g_param_spec_boolean("loop_based","loop_based","loop_based",
TRUE,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SLEEP_TIME,
g_param_spec_uint("sleep_time","sleep_time","sleep_time",
0,G_MAXUINT,0,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SILENT,
g_param_spec_boolean("silent","silent","silent",
TRUE,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop_based", "loop_based", "loop_based",
TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLEEP_TIME,
g_param_spec_uint ("sleep_time", "sleep_time", "sleep_time",
0, G_MAXUINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUPLICATE,
g_param_spec_uint ("duplicate", "duplicate", "duplicate",
0, G_MAXUINT, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
g_param_spec_boolean ("silent", "silent", "silent",
TRUE,G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_newc ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
@ -155,6 +159,7 @@ gst_identity_init (GstIdentity *identity)
identity->loop_based = FALSE;
identity->sleep_time = 0;
identity->duplicate = 1;
identity->silent = FALSE;
}
@ -162,6 +167,7 @@ static void
gst_identity_chain (GstPad *pad, GstBuffer *buf)
{
GstIdentity *identity;
guint i;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
@ -169,17 +175,22 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
identity = GST_IDENTITY (gst_pad_get_parent (pad));
if (!identity->silent)
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
for (i=identity->duplicate; i; i--) {
if (!identity->silent)
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
buf);
gst_pad_push (identity->srcpad, buf);
if (i>1)
gst_buffer_ref (buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
gst_pad_push (identity->srcpad, buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
}
}
static void
@ -187,6 +198,7 @@ gst_identity_loop (GstElement *element)
{
GstIdentity *identity;
GstBuffer *buf;
guint i;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_IDENTITY (element));
@ -195,17 +207,23 @@ gst_identity_loop (GstElement *element)
do {
buf = gst_pad_pull (identity->sinkpad);
if (!identity->silent)
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
for (i=identity->duplicate; i; i--) {
if (!identity->silent)
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
buf);
gst_pad_push (identity->srcpad, buf);
if (i>1)
gst_buffer_ref (buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
gst_pad_push (identity->srcpad, buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
}
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
}
@ -238,6 +256,9 @@ gst_identity_set_property (GObject *object, guint prop_id, const GValue *value,
case ARG_SILENT:
identity->silent = g_value_get_boolean (value);
break;
case ARG_DUPLICATE:
identity->duplicate = g_value_get_uint (value);
break;
default:
break;
}
@ -258,6 +279,9 @@ static void gst_identity_get_property(GObject *object, guint prop_id, GValue *va
case ARG_SLEEP_TIME:
g_value_set_uint (value, identity->sleep_time);
break;
case ARG_DUPLICATE:
g_value_set_uint (value, identity->duplicate);
break;
case ARG_SILENT:
g_value_set_boolean (value, identity->silent);
break;

View file

@ -58,7 +58,7 @@ struct _GstIdentity {
GstPad *srcpad;
gboolean loop_based;
guint duplicate;
guint sleep_time;
gboolean silent;
};

View file

@ -41,6 +41,7 @@ enum {
enum {
ARG_0,
ARG_SILENT,
ARG_NUM_PADS,
/* FILL ME */
};
@ -101,6 +102,11 @@ gst_tee_class_init (GstTeeClass *klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "num_pads", "num_pads",
0, G_MAXINT, 0, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
g_param_spec_boolean ("silent", "silent", "silent",
FALSE, G_PARAM_READWRITE));
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_tee_get_property);
@ -117,6 +123,7 @@ gst_tee_init (GstTee *tee)
tee->numsrcpads = 0;
tee->srcpads = NULL;
tee->silent = FALSE;
}
static GstPad*
@ -157,9 +164,9 @@ gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GPara
tee = GST_TEE (object);
switch (prop_id) {
// case ARG_NUM_PADS:
// g_value_set_int (value, tee->numsrcpads);
// break;
case ARG_SILENT:
tee->silent = g_value_get_boolean (value);
break;
default:
break;
}
@ -179,6 +186,9 @@ gst_tee_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
case ARG_NUM_PADS:
g_value_set_int (value, tee->numsrcpads);
break;
case ARG_SILENT:
g_value_set_boolean (value, tee->silent);
break;
default:
break;
}
@ -210,8 +220,14 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
srcpads = tee->srcpads;
while (srcpads) {
gst_pad_push (GST_PAD (srcpads->data), buf);
GstPad *outpad = GST_PAD (srcpads->data);
srcpads = g_slist_next (srcpads);
if (!tee->silent)
g_print("tee: chain ******* (%s:%s)t (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
gst_pad_push (outpad, buf);
}
}

View file

@ -52,6 +52,7 @@ struct _GstTee {
GstPad *sinkpad;
gboolean silent;
gint numsrcpads;
GSList *srcpads;
};

View file

@ -220,7 +220,7 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
fakesink = GST_FAKESINK (gst_pad_get_parent (pad));
if (!fakesink->silent)
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
g_print("fakesink: chain ******* (%s:%s)< (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF], 0,

View file

@ -133,7 +133,7 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
1, G_MAXINT, 1, G_PARAM_READABLE));
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
g_param_spec_boolean("loop_based","loop_based","loop_based",
TRUE,G_PARAM_READWRITE)); // CHECKME
FALSE, G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_OUTPUT,
g_param_spec_enum("output","output","output",
GST_TYPE_FAKESRC_OUTPUT,FAKESRC_FIRST_LAST_LOOP,G_PARAM_READWRITE)); // CHECKME!
@ -175,7 +175,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
gst_element_add_pad (GST_ELEMENT (fakesrc), pad);
fakesrc->srcpads = g_slist_append (NULL, pad);
fakesrc->loop_based = TRUE;
fakesrc->loop_based = FALSE;
if (fakesrc->loop_based)
gst_element_set_loop_function (GST_ELEMENT (fakesrc), GST_DEBUG_FUNCPTR (gst_fakesrc_loop));
@ -347,7 +347,7 @@ gst_fakesrc_get(GstPad *pad)
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
if (!src->silent)
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
g_print("fakesrc: get ******* (%s:%s)> (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,
@ -400,7 +400,7 @@ gst_fakesrc_loop(GstElement *element)
GST_BUFFER_TIMESTAMP (buf) = src->buffer_count++;
if (!src->silent)
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
g_print("fakesrc: loop ******* (%s:%s) > (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (pad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF], 0,

View file

@ -45,6 +45,7 @@ enum {
ARG_0,
ARG_LOOP_BASED,
ARG_SLEEP_TIME,
ARG_DUPLICATE,
ARG_SILENT,
};
@ -90,15 +91,18 @@ gst_identity_class_init (GstIdentityClass *klass)
parent_class = g_type_class_ref (GST_TYPE_ELEMENT);
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_LOOP_BASED,
g_param_spec_boolean("loop_based","loop_based","loop_based",
TRUE,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SLEEP_TIME,
g_param_spec_uint("sleep_time","sleep_time","sleep_time",
0,G_MAXUINT,0,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property(G_OBJECT_CLASS(klass), ARG_SILENT,
g_param_spec_boolean("silent","silent","silent",
TRUE,G_PARAM_READWRITE)); // CHECKME
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_LOOP_BASED,
g_param_spec_boolean ("loop_based", "loop_based", "loop_based",
TRUE, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SLEEP_TIME,
g_param_spec_uint ("sleep_time", "sleep_time", "sleep_time",
0, G_MAXUINT, 0, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_DUPLICATE,
g_param_spec_uint ("duplicate", "duplicate", "duplicate",
0, G_MAXUINT, 1, G_PARAM_READWRITE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
g_param_spec_boolean ("silent", "silent", "silent",
TRUE,G_PARAM_READWRITE));
gst_identity_signals[SIGNAL_HANDOFF] =
g_signal_newc ("handoff", G_TYPE_FROM_CLASS(klass), G_SIGNAL_RUN_LAST,
@ -155,6 +159,7 @@ gst_identity_init (GstIdentity *identity)
identity->loop_based = FALSE;
identity->sleep_time = 0;
identity->duplicate = 1;
identity->silent = FALSE;
}
@ -162,6 +167,7 @@ static void
gst_identity_chain (GstPad *pad, GstBuffer *buf)
{
GstIdentity *identity;
guint i;
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
@ -169,17 +175,22 @@ gst_identity_chain (GstPad *pad, GstBuffer *buf)
identity = GST_IDENTITY (gst_pad_get_parent (pad));
if (!identity->silent)
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
for (i=identity->duplicate; i; i--) {
if (!identity->silent)
g_print("identity: chain ******* (%s:%s)i (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
buf);
gst_pad_push (identity->srcpad, buf);
if (i>1)
gst_buffer_ref (buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
gst_pad_push (identity->srcpad, buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
}
}
static void
@ -187,6 +198,7 @@ gst_identity_loop (GstElement *element)
{
GstIdentity *identity;
GstBuffer *buf;
guint i;
g_return_if_fail (element != NULL);
g_return_if_fail (GST_IS_IDENTITY (element));
@ -195,17 +207,23 @@ gst_identity_loop (GstElement *element)
do {
buf = gst_pad_pull (identity->sinkpad);
if (!identity->silent)
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
for (i=identity->duplicate; i; i--) {
if (!identity->silent)
g_print("identity: loop ******* (%s:%s)i (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (identity->sinkpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
g_signal_emit (G_OBJECT (identity), gst_identity_signals[SIGNAL_HANDOFF], 0,
buf);
gst_pad_push (identity->srcpad, buf);
if (i>1)
gst_buffer_ref (buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
gst_pad_push (identity->srcpad, buf);
if (identity->sleep_time)
usleep (identity->sleep_time);
}
} while (!GST_ELEMENT_IS_COTHREAD_STOPPING(element));
}
@ -238,6 +256,9 @@ gst_identity_set_property (GObject *object, guint prop_id, const GValue *value,
case ARG_SILENT:
identity->silent = g_value_get_boolean (value);
break;
case ARG_DUPLICATE:
identity->duplicate = g_value_get_uint (value);
break;
default:
break;
}
@ -258,6 +279,9 @@ static void gst_identity_get_property(GObject *object, guint prop_id, GValue *va
case ARG_SLEEP_TIME:
g_value_set_uint (value, identity->sleep_time);
break;
case ARG_DUPLICATE:
g_value_set_uint (value, identity->duplicate);
break;
case ARG_SILENT:
g_value_set_boolean (value, identity->silent);
break;

View file

@ -58,7 +58,7 @@ struct _GstIdentity {
GstPad *srcpad;
gboolean loop_based;
guint duplicate;
guint sleep_time;
gboolean silent;
};

View file

@ -41,6 +41,7 @@ enum {
enum {
ARG_0,
ARG_SILENT,
ARG_NUM_PADS,
/* FILL ME */
};
@ -101,6 +102,11 @@ gst_tee_class_init (GstTeeClass *klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_NUM_PADS,
g_param_spec_int ("num_pads", "num_pads", "num_pads",
0, G_MAXINT, 0, G_PARAM_READABLE));
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_SILENT,
g_param_spec_boolean ("silent", "silent", "silent",
FALSE, G_PARAM_READWRITE));
gobject_class->set_property = GST_DEBUG_FUNCPTR(gst_tee_set_property);
gobject_class->get_property = GST_DEBUG_FUNCPTR(gst_tee_get_property);
@ -117,6 +123,7 @@ gst_tee_init (GstTee *tee)
tee->numsrcpads = 0;
tee->srcpads = NULL;
tee->silent = FALSE;
}
static GstPad*
@ -157,9 +164,9 @@ gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GPara
tee = GST_TEE (object);
switch (prop_id) {
// case ARG_NUM_PADS:
// g_value_set_int (value, tee->numsrcpads);
// break;
case ARG_SILENT:
tee->silent = g_value_get_boolean (value);
break;
default:
break;
}
@ -179,6 +186,9 @@ gst_tee_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
case ARG_NUM_PADS:
g_value_set_int (value, tee->numsrcpads);
break;
case ARG_SILENT:
g_value_set_boolean (value, tee->silent);
break;
default:
break;
}
@ -210,8 +220,14 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
srcpads = tee->srcpads;
while (srcpads) {
gst_pad_push (GST_PAD (srcpads->data), buf);
GstPad *outpad = GST_PAD (srcpads->data);
srcpads = g_slist_next (srcpads);
if (!tee->silent)
g_print("tee: chain ******* (%s:%s)t (%d bytes, %llu) \n",
GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf));
gst_pad_push (outpad, buf);
}
}

View file

@ -52,6 +52,7 @@ struct _GstTee {
GstPad *sinkpad;
gboolean silent;
gint numsrcpads;
GSList *srcpads;
};