Original commit message from CVS:
fixes:
- g_free accepts NULL
- indenting
- last_message is readable, not writeable
- warn on invalid property id
This commit is contained in:
Benjamin Otte 2002-02-24 13:38:10 +00:00
parent 2bcb002772
commit 24fb9e8282
2 changed files with 22 additions and 22 deletions

View file

@ -204,13 +204,11 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
name = NULL; name = NULL;
} }
} }
/* FIXME: thomas: does tee also have to notify a new pad ? */ if (!tee->silent) {
if (!tee->silent) { g_free (tee->last_message);
if (tee->last_message) g_free (tee->last_message); tee->last_message = g_strdup_printf ("new pad %s", name);
tee->last_message = g_strdup_printf ("new pad %s", name); g_object_notify (G_OBJECT (tee), "last_message");
g_object_notify (G_OBJECT (tee), "last_message"); }
}
/* g_object_notify (G_OBJECT (element), "new pad"); */
srcpad = gst_pad_new_from_template (templ, name); srcpad = gst_pad_new_from_template (templ, name);
g_free (name); g_free (name);
@ -257,10 +255,8 @@ gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GPara
case ARG_SILENT: case ARG_SILENT:
tee->silent = g_value_get_boolean (value); tee->silent = g_value_get_boolean (value);
break; break;
case ARG_LAST_MESSAGE:
g_value_set_string ((GValue *) value, tee->last_message);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
@ -282,7 +278,11 @@ gst_tee_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
case ARG_SILENT: case ARG_SILENT:
g_value_set_boolean (value, tee->silent); g_value_set_boolean (value, tee->silent);
break; break;
case ARG_LAST_MESSAGE:
g_value_set_string ((GValue *) value, tee->last_message);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
@ -329,7 +329,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
} }
if (!tee->silent) { if (!tee->silent) {
if (tee->last_message) g_free (tee->last_message); g_free (tee->last_message);
tee->last_message = g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %llu) %p", tee->last_message = g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %llu) %p",
GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf); GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
g_object_notify (G_OBJECT (tee), "last_message"); g_object_notify (G_OBJECT (tee), "last_message");

View file

@ -204,13 +204,11 @@ gst_tee_request_new_pad (GstElement *element, GstPadTemplate *templ, const gchar
name = NULL; name = NULL;
} }
} }
/* FIXME: thomas: does tee also have to notify a new pad ? */ if (!tee->silent) {
if (!tee->silent) { g_free (tee->last_message);
if (tee->last_message) g_free (tee->last_message); tee->last_message = g_strdup_printf ("new pad %s", name);
tee->last_message = g_strdup_printf ("new pad %s", name); g_object_notify (G_OBJECT (tee), "last_message");
g_object_notify (G_OBJECT (tee), "last_message"); }
}
/* g_object_notify (G_OBJECT (element), "new pad"); */
srcpad = gst_pad_new_from_template (templ, name); srcpad = gst_pad_new_from_template (templ, name);
g_free (name); g_free (name);
@ -257,10 +255,8 @@ gst_tee_set_property (GObject *object, guint prop_id, const GValue *value, GPara
case ARG_SILENT: case ARG_SILENT:
tee->silent = g_value_get_boolean (value); tee->silent = g_value_get_boolean (value);
break; break;
case ARG_LAST_MESSAGE:
g_value_set_string ((GValue *) value, tee->last_message);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
@ -282,7 +278,11 @@ gst_tee_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec
case ARG_SILENT: case ARG_SILENT:
g_value_set_boolean (value, tee->silent); g_value_set_boolean (value, tee->silent);
break; break;
case ARG_LAST_MESSAGE:
g_value_set_string ((GValue *) value, tee->last_message);
break;
default: default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break; break;
} }
} }
@ -329,7 +329,7 @@ gst_tee_chain (GstPad *pad, GstBuffer *buf)
} }
if (!tee->silent) { if (!tee->silent) {
if (tee->last_message) g_free (tee->last_message); g_free (tee->last_message);
tee->last_message = g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %llu) %p", tee->last_message = g_strdup_printf ("chain ******* (%s:%s)t (%d bytes, %llu) %p",
GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf); GST_DEBUG_PAD_NAME (outpad), GST_BUFFER_SIZE (buf), GST_BUFFER_TIMESTAMP (buf), buf);
g_object_notify (G_OBJECT (tee), "last_message"); g_object_notify (G_OBJECT (tee), "last_message");