debugging additions and style cleanups

Original commit message from CVS:
debugging additions and style cleanups
This commit is contained in:
Thomas Vander Stichele 2004-07-15 16:20:50 +00:00
parent baa63d42e5
commit 1c5150d393
9 changed files with 232 additions and 174 deletions

View file

@ -1,3 +1,14 @@
2004-07-15 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gstelement.c: (gst_element_set_state):
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gststructure.c:
* gst/gstthread.c: (gst_thread_child_state_change):
* gst/gstvalue.c: (gst_value_compare_double):
* gst/gstvalue.h:
* testsuite/parse/parse1.c: (main):
debugging additions and style cleanups
2004-07-15 Zaheer Abbas Merali <zaheerabbas at merali dot org> 2004-07-15 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* docs/manual/states.xml: Grammar fix * docs/manual/states.xml: Grammar fix
@ -26,7 +37,7 @@
2004-07-15 Benjamin Otte <otte@gnome.org> 2004-07-15 Benjamin Otte <otte@gnome.org>
* gst/gstelement.h: * gst/gstelement.h:
Don't GST_ERROR_OBJECT smpty strings - Solaris doesn't like NULL Don't GST_ERROR_OBJECT empty strings - Solaris doesn't like NULL
strings. strings.
* gst/gstelement.c (gst_element_class_init): * gst/gstelement.c (gst_element_class_init):
GError's are boxed, not objects GError's are boxed, not objects

View file

@ -2726,6 +2726,8 @@ gst_element_set_state (GstElement * element, GstElementState state)
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element); GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE); g_return_val_if_fail (GST_IS_ELEMENT (element), GST_STATE_FAILURE);
GST_DEBUG_OBJECT (element, "setting state to %s",
gst_element_state_get_name (state));
klass = GST_ELEMENT_GET_CLASS (element); klass = GST_ELEMENT_GET_CLASS (element);
/* a set_state function is mandatory */ /* a set_state function is mandatory */
g_return_val_if_fail (klass->set_state, GST_STATE_FAILURE); g_return_val_if_fail (klass->set_state, GST_STATE_FAILURE);

View file

@ -1482,6 +1482,7 @@ gst_pad_try_set_caps (GstPad * pad, const GstCaps * caps)
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
} }
GST_CAT_INFO_OBJECT (GST_CAT_CAPS, pad, "caps %" GST_PTR_FORMAT, caps);
/* setting non-fixed caps on a pad is not allowed */ /* setting non-fixed caps on a pad is not allowed */
if (!gst_caps_is_fixed (caps)) { if (!gst_caps_is_fixed (caps)) {
GST_CAT_INFO (GST_CAT_CAPS, GST_CAT_INFO (GST_CAT_CAPS,

View file

@ -984,7 +984,10 @@ static GstStructureAbbreviation gst_structure_abbrs[] = {
{"f", G_TYPE_FLOAT}, {"f", G_TYPE_FLOAT},
{"double", G_TYPE_DOUBLE}, {"double", G_TYPE_DOUBLE},
{"d", G_TYPE_DOUBLE}, {"d", G_TYPE_DOUBLE},
/* these are implemented with strcmp below */
//{ "buffer", GST_TYPE_BUFFER },
//{ "fourcc", GST_TYPE_FOURCC }, //{ "fourcc", GST_TYPE_FOURCC },
//{ "4", GST_TYPE_FOURCC },
{"boolean", G_TYPE_BOOLEAN}, {"boolean", G_TYPE_BOOLEAN},
{"bool", G_TYPE_BOOLEAN}, {"bool", G_TYPE_BOOLEAN},
{"b", G_TYPE_BOOLEAN}, {"b", G_TYPE_BOOLEAN},

View file

@ -52,7 +52,6 @@ struct _GstValueSubtractInfo
GstValueSubtractFunc func; GstValueSubtractFunc func;
}; };
GType gst_type_fourcc;
GType gst_type_fourcc; GType gst_type_fourcc;
GType gst_type_int_range; GType gst_type_int_range;
GType gst_type_double_range; GType gst_type_double_range;
@ -64,9 +63,9 @@ static GArray *gst_value_union_funcs;
static GArray *gst_value_intersect_funcs; static GArray *gst_value_intersect_funcs;
static GArray *gst_value_subtract_funcs; static GArray *gst_value_subtract_funcs;
/********/ /********
/* list */ * list *
/********/ ********/
/* two helper functions to serialize/stringify any type of list /* two helper functions to serialize/stringify any type of list
* regular lists are done with { }, fixed lists with < > * regular lists are done with { }, fixed lists with < >
@ -399,8 +398,9 @@ gst_value_deserialize_fixed_list (GValue * dest, const char *s)
return FALSE; return FALSE;
} }
/*************************************/ /**********
/* fourcc */ * fourcc *
**********/
static void static void
gst_value_init_fourcc (GValue * value) gst_value_init_fourcc (GValue * value)
@ -530,8 +530,9 @@ gst_value_deserialize_fourcc (GValue * dest, const char *s)
return ret; return ret;
} }
/*************************************/ /*************
/* int range */ * int range *
*************/
static void static void
gst_value_init_int_range (GValue * value) gst_value_init_int_range (GValue * value)
@ -602,7 +603,7 @@ gst_value_set_int_range (GValue * value, int start, int end)
* *
* Gets the minimum of the range specified by @value. * Gets the minimum of the range specified by @value.
* *
* Returns: the minumum of the range * Returns: the minimum of the range
*/ */
int int
gst_value_get_int_range_min (const GValue * value) gst_value_get_int_range_min (const GValue * value)
@ -659,8 +660,9 @@ gst_value_deserialize_int_range (GValue * dest, const char *s)
return FALSE; return FALSE;
} }
/*************************************/ /****************
/* double range */ * double range *
****************/
static void static void
gst_value_init_double_range (GValue * value) gst_value_init_double_range (GValue * value)
@ -795,8 +797,9 @@ gst_value_deserialize_double_range (GValue * dest, const char *s)
return FALSE; return FALSE;
} }
/*************************************/ /***********
/* GstCaps */ * GstCaps *
***********/
/** /**
* gst_value_set_caps: * gst_value_set_caps:
@ -830,8 +833,9 @@ gst_value_get_caps (const GValue * value)
return (GstCaps *) g_value_get_boxed (value); return (GstCaps *) g_value_get_boxed (value);
} }
/*************************************/ /*************
/* GstBuffer */ * GstBuffer *
*************/
static int static int
gst_value_compare_buffer (const GValue * value1, const GValue * value2) gst_value_compare_buffer (const GValue * value1, const GValue * value2)
@ -910,8 +914,9 @@ gst_value_deserialize_buffer (GValue * dest, const char *s)
} }
/*************************************/ /***********
/* boolean */ * boolean *
***********/
static int static int
gst_value_compare_boolean (const GValue * value1, const GValue * value2) gst_value_compare_boolean (const GValue * value1, const GValue * value2)
@ -950,8 +955,9 @@ gst_value_deserialize_boolean (GValue * dest, const char *s)
return ret; return ret;
} }
/*************************************/ /*******
/* ints */ * int *
*******/
static int static int
gst_strtoll (const char *s, char **end, int base) gst_strtoll (const char *s, char **end, int base)
@ -1102,8 +1108,9 @@ CREATE_USERIALIZATION (uint, UINT)
CREATE_USERIALIZATION (uint64, UINT64) CREATE_USERIALIZATION (uint64, UINT64)
CREATE_USERIALIZATION (ulong, ULONG) CREATE_USERIALIZATION (ulong, ULONG)
/*************************************/ /**********
/* double */ * double *
**********/
static int static int
gst_value_compare_double (const GValue * value1, const GValue * value2) gst_value_compare_double (const GValue * value1, const GValue * value2)
{ {
@ -1150,8 +1157,9 @@ gst_value_deserialize_double (GValue * dest, const char *s)
return ret; return ret;
} }
/*************************************/ /*********
/* float */ * float *
*********/
static int static int
gst_value_compare_float (const GValue * value1, const GValue * value2) gst_value_compare_float (const GValue * value1, const GValue * value2)
@ -1201,8 +1209,9 @@ gst_value_deserialize_float (GValue * dest, const char *s)
return ret; return ret;
} }
/*************************************/ /**********
/* string */ * string *
**********/
static int static int
gst_value_compare_string (const GValue * value1, const GValue * value2) gst_value_compare_string (const GValue * value1, const GValue * value2)
@ -1283,8 +1292,9 @@ gst_value_deserialize_string (GValue * dest, const char *s)
return TRUE; return TRUE;
} }
/*************************************/ /********
/* enums */ * enum *
********/
static int static int
gst_value_compare_enum (const GValue * value1, const GValue * value2) gst_value_compare_enum (const GValue * value1, const GValue * value2)
@ -1345,8 +1355,9 @@ gst_value_deserialize_enum (GValue * dest, const char *s)
return TRUE; return TRUE;
} }
/*************************************/ /*********
/* unions */ * union *
*********/
static gboolean static gboolean
gst_value_union_int_int_range (GValue * dest, const GValue * src1, gst_value_union_int_int_range (GValue * dest, const GValue * src1,
@ -1388,8 +1399,9 @@ gst_value_union_int_range_int_range (GValue * dest, const GValue * src1,
return FALSE; return FALSE;
} }
/*************************************/ /****************
/* intersection */ * intersection *
****************/
static gboolean static gboolean
gst_value_intersect_int_int_range (GValue * dest, const GValue * src1, gst_value_intersect_int_int_range (GValue * dest, const GValue * src1,
@ -1512,8 +1524,9 @@ gst_value_intersect_list (GValue * dest, const GValue * value1,
return ret; return ret;
} }
/*************************************/ /***************
/* subtraction */ * subtraction *
***************/
static gboolean static gboolean
gst_value_subtract_int_int_range (GValue * dest, const GValue * minuend, gst_value_subtract_int_int_range (GValue * dest, const GValue * minuend,
@ -1764,7 +1777,9 @@ gst_value_subtract_list (GValue * dest, const GValue * minuend,
} }
/*************************************/ /**************
* comparison *
**************/
/** /**
* gst_value_can_compare: * gst_value_can_compare:

View file

@ -101,7 +101,8 @@ void gst_value_list_concat (GValue
const GValue *value1, const GValue *value1,
const GValue *value2); const GValue *value2);
guint gst_value_list_get_size (const GValue *value); guint gst_value_list_get_size (const GValue *value);
G_CONST_RETURN GValue * gst_value_list_get_value (const GValue *value, G_CONST_RETURN GValue *
gst_value_list_get_value (const GValue *value,
guint index); guint index);
/* fourcc */ /* fourcc */
@ -124,7 +125,8 @@ double gst_value_get_double_range_min (const GValue
double gst_value_get_double_range_max (const GValue *value); double gst_value_get_double_range_max (const GValue *value);
/* caps */ /* caps */
G_CONST_RETURN GstCaps * gst_value_get_caps (const GValue *value); G_CONST_RETURN GstCaps *
gst_value_get_caps (const GValue *value);
void gst_value_set_caps (GValue *value, void gst_value_set_caps (GValue *value,
const GstCaps *caps); const GstCaps *caps);

View file

@ -38,42 +38,54 @@ static gchar *s;
if (condition) { \ if (condition) { \
g_print ("TEST %2d line %3d OK\n", test, __LINE__); \ g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
} else { \ } else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
#condition); \
return -test; \ return -test; \
} \ } \
}G_STMT_END }G_STMT_END
#define TEST_START(pipeline) G_STMT_START{ \ #define TEST_START(pipeline) G_STMT_START{ \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \ g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \
pipeline); \
cur = gst_parse_launch (pipeline, &error); \ cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \ if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \ } else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
error->message); \
g_error_free (error); \ g_error_free (error); \
return -test; \ return -test; \
} \ } \
}G_STMT_END }G_STMT_END
#define TEST_OK G_STMT_START{ \ #define TEST_OK G_STMT_START{ \
gst_object_unref (GST_OBJECT (cur)); \ gst_object_unref (GST_OBJECT (cur)); \
cur = NULL; \ cur = NULL; \
g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END }G_STMT_END
#define TEST_RUN G_STMT_START{ \ #define TEST_RUN G_STMT_START{ \
alarm(10); \ alarm(10); \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ == GST_STATE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be set to PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
iterations = 0; \ iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \ if (gst_element_set_state (cur, GST_STATE_NULL) \
g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \ == GST_STATE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \
test, __LINE__, iterations); \
alarm(0); \ alarm(0); \
}G_STMT_END }G_STMT_END
#define PIPELINE1 "fakesrc" #define PIPELINE1 "fakesrc"
#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data" #define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data"
#define PIPELINE3 "fakesrc identity fakesink" #define PIPELINE3 "fakesrc identity fakesink"
@ -89,7 +101,6 @@ static gchar *s;
#define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink" #define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink"
#define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink." #define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink."
gint gint
main (gint argc, gchar * argv[]) main (gint argc, gchar * argv[])
{ {
@ -107,7 +118,8 @@ main (gint argc, gchar * argv[])
/** /**
* checks: * checks:
* - properties works * - properties works
* - string, int, boolean and enums can be properly set (note: eos should be false) * - string, int, boolean and enums can be properly set
* (note: eos should be false)
* - first test of escaping strings * - first test of escaping strings
*/ */
TEST_START (PIPELINE2); TEST_START (PIPELINE2);

View file

@ -38,42 +38,54 @@ static gchar *s;
if (condition) { \ if (condition) { \
g_print ("TEST %2d line %3d OK\n", test, __LINE__); \ g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
} else { \ } else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
#condition); \
return -test; \ return -test; \
} \ } \
}G_STMT_END }G_STMT_END
#define TEST_START(pipeline) G_STMT_START{ \ #define TEST_START(pipeline) G_STMT_START{ \
g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \ g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \
pipeline); \
cur = gst_parse_launch (pipeline, &error); \ cur = gst_parse_launch (pipeline, &error); \
if (error == NULL) { \ if (error == NULL) { \
g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \ g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
} else { \ } else { \
g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
error->message); \
g_error_free (error); \ g_error_free (error); \
return -test; \ return -test; \
} \ } \
}G_STMT_END }G_STMT_END
#define TEST_OK G_STMT_START{ \ #define TEST_OK G_STMT_START{ \
gst_object_unref (GST_OBJECT (cur)); \ gst_object_unref (GST_OBJECT (cur)); \
cur = NULL; \ cur = NULL; \
g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \ g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END }G_STMT_END
#define TEST_RUN G_STMT_START{ \ #define TEST_RUN G_STMT_START{ \
alarm(10); \ alarm(10); \
g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \ == GST_STATE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be set to PLAYING\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
iterations = 0; \ iterations = 0; \
while (gst_bin_iterate (GST_BIN (cur))) iterations++; \ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \ if (gst_element_set_state (cur, GST_STATE_NULL) \
g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \ == GST_STATE_FAILURE) { \
g_print ("TEST %2d line %3d FAILED : " \
"pipeline could not be reset to state NULL\n", test, __LINE__); \
return -test; \ return -test; \
} \ } \
g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \
test, __LINE__, iterations); \
alarm(0); \ alarm(0); \
}G_STMT_END }G_STMT_END
#define PIPELINE1 "fakesrc" #define PIPELINE1 "fakesrc"
#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data" #define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data"
#define PIPELINE3 "fakesrc identity fakesink" #define PIPELINE3 "fakesrc identity fakesink"
@ -89,7 +101,6 @@ static gchar *s;
#define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink" #define PIPELINE10 "( fakesrc num-buffers=\"4\" ! ) identity ! fakesink"
#define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink." #define PIPELINE11 "fakesink name = sink identity name=id ( fakesrc num-buffers=\"4\" ! id. ) id. ! sink."
gint gint
main (gint argc, gchar * argv[]) main (gint argc, gchar * argv[])
{ {
@ -107,7 +118,8 @@ main (gint argc, gchar * argv[])
/** /**
* checks: * checks:
* - properties works * - properties works
* - string, int, boolean and enums can be properly set (note: eos should be false) * - string, int, boolean and enums can be properly set
* (note: eos should be false)
* - first test of escaping strings * - first test of escaping strings
*/ */
TEST_START (PIPELINE2); TEST_START (PIPELINE2);