mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
debugging additions and style cleanups
Original commit message from CVS: debugging additions and style cleanups
This commit is contained in:
parent
baa63d42e5
commit
1c5150d393
9 changed files with 232 additions and 174 deletions
13
ChangeLog
13
ChangeLog
|
@ -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>
|
||||
|
||||
* docs/manual/states.xml: Grammar fix
|
||||
|
@ -26,7 +37,7 @@
|
|||
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
|
||||
|
|
|
@ -2726,6 +2726,8 @@ gst_element_set_state (GstElement * element, GstElementState state)
|
|||
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);
|
||||
|
|
|
@ -1482,6 +1482,7 @@ gst_pad_try_set_caps (GstPad * pad, const GstCaps * caps)
|
|||
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,
|
||||
|
|
|
@ -984,7 +984,10 @@ static GstStructureAbbreviation gst_structure_abbrs[] = {
|
|||
{"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},
|
||||
|
|
|
@ -540,7 +540,7 @@ gst_thread_child_state_change (GstBin * bin, GstElementState oldstate,
|
|||
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)
|
||||
|
|
|
@ -52,7 +52,6 @@ struct _GstValueSubtractInfo
|
|||
GstValueSubtractFunc func;
|
||||
};
|
||||
|
||||
GType gst_type_fourcc;
|
||||
GType gst_type_fourcc;
|
||||
GType gst_type_int_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_subtract_funcs;
|
||||
|
||||
/********/
|
||||
/* list */
|
||||
/********/
|
||||
/********
|
||||
* list *
|
||||
********/
|
||||
|
||||
/* two helper functions to serialize/stringify any type of list
|
||||
* regular lists are done with { }, fixed lists with < >
|
||||
|
@ -399,8 +398,9 @@ gst_value_deserialize_fixed_list (GValue * dest, const char *s)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* fourcc */
|
||||
/**********
|
||||
* fourcc *
|
||||
**********/
|
||||
|
||||
static void
|
||||
gst_value_init_fourcc (GValue * value)
|
||||
|
@ -530,8 +530,9 @@ gst_value_deserialize_fourcc (GValue * dest, const char *s)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* int range */
|
||||
/*************
|
||||
* int range *
|
||||
*************/
|
||||
|
||||
static void
|
||||
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.
|
||||
*
|
||||
* Returns: the minumum of the range
|
||||
* Returns: the minimum of the range
|
||||
*/
|
||||
int
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* double range */
|
||||
/****************
|
||||
* double range *
|
||||
****************/
|
||||
|
||||
static void
|
||||
gst_value_init_double_range (GValue * value)
|
||||
|
@ -795,8 +797,9 @@ gst_value_deserialize_double_range (GValue * dest, const char *s)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* GstCaps */
|
||||
/***********
|
||||
* GstCaps *
|
||||
***********/
|
||||
|
||||
/**
|
||||
* gst_value_set_caps:
|
||||
|
@ -830,8 +833,9 @@ gst_value_get_caps (const GValue * value)
|
|||
return (GstCaps *) g_value_get_boxed (value);
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* GstBuffer */
|
||||
/*************
|
||||
* GstBuffer *
|
||||
*************/
|
||||
|
||||
static int
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* ints */
|
||||
/*******
|
||||
* int *
|
||||
*******/
|
||||
|
||||
static int
|
||||
gst_strtoll (const char *s, char **end, int base)
|
||||
|
@ -1102,8 +1108,9 @@ CREATE_USERIALIZATION (uint, UINT)
|
|||
CREATE_USERIALIZATION (uint64, UINT64)
|
||||
CREATE_USERIALIZATION (ulong, ULONG)
|
||||
|
||||
/*************************************/
|
||||
/* double */
|
||||
/**********
|
||||
* double *
|
||||
**********/
|
||||
static int
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* float */
|
||||
/*********
|
||||
* float *
|
||||
*********/
|
||||
|
||||
static int
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* string */
|
||||
/**********
|
||||
* string *
|
||||
**********/
|
||||
|
||||
static int
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* enums */
|
||||
/********
|
||||
* enum *
|
||||
********/
|
||||
|
||||
static int
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* unions */
|
||||
/*********
|
||||
* union *
|
||||
*********/
|
||||
|
||||
static gboolean
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* intersection */
|
||||
/****************
|
||||
* intersection *
|
||||
****************/
|
||||
|
||||
static gboolean
|
||||
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;
|
||||
}
|
||||
|
||||
/*************************************/
|
||||
/* subtraction */
|
||||
/***************
|
||||
* subtraction *
|
||||
***************/
|
||||
|
||||
static gboolean
|
||||
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:
|
||||
|
|
126
gst/gstvalue.h
126
gst/gstvalue.h
|
@ -84,91 +84,93 @@ extern GType gst_type_double_range;
|
|||
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
|
||||
|
||||
|
|
|
@ -34,46 +34,58 @@ static gint i;
|
|||
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"
|
||||
|
@ -89,7 +101,6 @@ static gchar *s;
|
|||
#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[])
|
||||
{
|
||||
|
@ -107,7 +118,8 @@ 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);
|
||||
|
|
|
@ -34,46 +34,58 @@ static gint i;
|
|||
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"
|
||||
|
@ -89,7 +101,6 @@ static gchar *s;
|
|||
#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[])
|
||||
{
|
||||
|
@ -107,7 +118,8 @@ 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);
|
||||
|
|
Loading…
Reference in a new issue