gst/gstinfo.c: don't do dummy g_strdup()s

Original commit message from CVS:
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
This commit is contained in:
Stefan Kost 2005-09-28 17:30:13 +00:00
parent bf443a4639
commit e37803d652
5 changed files with 110 additions and 91 deletions

View file

@ -1,3 +1,20 @@
2005-09-28 Stefan Kost <ensonic@users.sf.net>
* gst/gstinfo.c: (gst_debug_log_default):
don't do dummy g_strdup()s
* libs/gst/controller/gstcontroller.c:
(on_object_controlled_property_changed),
(gst_controlled_property_new), (gst_controller_new_valist),
(gst_controller_new_list),
(gst_controller_remove_properties_valist), (gst_controller_set),
(gst_controller_get), (gst_controller_sync_values),
(gst_controller_get_value_array), (_gst_controller_class_init),
(gst_controller_get_type):
* libs/gst/controller/gstcontroller.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_timed_value_node):
convert // to /**/ comments
2005-09-28 Wim Taymans <wim@fluendo.com>
* gst/gstbus.c: (marshal_VOID__MINIOBJECT), (gst_bus_class_init),
@ -59,7 +76,7 @@
* gst/elements/gstfdsrc.c: Cleaned up a bit.
2005-09-28 Tim-Philipp Müller <tim at centricular dot net>
2005-09-28 Tim-Philipp M??ller <tim at centricular dot net>
* gst/elements/gstcapsfilter.c:
* gst/elements/gstfakesink.c:
@ -160,12 +177,12 @@
Leak fixes, the fold functions need to unref the passed object and
_get_parent_*() returns ref to parent.
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
2005-09-27 Tim-Philipp M??ller <tim at centricular dot net>
* check/gst/gstbuffer.c: (test_make_writable):
Plug leak in test case and fix 'make check-valgrind'
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
2005-09-27 Tim-Philipp M??ller <tim at centricular dot net>
* gst/gstbuffer.c: (gst_subbuffer_init):
Set READONLY flag on subbuffers, so that gst_buffer_make_writable()
@ -197,7 +214,7 @@
(main):
Fix compilation of some tests.
2005-09-27 Tim-Philipp Müller <tim at centricular dot net>
2005-09-27 Tim-Philipp M??ller <tim at centricular dot net>
* gst/gsterror.h:
Remove comment. GST_TYPE_G_ERROR is here to stay,
@ -221,7 +238,7 @@
* gst/gstpad.c: (gst_pad_dispose):
Added some debug info first.
2005-09-26 Tim-Philipp Müller <tim at centricular dot net>
2005-09-26 Tim-Philipp M??ller <tim at centricular dot net>
* docs/design/draft-push-pull.txt:
* docs/design/part-events.txt:
@ -319,7 +336,7 @@
inlined two more docs
factored gstpadtemplate out of gstpad
2005-09-24 Tim-Philipp Müller <tim at centricular dot net>
2005-09-24 Tim-Philipp M??ller <tim at centricular dot net>
* check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
(test_children_state_change_order_semi_sink):
@ -362,7 +379,7 @@
* gst/gststructure.c:
some doc updates
2005-09-23 Tim-Philipp Müller <tim at centricular dot net>
2005-09-23 Tim-Philipp M??ller <tim at centricular dot net>
* docs/design/part-gstbin.txt:
* docs/design/part-gstbus.txt:
@ -378,7 +395,7 @@
* gst/gststructure.h:
add a method to get a GstClockTime out of a structure
2005-09-23 Tim-Philipp Müller <tim at centricular dot net>
2005-09-23 Tim-Philipp M??ller <tim at centricular dot net>
* check/gst/gstbin.c: (test_children_state_change_order_flagged_sink),
(test_children_state_change_order_semi_sink), (gst_bin_suite):
@ -474,13 +491,13 @@
* gst/gstquery.h:
Added new query.
2005-09-22 Tim-Philipp Müller <tim at centricular dot net>
2005-09-22 Tim-Philipp M??ller <tim at centricular dot net>
* check/gst/gstvalue.c: (test_date), (gst_value_suite):
Add simplistic test suite for GST_TYPE_DATE serialisation and
deserialisation.
2005-09-22 Tim-Philipp Müller <tim at centricular dot net>
2005-09-22 Tim-Philipp M??ller <tim at centricular dot net>
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
@ -531,7 +548,7 @@
2005-09-21 Francis Labonte <francis_labonte at hotmail dot com>
Reviewed by: Tim-Philipp Müller <tim at centricular dot net>
Reviewed by: Tim-Philipp M??ller <tim at centricular dot net>
* gst/gstinfo.c: (_gst_debug_nameof_funcptr),
(_gst_debug_register_funcptr):
@ -542,7 +559,7 @@
* gst/registries/.cvsignore:
Remove left-over file.
2005-09-21 Tim-Philipp Müller <tim at centricular dot net>
2005-09-21 Tim-Philipp M??ller <tim at centricular dot net>
* docs/pwg/appendix-porting.xml:
And something about newsegment events and caps-on-buffers to
@ -577,7 +594,7 @@
(gst_pad_class_init): have-data is now a detailed signal, yes it
is.
2005-09-21 Tim-Philipp Müller <tim at centricular dot net>
2005-09-21 Tim-Philipp M??ller <tim at centricular dot net>
* gst/base/gstbasetransform.c: (gst_base_transform_transform_size):
* gst/gstutils.c: (gst_util_set_value_from_string),

View file

@ -100,6 +100,7 @@
#ifdef HAVE_VALGRIND
#include <valgrind/valgrind.h>
#endif
#include <glib/gprintf.h> /* g_sprintf */
/* underscore is to prevent conflict with GST_CAT_DEBUG define */
GST_DEBUG_CATEGORY_STATIC (_GST_CAT_DEBUG);
@ -539,13 +540,15 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
const gchar * file, const gchar * function, gint line,
GObject * object, GstDebugMessage * message, gpointer unused)
{
gchar *color;
gchar *color = NULL;
gchar *clear;
gchar *obj;
gchar *pidcolor;
gchar *obj = NULL;
gchar pidcolor[10];
gint pid;
GTimeVal now;
GstClockTime elapsed;
gboolean free_color = TRUE;
gboolean free_obj = TRUE;
if (level > gst_debug_category_get_threshold (category))
return;
@ -554,18 +557,23 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
/* color info */
if (gst_debug_is_colored ()) {
color =
gst_debug_construct_term_color (gst_debug_category_get_color
color = gst_debug_construct_term_color (gst_debug_category_get_color
(category));
clear = "\033[00m";
pidcolor = g_strdup_printf ("\033[3%1dm", pid % 6 + 31);
g_sprintf (pidcolor, "\033[3%1dm", pid % 6 + 31);
} else {
color = g_strdup ("");
color = "\0";
free_color = FALSE;
clear = "";
pidcolor = g_strdup ("");
pidcolor[0] = '\0';
}
obj = object ? gst_debug_print_object (object) : g_strdup ("");
if (object) {
obj = gst_debug_print_object (object);
} else {
obj = "\0";
free_obj = FALSE;
}
g_get_current_time (&now);
elapsed = GST_TIMEVAL_TO_TIME (now) - start_time;
@ -576,9 +584,10 @@ gst_debug_log_default (GstDebugCategory * category, GstDebugLevel level,
gst_debug_category_get_name (category), clear, pidcolor, pid, clear,
color, file, line, function, obj, clear, gst_debug_message_get (message));
g_free (color);
g_free (pidcolor);
g_free (obj);
if (free_color)
g_free (color);
if (free_obj)
g_free (obj);
}
/**

View file

@ -99,7 +99,6 @@ on_object_controlled_property_changed (const GObject * object, GParamSpec * arg,
if (g_mutex_trylock (ctrl->lock)) {
if (!G_IS_VALUE (&prop->live_value.value)) {
//g_value_unset (&prop->live_value.value);
g_value_init (&prop->live_value.value, prop->type);
}
g_object_get_property (G_OBJECT (object), prop->name,
@ -109,9 +108,6 @@ on_object_controlled_property_changed (const GObject * object, GParamSpec * arg,
GST_DEBUG ("-> is live update : ts=%" G_GUINT64_FORMAT,
prop->live_value.timestamp);
}
//else {
//GST_DEBUG ("-> is control change");
//}
}
/* helper */
@ -238,16 +234,16 @@ gst_controlled_property_new (GObject * object, const gchar * name)
GST_INFO ("trying to put property '%s' under control", name);
// check if the object has a property of that name
/* check if the object has a property of that name */
if ((pspec =
g_object_class_find_property (G_OBJECT_GET_CLASS (object), name))) {
GST_DEBUG (" psec->flags : 0x%08x", pspec->flags);
// check if this param is witable
/* check if this param is witable */
g_return_val_if_fail ((pspec->flags & G_PARAM_WRITABLE), NULL);
// check if property is controlable
/* check if property is controlable */
g_return_val_if_fail ((pspec->flags & GST_PARAM_CONTROLLABLE), NULL);
// check if this param is not construct-only
/* check if this param is not construct-only */
g_return_val_if_fail (!(pspec->flags & G_PARAM_CONSTRUCT_ONLY), NULL);
/* TODO do sanity checks
@ -264,7 +260,7 @@ gst_controlled_property_new (GObject * object, const gchar * name)
if ((prop = g_new0 (GstControlledProperty, 1))) {
gchar *signal_name;
prop->name = pspec->name; // so we don't use the same mem twice
prop->name = pspec->name; /* so we don't use the same mem twice */
prop->type = G_PARAM_SPEC_VALUE_TYPE (pspec);
gst_controlled_property_set_interpolation_mode (prop,
GST_INTERPOLATE_NONE);
@ -421,17 +417,17 @@ gst_controller_new_valist (GObject * object, va_list var_args)
*/
self = g_object_get_qdata (object, __gst_controller_key);
// create GstControlledProperty for each property
/* create GstControlledProperty for each property */
while ((name = va_arg (var_args, gchar *))) {
// test if this property isn't yet controlled
/* test if this property isn't yet controlled */
if (!self || !(prop = gst_controller_find_controlled_property (self, name))) {
// create GstControlledProperty and add to self->propeties List
/* create GstControlledProperty and add to self->propeties List */
if ((prop = gst_controlled_property_new (object, name))) {
// if we don't have a controller object yet, now is the time to create one
/* if we don't have a controller object yet, now is the time to create one */
if (!self) {
self = g_object_new (GST_TYPE_CONTROLLER, NULL);
self->object = object;
// store the controller
/* store the controller */
g_object_set_qdata (object, __gst_controller_key, self);
} else {
GST_INFO ("returning existing controller");
@ -472,18 +468,18 @@ gst_controller_new_list (GObject * object, GList * list)
GST_INFO ("setting up a new controller");
self = g_object_get_qdata (object, __gst_controller_key);
// create GstControlledProperty for each property
/* create GstControlledProperty for each property */
for (node = list; node; node = g_list_next (list)) {
name = (gchar *) node->data;
// test if this property isn't yet controlled
/* test if this property isn't yet controlled */
if (!self || !(prop = gst_controller_find_controlled_property (self, name))) {
// create GstControlledProperty and add to self->propeties List
/* create GstControlledProperty and add to self->propeties List */
if ((prop = gst_controlled_property_new (object, name))) {
// if we don't have a controller object yet, now is the time to create one
/* if we don't have a controller object yet, now is the time to create one */
if (!self) {
self = g_object_new (GST_TYPE_CONTROLLER, NULL);
self->object = object;
// store the controller
/* store the controller */
g_object_set_qdata (object, __gst_controller_key, self);
} else {
GST_INFO ("returning existing controller");
@ -545,7 +541,7 @@ gst_controller_remove_properties_valist (GstController * self, va_list var_args)
g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
while ((name = va_arg (var_args, gchar *))) {
// find the property in the properties list of the controller, remove and free it
/* find the property in the properties list of the controller, remove and free it */
g_mutex_lock (self->lock);
if ((prop = gst_controller_find_controlled_property (self, name))) {
self->properties = g_list_remove (self->properties, prop);
@ -615,17 +611,17 @@ gst_controller_set (GstController * self, gchar * property_name,
GstTimedValue *tv;
GList *node;
// check if a timed_value for the timestamp already exists
/* check if a timed_value for the timestamp already exists */
if ((node = g_list_find_custom (prop->values, &timestamp,
gst_timed_value_find))) {
tv = node->data;
memcpy (&tv->value, value, sizeof (GValue));
} else {
// create a new GstTimedValue
/* create a new GstTimedValue */
tv = g_new (GstTimedValue, 1);
tv->timestamp = timestamp;
memcpy (&tv->value, value, sizeof (GValue));
// and sort it into the prop->values list
/* and sort it into the prop->values list */
prop->values =
g_list_insert_sorted (prop->values, tv, gst_timed_value_compare);
}
@ -741,7 +737,7 @@ gst_controller_get (GstController * self, gchar * property_name,
g_mutex_lock (self->lock);
if ((prop = gst_controller_find_controlled_property (self, property_name))) {
//get current value via interpolator
/* get current value via interpolator */
val = prop->get (prop, timestamp);
}
g_mutex_unlock (self->lock);
@ -804,7 +800,7 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
GST_INFO ("sync_values");
g_mutex_lock (self->lock);
// go over the controlled properties of the controller
/* go over the controlled properties of the controller */
for (node = self->properties; node; node = g_list_next (node)) {
prop = node->data;
GST_DEBUG (" property '%s' at ts=%" G_GUINT64_FORMAT, prop->name,
@ -820,7 +816,6 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
} else {
GstTimedValue *tv = lnode->data;
//GST_DEBUG ("live.ts %"G_UINT64_FORMAT" <-> now %"G_UINT64_FORMAT, prop->live_value.timestamp, tv->timestamp);
if (prop->live_value.timestamp < tv->timestamp) {
g_value_unset (&prop->live_value.value);
GST_DEBUG (" live value resetted");
@ -830,7 +825,7 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
}
}
if (!live) {
//get current value via interpolator
/* get current value via interpolator */
value = prop->get (prop, timestamp);
prop->last_value.timestamp = timestamp;
g_value_copy (value, &prop->last_value.value);
@ -919,7 +914,7 @@ gst_controller_get_value_array (GstController * self, GstClockTime timestamp,
value_array->values=g_new(sizeof(???),nbsamples);
*/
}
//get current value_array via interpolator
/* get current value_array via interpolator */
res = prop->get_value_array (prop, timestamp, value_array);
}
g_mutex_unlock (self->lock);
@ -1029,9 +1024,9 @@ _gst_controller_class_init (GstControllerClass * klass)
__gst_controller_key = g_quark_from_string ("gst::controller");
// register properties
// register signals
// set defaults for overridable methods
/* register properties */
/* register signals */
/* set defaults for overridable methods */
/* TODO which of theses do we need ?
BilboEd : none :)
*/
@ -1045,15 +1040,15 @@ gst_controller_get_type (void)
if (type == 0) {
static const GTypeInfo info = {
sizeof (GstControllerClass),
NULL, // base_init
NULL, // base_finalize
(GClassInitFunc) _gst_controller_class_init, // class_init
NULL, // class_finalize
NULL, // class_data
NULL, /* base_init */
NULL, /* base_finalize */
(GClassInitFunc) _gst_controller_class_init, /* class_init */
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GstController),
0, // n_preallocs
(GInstanceInitFunc) _gst_controller_init, // instance_init
NULL // value_table
0, /* n_preallocs */
(GInstanceInitFunc) _gst_controller_init, /* instance_init */
NULL /* value_table */
};
type = g_type_register_static (G_TYPE_OBJECT, "GstController", &info, 0);
}

View file

@ -49,8 +49,8 @@ G_BEGIN_DECLS
*/
typedef struct _GstTimedValue
{
GstClockTime timestamp; // timestamp of the value change
GValue value; // the new value
GstClockTime timestamp; /* timestamp of the value change */
GValue value; /* the new value */
/* TODO what about storing the difference to next timestamp and value here
+ make calculations slightly easier and faster
- determining the GType for the value_dif is not simple
@ -132,14 +132,14 @@ typedef struct _GstInterpolateMethod
*/
typedef struct _GstControlledProperty
{
gchar *name; // name of the property
GType type; // type of the handled property
GValue default_value; // default value for the handled property
GValue result_value; // result value location for the interpolation method
GstTimedValue last_value; // the last value a _sink call wrote
GstTimedValue live_value; // temporary value override for live input
gulong notify_handler_id; // id of the notify::<name> signal handler
GstInterpolateMode interpolation; // Interpolation mode
gchar *name; /* name of the property */
GType type; /* type of the handled property */
GValue default_value; /* default value for the handled property */
GValue result_value; /* result value location for the interpolation method */
GstTimedValue last_value; /* the last value a _sink call wrote */
GstTimedValue live_value; /* temporary value override for live input */
gulong notify_handler_id; /* id of the notify::<name> signal handler */
GstInterpolateMode interpolation; /* Interpolation mode */
/* TODO instead of *method, have pointers to get() and get_value_array() here
gst_controller_set_interpolation_mode() will pick the right ones for the
properties value type
@ -148,9 +148,9 @@ typedef struct _GstControlledProperty
InterpolateGet get;
InterpolateGetValueArray get_value_array;
GList *values; // List of GstTimedValue
GList *values; /* List of GstTimedValue */
/* TODO keep the last search result to be able to continue
GList *last_value; // last search result, can be used for incremental searches
GList *last_value; // last search result, can be used for incremental searches
*/
/*< private >*/
@ -171,8 +171,6 @@ typedef struct _GstControlledProperty
typedef struct _GstController GstController;
typedef struct _GstControllerClass GstControllerClass;
//typedef struct _GstControllerPrivate GstControllerPrivate;
/**
* GstController:
*
@ -183,9 +181,9 @@ struct _GstController
{
GObject parent;
GList *properties; // List of GstControlledProperty
GMutex *lock; // Secure property access, elements will access from threads
GObject *object; // the object we control
GList *properties; /* List of GstControlledProperty */
GMutex *lock; /* Secure property access, elements will access from threads */
GObject *object; /* the object we control */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];

View file

@ -41,7 +41,7 @@ GList *
gst_controlled_property_find_timed_value_node (GstControlledProperty * prop,
GstClockTime timestamp)
{
//GList *prev_node = NULL;
/* GList *prev_node = NULL; */
GList *prev_node = g_list_last (prop->values);
GList *node;
GstTimedValue *tv;
@ -74,8 +74,8 @@ gst_controlled_property_find_timed_value_node (GstControlledProperty * prop,
return (prev_node);
}
// steps-like (no-)interpolation, default
// just returns the value for the most recent key-frame
/* steps-like (no-)interpolation, default */
/* just returns the value for the most recent key-frame */
static GValue *
interpolate_none_get (GstControlledProperty * prop, GstClockTime timestamp)
@ -126,8 +126,8 @@ DEFINE_NONE_GET (boolean)
interpolate_none_get_boolean_value_array
};
// returns the default value of the property, except for times with specific values
// needed for one-shot events, such as notes and triggers
/* returns the default value of the property, except for times with specific values */
/* needed for one-shot events, such as notes and triggers */
static GValue *
interpolate_trigger_get (GstControlledProperty * prop, GstClockTime timestamp)
@ -166,8 +166,8 @@ static GstInterpolateMethod interpolate_trigger = {
NULL
};
// linear interpolation
// smoothes inbetween values
/* linear interpolation */
/* smoothes inbetween values */
#define DEFINE_LINEAR_GET(type) \
static g##type \
@ -240,11 +240,11 @@ DEFINE_LINEAR_GET (double)
NULL
};
// square interpolation
/* square interpolation */
// cubic interpolation
/* cubic interpolation */
// register all interpolation methods
/* register all interpolation methods */
GstInterpolateMethod *interpolation_methods[] = {
&interpolate_none,
&interpolate_trigger,