diff --git a/ChangeLog b/ChangeLog index f8876b9242..dbb9ff27c2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-10-15 Thomas Vander Stichele + + * docs/gst/gstreamer-sections.txt: + * gst/gstvalue.c: (gst_date_get_type), (_gst_value_initialize): + * gst/gstvalue.h: + give each value a _get_type, removes the DATA exports + 2005-10-15 Thomas Vander Stichele * gst/gst.c: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 02265a4c43..b6ee954b45 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -24,7 +24,6 @@ gst_init_check gst_init_get_option_group gst_deinit -GstPoptOption mutex start_cond sync_cond @@ -510,7 +509,6 @@ gst_element_set_locked_state gst_element_set_name gst_element_set_parent gst_element_set_state -gst_element_set_state_async gst_element_state_get_name gst_element_sync_state_with_parent gst_element_unlink @@ -2029,7 +2027,6 @@ GST_ROUND_UP_32 GST_ROUND_UP_64 gst_atomic_int_set -gst_bin_watch_for_state_change gst_flow_get_name gst_print_element_args gst_print_pad_caps diff --git a/gst/gstvalue.c b/gst/gstvalue.c index c2dc2fdc2a..584d413862 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -60,8 +60,6 @@ struct _GstValueSubtractInfo GstValueSubtractFunc func; }; -GType gst_type_fourcc; -GType gst_type_int_range; GType gst_type_double_range; GType gst_type_list; GType gst_type_array; @@ -3087,25 +3085,138 @@ gst_value_transform_string_date (const GValue * src_value, GValue * dest_value) gst_value_deserialize_date (dest_value, src_value->data[0].v_pointer); } +static GTypeInfo _info = { + 0, + NULL, + NULL, + NULL, + NULL, + NULL, + 0, + 0, + NULL, + NULL, +}; + +static GTypeFundamentalInfo _finfo = { + 0 +}; + +#define FUNC_VALUE_GET_TYPE(type, name) \ +GType gst_ ## type ## _get_type (void) \ +{ \ + static GType gst_ ## type ## _type = 0; \ + \ + if (!gst_ ## type ## _type) { \ + _info.value_table = & _gst_ ## type ## _value_table; \ + gst_ ## type ## _type = g_type_register_fundamental ( \ + g_type_fundamental_next (), \ + name, &_info, &_finfo, 0); \ + } \ + \ + return gst_ ## type ## _type; \ +} + +static const GTypeValueTable _gst_fourcc_value_table = { + gst_value_init_fourcc, + NULL, + gst_value_copy_fourcc, + NULL, + "i", + gst_value_collect_fourcc, + "p", + gst_value_lcopy_fourcc +}; + +FUNC_VALUE_GET_TYPE (fourcc, "GstFourcc"); + +static const GTypeValueTable _gst_int_range_value_table = { + gst_value_init_int_range, + NULL, + gst_value_copy_int_range, + NULL, + "ii", + gst_value_collect_int_range, + "pp", + gst_value_lcopy_int_range +}; + +FUNC_VALUE_GET_TYPE (int_range, "GstIntRange"); + +static const GTypeValueTable _gst_double_range_value_table = { + gst_value_init_double_range, + NULL, + gst_value_copy_double_range, + NULL, + "dd", + gst_value_collect_double_range, + "pp", + gst_value_lcopy_double_range +}; + +FUNC_VALUE_GET_TYPE (double_range, "GstDoubleRange"); + +static const GTypeValueTable _gst_value_list_value_table = { + gst_value_init_list, + gst_value_free_list, + gst_value_copy_list, + gst_value_list_peek_pointer, + "p", + gst_value_collect_list, + "p", + gst_value_lcopy_list +}; + +FUNC_VALUE_GET_TYPE (value_list, "GstValueList"); + +static const GTypeValueTable _gst_value_array_value_table = { + gst_value_init_list, + gst_value_free_list, + gst_value_copy_list, + gst_value_list_peek_pointer, + "p", + gst_value_collect_list, + "p", + gst_value_lcopy_list +}; + +FUNC_VALUE_GET_TYPE (value_array, "GstValueArray"); + +static const GTypeValueTable _gst_fraction_value_table = { + gst_value_init_fraction, + NULL, + gst_value_copy_fraction, + NULL, + "ii", + gst_value_collect_fraction, + "pp", + gst_value_lcopy_fraction +}; + +FUNC_VALUE_GET_TYPE (fraction, "GstFraction"); + + +GType +gst_date_get_type (void) +{ + static GType gst_date_type = 0; + + if (!gst_date_type) { + /* Not using G_TYPE_DATE here on purpose, even if we could + * if GLIB_CHECK_VERSION(2,8,0) was true: we don't want the + * serialised strings to have different type strings depending + * on what version is used, so FIXME in 0.11 when we + * require GLib-2.8 */ + gst_date_type = g_boxed_type_register_static ("GstDate", + (GBoxedCopyFunc) gst_date_copy, (GBoxedFreeFunc) g_date_free); + } + + return gst_date_type; +} + void _gst_value_initialize (void) { - GTypeInfo info = { - 0, - NULL, - NULL, - NULL, - NULL, - NULL, - 0, - 0, - NULL, - NULL, - }; - GTypeFundamentalInfo finfo = { - 0 - }; - //const GTypeFundamentalInfo finfo = { G_TYPE_FLAG_DERIVABLE, }; gst_value_table = g_array_new (FALSE, FALSE, sizeof (GstValueTable)); @@ -3117,16 +3228,6 @@ _gst_value_initialize (void) sizeof (GstValueSubtractInfo)); { - static const GTypeValueTable value_table = { - gst_value_init_fourcc, - NULL, - gst_value_copy_fourcc, - NULL, - "i", - gst_value_collect_fourcc, - "p", - gst_value_lcopy_fourcc - }; static GstValueTable gst_value = { 0, gst_value_compare_fourcc, @@ -3134,24 +3235,11 @@ _gst_value_initialize (void) gst_value_deserialize_fourcc, }; - info.value_table = &value_table; - gst_type_fourcc = g_type_register_fundamental (g_type_fundamental_next (), - "GstFourcc", &info, &finfo, 0); - gst_value.type = gst_type_fourcc; + gst_value.type = gst_fourcc_get_type (); gst_value_register (&gst_value); } { - static const GTypeValueTable value_table = { - gst_value_init_int_range, - NULL, - gst_value_copy_int_range, - NULL, - "ii", - gst_value_collect_int_range, - "pp", - gst_value_lcopy_int_range - }; static GstValueTable gst_value = { 0, gst_value_compare_int_range, @@ -3159,25 +3247,11 @@ _gst_value_initialize (void) gst_value_deserialize_int_range, }; - info.value_table = &value_table; - gst_type_int_range = - g_type_register_fundamental (g_type_fundamental_next (), "GstIntRange", - &info, &finfo, 0); - gst_value.type = gst_type_int_range; + gst_value.type = gst_int_range_get_type (); gst_value_register (&gst_value); } { - static const GTypeValueTable value_table = { - gst_value_init_double_range, - NULL, - gst_value_copy_double_range, - NULL, - "dd", - gst_value_collect_double_range, - "pp", - gst_value_lcopy_double_range - }; static GstValueTable gst_value = { 0, gst_value_compare_double_range, @@ -3185,25 +3259,11 @@ _gst_value_initialize (void) gst_value_deserialize_double_range, }; - info.value_table = &value_table; - gst_type_double_range = - g_type_register_fundamental (g_type_fundamental_next (), - "GstDoubleRange", &info, &finfo, 0); - gst_value.type = gst_type_double_range; + gst_value.type = gst_double_range_get_type (); gst_value_register (&gst_value); } { - static const GTypeValueTable value_table = { - gst_value_init_list, - gst_value_free_list, - gst_value_copy_list, - gst_value_list_peek_pointer, - "p", - gst_value_collect_list, - "p", - gst_value_lcopy_list - }; static GstValueTable gst_value = { 0, gst_value_compare_list, @@ -3211,24 +3271,11 @@ _gst_value_initialize (void) gst_value_deserialize_list, }; - info.value_table = &value_table; - gst_type_list = g_type_register_fundamental (g_type_fundamental_next (), - "GstValueList", &info, &finfo, 0); - gst_value.type = gst_type_list; + gst_value.type = gst_value_list_get_type (); gst_value_register (&gst_value); } { - static const GTypeValueTable value_table = { - gst_value_init_list, - gst_value_free_list, - gst_value_copy_list, - gst_value_list_peek_pointer, - "p", - gst_value_collect_list, - "p", - gst_value_lcopy_list - }; static GstValueTable gst_value = { 0, gst_value_compare_list, @@ -3236,11 +3283,7 @@ _gst_value_initialize (void) gst_value_deserialize_array, }; - info.value_table = &value_table; - gst_type_array = - g_type_register_fundamental (g_type_fundamental_next (), - "GstValueArray", &info, &finfo, 0); - gst_value.type = gst_type_array; + gst_value.type = gst_value_array_get_type ();; gst_value_register (&gst_value); } @@ -3268,16 +3311,6 @@ _gst_value_initialize (void) gst_value_register (&gst_value); } { - static const GTypeValueTable value_table = { - gst_value_init_fraction, - NULL, - gst_value_copy_fraction, - NULL, - "ii", - gst_value_collect_fraction, - "pp", - gst_value_lcopy_fraction - }; static GstValueTable gst_value = { 0, gst_value_compare_fraction, @@ -3285,11 +3318,7 @@ _gst_value_initialize (void) gst_value_deserialize_fraction, }; - info.value_table = &value_table; - gst_type_fraction = - g_type_register_fundamental (g_type_fundamental_next (), "GstFraction", - &info, &finfo, 0); - gst_value.type = gst_type_fraction; + gst_value.type = gst_fraction_get_type (); gst_value_register (&gst_value); } { @@ -3311,15 +3340,7 @@ _gst_value_initialize (void) gst_value_deserialize_date, }; - /* Not using G_TYPE_DATE here on purpose, even if we could - * if GLIB_CHECK_VERSION(2,8,0) was true: we don't want the - * serialised strings to have different type strings depending - * on what version is used, so FIXME in 0.11 when we - * require GLib-2.8 */ - gst_type_date = g_boxed_type_register_static ("GstDate", - (GBoxedCopyFunc) gst_date_copy, (GBoxedFreeFunc) g_date_free); - - gst_value.type = gst_type_date; + gst_value.type = gst_date_get_type (); gst_value_register (&gst_value); } diff --git a/gst/gstvalue.h b/gst/gstvalue.h index 8d73fbf1c4..a4a2573bb0 100644 --- a/gst/gstvalue.h +++ b/gst/gstvalue.h @@ -90,7 +90,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_FOURCC value. */ -#define GST_VALUE_HOLDS_FOURCC(x) (G_VALUE_HOLDS(x, gst_type_fourcc)) +#define GST_VALUE_HOLDS_FOURCC(x) (G_VALUE_HOLDS(x, gst_fourcc_get_type ())) /** * GST_VALUE_HOLDS_INT_RANGE: @@ -98,7 +98,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_INT_RANGE value. */ -#define GST_VALUE_HOLDS_INT_RANGE(x) (G_VALUE_HOLDS(x, gst_type_int_range)) +#define GST_VALUE_HOLDS_INT_RANGE(x) (G_VALUE_HOLDS(x, gst_int_range_get_type ())) /** * GST_VALUE_HOLDS_DOUBLE_RANGE: @@ -106,7 +106,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_DOUBLE_RANGE value. */ -#define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_type_double_range)) +#define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_double_range_get_type ())) /** * GST_VALUE_HOLDS_LIST: @@ -114,7 +114,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_LIST value. */ -#define GST_VALUE_HOLDS_LIST(x) (G_VALUE_HOLDS(x, gst_type_list)) +#define GST_VALUE_HOLDS_LIST(x) (G_VALUE_HOLDS(x, gst_value_list_get_type ())) /** * GST_VALUE_HOLDS_ARRAY: @@ -122,7 +122,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_ARRAY value. */ -#define GST_VALUE_HOLDS_ARRAY(x) (G_VALUE_HOLDS(x, gst_type_array)) +#define GST_VALUE_HOLDS_ARRAY(x) (G_VALUE_HOLDS(x, gst_value_array_get_type ())) /** * GST_VALUE_HOLDS_CAPS: @@ -146,7 +146,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_FRACTION value. */ -#define GST_VALUE_HOLDS_FRACTION(x) (G_VALUE_HOLDS(x, gst_type_fraction)) +#define GST_VALUE_HOLDS_FRACTION(x) (G_VALUE_HOLDS(x, gst_fraction_get_type ())) /** * GST_VALUE_HOLDS_DATE: @@ -154,7 +154,7 @@ G_BEGIN_DECLS * * Checks if the given #GValue contains a #GST_TYPE_DATE value. */ -#define GST_VALUE_HOLDS_DATE(x) (G_VALUE_HOLDS(x, gst_type_date)) +#define GST_VALUE_HOLDS_DATE(x) (G_VALUE_HOLDS(x, gst_date_get_type ())) /** * GST_TYPE_FOURCC: @@ -163,7 +163,7 @@ G_BEGIN_DECLS * * Returns: the #GType of GstFourcc */ -#define GST_TYPE_FOURCC gst_type_fourcc +#define GST_TYPE_FOURCC gst_fourcc_get_type () /** * GST_TYPE_INT_RANGE: @@ -172,7 +172,7 @@ G_BEGIN_DECLS * * Returns: the #GType of GstIntRange */ -#define GST_TYPE_INT_RANGE gst_type_int_range +#define GST_TYPE_INT_RANGE gst_int_range_get_type () /** * GST_TYPE_DOUBLE_RANGE: @@ -181,7 +181,7 @@ G_BEGIN_DECLS * * Returns: the #GType of GstIntRange */ -#define GST_TYPE_DOUBLE_RANGE gst_type_double_range +#define GST_TYPE_DOUBLE_RANGE gst_double_range_get_type () /** * GST_TYPE_LIST: @@ -190,7 +190,7 @@ G_BEGIN_DECLS * * Returns: the #GType of GstValueList (which is not explicitly typed) */ -#define GST_TYPE_LIST gst_type_list +#define GST_TYPE_LIST gst_value_list_get_type () /** * GST_TYPE_ARRAY: @@ -199,7 +199,7 @@ G_BEGIN_DECLS * * Returns: the #GType of GstArrayList (which is not explicitly typed) */ -#define GST_TYPE_ARRAY gst_type_array +#define GST_TYPE_ARRAY gst_value_array_get_type () /** * GST_TYPE_FRACTION: @@ -210,7 +210,7 @@ G_BEGIN_DECLS * Returns: the #GType of GstFraction (which is not explicitly typed) */ -#define GST_TYPE_FRACTION gst_type_fraction +#define GST_TYPE_FRACTION gst_fraction_get_type () /** * GST_TYPE_DATE: @@ -220,7 +220,7 @@ G_BEGIN_DECLS * Returns: the #GType of GstDate */ -#define GST_TYPE_DATE gst_type_date +#define GST_TYPE_DATE gst_date_get_type () /** * GST_VALUE_LESS_THAN: @@ -295,13 +295,14 @@ struct _GstValueTable { void *_gst_reserved [GST_PADDING]; }; -GST_EXPORT GType gst_type_fourcc; -GST_EXPORT GType gst_type_int_range; -GST_EXPORT GType gst_type_double_range; -GST_EXPORT GType gst_type_list; -GST_EXPORT GType gst_type_array; -GST_EXPORT GType gst_type_fraction; -GST_EXPORT GType gst_type_date; +GType gst_int_range_get_type (); +GType gst_double_range_get_type (); +GType gst_fourcc_get_type (); +GType gst_fraction_get_type (); +GType gst_value_list_get_type (); +GType gst_value_array_get_type (); + +GType gst_date_get_type (); void gst_value_register (const GstValueTable *table); void gst_value_init_and_copy (GValue *dest,