+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>
* docs/manual/states.xml: Grammar fix
2004-07-15 Benjamin Otte <otte@gnome.org>
* 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.
* gst/gstelement.c (gst_element_class_init):
GError's are boxed, not objects
GstElementClass *klass = GST_ELEMENT_GET_CLASS (element);
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);
/* a set_state function is mandatory */
g_return_val_if_fail (klass->set_state, GST_STATE_FAILURE);
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 */
if (!gst_caps_is_fixed (caps)) {
GST_CAT_INFO (GST_CAT_CAPS,
{"f", G_TYPE_FLOAT},
{"double", G_TYPE_DOUBLE},
{"d", G_TYPE_DOUBLE},
+/* these are implemented with strcmp below */
+//{ "buffer", GST_TYPE_BUFFER },
//{ "fourcc", GST_TYPE_FOURCC },
+//{ "4", GST_TYPE_FOURCC },
{"boolean", G_TYPE_BOOLEAN},
{"bool", G_TYPE_BOOLEAN},
{"b", G_TYPE_BOOLEAN},
gst_element_state_get_name (newstate));
if (parent_class->child_state_change)
parent_class->child_state_change (bin, oldstate, newstate, element);
- /* We'll wake up the main thread now. Note that we can't lock the thread here,
+ /* We'll wake up the main thread now. Note that we can't lock the thread here,
because we might be called from inside gst_thread_change_state when holding
the lock. But this doesn't cause any problems. */
if (newstate == GST_STATE_PLAYING)
};
GType gst_type_fourcc;
-GType gst_type_fourcc;
GType gst_type_int_range;
GType gst_type_double_range;
GType gst_type_list;
static GArray *gst_value_intersect_funcs;
static GArray *gst_value_subtract_funcs;
-/********/
-/* list */
-/********/
+/********
+ * list *
+ ********/
/* two helper functions to serialize/stringify any type of list
* regular lists are done with { }, fixed lists with < >
return FALSE;
}
-/*************************************/
-/* fourcc */
+/**********
+ * fourcc *
+ **********/
static void
gst_value_init_fourcc (GValue * value)
return ret;
}
-/*************************************/
-/* int range */
+/*************
+ * int range *
+ *************/
static void
gst_value_init_int_range (GValue * value)
*
* Gets the minimum of the range specified by @value.
*
- * Returns: the minumum of the range
+ * Returns: the minimum of the range
*/
int
gst_value_get_int_range_min (const GValue * value)
return FALSE;
}
-/*************************************/
-/* double range */
+/****************
+ * double range *
+ ****************/
static void
gst_value_init_double_range (GValue * value)
return FALSE;
}
-/*************************************/
-/* GstCaps */
+/***********
+ * GstCaps *
+ ***********/
/**
* gst_value_set_caps:
return (GstCaps *) g_value_get_boxed (value);
}
-/*************************************/
-/* GstBuffer */
+/*************
+ * GstBuffer *
+ *************/
static int
gst_value_compare_buffer (const GValue * value1, const GValue * value2)
}
-/*************************************/
-/* boolean */
+/***********
+ * boolean *
+ ***********/
static int
gst_value_compare_boolean (const GValue * value1, const GValue * value2)
return ret;
}
-/*************************************/
-/* ints */
+/*******
+ * int *
+ *******/
static int
gst_strtoll (const char *s, char **end, int base)
CREATE_USERIALIZATION (uint64, UINT64)
CREATE_USERIALIZATION (ulong, ULONG)
-/*************************************/
-/* double */
+/**********
+ * double *
+ **********/
static int
gst_value_compare_double (const GValue * value1, const GValue * value2)
{
return ret;
}
-/*************************************/
-/* float */
+/*********
+ * float *
+ *********/
static int
gst_value_compare_float (const GValue * value1, const GValue * value2)
return ret;
}
-/*************************************/
-/* string */
+/**********
+ * string *
+ **********/
static int
gst_value_compare_string (const GValue * value1, const GValue * value2)
return TRUE;
}
-/*************************************/
-/* enums */
+/********
+ * enum *
+ ********/
static int
gst_value_compare_enum (const GValue * value1, const GValue * value2)
return TRUE;
}
-/*************************************/
-/* unions */
+/*********
+ * union *
+ *********/
static gboolean
gst_value_union_int_int_range (GValue * dest, const GValue * src1,
return FALSE;
}
-/*************************************/
-/* intersection */
+/****************
+ * intersection *
+ ****************/
static gboolean
gst_value_intersect_int_int_range (GValue * dest, const GValue * src1,
return ret;
}
-/*************************************/
-/* subtraction */
+/***************
+ * subtraction *
+ ***************/
static gboolean
gst_value_subtract_int_int_range (GValue * dest, const GValue * minuend,
}
-/*************************************/
+/**************
+ * comparison *
+ **************/
/**
* gst_value_can_compare:
extern GType gst_type_list;
extern GType gst_type_fixed_list;
-void gst_value_register (const GstValueTable *table);
-void gst_value_init_and_copy (GValue *dest,
- const GValue *src);
+void gst_value_register (const GstValueTable *table);
+void gst_value_init_and_copy (GValue *dest,
+ const GValue *src);
-gchar * gst_value_serialize (const GValue *value);
-gboolean gst_value_deserialize (GValue *dest,
- const gchar *src);
+gchar * gst_value_serialize (const GValue *value);
+gboolean gst_value_deserialize (GValue *dest,
+ const gchar *src);
/* list */
-void gst_value_list_append_value (GValue *value,
- const GValue *append_value);
-void gst_value_list_prepend_value (GValue *value,
- const GValue *prepend_value);
-void gst_value_list_concat (GValue *dest,
- const GValue *value1,
- const GValue *value2);
-guint gst_value_list_get_size (const GValue *value);
-G_CONST_RETURN GValue * gst_value_list_get_value (const GValue *value,
- guint index);
+void gst_value_list_append_value (GValue *value,
+ const GValue *append_value);
+void gst_value_list_prepend_value (GValue *value,
+ const GValue *prepend_value);
+void gst_value_list_concat (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+guint gst_value_list_get_size (const GValue *value);
+G_CONST_RETURN GValue *
+ gst_value_list_get_value (const GValue *value,
+ guint index);
/* fourcc */
-void gst_value_set_fourcc (GValue *value,
- guint32 fourcc);
-guint32 gst_value_get_fourcc (const GValue *value);
+void gst_value_set_fourcc (GValue *value,
+ guint32 fourcc);
+guint32 gst_value_get_fourcc (const GValue *value);
/* int range */
-void gst_value_set_int_range (GValue *value,
- int start,
- int end);
-int gst_value_get_int_range_min (const GValue *value);
-int gst_value_get_int_range_max (const GValue *value);
+void gst_value_set_int_range (GValue *value,
+ int start,
+ int end);
+int gst_value_get_int_range_min (const GValue *value);
+int gst_value_get_int_range_max (const GValue *value);
/* double range */
-void gst_value_set_double_range (GValue *value,
- double start,
- double end);
-double gst_value_get_double_range_min (const GValue *value);
-double gst_value_get_double_range_max (const GValue *value);
+void gst_value_set_double_range (GValue *value,
+ double start,
+ double end);
+double gst_value_get_double_range_min (const GValue *value);
+double gst_value_get_double_range_max (const GValue *value);
/* caps */
-G_CONST_RETURN GstCaps * gst_value_get_caps (const GValue *value);
-void gst_value_set_caps (GValue *value,
- const GstCaps *caps);
+G_CONST_RETURN GstCaps *
+ gst_value_get_caps (const GValue *value);
+void gst_value_set_caps (GValue *value,
+ const GstCaps *caps);
/* compare */
-int gst_value_compare (const GValue *value1,
- const GValue *value2);
-gboolean gst_value_can_compare (const GValue *value1,
- const GValue *value2);
+int gst_value_compare (const GValue *value1,
+ const GValue *value2);
+gboolean gst_value_can_compare (const GValue *value1,
+ const GValue *value2);
/* union */
-gboolean gst_value_union (GValue *dest,
- const GValue *value1,
- const GValue *value2);
-gboolean gst_value_can_union (const GValue *value1,
- const GValue *value2);
-void gst_value_register_union_func (GType type1,
- GType type2,
- GstValueUnionFunc func);
+gboolean gst_value_union (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+gboolean gst_value_can_union (const GValue *value1,
+ const GValue *value2);
+void gst_value_register_union_func (GType type1,
+ GType type2,
+ GstValueUnionFunc func);
/* intersection */
-gboolean gst_value_intersect (GValue *dest,
- const GValue *value1,
- const GValue *value2);
-gboolean gst_value_can_intersect (const GValue *value1,
- const GValue *value2);
-void gst_value_register_intersect_func (GType type1,
- GType type2,
- GstValueIntersectFunc func);
+gboolean gst_value_intersect (GValue *dest,
+ const GValue *value1,
+ const GValue *value2);
+gboolean gst_value_can_intersect (const GValue *value1,
+ const GValue *value2);
+void gst_value_register_intersect_func (GType type1,
+ GType type2,
+ GstValueIntersectFunc func);
/* subtraction */
-gboolean gst_value_subtract (GValue *dest,
- const GValue *minuend,
- const GValue *subtrahend);
-gboolean gst_value_can_subtract (const GValue *minuend,
- const GValue *subtrahend);
-void gst_value_register_subtract_func (GType minuend_type,
- GType subtrahend_type,
- GstValueSubtractFunc func);
+gboolean gst_value_subtract (GValue *dest,
+ const GValue *minuend,
+ const GValue *subtrahend);
+gboolean gst_value_can_subtract (const GValue *minuend,
+ const GValue *subtrahend);
+void gst_value_register_subtract_func (GType minuend_type,
+ GType subtrahend_type,
+ GstValueSubtractFunc func);
/* fixation */
-gboolean gst_type_is_fixed (GType type);
+gboolean gst_type_is_fixed (GType type);
/* private */
-void _gst_value_initialize (void);
+void _gst_value_initialize (void);
G_END_DECLS
static gboolean b;
static gchar *s;
-#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
- if (condition) { \
- g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
- } else { \
- g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \
- return -test; \
- } \
+#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
+ if (condition) { \
+ g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
+ } else { \
+ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
+ #condition); \
+ return -test; \
+ } \
}G_STMT_END
-#define TEST_START(pipeline) G_STMT_START{ \
- g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \
- cur = gst_parse_launch (pipeline, &error); \
- if (error == NULL) { \
- g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
- } else { \
- g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \
- g_error_free (error); \
- return -test; \
- } \
+
+#define TEST_START(pipeline) G_STMT_START{ \
+ g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \
+ pipeline); \
+ cur = gst_parse_launch (pipeline, &error); \
+ if (error == NULL) { \
+ g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
+ } else { \
+ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
+ error->message); \
+ g_error_free (error); \
+ return -test; \
+ } \
}G_STMT_END
-#define TEST_OK G_STMT_START{ \
- gst_object_unref (GST_OBJECT (cur)); \
- cur = NULL; \
- g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
+
+#define TEST_OK G_STMT_START{ \
+ gst_object_unref (GST_OBJECT (cur)); \
+ cur = NULL; \
+ g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END
-#define TEST_RUN G_STMT_START{ \
- alarm(10); \
- g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
- if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \
- g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \
- return -test; \
- } \
- iterations = 0; \
- while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
- if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \
- g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \
- return -test; \
- } \
- g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \
- alarm(0); \
+
+#define TEST_RUN G_STMT_START{ \
+ alarm(10); \
+ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
+ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
+ == GST_STATE_FAILURE) { \
+ g_print ("TEST %2d line %3d FAILED : " \
+ "pipeline could not be set to PLAYING\n", test, __LINE__); \
+ return -test; \
+ } \
+ iterations = 0; \
+ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
+ if (gst_element_set_state (cur, GST_STATE_NULL) \
+ == GST_STATE_FAILURE) { \
+ g_print ("TEST %2d line %3d FAILED : " \
+ "pipeline could not be reset to state NULL\n", test, __LINE__); \
+ return -test; \
+ } \
+ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \
+ test, __LINE__, iterations); \
+ alarm(0); \
}G_STMT_END
+
#define PIPELINE1 "fakesrc"
#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data"
#define PIPELINE3 "fakesrc 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."
-
gint
main (gint argc, gchar * argv[])
{
/**
* checks:
* - 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
*/
TEST_START (PIPELINE2);
static gboolean b;
static gchar *s;
-#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
- if (condition) { \
- g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
- } else { \
- g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, #condition); \
- return -test; \
- } \
+#define TEST_CHECK_FAIL(condition) G_STMT_START{ \
+ if (condition) { \
+ g_print ("TEST %2d line %3d OK\n", test, __LINE__); \
+ } else { \
+ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
+ #condition); \
+ return -test; \
+ } \
}G_STMT_END
-#define TEST_START(pipeline) G_STMT_START{ \
- g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, pipeline); \
- cur = gst_parse_launch (pipeline, &error); \
- if (error == NULL) { \
- g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
- } else { \
- g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, error->message); \
- g_error_free (error); \
- return -test; \
- } \
+
+#define TEST_START(pipeline) G_STMT_START{ \
+ g_print ("TEST %2d line %3d START : %s\n", ++test, __LINE__, \
+ pipeline); \
+ cur = gst_parse_launch (pipeline, &error); \
+ if (error == NULL) { \
+ g_print ("TEST %2d line %3d CREATED\n", test, __LINE__); \
+ } else { \
+ g_print ("TEST %2d line %3d FAILED : %s\n", test, __LINE__, \
+ error->message); \
+ g_error_free (error); \
+ return -test; \
+ } \
}G_STMT_END
-#define TEST_OK G_STMT_START{ \
- gst_object_unref (GST_OBJECT (cur)); \
- cur = NULL; \
- g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
+
+#define TEST_OK G_STMT_START{ \
+ gst_object_unref (GST_OBJECT (cur)); \
+ cur = NULL; \
+ g_print ("TEST %2d line %3d COMPLETE\n", test, __LINE__); \
}G_STMT_END
-#define TEST_RUN G_STMT_START{ \
- alarm(10); \
- g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
- if (gst_element_set_state (cur, GST_STATE_PLAYING) == GST_STATE_FAILURE) { \
- g_print ("TEST %2d line %3d FAILED : pipeline could not be set to state PLAYING\n", test, __LINE__); \
- return -test; \
- } \
- iterations = 0; \
- while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
- if (gst_element_set_state (cur, GST_STATE_NULL) == GST_STATE_FAILURE) { \
- g_print ("TEST %2d line %3d FAILED : pipeline could not be reset to state NULL\n", test, __LINE__); \
- return -test; \
- } \
- g_print ("TEST %2d line %3d STOPPED : %u iterations\n", test, __LINE__, iterations); \
- alarm(0); \
+
+#define TEST_RUN G_STMT_START{ \
+ alarm(10); \
+ g_print ("TEST %2d line %3d RUN\n", test, __LINE__); \
+ if (gst_element_set_state (cur, GST_STATE_PLAYING) \
+ == GST_STATE_FAILURE) { \
+ g_print ("TEST %2d line %3d FAILED : " \
+ "pipeline could not be set to PLAYING\n", test, __LINE__); \
+ return -test; \
+ } \
+ iterations = 0; \
+ while (gst_bin_iterate (GST_BIN (cur))) iterations++; \
+ if (gst_element_set_state (cur, GST_STATE_NULL) \
+ == GST_STATE_FAILURE) { \
+ g_print ("TEST %2d line %3d FAILED : " \
+ "pipeline could not be reset to state NULL\n", test, __LINE__); \
+ return -test; \
+ } \
+ g_print ("TEST %2d line %3d STOPPED : %u iterations\n", \
+ test, __LINE__, iterations); \
+ alarm(0); \
}G_STMT_END
+
#define PIPELINE1 "fakesrc"
#define PIPELINE2 "fakesrc name=donald num-buffers= 27 silent =TruE sizetype = 3 eos = falSe data= Subbuffer\\ data"
#define PIPELINE3 "fakesrc 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."
-
gint
main (gint argc, gchar * argv[])
{
/**
* checks:
* - 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
*/
TEST_START (PIPELINE2);