2003-11-03 09:10:07 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) <2003> David A. Schleef <ds@schleef.org>
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
|
|
|
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
2005-09-23 16:35:43 +00:00
|
|
|
|
2005-09-21 09:48:40 +00:00
|
|
|
/**
|
|
|
|
* SECTION:gstvalue
|
API: add GstParamSpecFraction, so elements can have fraction properties without lots of painful string parsing (#4446...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c:
* gst/gst.h:
* gst/gstparamspecs.c: (_gst_param_fraction_init),
(_gst_param_fraction_set_default), (_gst_param_fraction_validate),
(_gst_param_fraction_values_cmp),
(gst_param_spec_fraction_get_type), (gst_param_spec_fraction):
* gst/gstparamspecs.h:
* gst/gstvalue.c:
* tests/check/Makefile.am:
* tests/check/gst/.cvsignore:
* tests/check/gst/gstparamspecs.c: (gst_dummy_obj_base_init),
(gst_dummy_obj_class_init), (gst_dummy_obj_init),
(gst_dummy_obj_set_property), (gst_dummy_obj_get_property),
(GST_START_TEST), (gst_param_spec_suite):
API: add GstParamSpecFraction, so elements can have fraction
properties without lots of painful string parsing (#444648).
2007-06-06 11:18:12 +00:00
|
|
|
* @short_description: GValue and GParamSpec implementations specific
|
|
|
|
* to GStreamer
|
2005-09-21 09:48:40 +00:00
|
|
|
*
|
API: add GstParamSpecFraction, so elements can have fraction properties without lots of painful string parsing (#4446...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/Makefile.am:
* gst/gst.c:
* gst/gst.h:
* gst/gstparamspecs.c: (_gst_param_fraction_init),
(_gst_param_fraction_set_default), (_gst_param_fraction_validate),
(_gst_param_fraction_values_cmp),
(gst_param_spec_fraction_get_type), (gst_param_spec_fraction):
* gst/gstparamspecs.h:
* gst/gstvalue.c:
* tests/check/Makefile.am:
* tests/check/gst/.cvsignore:
* tests/check/gst/gstparamspecs.c: (gst_dummy_obj_base_init),
(gst_dummy_obj_class_init), (gst_dummy_obj_init),
(gst_dummy_obj_set_property), (gst_dummy_obj_get_property),
(GST_START_TEST), (gst_param_spec_suite):
API: add GstParamSpecFraction, so elements can have fraction
properties without lots of painful string parsing (#444648).
2007-06-06 11:18:12 +00:00
|
|
|
* GValue and GParamSpec implementations specific to GStreamer.
|
2005-11-24 09:44:07 +00:00
|
|
|
*
|
2006-03-07 15:08:57 +00:00
|
|
|
* Note that operations on the same GstValue (or GValue) from multiple
|
|
|
|
* threads may lead to undefined behaviour.
|
|
|
|
*
|
|
|
|
* Last reviewed on 2006-03-07 (0.10.4)
|
2005-09-21 09:48:40 +00:00
|
|
|
*/
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2004-07-27 16:45:30 +00:00
|
|
|
#include <math.h>
|
2004-02-12 16:49:16 +00:00
|
|
|
#include <stdlib.h>
|
2003-11-04 19:00:54 +00:00
|
|
|
#include <string.h>
|
2004-04-13 02:22:02 +00:00
|
|
|
#include <ctype.h>
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2004-05-07 02:36:28 +00:00
|
|
|
#include "gst_private.h"
|
2005-11-21 18:03:22 +00:00
|
|
|
#include "glib-compat-private.h"
|
2003-11-03 09:10:07 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gobject/gvaluecollector.h>
|
2003-11-04 19:00:54 +00:00
|
|
|
|
|
|
|
typedef struct _GstValueUnionInfo GstValueUnionInfo;
|
2004-03-13 15:27:01 +00:00
|
|
|
struct _GstValueUnionInfo
|
|
|
|
{
|
2003-11-04 19:00:54 +00:00
|
|
|
GType type1;
|
|
|
|
GType type2;
|
|
|
|
GstValueUnionFunc func;
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _GstValueIntersectInfo GstValueIntersectInfo;
|
2004-03-13 15:27:01 +00:00
|
|
|
struct _GstValueIntersectInfo
|
|
|
|
{
|
2003-11-04 19:00:54 +00:00
|
|
|
GType type1;
|
|
|
|
GType type2;
|
|
|
|
GstValueIntersectFunc func;
|
|
|
|
};
|
2003-11-03 09:10:07 +00:00
|
|
|
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
typedef struct _GstValueSubtractInfo GstValueSubtractInfo;
|
|
|
|
struct _GstValueSubtractInfo
|
|
|
|
{
|
|
|
|
GType minuend;
|
|
|
|
GType subtrahend;
|
|
|
|
GstValueSubtractFunc func;
|
|
|
|
};
|
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
GType gst_type_double_range;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
GType gst_type_fraction_range;
|
2003-11-29 06:31:10 +00:00
|
|
|
GType gst_type_list;
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
GType gst_type_array;
|
2004-07-15 20:27:20 +00:00
|
|
|
GType gst_type_fraction;
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
GType gst_type_date;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static GArray *gst_value_table;
|
|
|
|
static GArray *gst_value_union_funcs;
|
|
|
|
static GArray *gst_value_intersect_funcs;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
static GArray *gst_value_subtract_funcs;
|
2003-11-04 19:00:54 +00:00
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
/* Forward declarations */
|
|
|
|
static gint gst_greatest_common_divisor (gint a, gint b);
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *gst_value_serialize_fraction (const GValue * value);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
2006-08-20 15:55:12 +00:00
|
|
|
static GstValueCompareFunc gst_value_get_compare_func (const GValue * value1);
|
|
|
|
static gint gst_value_compare_with_func (const GValue * value1,
|
|
|
|
const GValue * value2, GstValueCompareFunc compare);
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/********
|
|
|
|
* list *
|
|
|
|
********/
|
2004-05-20 17:03:02 +00:00
|
|
|
|
|
|
|
/* two helper functions to serialize/stringify any type of list
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
* regular lists are done with { }, arrays with < >
|
2004-05-20 17:03:02 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
|
|
|
gst_value_serialize_any_list (const GValue * value, const gchar * begin,
|
|
|
|
const gchar * end)
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2004-05-20 17:03:02 +00:00
|
|
|
GArray *array = value->data[0].v_pointer;
|
|
|
|
GString *s;
|
|
|
|
GValue *v;
|
|
|
|
gchar *s_val;
|
|
|
|
|
|
|
|
s = g_string_new (begin);
|
|
|
|
for (i = 0; i < array->len; i++) {
|
|
|
|
v = &g_array_index (array, GValue, i);
|
|
|
|
s_val = gst_value_serialize (v);
|
|
|
|
g_string_append (s, s_val);
|
|
|
|
g_free (s_val);
|
|
|
|
if (i < array->len - 1) {
|
|
|
|
g_string_append (s, ", ");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
g_string_append (s, end);
|
|
|
|
return g_string_free (s, FALSE);
|
|
|
|
}
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2004-05-20 17:03:02 +00:00
|
|
|
static void
|
|
|
|
gst_value_transform_any_list_string (const GValue * src_value,
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
GValue * dest_value, const gchar * begin, const gchar * end)
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
|
|
|
GValue *list_value;
|
|
|
|
GArray *array;
|
|
|
|
GString *s;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gchar *list_s;
|
2004-05-20 17:03:02 +00:00
|
|
|
|
|
|
|
array = src_value->data[0].v_pointer;
|
|
|
|
|
|
|
|
s = g_string_new (begin);
|
|
|
|
for (i = 0; i < array->len; i++) {
|
|
|
|
list_value = &g_array_index (array, GValue, i);
|
|
|
|
|
|
|
|
if (i != 0) {
|
|
|
|
g_string_append (s, ", ");
|
|
|
|
}
|
|
|
|
list_s = g_strdup_value_contents (list_value);
|
|
|
|
g_string_append (s, list_s);
|
|
|
|
g_free (list_s);
|
|
|
|
}
|
|
|
|
g_string_append (s, end);
|
|
|
|
|
|
|
|
dest_value->data[0].v_pointer = g_string_free (s, FALSE);
|
|
|
|
}
|
|
|
|
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
/*
|
|
|
|
* helper function to see if a type is fixed. Is used internally here and
|
|
|
|
* there. Do not export, since it doesn't work for types where the content
|
|
|
|
* decides the fixedness (e.g. GST_TYPE_ARRAY).
|
|
|
|
*/
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_type_is_fixed (GType type)
|
|
|
|
{
|
|
|
|
if (type == GST_TYPE_INT_RANGE || type == GST_TYPE_DOUBLE_RANGE ||
|
|
|
|
type == GST_TYPE_LIST) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
if (G_TYPE_FUNDAMENTAL (type) <=
|
|
|
|
G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (type == GST_TYPE_BUFFER || type == GST_TYPE_FOURCC
|
|
|
|
|| type == GST_TYPE_ARRAY || type == GST_TYPE_FRACTION) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* GValue functions usable for both regular lists and arrays */
|
2003-11-24 02:09:23 +00:00
|
|
|
static void
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_init_list_or_array (GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
value->data[0].v_pointer = g_array_new (FALSE, TRUE, sizeof (GValue));
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static GArray *
|
2005-11-19 16:46:30 +00:00
|
|
|
copy_garray_of_gstvalue (const GArray * src)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
GArray *dest;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
dest = g_array_sized_new (FALSE, TRUE, sizeof (GValue), src->len);
|
2003-11-24 02:09:23 +00:00
|
|
|
g_array_set_size (dest, src->len);
|
|
|
|
for (i = 0; i < src->len; i++) {
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (&g_array_index (dest, GValue, i),
|
2004-03-15 19:27:17 +00:00
|
|
|
&g_array_index (src, GValue, i));
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return dest;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_copy_list_or_array (const GValue * src_value, GValue * dest_value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
dest_value->data[0].v_pointer =
|
2005-11-19 16:46:30 +00:00
|
|
|
copy_garray_of_gstvalue ((GArray *) src_value->data[0].v_pointer);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_free_list_or_array (GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-11-24 02:09:23 +00:00
|
|
|
GArray *src = (GArray *) value->data[0].v_pointer;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
if ((value->data[1].v_uint & G_VALUE_NOCOPY_CONTENTS) == 0) {
|
|
|
|
for (i = 0; i < src->len; i++) {
|
2004-03-13 15:27:01 +00:00
|
|
|
g_value_unset (&g_array_index (src, GValue, i));
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
g_array_free (src, TRUE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_list_or_array_peek_pointer (const GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
return value->data[0].v_pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_collect_list_or_array (GValue * value, guint n_collect_values,
|
2004-03-13 15:27:01 +00:00
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
|
|
|
|
value->data[0].v_pointer = collect_values[0].v_pointer;
|
|
|
|
value->data[1].v_uint = G_VALUE_NOCOPY_CONTENTS;
|
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
value->data[0].v_pointer =
|
2005-11-19 16:46:30 +00:00
|
|
|
copy_garray_of_gstvalue ((GArray *) collect_values[0].v_pointer);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_lcopy_list_or_array (const GValue * value, guint n_collect_values,
|
2004-03-13 15:27:01 +00:00
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
GArray **dest = collect_values[0].v_pointer;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
if (!dest)
|
|
|
|
return g_strdup_printf ("value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2004-03-13 15:27:01 +00:00
|
|
|
if (!value->data[0].v_pointer)
|
2003-11-24 02:09:23 +00:00
|
|
|
return g_strdup_printf ("invalid value given for `%s'",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-11-24 02:09:23 +00:00
|
|
|
if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
|
|
|
|
*dest = (GArray *) value->data[0].v_pointer;
|
|
|
|
} else {
|
2005-11-19 16:46:30 +00:00
|
|
|
*dest = copy_garray_of_gstvalue ((GArray *) value->data[0].v_pointer);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_list_append_value:
|
2005-11-19 16:46:30 +00:00
|
|
|
* @value: a #GValue of type #GST_TYPE_LIST
|
2004-03-30 07:36:19 +00:00
|
|
|
* @append_value: the value to append
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Appends @append_value to the GstValueList in @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2004-03-13 15:27:01 +00:00
|
|
|
void
|
|
|
|
gst_value_list_append_value (GValue * value, const GValue * append_value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2004-04-22 16:39:23 +00:00
|
|
|
GValue val = { 0, };
|
|
|
|
|
2005-11-19 16:46:30 +00:00
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_LIST (value));
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2004-04-22 16:39:23 +00:00
|
|
|
gst_value_init_and_copy (&val, append_value);
|
|
|
|
g_array_append_vals ((GArray *) value->data[0].v_pointer, &val, 1);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
2005-11-19 16:46:30 +00:00
|
|
|
* gst_value_list_prepend_value:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_LIST
|
|
|
|
* @prepend_value: the value to prepend
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2005-11-19 16:46:30 +00:00
|
|
|
* Prepends @prepend_value to the GstValueList in @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2005-11-19 16:46:30 +00:00
|
|
|
void
|
|
|
|
gst_value_list_prepend_value (GValue * value, const GValue * prepend_value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2005-11-19 16:46:30 +00:00
|
|
|
GValue val = { 0, };
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2005-11-19 16:46:30 +00:00
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_LIST (value));
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_init_and_copy (&val, prepend_value);
|
|
|
|
g_array_prepend_vals ((GArray *) value->data[0].v_pointer, &val, 1);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_list_concat:
|
|
|
|
* @dest: an uninitialized #GValue to take the result
|
2005-11-19 16:46:30 +00:00
|
|
|
* @value1: a #GValue
|
2005-11-20 14:50:43 +00:00
|
|
|
* @value2: a #GValue
|
2003-11-24 02:09:23 +00:00
|
|
|
*
|
2005-11-19 16:46:30 +00:00
|
|
|
* Concatenates copies of @value1 and @value2 into a list. Values that are not
|
|
|
|
* of type #GST_TYPE_LIST are treated as if they were lists of length 1.
|
|
|
|
* @dest will be initialized to the type #GST_TYPE_LIST.
|
2003-11-24 02:09:23 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_list_concat (GValue * dest, const GValue * value1,
|
|
|
|
const GValue * value2)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
guint i, value1_length, value2_length;
|
|
|
|
GArray *array;
|
|
|
|
|
|
|
|
g_return_if_fail (dest != NULL);
|
|
|
|
g_return_if_fail (G_VALUE_TYPE (dest) == 0);
|
|
|
|
g_return_if_fail (G_IS_VALUE (value1));
|
|
|
|
g_return_if_fail (G_IS_VALUE (value2));
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
value1_length =
|
|
|
|
(GST_VALUE_HOLDS_LIST (value1) ? gst_value_list_get_size (value1) : 1);
|
|
|
|
value2_length =
|
|
|
|
(GST_VALUE_HOLDS_LIST (value2) ? gst_value_list_get_size (value2) : 1);
|
2003-11-29 06:31:10 +00:00
|
|
|
g_value_init (dest, GST_TYPE_LIST);
|
2003-11-24 02:09:23 +00:00
|
|
|
array = (GArray *) dest->data[0].v_pointer;
|
|
|
|
g_array_set_size (array, value1_length + value2_length);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
if (GST_VALUE_HOLDS_LIST (value1)) {
|
|
|
|
for (i = 0; i < value1_length; i++) {
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (&g_array_index (array, GValue, i),
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_value_list_get_value (value1, i));
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (&g_array_index (array, GValue, 0), value1);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
if (GST_VALUE_HOLDS_LIST (value2)) {
|
|
|
|
for (i = 0; i < value2_length; i++) {
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (&g_array_index (array, GValue,
|
2004-03-15 19:27:17 +00:00
|
|
|
i + value1_length), gst_value_list_get_value (value2, i));
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (&g_array_index (array, GValue, value1_length),
|
2004-03-15 19:27:17 +00:00
|
|
|
value2);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-11-19 16:46:30 +00:00
|
|
|
/**
|
|
|
|
* gst_value_list_get_size:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_LIST
|
|
|
|
*
|
|
|
|
* Gets the number of values contained in @value.
|
|
|
|
*
|
|
|
|
* Returns: the number of values
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_value_list_get_size (const GValue * value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_LIST (value), 0);
|
|
|
|
|
|
|
|
return ((GArray *) value->data[0].v_pointer)->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_list_get_value:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_LIST
|
|
|
|
* @index: index of value to get from the list
|
|
|
|
*
|
|
|
|
* Gets the value that is a member of the list contained in @value and
|
|
|
|
* has the index @index.
|
|
|
|
*
|
|
|
|
* Returns: the value at the given index
|
|
|
|
*/
|
|
|
|
const GValue *
|
|
|
|
gst_value_list_get_value (const GValue * value, guint index)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_LIST (value), NULL);
|
|
|
|
g_return_val_if_fail (index < gst_value_list_get_size (value), NULL);
|
|
|
|
|
|
|
|
return (const GValue *) &g_array_index ((GArray *) value->data[0].v_pointer,
|
|
|
|
GValue, index);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_array_append_value:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_ARRAY
|
|
|
|
* @append_value: the value to append
|
|
|
|
*
|
|
|
|
* Appends @append_value to the GstValueArray in @value.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_array_append_value (GValue * value, const GValue * append_value)
|
|
|
|
{
|
|
|
|
GValue val = { 0, };
|
|
|
|
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (value));
|
|
|
|
|
|
|
|
gst_value_init_and_copy (&val, append_value);
|
|
|
|
g_array_append_vals ((GArray *) value->data[0].v_pointer, &val, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_array_prepend_value:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_ARRAY
|
|
|
|
* @prepend_value: the value to prepend
|
|
|
|
*
|
|
|
|
* Prepends @prepend_value to the GstValueArray in @value.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_array_prepend_value (GValue * value, const GValue * prepend_value)
|
|
|
|
{
|
|
|
|
GValue val = { 0, };
|
|
|
|
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_ARRAY (value));
|
|
|
|
|
|
|
|
gst_value_init_and_copy (&val, prepend_value);
|
|
|
|
g_array_prepend_vals ((GArray *) value->data[0].v_pointer, &val, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_array_get_size:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_ARRAY
|
|
|
|
*
|
|
|
|
* Gets the number of values contained in @value.
|
|
|
|
*
|
|
|
|
* Returns: the number of values
|
|
|
|
*/
|
|
|
|
guint
|
|
|
|
gst_value_array_get_size (const GValue * value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_ARRAY (value), 0);
|
|
|
|
|
|
|
|
return ((GArray *) value->data[0].v_pointer)->len;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_array_get_value:
|
|
|
|
* @value: a #GValue of type #GST_TYPE_ARRAY
|
|
|
|
* @index: index of value to get from the array
|
|
|
|
*
|
|
|
|
* Gets the value that is a member of the array contained in @value and
|
|
|
|
* has the index @index.
|
|
|
|
*
|
|
|
|
* Returns: the value at the given index
|
|
|
|
*/
|
|
|
|
const GValue *
|
|
|
|
gst_value_array_get_value (const GValue * value, guint index)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_ARRAY (value), NULL);
|
|
|
|
g_return_val_if_fail (index < gst_value_array_get_size (value), NULL);
|
|
|
|
|
|
|
|
return (const GValue *) &g_array_index ((GArray *) value->data[0].v_pointer,
|
|
|
|
GValue, index);
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_transform_list_string (const GValue * src_value, GValue * dest_value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-05-20 17:03:02 +00:00
|
|
|
gst_value_transform_any_list_string (src_value, dest_value, "{ ", " }");
|
|
|
|
}
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-05-20 17:03:02 +00:00
|
|
|
static void
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
gst_value_transform_array_string (const GValue * src_value, GValue * dest_value)
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
|
|
|
gst_value_transform_any_list_string (src_value, dest_value, "< ", " >");
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2006-07-11 20:14:20 +00:00
|
|
|
/* Do an unordered compare of the contents of a list */
|
2003-12-23 20:58:05 +00:00
|
|
|
static int
|
2006-07-11 20:14:20 +00:00
|
|
|
gst_value_compare_list (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i, j;
|
2003-12-23 20:58:05 +00:00
|
|
|
GArray *array1 = value1->data[0].v_pointer;
|
|
|
|
GArray *array2 = value2->data[0].v_pointer;
|
|
|
|
GValue *v1;
|
|
|
|
GValue *v2;
|
2006-07-31 16:34:41 +00:00
|
|
|
gint len, to_remove;
|
|
|
|
guint8 *removed;
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2006-07-31 16:34:41 +00:00
|
|
|
/* get length and do initial length check. */
|
|
|
|
len = array1->len;
|
|
|
|
if (len != array2->len)
|
2004-03-13 15:27:01 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2006-07-31 16:34:41 +00:00
|
|
|
/* place to mark removed value indices of array2 */
|
|
|
|
removed = g_newa (guint8, len);
|
|
|
|
memset (removed, 0, len);
|
|
|
|
to_remove = len;
|
|
|
|
|
|
|
|
/* loop over array1, all items should be in array2. When we find an
|
|
|
|
* item in array2, remove it from array2 by marking it as removed */
|
|
|
|
for (i = 0; i < len; i++) {
|
2003-12-23 20:58:05 +00:00
|
|
|
v1 = &g_array_index (array1, GValue, i);
|
2006-08-20 14:30:20 +00:00
|
|
|
if ((compare = gst_value_get_compare_func (v1))) {
|
|
|
|
for (j = 0; j < len; j++) {
|
|
|
|
/* item is removed, we can skip it */
|
|
|
|
if (removed[j])
|
|
|
|
continue;
|
|
|
|
v2 = &g_array_index (array2, GValue, j);
|
|
|
|
if (gst_value_compare_with_func (v1, v2, compare) == GST_VALUE_EQUAL) {
|
|
|
|
/* mark item as removed now that we found it in array2 and
|
|
|
|
* decrement the number of remaining items in array2. */
|
|
|
|
removed[j] = 1;
|
|
|
|
to_remove--;
|
|
|
|
break;
|
|
|
|
}
|
2006-07-31 16:34:41 +00:00
|
|
|
}
|
2006-08-20 14:30:20 +00:00
|
|
|
/* item in array1 and not in array2, UNORDERED */
|
|
|
|
if (j == len)
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
} else
|
2003-12-23 20:58:05 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
2006-07-31 16:34:41 +00:00
|
|
|
/* if not all items were removed, array2 contained something not in array1 */
|
|
|
|
if (to_remove != 0)
|
|
|
|
return GST_VALUE_UNORDERED;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2006-07-31 16:34:41 +00:00
|
|
|
/* arrays are equal */
|
2003-12-23 20:58:05 +00:00
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
|
|
|
|
2006-07-11 20:14:20 +00:00
|
|
|
/* Perform an ordered comparison of the contents of an array */
|
|
|
|
static int
|
|
|
|
gst_value_compare_array (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
guint i;
|
|
|
|
GArray *array1 = value1->data[0].v_pointer;
|
|
|
|
GArray *array2 = value2->data[0].v_pointer;
|
|
|
|
GValue *v1;
|
|
|
|
GValue *v2;
|
|
|
|
|
|
|
|
if (array1->len != array2->len)
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
|
|
|
|
for (i = 0; i < array1->len; i++) {
|
|
|
|
v1 = &g_array_index (array1, GValue, i);
|
|
|
|
v2 = &g_array_index (array2, GValue, i);
|
|
|
|
if (gst_value_compare (v1, v2) != GST_VALUE_EQUAL)
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_list (const GValue * value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-05-20 17:03:02 +00:00
|
|
|
return gst_value_serialize_any_list (value, "{ ", " }");
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_list (GValue * dest, const gchar * s)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2007-01-02 09:31:45 +00:00
|
|
|
g_warning ("gst_value_deserialize_list: unimplemented");
|
2003-12-23 20:58:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
gst_value_serialize_array (const GValue * value)
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
|
|
|
return gst_value_serialize_any_list (value, "< ", " >");
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_array (GValue * dest, const gchar * s)
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
2007-01-02 09:31:45 +00:00
|
|
|
g_warning ("gst_value_deserialize_array: unimplemented");
|
2004-05-20 17:03:02 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/**********
|
|
|
|
* fourcc *
|
|
|
|
**********/
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_value_init_fourcc (GValue * value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = 0;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_copy_fourcc (const GValue * src_value, GValue * dest_value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
dest_value->data[0].v_int = src_value->data[0].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_collect_fourcc (GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = collect_values[0].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_lcopy_fourcc (const GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
|
|
|
guint32 *fourcc_p = collect_values[0].v_pointer;
|
|
|
|
|
|
|
|
if (!fourcc_p)
|
|
|
|
return g_strdup_printf ("value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
*fourcc_p = value->data[0].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_set_fourcc:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @value: a GValue initialized to #GST_TYPE_FOURCC
|
|
|
|
* @fourcc: the #guint32 fourcc to set
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Sets @value to @fourcc.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-03 09:10:07 +00:00
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_set_fourcc (GValue * value, guint32 fourcc)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_FOURCC (value));
|
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = fourcc;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_fourcc:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @value: a GValue initialized to #GST_TYPE_FOURCC
|
2004-03-26 03:46:16 +00:00
|
|
|
*
|
2005-09-11 12:01:12 +00:00
|
|
|
* Gets the #guint32 fourcc contained in @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2005-09-11 12:01:12 +00:00
|
|
|
* Returns: the #guint32 fourcc contained in @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-03 09:10:07 +00:00
|
|
|
guint32
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_fourcc (const GValue * value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FOURCC (value), 0);
|
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
return value->data[0].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_transform_fourcc_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
guint32 fourcc = src_value->data[0].v_int;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (g_ascii_isprint ((fourcc >> 0) & 0xff) &&
|
|
|
|
g_ascii_isprint ((fourcc >> 8) & 0xff) &&
|
|
|
|
g_ascii_isprint ((fourcc >> 16) & 0xff) &&
|
|
|
|
g_ascii_isprint ((fourcc >> 24) & 0xff)) {
|
|
|
|
dest_value->data[0].v_pointer =
|
2005-11-21 13:26:40 +00:00
|
|
|
g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
2003-12-23 20:58:05 +00:00
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
dest_value->data[0].v_pointer = g_strdup_printf ("0x%08x", fourcc);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_compare_fourcc (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
if (value2->data[0].v_int == value1->data[0].v_int)
|
|
|
|
return GST_VALUE_EQUAL;
|
2003-12-23 20:58:05 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_fourcc (const GValue * value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
guint32 fourcc = value->data[0].v_int;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (g_ascii_isalnum ((fourcc >> 0) & 0xff) &&
|
|
|
|
g_ascii_isalnum ((fourcc >> 8) & 0xff) &&
|
|
|
|
g_ascii_isalnum ((fourcc >> 16) & 0xff) &&
|
|
|
|
g_ascii_isalnum ((fourcc >> 24) & 0xff)) {
|
2005-11-21 13:26:40 +00:00
|
|
|
return g_strdup_printf ("%" GST_FOURCC_FORMAT, GST_FOURCC_ARGS (fourcc));
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
} else {
|
2004-03-13 15:27:01 +00:00
|
|
|
return g_strdup_printf ("0x%08x", fourcc);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
}
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_deserialize_fourcc (GValue * dest, const char *s)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
guint32 fourcc = 0;
|
|
|
|
char *end;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (strlen (s) == 4) {
|
|
|
|
fourcc = GST_MAKE_FOURCC (s[0], s[1], s[2], s[3]);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_isdigit (*s)) {
|
|
|
|
fourcc = strtoul (s, &end, 0);
|
|
|
|
if (*end == 0) {
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_value_set_fourcc (dest, fourcc);
|
|
|
|
|
|
|
|
return ret;
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/*************
|
|
|
|
* int range *
|
|
|
|
*************/
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_value_init_int_range (GValue * value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = 0;
|
|
|
|
value->data[1].v_int = 0;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_copy_int_range (const GValue * src_value, GValue * dest_value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
dest_value->data[0].v_int = src_value->data[0].v_int;
|
|
|
|
dest_value->data[1].v_int = src_value->data[1].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_collect_int_range (GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = collect_values[0].v_int;
|
|
|
|
value->data[1].v_int = collect_values[1].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_lcopy_int_range (const GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
guint32 *int_range_start = collect_values[0].v_pointer;
|
|
|
|
guint32 *int_range_end = collect_values[1].v_pointer;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
if (!int_range_start)
|
|
|
|
return g_strdup_printf ("start value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-12-22 01:39:35 +00:00
|
|
|
if (!int_range_end)
|
|
|
|
return g_strdup_printf ("end value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
*int_range_start = value->data[0].v_int;
|
|
|
|
*int_range_end = value->data[1].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_set_int_range:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_INT_RANGE
|
|
|
|
* @start: the start of the range
|
|
|
|
* @end: the end of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Sets @value to the range specified by @start and @end.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-03 09:10:07 +00:00
|
|
|
void
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_set_int_range (GValue * value, gint start, gint end)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-11-24 02:09:23 +00:00
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_INT_RANGE (value));
|
2004-06-20 17:05:40 +00:00
|
|
|
g_return_if_fail (start < end);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
value->data[0].v_int = start;
|
|
|
|
value->data[1].v_int = end;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_int_range_min:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_INT_RANGE
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Gets the minimum of the range specified by @value.
|
|
|
|
*
|
2004-07-15 16:20:50 +00:00
|
|
|
* Returns: the minimum of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_int_range_min (const GValue * value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-11-24 02:09:23 +00:00
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_INT_RANGE (value), 0);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
return value->data[0].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_int_range_max:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_INT_RANGE
|
|
|
|
*
|
|
|
|
* Gets the maximum of the range specified by @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Returns: the maxumum of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_int_range_max (const GValue * value)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-11-24 02:09:23 +00:00
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_INT_RANGE (value), 0);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
return value->data[1].v_int;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_transform_int_range_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
dest_value->data[0].v_pointer = g_strdup_printf ("[%d,%d]",
|
|
|
|
(int) src_value->data[0].v_int, (int) src_value->data[1].v_int);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_compare_int_range (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
if (value2->data[0].v_int == value1->data[0].v_int &&
|
2004-05-25 19:52:02 +00:00
|
|
|
value2->data[1].v_int == value1->data[1].v_int)
|
2004-03-13 15:27:01 +00:00
|
|
|
return GST_VALUE_EQUAL;
|
2003-12-23 20:58:05 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_int_range (const GValue * value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
return g_strdup_printf ("[ %d, %d ]", value->data[0].v_int,
|
|
|
|
value->data[1].v_int);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_int_range (GValue * dest, const gchar * s)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_warning ("unimplemented");
|
2003-12-23 20:58:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/****************
|
|
|
|
* double range *
|
|
|
|
****************/
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
static void
|
|
|
|
gst_value_init_double_range (GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
value->data[0].v_double = 0;
|
|
|
|
value->data[1].v_double = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_copy_double_range (const GValue * src_value, GValue * dest_value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
dest_value->data[0].v_double = src_value->data[0].v_double;
|
|
|
|
dest_value->data[1].v_double = src_value->data[1].v_double;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_collect_double_range (GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
value->data[0].v_double = collect_values[0].v_double;
|
|
|
|
value->data[1].v_double = collect_values[1].v_double;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_lcopy_double_range (const GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
gdouble *double_range_start = collect_values[0].v_pointer;
|
|
|
|
gdouble *double_range_end = collect_values[1].v_pointer;
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
if (!double_range_start)
|
|
|
|
return g_strdup_printf ("start value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-12-22 01:39:35 +00:00
|
|
|
if (!double_range_end)
|
|
|
|
return g_strdup_printf ("end value location for `%s' passed as NULL",
|
2004-03-15 19:27:17 +00:00
|
|
|
G_VALUE_TYPE_NAME (value));
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
*double_range_start = value->data[0].v_double;
|
|
|
|
*double_range_end = value->data[1].v_double;
|
2003-11-24 02:09:23 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_set_double_range:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_DOUBLE_RANGE
|
|
|
|
* @start: the start of the range
|
|
|
|
* @end: the end of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Sets @value to the range specified by @start and @end.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-24 02:09:23 +00:00
|
|
|
void
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_set_double_range (GValue * value, gdouble start, gdouble end)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_DOUBLE_RANGE (value));
|
|
|
|
|
|
|
|
value->data[0].v_double = start;
|
|
|
|
value->data[1].v_double = end;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_double_range_min:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_DOUBLE_RANGE
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Gets the minimum of the range specified by @value.
|
|
|
|
*
|
|
|
|
* Returns: the minumum of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gdouble
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_double_range_min (const GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_DOUBLE_RANGE (value), 0);
|
|
|
|
|
|
|
|
return value->data[0].v_double;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_double_range_max:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_DOUBLE_RANGE
|
|
|
|
*
|
|
|
|
* Gets the maximum of the range specified by @value.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Returns: the maxumum of the range
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gdouble
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_double_range_max (const GValue * value)
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_DOUBLE_RANGE (value), 0);
|
|
|
|
|
|
|
|
return value->data[1].v_double;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_transform_double_range_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
char s1[G_ASCII_DTOSTR_BUF_SIZE], s2[G_ASCII_DTOSTR_BUF_SIZE];
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
dest_value->data[0].v_pointer = g_strdup_printf ("[%s,%s]",
|
2003-12-23 20:58:05 +00:00
|
|
|
g_ascii_dtostr (s1, G_ASCII_DTOSTR_BUF_SIZE,
|
2004-03-15 19:27:17 +00:00
|
|
|
src_value->data[0].v_double),
|
2003-12-23 20:58:05 +00:00
|
|
|
g_ascii_dtostr (s2, G_ASCII_DTOSTR_BUF_SIZE,
|
2004-03-15 19:27:17 +00:00
|
|
|
src_value->data[1].v_double));
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_compare_double_range (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
if (value2->data[0].v_double == value1->data[0].v_double &&
|
|
|
|
value2->data[0].v_double == value1->data[0].v_double)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_double_range (const GValue * value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
char d1[G_ASCII_DTOSTR_BUF_SIZE];
|
|
|
|
char d2[G_ASCII_DTOSTR_BUF_SIZE];
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
g_ascii_dtostr (d1, G_ASCII_DTOSTR_BUF_SIZE, value->data[0].v_double);
|
|
|
|
g_ascii_dtostr (d2, G_ASCII_DTOSTR_BUF_SIZE, value->data[1].v_double);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
return g_strdup_printf ("[ %s, %s ]", d1, d2);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_double_range (GValue * dest, const gchar * s)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_warning ("unimplemented");
|
2003-12-23 20:58:05 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
/****************
|
|
|
|
* fraction range *
|
|
|
|
****************/
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_init_fraction_range (GValue * value)
|
|
|
|
{
|
|
|
|
GValue *vals;
|
|
|
|
|
|
|
|
value->data[0].v_pointer = vals = g_new0 (GValue, 2);
|
|
|
|
g_value_init (&vals[0], GST_TYPE_FRACTION);
|
|
|
|
g_value_init (&vals[1], GST_TYPE_FRACTION);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_free_fraction_range (GValue * value)
|
|
|
|
{
|
|
|
|
GValue *vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (vals != NULL) {
|
|
|
|
g_value_unset (&vals[0]);
|
|
|
|
g_value_unset (&vals[1]);
|
|
|
|
g_free (vals);
|
|
|
|
value->data[0].v_pointer = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_copy_fraction_range (const GValue * src_value, GValue * dest_value)
|
|
|
|
{
|
|
|
|
GValue *vals = (GValue *) dest_value->data[0].v_pointer;
|
|
|
|
GValue *src_vals = (GValue *) src_value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (vals == NULL) {
|
|
|
|
dest_value->data[0].v_pointer = vals = g_new0 (GValue, 2);
|
|
|
|
g_return_if_fail (vals != NULL);
|
|
|
|
g_value_init (&vals[0], GST_TYPE_FRACTION);
|
|
|
|
g_value_init (&vals[1], GST_TYPE_FRACTION);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (src_vals != NULL) {
|
|
|
|
g_value_copy (&src_vals[0], &vals[0]);
|
|
|
|
g_value_copy (&src_vals[1], &vals[1]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_value_collect_fraction_range (GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
|
|
|
{
|
|
|
|
GValue *vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (n_collect_values != 4)
|
|
|
|
return g_strdup_printf ("not enough value locations for `%s' passed",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
2005-11-22 14:29:10 +00:00
|
|
|
if (vals == NULL) {
|
|
|
|
value->data[0].v_pointer = vals = g_new0 (GValue, 2);
|
|
|
|
if (vals == NULL)
|
|
|
|
return g_strdup_printf ("Could not initialise`%s' during collect",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
g_value_init (&vals[0], GST_TYPE_FRACTION);
|
|
|
|
g_value_init (&vals[1], GST_TYPE_FRACTION);
|
|
|
|
}
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
gst_value_set_fraction (&vals[0], collect_values[0].v_int,
|
|
|
|
collect_values[1].v_int);
|
|
|
|
gst_value_set_fraction (&vals[1], collect_values[2].v_int,
|
|
|
|
collect_values[3].v_int);
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_value_lcopy_fraction_range (const GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
int *dest_values[4];
|
|
|
|
GValue *vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (n_collect_values != 4)
|
|
|
|
return g_strdup_printf ("not enough value locations for `%s' passed",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
|
|
|
|
for (i = 0; i < 4; i++) {
|
|
|
|
if (collect_values[i].v_pointer == NULL) {
|
|
|
|
return g_strdup_printf ("value location for `%s' passed as NULL",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
}
|
|
|
|
dest_values[i] = collect_values[i].v_pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (vals == NULL) {
|
|
|
|
return g_strdup_printf ("Uninitialised `%s' passed",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
}
|
|
|
|
|
|
|
|
dest_values[0][0] = gst_value_get_fraction_numerator (&vals[0]);
|
|
|
|
dest_values[1][0] = gst_value_get_fraction_denominator (&vals[0]);
|
|
|
|
dest_values[2][0] = gst_value_get_fraction_denominator (&vals[1]);
|
|
|
|
dest_values[3][0] = gst_value_get_fraction_denominator (&vals[1]);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_set_fraction_range:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_FRACTION_RANGE
|
|
|
|
* @start: the start of the range (a GST_TYPE_FRACTION GValue)
|
|
|
|
* @end: the end of the range (a GST_TYPE_FRACTION GValue)
|
|
|
|
*
|
|
|
|
* Sets @value to the range specified by @start and @end.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_set_fraction_range (GValue * value, const GValue * start,
|
|
|
|
const GValue * end)
|
|
|
|
{
|
|
|
|
GValue *vals;
|
|
|
|
|
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value));
|
|
|
|
|
|
|
|
vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
if (vals == NULL) {
|
|
|
|
value->data[0].v_pointer = vals = g_new0 (GValue, 2);
|
|
|
|
g_value_init (&vals[0], GST_TYPE_FRACTION);
|
|
|
|
g_value_init (&vals[1], GST_TYPE_FRACTION);
|
|
|
|
}
|
|
|
|
|
|
|
|
g_value_copy (start, &vals[0]);
|
|
|
|
g_value_copy (end, &vals[1]);
|
|
|
|
}
|
|
|
|
|
2005-11-23 16:10:38 +00:00
|
|
|
/**
|
|
|
|
* gst_value_set_fraction_range_full:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_FRACTION_RANGE
|
|
|
|
* @numerator_start: the numerator start of the range
|
|
|
|
* @denominator_start: the denominator start of the range
|
|
|
|
* @numerator_end: the numerator end of the range
|
|
|
|
* @denominator_end: the denominator end of the range
|
|
|
|
*
|
|
|
|
* Sets @value to the range specified by @numerator_start/@denominator_start
|
|
|
|
* and @numerator_end/@denominator_end.
|
|
|
|
*/
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
void
|
|
|
|
gst_value_set_fraction_range_full (GValue * value,
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint numerator_start, gint denominator_start,
|
|
|
|
gint numerator_end, gint denominator_end)
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
{
|
|
|
|
GValue start = { 0 };
|
|
|
|
GValue end = { 0 };
|
|
|
|
|
|
|
|
g_value_init (&start, GST_TYPE_FRACTION);
|
|
|
|
g_value_init (&end, GST_TYPE_FRACTION);
|
|
|
|
|
|
|
|
gst_value_set_fraction (&start, numerator_start, denominator_start);
|
|
|
|
gst_value_set_fraction (&end, numerator_end, denominator_end);
|
|
|
|
gst_value_set_fraction_range (value, &start, &end);
|
|
|
|
|
|
|
|
g_value_unset (&start);
|
|
|
|
g_value_unset (&end);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_get_fraction_range_min:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_FRACTION_RANGE
|
|
|
|
*
|
|
|
|
* Gets the minimum of the range specified by @value.
|
|
|
|
*
|
|
|
|
* Returns: the minumum of the range
|
|
|
|
*/
|
|
|
|
const GValue *
|
|
|
|
gst_value_get_fraction_range_min (const GValue * value)
|
|
|
|
{
|
|
|
|
GValue *vals;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), FALSE);
|
|
|
|
|
|
|
|
vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
if (vals != NULL) {
|
|
|
|
return &vals[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_get_fraction_range_max:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_FRACTION_RANGE
|
|
|
|
*
|
|
|
|
* Gets the maximum of the range specified by @value.
|
|
|
|
*
|
|
|
|
* Returns: the maximum of the range
|
|
|
|
*/
|
|
|
|
const GValue *
|
|
|
|
gst_value_get_fraction_range_max (const GValue * value)
|
|
|
|
{
|
|
|
|
GValue *vals;
|
|
|
|
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION_RANGE (value), FALSE);
|
|
|
|
|
|
|
|
vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
if (vals != NULL) {
|
|
|
|
return &vals[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static char *
|
|
|
|
gst_value_serialize_fraction_range (const GValue * value)
|
|
|
|
{
|
|
|
|
GValue *vals = (GValue *) value->data[0].v_pointer;
|
|
|
|
gchar *retval;
|
|
|
|
|
|
|
|
if (vals == NULL) {
|
|
|
|
retval = g_strdup ("[ 0/1, 0/1 ]");
|
|
|
|
} else {
|
|
|
|
gchar *start, *end;
|
|
|
|
|
|
|
|
start = gst_value_serialize_fraction (&vals[0]);
|
|
|
|
end = gst_value_serialize_fraction (&vals[1]);
|
|
|
|
|
|
|
|
retval = g_strdup_printf ("[ %s, %s ]", start, end);
|
|
|
|
g_free (start);
|
|
|
|
g_free (end);
|
|
|
|
}
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_fraction_range_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
|
|
|
dest_value->data[0].v_pointer =
|
|
|
|
gst_value_serialize_fraction_range (src_value);
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
gst_value_compare_fraction_range (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
GValue *vals1, *vals2;
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
if (value2->data[0].v_pointer == value1->data[0].v_pointer)
|
|
|
|
return GST_VALUE_EQUAL; /* Only possible if both are NULL */
|
|
|
|
|
|
|
|
if (value2->data[0].v_pointer == NULL || value1->data[0].v_pointer == NULL)
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
|
|
|
|
vals1 = (GValue *) value1->data[0].v_pointer;
|
|
|
|
vals2 = (GValue *) value2->data[0].v_pointer;
|
2006-08-20 14:30:20 +00:00
|
|
|
if ((compare = gst_value_get_compare_func (&vals1[0]))) {
|
|
|
|
if (gst_value_compare_with_func (&vals1[0], &vals2[0], compare) ==
|
|
|
|
GST_VALUE_EQUAL &&
|
|
|
|
gst_value_compare_with_func (&vals1[1], &vals2[1], compare) ==
|
|
|
|
GST_VALUE_EQUAL)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_fraction_range (GValue * dest, const gchar * s)
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
{
|
|
|
|
g_warning ("unimplemented");
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/***********
|
|
|
|
* GstCaps *
|
|
|
|
***********/
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_set_caps:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_CAPS
|
|
|
|
* @caps: the caps to set the value to
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Sets the contents of @value to coorespond to @caps. The actual
|
|
|
|
* #GstCaps structure is copied before it is used.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-29 06:31:10 +00:00
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_set_caps (GValue * value, const GstCaps * caps)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
2004-02-20 00:38:24 +00:00
|
|
|
g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS);
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2004-02-20 00:38:24 +00:00
|
|
|
g_value_set_boxed (value, caps);
|
2003-11-29 06:31:10 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_get_caps:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value: a GValue initialized to GST_TYPE_CAPS
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Gets the contents of @value.
|
|
|
|
*
|
|
|
|
* Returns: the contents of @value
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-12-22 01:39:35 +00:00
|
|
|
const GstCaps *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_get_caps (const GValue * value)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
2004-02-20 00:38:24 +00:00
|
|
|
g_return_val_if_fail (G_VALUE_TYPE (value) == GST_TYPE_CAPS, NULL);
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2004-02-20 00:38:24 +00:00
|
|
|
return (GstCaps *) g_value_get_boxed (value);
|
2003-11-29 06:31:10 +00:00
|
|
|
}
|
|
|
|
|
2005-04-24 21:16:45 +00:00
|
|
|
static char *
|
|
|
|
gst_value_serialize_caps (const GValue * value)
|
|
|
|
{
|
|
|
|
GstCaps *caps = g_value_get_boxed (value);
|
|
|
|
|
|
|
|
return gst_caps_to_string (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_caps (GValue * dest, const gchar * s)
|
2005-04-24 21:16:45 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
|
|
|
|
caps = gst_caps_from_string (s);
|
|
|
|
|
|
|
|
if (caps) {
|
|
|
|
g_value_set_boxed (dest, caps);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/*************
|
|
|
|
* GstBuffer *
|
|
|
|
*************/
|
2004-04-13 02:22:02 +00:00
|
|
|
|
2004-04-23 01:20:59 +00:00
|
|
|
static int
|
|
|
|
gst_value_compare_buffer (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
2005-06-20 15:18:17 +00:00
|
|
|
GstBuffer *buf1 = GST_BUFFER (gst_value_get_mini_object (value1));
|
|
|
|
GstBuffer *buf2 = GST_BUFFER (gst_value_get_mini_object (value2));
|
2004-04-23 01:20:59 +00:00
|
|
|
|
|
|
|
if (GST_BUFFER_SIZE (buf1) != GST_BUFFER_SIZE (buf2))
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
if (GST_BUFFER_SIZE (buf1) == 0)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
g_assert (GST_BUFFER_DATA (buf1));
|
|
|
|
g_assert (GST_BUFFER_DATA (buf2));
|
|
|
|
if (memcmp (GST_BUFFER_DATA (buf1), GST_BUFFER_DATA (buf2),
|
|
|
|
GST_BUFFER_SIZE (buf1)) == 0)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
2004-04-13 02:22:02 +00:00
|
|
|
static char *
|
|
|
|
gst_value_serialize_buffer (const GValue * value)
|
|
|
|
{
|
|
|
|
guint8 *data;
|
|
|
|
int i;
|
|
|
|
int size;
|
|
|
|
char *string;
|
2006-04-28 13:13:23 +00:00
|
|
|
GstBuffer *buffer;
|
|
|
|
|
|
|
|
buffer = gst_value_get_buffer (value);
|
|
|
|
if (buffer == NULL)
|
|
|
|
return NULL;
|
2004-04-13 02:22:02 +00:00
|
|
|
|
|
|
|
data = GST_BUFFER_DATA (buffer);
|
|
|
|
size = GST_BUFFER_SIZE (buffer);
|
|
|
|
|
2004-08-11 18:56:39 +00:00
|
|
|
string = g_malloc (size * 2 + 1);
|
2004-04-13 02:22:02 +00:00
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
sprintf (string + i * 2, "%02x", data[i]);
|
|
|
|
}
|
|
|
|
string[size * 2] = 0;
|
|
|
|
|
|
|
|
return string;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_buffer (GValue * dest, const gchar * s)
|
2004-04-13 02:22:02 +00:00
|
|
|
{
|
|
|
|
GstBuffer *buffer;
|
|
|
|
int len;
|
|
|
|
char ts[3];
|
|
|
|
guint8 *data;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
len = strlen (s);
|
|
|
|
if (len & 1)
|
2006-04-28 13:13:23 +00:00
|
|
|
goto wrong_length;
|
|
|
|
|
2004-04-13 02:22:02 +00:00
|
|
|
buffer = gst_buffer_new_and_alloc (len / 2);
|
|
|
|
data = GST_BUFFER_DATA (buffer);
|
|
|
|
for (i = 0; i < len / 2; i++) {
|
2006-04-28 13:13:23 +00:00
|
|
|
if (!isxdigit ((int) s[i * 2]) || !isxdigit ((int) s[i * 2 + 1]))
|
|
|
|
goto wrong_char;
|
|
|
|
|
2004-04-13 02:22:02 +00:00
|
|
|
ts[0] = s[i * 2 + 0];
|
|
|
|
ts[1] = s[i * 2 + 1];
|
|
|
|
ts[2] = 0;
|
|
|
|
|
2005-11-30 10:13:54 +00:00
|
|
|
data[i] = (guint8) strtoul (ts, NULL, 16);
|
2004-04-13 02:22:02 +00:00
|
|
|
}
|
|
|
|
|
2006-04-28 13:13:23 +00:00
|
|
|
gst_value_take_buffer (dest, buffer);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
/* ERRORS */
|
|
|
|
wrong_length:
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
wrong_char:
|
|
|
|
{
|
2004-04-13 02:22:02 +00:00
|
|
|
gst_buffer_unref (buffer);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/***********
|
|
|
|
* boolean *
|
|
|
|
***********/
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static int
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_compare_boolean (const GValue * value1, const GValue * value2)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
if ((value1->data[0].v_int != 0) == (value2->data[0].v_int != 0))
|
2003-12-23 20:58:05 +00:00
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static char *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_boolean (const GValue * value)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
if (value->data[0].v_int) {
|
|
|
|
return g_strdup ("true");
|
|
|
|
}
|
|
|
|
return g_strdup ("false");
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_boolean (GValue * dest, const gchar * s)
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
if (g_ascii_strcasecmp (s, "true") == 0 ||
|
|
|
|
g_ascii_strcasecmp (s, "yes") == 0 ||
|
2004-03-13 15:27:01 +00:00
|
|
|
g_ascii_strcasecmp (s, "t") == 0 || strcmp (s, "1") == 0) {
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
g_value_set_boolean (dest, TRUE);
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "false") == 0 ||
|
|
|
|
g_ascii_strcasecmp (s, "no") == 0 ||
|
2004-03-13 15:27:01 +00:00
|
|
|
g_ascii_strcasecmp (s, "f") == 0 || strcmp (s, "0") == 0) {
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
g_value_set_boolean (dest, FALSE);
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
return ret;
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2005-12-06 19:29:15 +00:00
|
|
|
#define CREATE_SERIALIZATION_START(_type,_macro) \
|
|
|
|
static gint \
|
|
|
|
gst_value_compare_ ## _type \
|
|
|
|
(const GValue * value1, const GValue * value2) \
|
|
|
|
{ \
|
|
|
|
g ## _type val1 = g_value_get_ ## _type (value1); \
|
|
|
|
g ## _type val2 = g_value_get_ ## _type (value2); \
|
|
|
|
if (val1 > val2) \
|
|
|
|
return GST_VALUE_GREATER_THAN; \
|
|
|
|
if (val1 < val2) \
|
|
|
|
return GST_VALUE_LESS_THAN; \
|
|
|
|
return GST_VALUE_EQUAL; \
|
|
|
|
} \
|
|
|
|
\
|
|
|
|
static char * \
|
|
|
|
gst_value_serialize_ ## _type (const GValue * value) \
|
|
|
|
{ \
|
|
|
|
GValue val = { 0, }; \
|
|
|
|
g_value_init (&val, G_TYPE_STRING); \
|
|
|
|
if (!g_value_transform (value, &val)) \
|
|
|
|
g_assert_not_reached (); \
|
|
|
|
/* NO_COPY_MADNESS!!! */ \
|
|
|
|
return (char *) g_value_get_string (&val); \
|
2004-05-19 14:20:46 +00:00
|
|
|
}
|
|
|
|
|
2005-10-10 09:48:21 +00:00
|
|
|
/* deserialize the given s into to as a gint64.
|
2005-06-22 19:22:34 +00:00
|
|
|
* check if the result is actually storeable in the given size number of
|
|
|
|
* bytes.
|
|
|
|
*/
|
2004-05-19 14:20:46 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_int_helper (gint64 * to, const gchar * s,
|
|
|
|
gint64 min, gint64 max, gint size)
|
2004-05-19 14:20:46 +00:00
|
|
|
{
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
char *end;
|
2005-10-10 09:48:21 +00:00
|
|
|
gint64 mask = -1;
|
2004-05-19 14:20:46 +00:00
|
|
|
|
2005-06-23 11:25:29 +00:00
|
|
|
errno = 0;
|
|
|
|
*to = g_ascii_strtoull (s, &end, 0);
|
|
|
|
/* a range error is a definitive no-no */
|
|
|
|
if (errno == ERANGE) {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-05-19 14:20:46 +00:00
|
|
|
if (*end == 0) {
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
|
|
|
if (g_ascii_strcasecmp (s, "little_endian") == 0) {
|
|
|
|
*to = G_LITTLE_ENDIAN;
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "big_endian") == 0) {
|
|
|
|
*to = G_BIG_ENDIAN;
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "byte_order") == 0) {
|
|
|
|
*to = G_BYTE_ORDER;
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "min") == 0) {
|
|
|
|
*to = min;
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "max") == 0) {
|
|
|
|
*to = max;
|
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret) {
|
2005-10-10 09:48:21 +00:00
|
|
|
/* by definition, a gint64 fits into a gint64; so ignore those */
|
2005-06-22 19:22:34 +00:00
|
|
|
if (size != sizeof (mask)) {
|
|
|
|
if (*to >= 0) {
|
|
|
|
/* for positive numbers, we create a mask of 1's outside of the range
|
|
|
|
* and 0's inside the range. An and will thus keep only 1 bits
|
|
|
|
* outside of the range */
|
|
|
|
mask <<= (size * 8);
|
|
|
|
if ((mask & *to) != 0) {
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* for negative numbers, we do a 2's complement version */
|
|
|
|
mask <<= ((size * 8) - 1);
|
|
|
|
if ((mask & *to) != mask) {
|
|
|
|
ret = FALSE;
|
|
|
|
}
|
|
|
|
}
|
2004-05-19 14:20:46 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
2005-12-06 19:29:15 +00:00
|
|
|
#define CREATE_SERIALIZATION(_type,_macro) \
|
|
|
|
CREATE_SERIALIZATION_START(_type,_macro) \
|
|
|
|
\
|
|
|
|
static gboolean \
|
|
|
|
gst_value_deserialize_ ## _type (GValue * dest, const gchar *s) \
|
|
|
|
{ \
|
|
|
|
gint64 x; \
|
|
|
|
\
|
|
|
|
if (gst_value_deserialize_int_helper (&x, s, G_MIN ## _macro, \
|
|
|
|
G_MAX ## _macro, sizeof (g ## _type))) { \
|
|
|
|
g_value_set_ ## _type (dest, /*(g ## _type)*/ x); \
|
|
|
|
return TRUE; \
|
|
|
|
} else { \
|
|
|
|
return FALSE; \
|
|
|
|
} \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define CREATE_USERIALIZATION(_type,_macro) \
|
|
|
|
CREATE_SERIALIZATION_START(_type,_macro) \
|
|
|
|
\
|
|
|
|
static gboolean \
|
|
|
|
gst_value_deserialize_ ## _type (GValue * dest, const gchar *s) \
|
|
|
|
{ \
|
|
|
|
gint64 x; \
|
|
|
|
char *end; \
|
|
|
|
gboolean ret = FALSE; \
|
|
|
|
\
|
|
|
|
errno = 0; \
|
|
|
|
x = g_ascii_strtoull (s, &end, 0); \
|
|
|
|
/* a range error is a definitive no-no */ \
|
|
|
|
if (errno == ERANGE) { \
|
|
|
|
return FALSE; \
|
|
|
|
} \
|
|
|
|
/* the cast ensures the range check later on makes sense */ \
|
|
|
|
x = (g ## _type) x; \
|
|
|
|
if (*end == 0) { \
|
|
|
|
ret = TRUE; \
|
|
|
|
} else { \
|
|
|
|
if (g_ascii_strcasecmp (s, "little_endian") == 0) { \
|
|
|
|
x = G_LITTLE_ENDIAN; \
|
|
|
|
ret = TRUE; \
|
|
|
|
} else if (g_ascii_strcasecmp (s, "big_endian") == 0) { \
|
|
|
|
x = G_BIG_ENDIAN; \
|
|
|
|
ret = TRUE; \
|
|
|
|
} else if (g_ascii_strcasecmp (s, "byte_order") == 0) { \
|
|
|
|
x = G_BYTE_ORDER; \
|
|
|
|
ret = TRUE; \
|
|
|
|
} else if (g_ascii_strcasecmp (s, "min") == 0) { \
|
|
|
|
x = 0; \
|
|
|
|
ret = TRUE; \
|
|
|
|
} else if (g_ascii_strcasecmp (s, "max") == 0) { \
|
|
|
|
x = G_MAX ## _macro; \
|
|
|
|
ret = TRUE; \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
if (ret) { \
|
|
|
|
if (x > G_MAX ## _macro) { \
|
|
|
|
ret = FALSE; \
|
|
|
|
} else { \
|
|
|
|
g_value_set_ ## _type (dest, x); \
|
|
|
|
} \
|
|
|
|
} \
|
|
|
|
return ret; \
|
|
|
|
}
|
|
|
|
|
|
|
|
#define REGISTER_SERIALIZATION(_gtype, _type) \
|
|
|
|
G_STMT_START { \
|
|
|
|
static const GstValueTable gst_value = { \
|
|
|
|
_gtype, \
|
|
|
|
gst_value_compare_ ## _type, \
|
|
|
|
gst_value_serialize_ ## _type, \
|
|
|
|
gst_value_deserialize_ ## _type, \
|
|
|
|
}; \
|
|
|
|
\
|
|
|
|
gst_value_register (&gst_value); \
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
} G_STMT_END
|
|
|
|
|
2005-10-10 09:48:21 +00:00
|
|
|
CREATE_SERIALIZATION (int, INT);
|
|
|
|
CREATE_SERIALIZATION (int64, INT64);
|
|
|
|
CREATE_SERIALIZATION (long, LONG);
|
|
|
|
|
|
|
|
CREATE_USERIALIZATION (uint, UINT);
|
|
|
|
CREATE_USERIALIZATION (uint64, UINT64);
|
|
|
|
CREATE_USERIALIZATION (ulong, ULONG);
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/**********
|
|
|
|
* double *
|
|
|
|
**********/
|
2005-10-10 09:48:21 +00:00
|
|
|
static int
|
|
|
|
gst_value_compare_double (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (value1->data[0].v_double > value2->data[0].v_double)
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
|
|
|
if (value1->data[0].v_double < value2->data[0].v_double)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
if (value1->data[0].v_double == value2->data[0].v_double)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
return GST_VALUE_UNORDERED;
|
2003-11-29 06:31:10 +00:00
|
|
|
}
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
static char *
|
|
|
|
gst_value_serialize_double (const GValue * value)
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
{
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
char d[G_ASCII_DTOSTR_BUF_SIZE];
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_ascii_dtostr (d, G_ASCII_DTOSTR_BUF_SIZE, value->data[0].v_double);
|
|
|
|
return g_strdup (d);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_double (GValue * dest, const gchar * s)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
double x;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
gboolean ret = FALSE;
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
char *end;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
x = g_ascii_strtod (s, &end);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
if (*end == 0) {
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (g_ascii_strcasecmp (s, "min") == 0) {
|
|
|
|
x = -G_MAXDOUBLE;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "max") == 0) {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
x = G_MAXDOUBLE;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (ret) {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_value_set_double (dest, x);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
|
|
|
return ret;
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/*********
|
|
|
|
* float *
|
|
|
|
*********/
|
2003-11-04 19:00:54 +00:00
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
gst_value_compare_float (const GValue * value1, const GValue * value2)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (value1->data[0].v_float > value2->data[0].v_float)
|
2003-11-24 02:09:23 +00:00
|
|
|
return GST_VALUE_GREATER_THAN;
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (value1->data[0].v_float < value2->data[0].v_float)
|
2003-11-24 02:09:23 +00:00
|
|
|
return GST_VALUE_LESS_THAN;
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (value1->data[0].v_float == value2->data[0].v_float)
|
2003-11-24 02:09:23 +00:00
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
return GST_VALUE_UNORDERED;
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
gst_value_serialize_float (const GValue * value)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gchar d[G_ASCII_DTOSTR_BUF_SIZE];
|
2004-03-13 15:27:01 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_ascii_dtostr (d, G_ASCII_DTOSTR_BUF_SIZE, value->data[0].v_float);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
return g_strdup (d);
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_float (GValue * dest, const gchar * s)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
double x;
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
char *end;
|
|
|
|
|
|
|
|
x = g_ascii_strtod (s, &end);
|
|
|
|
if (*end == 0) {
|
|
|
|
ret = TRUE;
|
|
|
|
} else {
|
|
|
|
if (g_ascii_strcasecmp (s, "min") == 0) {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
x = -G_MAXFLOAT;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
ret = TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "max") == 0) {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
x = G_MAXFLOAT;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
ret = TRUE;
|
|
|
|
}
|
|
|
|
}
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (x > G_MAXFLOAT || x < -G_MAXFLOAT)
|
|
|
|
ret = FALSE;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
if (ret) {
|
2005-11-30 10:13:54 +00:00
|
|
|
g_value_set_float (dest, (float) x);
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
|
|
|
return ret;
|
2003-11-29 06:31:10 +00:00
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/**********
|
|
|
|
* string *
|
|
|
|
**********/
|
2003-11-29 06:31:10 +00:00
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_compare_string (const GValue * value1, const GValue * value2)
|
2003-11-29 06:31:10 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
int x = strcmp (value1->data[0].v_pointer, value2->data[0].v_pointer);
|
|
|
|
|
|
|
|
if (x < 0)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
if (x > 0)
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
2003-11-29 06:31:10 +00:00
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
|
|
|
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
#define GST_ASCII_IS_STRING(c) (g_ascii_isalnum((c)) || ((c) == '_') || \
|
|
|
|
((c) == '-') || ((c) == '+') || ((c) == '/') || ((c) == ':') || \
|
|
|
|
((c) == '.'))
|
|
|
|
|
|
|
|
static gchar *
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_string_wrap (const gchar * s)
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
{
|
|
|
|
const gchar *t;
|
|
|
|
int len;
|
|
|
|
gchar *d, *e;
|
|
|
|
gboolean wrap = FALSE;
|
|
|
|
|
|
|
|
len = 0;
|
|
|
|
t = s;
|
2005-01-28 09:37:41 +00:00
|
|
|
if (!s)
|
2005-11-19 17:08:23 +00:00
|
|
|
return NULL;
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
while (*t) {
|
2004-03-13 15:27:01 +00:00
|
|
|
if (GST_ASCII_IS_STRING (*t)) {
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
len++;
|
2004-03-13 15:27:01 +00:00
|
|
|
} else if (*t < 0x20 || *t >= 0x7f) {
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
wrap = TRUE;
|
|
|
|
len += 4;
|
|
|
|
} else {
|
|
|
|
wrap = TRUE;
|
|
|
|
len += 2;
|
|
|
|
}
|
|
|
|
t++;
|
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (!wrap)
|
2004-08-10 19:23:53 +00:00
|
|
|
return g_strdup (s);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
e = d = g_malloc (len + 3);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
|
|
|
|
*e++ = '\"';
|
|
|
|
t = s;
|
|
|
|
while (*t) {
|
2004-03-13 15:27:01 +00:00
|
|
|
if (GST_ASCII_IS_STRING (*t)) {
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*e++ = *t++;
|
2004-03-13 15:27:01 +00:00
|
|
|
} else if (*t < 0x20 || *t >= 0x7f) {
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*e++ = '\\';
|
2004-11-28 18:02:48 +00:00
|
|
|
*e++ = '0' + ((*(guchar *) t) >> 6);
|
2004-03-13 15:27:01 +00:00
|
|
|
*e++ = '0' + (((*t) >> 3) & 0x7);
|
|
|
|
*e++ = '0' + ((*t++) & 0x7);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
} else {
|
|
|
|
*e++ = '\\';
|
|
|
|
*e++ = *t++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
*e++ = '\"';
|
|
|
|
*e = 0;
|
|
|
|
|
|
|
|
return d;
|
|
|
|
}
|
|
|
|
|
2005-10-15 15:30:24 +00:00
|
|
|
/*
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
* This function takes a string delimited with double quotes (")
|
|
|
|
* and unescapes any \xxx octal numbers.
|
|
|
|
*
|
|
|
|
* If sequences of \y are found where y is not in the range of
|
|
|
|
* 0->3, y is copied unescaped.
|
|
|
|
*
|
|
|
|
* If \xyy is found where x is an octal number but y is not, an
|
|
|
|
* error is encountered and NULL is returned.
|
|
|
|
*
|
|
|
|
* the input string must be \0 terminated.
|
2005-07-11 18:41:49 +00:00
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-11-28 18:02:48 +00:00
|
|
|
gst_string_unwrap (const gchar * s)
|
|
|
|
{
|
2005-07-11 18:41:49 +00:00
|
|
|
gchar *ret;
|
|
|
|
gchar *read, *write;
|
2004-11-28 18:02:48 +00:00
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* NULL string returns NULL */
|
2005-07-11 18:41:49 +00:00
|
|
|
if (s == NULL)
|
2004-11-28 18:02:48 +00:00
|
|
|
return NULL;
|
2005-07-11 18:41:49 +00:00
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* strings not starting with " are invalid */
|
|
|
|
if (*s != '"')
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
/* make copy of original string to hold the result. This
|
|
|
|
* string will always be smaller than the original */
|
2005-07-11 18:41:49 +00:00
|
|
|
ret = g_strdup (s);
|
|
|
|
read = ret;
|
|
|
|
write = ret;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* need to move to the next position as we parsed the " */
|
|
|
|
read++;
|
2005-07-11 18:41:49 +00:00
|
|
|
|
2004-11-28 18:02:48 +00:00
|
|
|
while (*read) {
|
|
|
|
if (GST_ASCII_IS_STRING (*read)) {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* normal chars are just copied */
|
2004-11-28 18:02:48 +00:00
|
|
|
*write++ = *read++;
|
|
|
|
} else if (*read == '"') {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* quote marks end of string */
|
2004-11-28 18:02:48 +00:00
|
|
|
break;
|
|
|
|
} else if (*read == '\\') {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* got an escape char, move to next position to read a tripplet
|
|
|
|
* of octal numbers */
|
2004-11-28 18:02:48 +00:00
|
|
|
read++;
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* is the next char a possible first octal number? */
|
|
|
|
if (*read >= '0' && *read <= '3') {
|
|
|
|
/* parse other 2 numbers, if one of them is not in the range of
|
|
|
|
* an octal number, we error. We also catch the case where a zero
|
|
|
|
* byte is found here. */
|
2005-07-11 18:41:49 +00:00
|
|
|
if (read[1] < '0' || read[1] > '7' || read[2] < '0' || read[2] > '7')
|
|
|
|
goto beach;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* now convert the octal number to a byte again. */
|
2004-11-28 18:02:48 +00:00
|
|
|
*write++ = ((read[0] - '0') << 6) +
|
|
|
|
((read[1] - '0') << 3) + (read[2] - '0');
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
|
2004-11-28 18:02:48 +00:00
|
|
|
read += 3;
|
|
|
|
} else {
|
2005-07-11 18:41:49 +00:00
|
|
|
/* if we run into a \0 here, we definately won't get a quote later */
|
|
|
|
if (*read == 0)
|
|
|
|
goto beach;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* else copy \X sequence */
|
2004-11-28 18:02:48 +00:00
|
|
|
*write++ = *read++;
|
|
|
|
}
|
|
|
|
} else {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* weird character, error */
|
2005-07-11 18:41:49 +00:00
|
|
|
goto beach;
|
2004-11-28 18:02:48 +00:00
|
|
|
}
|
|
|
|
}
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* if the string is not ending in " and zero terminated, we error */
|
2005-07-11 18:41:49 +00:00
|
|
|
if (*read != '"' || read[1] != '\0')
|
|
|
|
goto beach;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* null terminate result string and return */
|
2004-11-28 18:02:48 +00:00
|
|
|
*write++ = '\0';
|
|
|
|
return ret;
|
2005-07-11 18:41:49 +00:00
|
|
|
|
|
|
|
beach:
|
|
|
|
g_free (ret);
|
|
|
|
return NULL;
|
2004-11-28 18:02:48 +00:00
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize_string (const GValue * value)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
return gst_string_wrap (value->data[0].v_pointer);
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_string (GValue * dest, const gchar * s)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
2004-11-28 18:02:48 +00:00
|
|
|
if (*s != '"') {
|
2004-12-17 02:52:24 +00:00
|
|
|
if (!g_utf8_validate (s, -1, NULL))
|
2004-12-16 20:56:52 +00:00
|
|
|
return FALSE;
|
2004-11-28 18:02:48 +00:00
|
|
|
g_value_set_string (dest, s);
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
|
|
|
gchar *str = gst_string_unwrap (s);
|
|
|
|
|
|
|
|
if (!str)
|
|
|
|
return FALSE;
|
2005-03-07 18:27:42 +00:00
|
|
|
g_value_take_string (dest, str);
|
2004-11-28 18:02:48 +00:00
|
|
|
}
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/********
|
|
|
|
* enum *
|
|
|
|
********/
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
gst_value_compare_enum (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
GEnumValue *en1, *en2;
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
GEnumClass *klass1 = (GEnumClass *) g_type_class_ref (G_VALUE_TYPE (value1));
|
|
|
|
GEnumClass *klass2 = (GEnumClass *) g_type_class_ref (G_VALUE_TYPE (value2));
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (klass1, GST_VALUE_UNORDERED);
|
|
|
|
g_return_val_if_fail (klass2, GST_VALUE_UNORDERED);
|
|
|
|
en1 = g_enum_get_value (klass1, g_value_get_enum (value1));
|
|
|
|
en2 = g_enum_get_value (klass2, g_value_get_enum (value2));
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
g_type_class_unref (klass1);
|
|
|
|
g_type_class_unref (klass2);
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_return_val_if_fail (en1, GST_VALUE_UNORDERED);
|
|
|
|
g_return_val_if_fail (en2, GST_VALUE_UNORDERED);
|
|
|
|
if (en1->value < en2->value)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
if (en1->value > en2->value)
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
|
|
|
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
gst_value_serialize_enum (const GValue * value)
|
|
|
|
{
|
|
|
|
GEnumValue *en;
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
GEnumClass *klass = (GEnumClass *) g_type_class_ref (G_VALUE_TYPE (value));
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (klass, NULL);
|
|
|
|
en = g_enum_get_value (klass, g_value_get_enum (value));
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
g_type_class_unref (klass);
|
2006-09-17 19:26:16 +00:00
|
|
|
|
|
|
|
/* might be one of the custom formats registered later */
|
|
|
|
if (G_UNLIKELY (en == NULL && G_VALUE_TYPE (value) == GST_TYPE_FORMAT)) {
|
|
|
|
const GstFormatDefinition *format_def;
|
|
|
|
|
|
|
|
format_def = gst_format_get_details (g_value_get_enum (value));
|
|
|
|
g_return_val_if_fail (format_def != NULL, NULL);
|
|
|
|
return g_strdup (format_def->description);
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_return_val_if_fail (en, NULL);
|
|
|
|
return g_strdup (en->value_name);
|
|
|
|
}
|
|
|
|
|
2006-09-17 19:26:16 +00:00
|
|
|
static gint
|
|
|
|
gst_value_deserialize_enum_iter_cmp (const GstFormatDefinition * format_def,
|
|
|
|
const gchar * s)
|
|
|
|
{
|
|
|
|
if (g_ascii_strcasecmp (s, format_def->nick) == 0)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
return g_ascii_strcasecmp (s, format_def->description);
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_enum (GValue * dest, const gchar * s)
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
{
|
|
|
|
GEnumValue *en;
|
|
|
|
gchar *endptr = NULL;
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
GEnumClass *klass = (GEnumClass *) g_type_class_ref (G_VALUE_TYPE (dest));
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (klass, FALSE);
|
|
|
|
if (!(en = g_enum_get_value_by_name (klass, s))) {
|
|
|
|
if (!(en = g_enum_get_value_by_nick (klass, s))) {
|
|
|
|
gint i = strtol (s, &endptr, 0);
|
|
|
|
|
|
|
|
if (endptr && *endptr == '\0') {
|
|
|
|
en = g_enum_get_value (klass, i);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
g_type_class_unref (klass);
|
2006-09-17 19:26:16 +00:00
|
|
|
|
|
|
|
/* might be one of the custom formats registered later */
|
|
|
|
if (G_UNLIKELY (en == NULL && G_VALUE_TYPE (dest) == GST_TYPE_FORMAT)) {
|
|
|
|
const GstFormatDefinition *format_def;
|
|
|
|
GstIterator *iter;
|
|
|
|
|
|
|
|
iter = gst_format_iterate_definitions ();
|
|
|
|
|
|
|
|
format_def = gst_iterator_find_custom (iter,
|
|
|
|
(GCompareFunc) gst_value_deserialize_enum_iter_cmp, (gpointer) s);
|
|
|
|
|
|
|
|
g_return_val_if_fail (format_def != NULL, FALSE);
|
|
|
|
g_value_set_enum (dest, (gint) format_def->value);
|
|
|
|
gst_iterator_free (iter);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_return_val_if_fail (en, FALSE);
|
|
|
|
g_value_set_enum (dest, en->value);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2005-05-10 14:50:55 +00:00
|
|
|
/********
|
|
|
|
* flags *
|
|
|
|
********/
|
|
|
|
|
|
|
|
/* we just compare the value here */
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2005-05-10 14:50:55 +00:00
|
|
|
gst_value_compare_flags (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
guint fl1, fl2;
|
|
|
|
GFlagsClass *klass1 =
|
|
|
|
(GFlagsClass *) g_type_class_ref (G_VALUE_TYPE (value1));
|
|
|
|
GFlagsClass *klass2 =
|
|
|
|
(GFlagsClass *) g_type_class_ref (G_VALUE_TYPE (value2));
|
|
|
|
|
|
|
|
g_return_val_if_fail (klass1, GST_VALUE_UNORDERED);
|
|
|
|
g_return_val_if_fail (klass2, GST_VALUE_UNORDERED);
|
|
|
|
fl1 = g_value_get_flags (value1);
|
|
|
|
fl2 = g_value_get_flags (value2);
|
|
|
|
g_type_class_unref (klass1);
|
|
|
|
g_type_class_unref (klass2);
|
|
|
|
if (fl1 < fl2)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
if (fl1 > fl2)
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
|
|
|
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* the different flags are serialized separated with a + */
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2005-05-10 14:50:55 +00:00
|
|
|
gst_value_serialize_flags (const GValue * value)
|
|
|
|
{
|
|
|
|
guint flags;
|
|
|
|
GFlagsValue *fl;
|
|
|
|
GFlagsClass *klass = (GFlagsClass *) g_type_class_ref (G_VALUE_TYPE (value));
|
|
|
|
gchar *result, *tmp;
|
|
|
|
gboolean first = TRUE;
|
|
|
|
|
|
|
|
g_return_val_if_fail (klass, NULL);
|
|
|
|
|
|
|
|
flags = g_value_get_flags (value);
|
2006-05-10 14:05:46 +00:00
|
|
|
|
|
|
|
/* if no flags are set, try to serialize to the _NONE string */
|
|
|
|
if (!flags) {
|
2006-06-13 08:20:24 +00:00
|
|
|
fl = g_flags_get_first_value (klass, flags);
|
2006-05-10 14:05:46 +00:00
|
|
|
return g_strdup (fl->value_name);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* some flags are set, so serialize one by one */
|
2006-05-10 15:38:53 +00:00
|
|
|
result = g_strdup ("");
|
2005-05-10 14:50:55 +00:00
|
|
|
while (flags) {
|
2006-06-13 08:20:24 +00:00
|
|
|
fl = g_flags_get_first_value (klass, flags);
|
2005-05-10 14:50:55 +00:00
|
|
|
if (fl != NULL) {
|
|
|
|
tmp = g_strconcat (result, (first ? "" : "+"), fl->value_name, NULL);
|
|
|
|
g_free (result);
|
|
|
|
result = tmp;
|
|
|
|
first = FALSE;
|
2006-04-28 13:51:00 +00:00
|
|
|
|
|
|
|
/* clear flag */
|
|
|
|
flags &= ~fl->value;
|
2005-05-10 14:50:55 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
g_type_class_unref (klass);
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_flags (GValue * dest, const gchar * s)
|
2005-05-10 14:50:55 +00:00
|
|
|
{
|
|
|
|
GFlagsValue *fl;
|
|
|
|
gchar *endptr = NULL;
|
|
|
|
GFlagsClass *klass = (GFlagsClass *) g_type_class_ref (G_VALUE_TYPE (dest));
|
|
|
|
gchar **split;
|
|
|
|
guint flags;
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
g_return_val_if_fail (klass, FALSE);
|
|
|
|
|
|
|
|
/* split into parts delimited with + */
|
|
|
|
split = g_strsplit (s, "+", 0);
|
|
|
|
|
|
|
|
flags = 0;
|
|
|
|
i = 0;
|
|
|
|
/* loop over each part */
|
|
|
|
while (split[i]) {
|
|
|
|
if (!(fl = g_flags_get_value_by_name (klass, split[i]))) {
|
|
|
|
if (!(fl = g_flags_get_value_by_nick (klass, split[i]))) {
|
|
|
|
gint val = strtol (split[i], &endptr, 0);
|
|
|
|
|
|
|
|
/* just or numeric value */
|
|
|
|
if (endptr && *endptr == '\0') {
|
|
|
|
flags |= val;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (fl) {
|
|
|
|
flags |= fl->value;
|
|
|
|
}
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
g_strfreev (split);
|
|
|
|
g_type_class_unref (klass);
|
|
|
|
g_value_set_flags (dest, flags);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/*********
|
|
|
|
* union *
|
|
|
|
*********/
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2004-03-31 21:49:19 +00:00
|
|
|
static gboolean
|
|
|
|
gst_value_union_int_int_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
|
|
|
{
|
|
|
|
if (src2->data[0].v_int <= src1->data[0].v_int &&
|
|
|
|
src2->data[1].v_int >= src1->data[0].v_int) {
|
|
|
|
gst_value_init_and_copy (dest, src2);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_union_int_range_int_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint min;
|
|
|
|
gint max;
|
2004-03-31 21:49:19 +00:00
|
|
|
|
|
|
|
min = MAX (src1->data[0].v_int, src2->data[0].v_int);
|
|
|
|
max = MIN (src1->data[1].v_int, src2->data[1].v_int);
|
|
|
|
|
|
|
|
if (min <= max) {
|
|
|
|
g_value_init (dest, GST_TYPE_INT_RANGE);
|
|
|
|
gst_value_set_int_range (dest,
|
|
|
|
MIN (src1->data[0].v_int, src2->data[0].v_int),
|
|
|
|
MAX (src1->data[1].v_int, src2->data[1].v_int));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/****************
|
|
|
|
* intersection *
|
|
|
|
****************/
|
2003-11-04 19:00:54 +00:00
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect_int_int_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
2003-12-22 01:39:35 +00:00
|
|
|
if (src2->data[0].v_int <= src1->data[0].v_int &&
|
2004-03-13 15:27:01 +00:00
|
|
|
src2->data[1].v_int >= src1->data[0].v_int) {
|
2003-12-22 07:00:25 +00:00
|
|
|
gst_value_init_and_copy (dest, src1);
|
2003-11-04 19:00:54 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect_int_range_int_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint min;
|
|
|
|
gint max;
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
min = MAX (src1->data[0].v_int, src2->data[0].v_int);
|
|
|
|
max = MIN (src1->data[1].v_int, src2->data[1].v_int);
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (min < max) {
|
|
|
|
g_value_init (dest, GST_TYPE_INT_RANGE);
|
|
|
|
gst_value_set_int_range (dest, min, max);
|
2003-11-04 19:00:54 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if (min == max) {
|
|
|
|
g_value_init (dest, G_TYPE_INT);
|
|
|
|
g_value_set_int (dest, min);
|
2003-11-04 19:00:54 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect_double_double_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
2003-12-22 01:39:35 +00:00
|
|
|
{
|
|
|
|
if (src2->data[0].v_double <= src1->data[0].v_double &&
|
2004-03-13 15:27:01 +00:00
|
|
|
src2->data[1].v_double >= src1->data[0].v_double) {
|
2003-12-22 07:00:25 +00:00
|
|
|
gst_value_init_and_copy (dest, src1);
|
2003-12-22 01:39:35 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect_double_range_double_range (GValue * dest,
|
|
|
|
const GValue * src1, const GValue * src2)
|
2003-12-22 01:39:35 +00:00
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gdouble min;
|
|
|
|
gdouble max;
|
2003-12-22 01:39:35 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
min = MAX (src1->data[0].v_double, src2->data[0].v_double);
|
|
|
|
max = MIN (src1->data[1].v_double, src2->data[1].v_double);
|
2003-12-22 01:39:35 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (min < max) {
|
|
|
|
g_value_init (dest, GST_TYPE_DOUBLE_RANGE);
|
|
|
|
gst_value_set_double_range (dest, min, max);
|
2003-12-22 01:39:35 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if (min == max) {
|
|
|
|
g_value_init (dest, G_TYPE_DOUBLE);
|
2005-11-30 10:13:54 +00:00
|
|
|
g_value_set_int (dest, (int) min);
|
2003-12-22 01:39:35 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect_list (GValue * dest, const GValue * value1,
|
|
|
|
const GValue * value2)
|
2003-12-22 01:39:35 +00:00
|
|
|
{
|
|
|
|
guint i, size;
|
|
|
|
GValue intersection = { 0, };
|
|
|
|
gboolean ret = FALSE;
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
size = gst_value_list_get_size (value1);
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
const GValue *cur = gst_value_list_get_value (value1, i);
|
|
|
|
|
|
|
|
if (gst_value_intersect (&intersection, cur, value2)) {
|
|
|
|
/* append value */
|
|
|
|
if (!ret) {
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_value_init_and_copy (dest, &intersection);
|
|
|
|
ret = TRUE;
|
2003-12-22 01:39:35 +00:00
|
|
|
} else if (GST_VALUE_HOLDS_LIST (dest)) {
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_value_list_append_value (dest, &intersection);
|
2003-12-22 01:39:35 +00:00
|
|
|
} else {
|
2004-03-15 19:27:17 +00:00
|
|
|
GValue temp = { 0, };
|
2003-12-22 01:39:35 +00:00
|
|
|
|
2004-03-15 19:27:17 +00:00
|
|
|
gst_value_init_and_copy (&temp, dest);
|
|
|
|
g_value_unset (dest);
|
|
|
|
gst_value_list_concat (dest, &temp, &intersection);
|
2005-06-30 10:10:00 +00:00
|
|
|
g_value_unset (&temp);
|
2003-12-22 01:39:35 +00:00
|
|
|
}
|
|
|
|
g_value_unset (&intersection);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2004-07-20 19:35:15 +00:00
|
|
|
static gboolean
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
gst_value_intersect_array (GValue * dest, const GValue * src1,
|
2004-07-20 19:35:15 +00:00
|
|
|
const GValue * src2)
|
|
|
|
{
|
2005-10-15 00:20:45 +00:00
|
|
|
guint size;
|
|
|
|
guint n;
|
2004-07-20 19:35:15 +00:00
|
|
|
GValue val = { 0 };
|
|
|
|
|
|
|
|
/* only works on similar-sized arrays */
|
2005-11-21 14:52:56 +00:00
|
|
|
size = gst_value_array_get_size (src1);
|
|
|
|
if (size != gst_value_array_get_size (src2))
|
2004-07-20 19:35:15 +00:00
|
|
|
return FALSE;
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
g_value_init (dest, GST_TYPE_ARRAY);
|
2004-07-20 19:35:15 +00:00
|
|
|
|
|
|
|
for (n = 0; n < size; n++) {
|
2005-11-21 14:52:56 +00:00
|
|
|
if (!gst_value_intersect (&val, gst_value_array_get_value (src1, n),
|
|
|
|
gst_value_array_get_value (src2, n))) {
|
2004-07-20 19:35:15 +00:00
|
|
|
g_value_unset (dest);
|
|
|
|
return FALSE;
|
|
|
|
}
|
2005-11-21 14:52:56 +00:00
|
|
|
gst_value_array_append_value (dest, &val);
|
2004-07-20 19:35:15 +00:00
|
|
|
g_value_unset (&val);
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
static gboolean
|
|
|
|
gst_value_intersect_fraction_fraction_range (GValue * dest, const GValue * src1,
|
|
|
|
const GValue * src2)
|
|
|
|
{
|
|
|
|
int res1, res2;
|
|
|
|
GValue *vals;
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
vals = src2->data[0].v_pointer;
|
|
|
|
|
|
|
|
if (vals == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2006-08-20 14:30:20 +00:00
|
|
|
if ((compare = gst_value_get_compare_func (src1))) {
|
|
|
|
res1 = gst_value_compare_with_func (&vals[0], src1, compare);
|
|
|
|
res2 = gst_value_compare_with_func (&vals[1], src1, compare);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
2006-08-20 14:30:20 +00:00
|
|
|
if ((res1 == GST_VALUE_EQUAL || res1 == GST_VALUE_LESS_THAN) &&
|
|
|
|
(res2 == GST_VALUE_EQUAL || res2 == GST_VALUE_GREATER_THAN)) {
|
|
|
|
gst_value_init_and_copy (dest, src1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_intersect_fraction_range_fraction_range
|
|
|
|
(GValue * dest, const GValue * src1, const GValue * src2)
|
|
|
|
{
|
|
|
|
GValue *min;
|
|
|
|
GValue *max;
|
|
|
|
int res;
|
|
|
|
GValue *vals1, *vals2;
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
vals1 = src1->data[0].v_pointer;
|
|
|
|
vals2 = src2->data[0].v_pointer;
|
|
|
|
g_return_val_if_fail (vals1 != NULL && vals2 != NULL, FALSE);
|
|
|
|
|
2006-08-20 14:30:20 +00:00
|
|
|
if ((compare = gst_value_get_compare_func (&vals1[0]))) {
|
|
|
|
/* min = MAX (src1.start, src2.start) */
|
|
|
|
res = gst_value_compare_with_func (&vals1[0], &vals2[0], compare);
|
|
|
|
g_return_val_if_fail (res != GST_VALUE_UNORDERED, FALSE);
|
|
|
|
if (res == GST_VALUE_LESS_THAN)
|
|
|
|
min = &vals2[0]; /* Take the max of the 2 */
|
|
|
|
else
|
|
|
|
min = &vals1[0];
|
|
|
|
|
|
|
|
/* max = MIN (src1.end, src2.end) */
|
|
|
|
res = gst_value_compare_with_func (&vals1[1], &vals2[1], compare);
|
|
|
|
g_return_val_if_fail (res != GST_VALUE_UNORDERED, FALSE);
|
|
|
|
if (res == GST_VALUE_GREATER_THAN)
|
|
|
|
max = &vals2[1]; /* Take the min of the 2 */
|
|
|
|
else
|
|
|
|
max = &vals1[1];
|
|
|
|
|
|
|
|
res = gst_value_compare_with_func (min, max, compare);
|
|
|
|
g_return_val_if_fail (res != GST_VALUE_UNORDERED, FALSE);
|
|
|
|
if (res == GST_VALUE_LESS_THAN) {
|
|
|
|
g_value_init (dest, GST_TYPE_FRACTION_RANGE);
|
|
|
|
vals1 = dest->data[0].v_pointer;
|
|
|
|
g_value_copy (min, &vals1[0]);
|
|
|
|
g_value_copy (max, &vals1[1]);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (res == GST_VALUE_EQUAL) {
|
|
|
|
gst_value_init_and_copy (dest, min);
|
|
|
|
return TRUE;
|
|
|
|
}
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/***************
|
|
|
|
* subtraction *
|
|
|
|
***************/
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_int_int_range (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
int min = gst_value_get_int_range_min (subtrahend);
|
|
|
|
int max = gst_value_get_int_range_max (subtrahend);
|
|
|
|
int val = g_value_get_int (minuend);
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* subtracting a range from an int only works if the int is not in the
|
|
|
|
* range */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
if (val < min || val > max) {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* and the result is the int */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2005-10-15 15:30:24 +00:00
|
|
|
/* creates a new int range based on input values.
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
*/
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_create_new_range (GValue * dest, gint min1, gint max1, gint min2,
|
|
|
|
gint max2)
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
{
|
|
|
|
GValue v1 = { 0, };
|
|
|
|
GValue v2 = { 0, };
|
|
|
|
GValue *pv1, *pv2; /* yeah, hungarian! */
|
|
|
|
|
|
|
|
if (min1 <= max1 && min2 <= max2) {
|
|
|
|
pv1 = &v1;
|
|
|
|
pv2 = &v2;
|
|
|
|
} else if (min1 <= max1) {
|
|
|
|
pv1 = dest;
|
2004-04-21 04:13:20 +00:00
|
|
|
pv2 = NULL;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
} else if (min2 <= max2) {
|
2004-04-21 04:13:20 +00:00
|
|
|
pv1 = NULL;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
pv2 = dest;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min1 < max1) {
|
|
|
|
g_value_init (pv1, GST_TYPE_INT_RANGE);
|
|
|
|
gst_value_set_int_range (pv1, min1, max1);
|
|
|
|
} else if (min1 == max1) {
|
|
|
|
g_value_init (pv1, G_TYPE_INT);
|
|
|
|
g_value_set_int (pv1, min1);
|
|
|
|
}
|
|
|
|
if (min2 < max2) {
|
|
|
|
g_value_init (pv2, GST_TYPE_INT_RANGE);
|
|
|
|
gst_value_set_int_range (pv2, min2, max2);
|
|
|
|
} else if (min2 == max2) {
|
|
|
|
g_value_init (pv2, G_TYPE_INT);
|
|
|
|
g_value_set_int (pv2, min2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min1 <= max1 && min2 <= max2) {
|
|
|
|
gst_value_list_concat (dest, pv1, pv2);
|
|
|
|
g_value_unset (pv1);
|
|
|
|
g_value_unset (pv2);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_int_range_int (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint min = gst_value_get_int_range_min (minuend);
|
|
|
|
gint max = gst_value_get_int_range_max (minuend);
|
|
|
|
gint val = g_value_get_int (subtrahend);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (min < max, FALSE);
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* value is outside of the range, return range unchanged */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
if (val < min || val > max) {
|
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
} else {
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* max must be MAXINT too as val <= max */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
if (val == G_MAXINT) {
|
|
|
|
max--;
|
|
|
|
val--;
|
|
|
|
}
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* min must be MININT too as val >= max */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
if (val == G_MININT) {
|
|
|
|
min++;
|
|
|
|
val++;
|
|
|
|
}
|
|
|
|
gst_value_create_new_range (dest, min, val - 1, val + 1, max);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_int_range_int_range (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint min1 = gst_value_get_int_range_min (minuend);
|
|
|
|
gint max1 = gst_value_get_int_range_max (minuend);
|
|
|
|
gint min2 = gst_value_get_int_range_min (subtrahend);
|
|
|
|
gint max2 = gst_value_get_int_range_max (subtrahend);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
2004-04-22 16:39:23 +00:00
|
|
|
if (max2 == G_MAXINT && min2 == G_MININT) {
|
|
|
|
return FALSE;
|
|
|
|
} else if (max2 == G_MAXINT) {
|
|
|
|
return gst_value_create_new_range (dest, min1, MIN (min2 - 1, max1), 1, 0);
|
|
|
|
} else if (min2 == G_MININT) {
|
|
|
|
return gst_value_create_new_range (dest, MAX (max2 + 1, min1), max1, 1, 0);
|
|
|
|
} else {
|
|
|
|
return gst_value_create_new_range (dest, min1, MIN (min2 - 1, max1),
|
|
|
|
MAX (max2 + 1, min1), max1);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_double_double_range (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gdouble min = gst_value_get_double_range_min (subtrahend);
|
|
|
|
gdouble max = gst_value_get_double_range_max (subtrahend);
|
|
|
|
gdouble val = g_value_get_double (minuend);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
if (val < min || val > max) {
|
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_double_range_double (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* since we don't have open ranges, we cannot create a hole in
|
|
|
|
* a double range. We return the original range */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_double_range_double_range (GValue * dest,
|
|
|
|
const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* since we don't have open ranges, we have to approximate */
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
/* done like with ints */
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gdouble min1 = gst_value_get_double_range_min (minuend);
|
|
|
|
gdouble max2 = gst_value_get_double_range_max (minuend);
|
|
|
|
gdouble max1 = MIN (gst_value_get_double_range_min (subtrahend), max2);
|
|
|
|
gdouble min2 = MAX (gst_value_get_double_range_max (subtrahend), min1);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
GValue v1 = { 0, };
|
|
|
|
GValue v2 = { 0, };
|
|
|
|
GValue *pv1, *pv2; /* yeah, hungarian! */
|
|
|
|
|
|
|
|
if (min1 < max1 && min2 < max2) {
|
|
|
|
pv1 = &v1;
|
|
|
|
pv2 = &v2;
|
|
|
|
} else if (min1 < max1) {
|
|
|
|
pv1 = dest;
|
2004-04-21 04:18:17 +00:00
|
|
|
pv2 = NULL;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
} else if (min2 < max2) {
|
2004-04-21 04:18:17 +00:00
|
|
|
pv1 = NULL;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
pv2 = dest;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min1 < max1) {
|
|
|
|
g_value_init (pv1, GST_TYPE_DOUBLE_RANGE);
|
|
|
|
gst_value_set_double_range (pv1, min1, max1);
|
|
|
|
}
|
|
|
|
if (min2 < max2) {
|
|
|
|
g_value_init (pv2, GST_TYPE_DOUBLE_RANGE);
|
|
|
|
gst_value_set_double_range (pv2, min2, max2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (min1 < max1 && min2 < max2) {
|
|
|
|
gst_value_list_concat (dest, pv1, pv2);
|
|
|
|
g_value_unset (pv1);
|
|
|
|
g_value_unset (pv2);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_from_list (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
guint i, size;
|
|
|
|
GValue subtraction = { 0, };
|
|
|
|
gboolean ret = FALSE;
|
|
|
|
|
|
|
|
size = gst_value_list_get_size (minuend);
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
const GValue *cur = gst_value_list_get_value (minuend, i);
|
|
|
|
|
|
|
|
if (gst_value_subtract (&subtraction, cur, subtrahend)) {
|
|
|
|
if (!ret) {
|
|
|
|
gst_value_init_and_copy (dest, &subtraction);
|
|
|
|
ret = TRUE;
|
|
|
|
} else if (GST_VALUE_HOLDS_LIST (dest)
|
|
|
|
&& GST_VALUE_HOLDS_LIST (&subtraction)) {
|
|
|
|
/* unroll */
|
|
|
|
GValue unroll = { 0, };
|
|
|
|
|
|
|
|
gst_value_init_and_copy (&unroll, dest);
|
|
|
|
g_value_unset (dest);
|
|
|
|
gst_value_list_concat (dest, &unroll, &subtraction);
|
|
|
|
} else if (GST_VALUE_HOLDS_LIST (dest)) {
|
|
|
|
gst_value_list_append_value (dest, &subtraction);
|
|
|
|
} else {
|
|
|
|
GValue temp = { 0, };
|
|
|
|
|
|
|
|
gst_value_init_and_copy (&temp, dest);
|
|
|
|
g_value_unset (dest);
|
|
|
|
gst_value_list_concat (dest, &temp, &subtraction);
|
2004-04-22 16:39:23 +00:00
|
|
|
g_value_unset (&temp);
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
}
|
|
|
|
g_value_unset (&subtraction);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_list (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
guint i, size;
|
|
|
|
GValue data[2] = { {0,}, {0,} };
|
|
|
|
GValue *subtraction = &data[0], *result = &data[1];
|
|
|
|
|
|
|
|
gst_value_init_and_copy (result, minuend);
|
|
|
|
size = gst_value_list_get_size (subtrahend);
|
|
|
|
for (i = 0; i < size; i++) {
|
|
|
|
const GValue *cur = gst_value_list_get_value (subtrahend, i);
|
|
|
|
|
|
|
|
if (gst_value_subtract (subtraction, result, cur)) {
|
|
|
|
GValue *temp = result;
|
|
|
|
|
|
|
|
result = subtraction;
|
|
|
|
subtraction = temp;
|
|
|
|
g_value_unset (subtraction);
|
|
|
|
} else {
|
|
|
|
g_value_unset (result);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gst_value_init_and_copy (dest, result);
|
|
|
|
g_value_unset (result);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_fraction_fraction_range (GValue * dest,
|
|
|
|
const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
const GValue *min = gst_value_get_fraction_range_min (subtrahend);
|
|
|
|
const GValue *max = gst_value_get_fraction_range_max (subtrahend);
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
|
|
|
|
|
|
|
if ((compare = gst_value_get_compare_func (minuend))) {
|
|
|
|
/* subtracting a range from an fraction only works if the fraction
|
|
|
|
* is not in the range */
|
|
|
|
if (gst_value_compare_with_func (minuend, min, compare) ==
|
|
|
|
GST_VALUE_LESS_THAN ||
|
|
|
|
gst_value_compare_with_func (minuend, max, compare) ==
|
|
|
|
GST_VALUE_GREATER_THAN) {
|
|
|
|
/* and the result is the value */
|
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_fraction_range_fraction (GValue * dest,
|
|
|
|
const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
/* since we don't have open ranges, we cannot create a hole in
|
|
|
|
* a range. We return the original range */
|
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_subtract_fraction_range_fraction_range (GValue * dest,
|
|
|
|
const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
/* since we don't have open ranges, we have to approximate */
|
|
|
|
/* done like with ints and doubles. Creates a list of 2 fraction ranges */
|
|
|
|
const GValue *min1 = gst_value_get_fraction_range_min (minuend);
|
|
|
|
const GValue *max2 = gst_value_get_fraction_range_max (minuend);
|
|
|
|
const GValue *max1 = gst_value_get_fraction_range_min (subtrahend);
|
|
|
|
const GValue *min2 = gst_value_get_fraction_range_max (subtrahend);
|
|
|
|
int cmp1, cmp2;
|
|
|
|
GValue v1 = { 0, };
|
|
|
|
GValue v2 = { 0, };
|
|
|
|
GValue *pv1, *pv2; /* yeah, hungarian! */
|
2006-08-20 14:30:20 +00:00
|
|
|
GstValueCompareFunc compare;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (min1 != NULL && max1 != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (min2 != NULL && max2 != NULL, FALSE);
|
|
|
|
|
2006-08-20 14:30:20 +00:00
|
|
|
compare = gst_value_get_compare_func (min1);
|
|
|
|
g_return_val_if_fail (compare, FALSE);
|
|
|
|
|
|
|
|
cmp1 = gst_value_compare_with_func (max2, max1, compare);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
|
|
|
|
if (cmp1 == GST_VALUE_LESS_THAN)
|
|
|
|
max1 = max2;
|
2006-08-20 14:30:20 +00:00
|
|
|
cmp1 = gst_value_compare_with_func (min1, min2, compare);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
g_return_val_if_fail (cmp1 != GST_VALUE_UNORDERED, FALSE);
|
|
|
|
if (cmp1 == GST_VALUE_GREATER_THAN)
|
|
|
|
min2 = min1;
|
|
|
|
|
2006-08-20 14:30:20 +00:00
|
|
|
cmp1 = gst_value_compare_with_func (min1, max1, compare);
|
|
|
|
cmp2 = gst_value_compare_with_func (min2, max2, compare);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
if (cmp1 == GST_VALUE_LESS_THAN && cmp2 == GST_VALUE_LESS_THAN) {
|
|
|
|
pv1 = &v1;
|
|
|
|
pv2 = &v2;
|
|
|
|
} else if (cmp1 == GST_VALUE_LESS_THAN) {
|
|
|
|
pv1 = dest;
|
|
|
|
pv2 = NULL;
|
|
|
|
} else if (cmp2 == GST_VALUE_LESS_THAN) {
|
|
|
|
pv1 = NULL;
|
|
|
|
pv2 = dest;
|
|
|
|
} else {
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmp1 == GST_VALUE_LESS_THAN) {
|
|
|
|
g_value_init (pv1, GST_TYPE_FRACTION_RANGE);
|
|
|
|
gst_value_set_fraction_range (pv1, min1, max1);
|
|
|
|
}
|
|
|
|
if (cmp2 == GST_VALUE_LESS_THAN) {
|
|
|
|
g_value_init (pv2, GST_TYPE_FRACTION_RANGE);
|
|
|
|
gst_value_set_fraction_range (pv2, min2, max2);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (cmp1 == GST_VALUE_LESS_THAN && cmp2 == GST_VALUE_LESS_THAN) {
|
|
|
|
gst_value_list_concat (dest, pv1, pv2);
|
|
|
|
g_value_unset (pv1);
|
|
|
|
g_value_unset (pv2);
|
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-07-15 16:20:50 +00:00
|
|
|
/**************
|
|
|
|
* comparison *
|
|
|
|
**************/
|
2003-12-23 20:58:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_can_compare:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value1: a value to compare
|
|
|
|
* @value2: another value to compare
|
|
|
|
*
|
|
|
|
* Determines if @value1 and @value2 can be compared.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Returns: TRUE if the values can be compared
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_can_compare (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
GstValueTable *table;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
|
|
|
|
return FALSE;
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_table->len; i++) {
|
|
|
|
table = &g_array_index (gst_value_table, GstValueTable, i);
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
if (g_type_is_a (G_VALUE_TYPE (value1), table->type) && table->compare)
|
2004-03-13 15:27:01 +00:00
|
|
|
return TRUE;
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2006-08-20 15:55:12 +00:00
|
|
|
/*
|
2006-08-20 14:30:20 +00:00
|
|
|
* gst_value_get_compare_func:
|
|
|
|
* @value1: a value to get the compare function for
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2006-08-20 14:30:20 +00:00
|
|
|
* Determines the compare function to be used with values of the same type as
|
|
|
|
* @value1. The function can be given to gst_value_compare_with_func().
|
2004-03-26 03:46:16 +00:00
|
|
|
*
|
2006-08-20 14:30:20 +00:00
|
|
|
* Returns: A #GstValueCompareFunc value
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2006-08-20 15:55:12 +00:00
|
|
|
static GstValueCompareFunc
|
2006-08-20 14:30:20 +00:00
|
|
|
gst_value_get_compare_func (const GValue * value1)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
GstValueTable *table, *best = NULL;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_table->len; i++) {
|
|
|
|
table = &g_array_index (gst_value_table, GstValueTable, i);
|
Fix enum serialization, deserialization, comparison in caps, add a test to ensure that this continues working in the ...
Original commit message from CVS:
* configure.ac:
* gst/gstvalue.c: (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum),
(gst_value_can_compare), (gst_value_compare):
* testsuite/Makefile.am:
Fix enum serialization, deserialization, comparison in caps, add
a test to ensure that this continues working in the future.
2004-07-07 04:22:28 +00:00
|
|
|
if (table->type == G_VALUE_TYPE (value1) && table->compare != NULL) {
|
|
|
|
best = table;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (g_type_is_a (G_VALUE_TYPE (value1), table->type)) {
|
|
|
|
if (!best || g_type_is_a (table->type, best->type))
|
|
|
|
best = table;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (best) {
|
2006-08-20 14:30:20 +00:00
|
|
|
return best->compare;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_compare:
|
|
|
|
* @value1: a value to compare
|
|
|
|
* @value2: another value to compare
|
|
|
|
*
|
|
|
|
* Compares @value1 and @value2. If @value1 and @value2 cannot be
|
|
|
|
* compared, the function returns GST_VALUE_UNORDERED. Otherwise,
|
2007-06-05 13:49:10 +00:00
|
|
|
* if @value1 is greater than @value2, GST_VALUE_GREATER_THAN is returned.
|
|
|
|
* If @value1 is less than @value2, GST_VALUE_LESS_THAN is returned.
|
2006-08-20 14:30:20 +00:00
|
|
|
* If the values are equal, GST_VALUE_EQUAL is returned.
|
|
|
|
*
|
|
|
|
* Returns: A #GstValueCompareType value
|
|
|
|
*/
|
|
|
|
gint
|
|
|
|
gst_value_compare (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
GstValueCompareFunc compare;
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
|
|
|
|
compare = gst_value_get_compare_func (value1);
|
|
|
|
if (compare) {
|
|
|
|
return compare (value1, value2);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_critical ("unable to compare values of type %s\n",
|
2003-12-23 20:58:05 +00:00
|
|
|
g_type_name (G_VALUE_TYPE (value1)));
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
2006-08-20 15:55:12 +00:00
|
|
|
/*
|
2006-08-20 14:30:20 +00:00
|
|
|
* gst_value_compare_with_func:
|
|
|
|
* @value1: a value to compare
|
|
|
|
* @value2: another value to compare
|
|
|
|
* @compare: compare function
|
|
|
|
*
|
|
|
|
* Compares @value1 and @value2 using the @compare function. Works like
|
|
|
|
* gst_value_compare() but allows to save time determining the compare function
|
|
|
|
* a multiple times.
|
|
|
|
*
|
|
|
|
* Returns: A #GstValueCompareType value
|
|
|
|
*/
|
2006-08-20 15:55:12 +00:00
|
|
|
static gint
|
2006-08-20 14:30:20 +00:00
|
|
|
gst_value_compare_with_func (const GValue * value1, const GValue * value2,
|
|
|
|
GstValueCompareFunc compare)
|
|
|
|
{
|
|
|
|
g_assert (compare);
|
|
|
|
|
|
|
|
if (G_VALUE_TYPE (value1) != G_VALUE_TYPE (value2))
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
|
|
|
|
return compare (value1, value2);
|
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* union */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_can_union:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value1: a value to union
|
|
|
|
* @value2: another value to union
|
|
|
|
*
|
|
|
|
* Determines if @value1 and @value2 can be non-trivially unioned.
|
|
|
|
* Any two values can be trivially unioned by adding both of them
|
|
|
|
* to a GstValueList. However, certain types have the possibility
|
|
|
|
* to be unioned in a simpler way. For example, an integer range
|
|
|
|
* and an integer can be unioned if the integer is a subset of the
|
|
|
|
* integer range. If there is the possibility that two values can
|
|
|
|
* be unioned, this function returns TRUE.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Returns: TRUE if there is a function allowing the two values to
|
|
|
|
* be unioned.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_can_union (const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
GstValueUnionInfo *union_info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_union_funcs->len; i++) {
|
|
|
|
union_info = &g_array_index (gst_value_union_funcs, GstValueUnionInfo, i);
|
|
|
|
if (union_info->type1 == G_VALUE_TYPE (value1) &&
|
2004-03-15 19:27:17 +00:00
|
|
|
union_info->type2 == G_VALUE_TYPE (value2))
|
2004-03-13 15:27:01 +00:00
|
|
|
return TRUE;
|
2004-03-31 21:49:19 +00:00
|
|
|
if (union_info->type1 == G_VALUE_TYPE (value2) &&
|
|
|
|
union_info->type2 == G_VALUE_TYPE (value1))
|
|
|
|
return TRUE;
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_union:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @dest: the destination value
|
|
|
|
* @value1: a value to union
|
|
|
|
* @value2: another value to union
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Creates a GValue cooresponding to the union of @value1 and @value2.
|
|
|
|
*
|
2005-11-27 19:52:49 +00:00
|
|
|
* Returns: always returns %TRUE
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2005-11-18 16:04:28 +00:00
|
|
|
/* FIXME: change return type to 'void'? */
|
2003-12-23 20:58:05 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_union (GValue * dest, const GValue * value1, const GValue * value2)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
|
|
|
GstValueUnionInfo *union_info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_union_funcs->len; i++) {
|
|
|
|
union_info = &g_array_index (gst_value_union_funcs, GstValueUnionInfo, i);
|
|
|
|
if (union_info->type1 == G_VALUE_TYPE (value1) &&
|
2004-03-15 19:27:17 +00:00
|
|
|
union_info->type2 == G_VALUE_TYPE (value2)) {
|
2004-03-31 21:49:19 +00:00
|
|
|
if (union_info->func (dest, value1, value2)) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (union_info->type1 == G_VALUE_TYPE (value2) &&
|
|
|
|
union_info->type2 == G_VALUE_TYPE (value1)) {
|
|
|
|
if (union_info->func (dest, value2, value1)) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_list_concat (dest, value1, value2);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_register_union_func:
|
2004-03-26 03:46:16 +00:00
|
|
|
* @type1: a type to union
|
|
|
|
* @type2: another type to union
|
|
|
|
* @func: a function that implments creating a union between the two types
|
|
|
|
*
|
|
|
|
* Registers a union function that can create a union between GValues
|
|
|
|
* of the type @type1 and @type2.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2006-03-07 11:47:24 +00:00
|
|
|
* Union functions should be registered at startup before any pipelines are
|
|
|
|
* started, as gst_value_register_union_func() is not thread-safe and cannot
|
|
|
|
* be used at the same time as gst_value_union() or gst_value_can_union().
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_register_union_func (GType type1, GType type2, GstValueUnionFunc func)
|
|
|
|
{
|
|
|
|
GstValueUnionInfo union_info;
|
|
|
|
|
|
|
|
union_info.type1 = type1;
|
|
|
|
union_info.type2 = type2;
|
|
|
|
union_info.func = func;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_array_append_val (gst_value_union_funcs, union_info);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* intersection */
|
|
|
|
|
2004-09-02 14:24:22 +00:00
|
|
|
/**
|
2003-12-23 20:58:05 +00:00
|
|
|
* gst_value_can_intersect:
|
2005-01-05 23:21:18 +00:00
|
|
|
* @value1: a value to intersect
|
|
|
|
* @value2: another value to intersect
|
|
|
|
*
|
|
|
|
* Determines if intersecting two values will produce a valid result.
|
|
|
|
* Two values will produce a valid intersection if they have the same
|
|
|
|
* type, or if there is a method (registered by
|
2006-01-27 22:34:51 +00:00
|
|
|
* gst_value_register_intersection_func()) to calculate the intersection.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2005-01-18 14:15:30 +00:00
|
|
|
* Returns: TRUE if the values can intersect
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-04 19:00:54 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_can_intersect (const GValue * value1, const GValue * value2)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
|
|
|
GstValueIntersectInfo *intersect_info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
/* special cases */
|
2004-03-13 15:27:01 +00:00
|
|
|
if (GST_VALUE_HOLDS_LIST (value1) || GST_VALUE_HOLDS_LIST (value2))
|
2003-12-22 01:39:35 +00:00
|
|
|
return TRUE;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_intersect_funcs->len; i++) {
|
|
|
|
intersect_info = &g_array_index (gst_value_intersect_funcs,
|
2004-03-15 19:27:17 +00:00
|
|
|
GstValueIntersectInfo, i);
|
2004-03-13 15:27:01 +00:00
|
|
|
if (intersect_info->type1 == G_VALUE_TYPE (value1) &&
|
2004-03-15 19:27:17 +00:00
|
|
|
intersect_info->type2 == G_VALUE_TYPE (value2))
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
if (intersect_info->type2 == G_VALUE_TYPE (value1) &&
|
|
|
|
intersect_info->type1 == G_VALUE_TYPE (value2))
|
|
|
|
return TRUE;
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
return gst_value_can_compare (value1, value2);
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
|
|
|
* gst_value_intersect:
|
2005-01-05 23:21:18 +00:00
|
|
|
* @dest: a uninitialized #GValue that will hold the calculated
|
|
|
|
* intersection value
|
2004-03-26 03:46:16 +00:00
|
|
|
* @value1: a value to intersect
|
|
|
|
* @value2: another value to intersect
|
|
|
|
*
|
2005-01-05 23:21:18 +00:00
|
|
|
* Calculates the intersection of two values. If the values have
|
|
|
|
* a non-empty intersection, the value representing the intersection
|
|
|
|
* is placed in @dest. If the intersection is non-empty, @dest is
|
|
|
|
* not modified.
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2004-03-26 03:46:16 +00:00
|
|
|
* Returns: TRUE if the intersection is non-empty
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
2003-11-24 02:09:23 +00:00
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_intersect (GValue * dest, const GValue * value1,
|
|
|
|
const GValue * value2)
|
2003-11-04 19:00:54 +00:00
|
|
|
{
|
|
|
|
GstValueIntersectInfo *intersect_info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
|
|
|
gboolean ret = FALSE;
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2003-12-22 01:39:35 +00:00
|
|
|
/* special cases first */
|
|
|
|
if (GST_VALUE_HOLDS_LIST (value1))
|
|
|
|
return gst_value_intersect_list (dest, value1, value2);
|
|
|
|
if (GST_VALUE_HOLDS_LIST (value2))
|
|
|
|
return gst_value_intersect_list (dest, value2, value1);
|
2004-03-13 15:27:01 +00:00
|
|
|
|
|
|
|
for (i = 0; i < gst_value_intersect_funcs->len; i++) {
|
|
|
|
intersect_info = &g_array_index (gst_value_intersect_funcs,
|
2004-03-15 19:27:17 +00:00
|
|
|
GstValueIntersectInfo, i);
|
2004-03-13 15:27:01 +00:00
|
|
|
if (intersect_info->type1 == G_VALUE_TYPE (value1) &&
|
2004-03-15 19:27:17 +00:00
|
|
|
intersect_info->type2 == G_VALUE_TYPE (value2)) {
|
2004-03-13 15:27:01 +00:00
|
|
|
ret = intersect_info->func (dest, value1, value2);
|
2003-12-22 01:39:35 +00:00
|
|
|
return ret;
|
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
if (intersect_info->type1 == G_VALUE_TYPE (value2) &&
|
2004-03-15 19:27:17 +00:00
|
|
|
intersect_info->type2 == G_VALUE_TYPE (value1)) {
|
2004-03-13 15:27:01 +00:00
|
|
|
ret = intersect_info->func (dest, value2, value1);
|
2003-11-29 06:31:10 +00:00
|
|
|
return ret;
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
}
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
if (gst_value_compare (value1, value2) == GST_VALUE_EQUAL) {
|
2003-12-22 07:00:25 +00:00
|
|
|
gst_value_init_and_copy (dest, value1);
|
2003-11-29 06:31:10 +00:00
|
|
|
ret = TRUE;
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
|
|
|
|
2003-11-29 06:31:10 +00:00
|
|
|
return ret;
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/**
|
2005-11-21 14:50:22 +00:00
|
|
|
* gst_value_register_intersect_func:
|
2005-01-05 23:21:18 +00:00
|
|
|
* @type1: the first type to intersect
|
|
|
|
* @type2: the second type to intersect
|
|
|
|
* @func: the intersection function
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2005-01-05 23:21:18 +00:00
|
|
|
* Registers a function that is called to calculate the intersection
|
|
|
|
* of the values having the types @type1 and @type2.
|
2006-03-07 11:47:24 +00:00
|
|
|
*
|
|
|
|
* Intersect functions should be registered at startup before any pipelines are
|
|
|
|
* started, as gst_value_register_intersect_func() is not thread-safe and
|
|
|
|
* cannot be used at the same time as gst_value_intersect() or
|
|
|
|
* gst_value_can_intersect().
|
2005-01-05 23:21:18 +00:00
|
|
|
*/
|
2003-11-04 19:00:54 +00:00
|
|
|
void
|
|
|
|
gst_value_register_intersect_func (GType type1, GType type2,
|
|
|
|
GstValueIntersectFunc func)
|
|
|
|
{
|
|
|
|
GstValueIntersectInfo intersect_info;
|
|
|
|
|
|
|
|
intersect_info.type1 = type1;
|
|
|
|
intersect_info.type2 = type2;
|
|
|
|
intersect_info.func = func;
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
g_array_append_val (gst_value_intersect_funcs, intersect_info);
|
2003-11-04 19:00:54 +00:00
|
|
|
}
|
2003-11-03 09:10:07 +00:00
|
|
|
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
/* subtraction */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_subtract:
|
|
|
|
* @dest: the destination value for the result if the subtraction is not empty
|
|
|
|
* @minuend: the value to subtract from
|
|
|
|
* @subtrahend: the value to subtract
|
|
|
|
*
|
|
|
|
* Subtracts @subtrahend from @minuend and stores the result in @dest.
|
|
|
|
* Note that this means subtraction as in sets, not as in mathematics.
|
|
|
|
*
|
2005-11-18 16:04:28 +00:00
|
|
|
* Returns: %TRUE if the subtraction is not empty
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_value_subtract (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
GstValueSubtractInfo *info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
/* special cases first */
|
|
|
|
if (GST_VALUE_HOLDS_LIST (minuend))
|
|
|
|
return gst_value_subtract_from_list (dest, minuend, subtrahend);
|
|
|
|
if (GST_VALUE_HOLDS_LIST (subtrahend))
|
|
|
|
return gst_value_subtract_list (dest, minuend, subtrahend);
|
|
|
|
|
|
|
|
for (i = 0; i < gst_value_subtract_funcs->len; i++) {
|
|
|
|
info = &g_array_index (gst_value_subtract_funcs, GstValueSubtractInfo, i);
|
|
|
|
if (info->minuend == G_VALUE_TYPE (minuend) &&
|
|
|
|
info->subtrahend == G_VALUE_TYPE (subtrahend)) {
|
|
|
|
return info->func (dest, minuend, subtrahend);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gst_value_compare (minuend, subtrahend) != GST_VALUE_EQUAL) {
|
|
|
|
gst_value_init_and_copy (dest, minuend);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
gboolean
|
|
|
|
gst_value_subtract (GValue * dest, const GValue * minuend,
|
|
|
|
const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
gboolean ret = gst_value_subtract2 (dest, minuend, subtrahend);
|
|
|
|
|
|
|
|
g_printerr ("\"%s\" - \"%s\" = \"%s\"\n", gst_value_serialize (minuend),
|
|
|
|
gst_value_serialize (subtrahend),
|
|
|
|
ret ? gst_value_serialize (dest) : "---");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_can_subtract:
|
|
|
|
* @minuend: the value to subtract from
|
|
|
|
* @subtrahend: the value to subtract
|
|
|
|
*
|
|
|
|
* Checks if it's possible to subtract @subtrahend from @minuend.
|
|
|
|
*
|
|
|
|
* Returns: TRUE if a subtraction is possible
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_value_can_subtract (const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
|
|
|
GstValueSubtractInfo *info;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
|
|
|
|
/* special cases */
|
|
|
|
if (GST_VALUE_HOLDS_LIST (minuend) || GST_VALUE_HOLDS_LIST (subtrahend))
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
for (i = 0; i < gst_value_subtract_funcs->len; i++) {
|
|
|
|
info = &g_array_index (gst_value_subtract_funcs, GstValueSubtractInfo, i);
|
|
|
|
if (info->minuend == G_VALUE_TYPE (minuend) &&
|
|
|
|
info->subtrahend == G_VALUE_TYPE (subtrahend))
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gst_value_can_compare (minuend, subtrahend);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_register_subtract_func:
|
|
|
|
* @minuend_type: type of the minuend
|
|
|
|
* @subtrahend_type: type of the subtrahend
|
|
|
|
* @func: function to use
|
|
|
|
*
|
2005-10-15 15:30:24 +00:00
|
|
|
* Registers @func as a function capable of subtracting the values of
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
* @subtrahend_type from values of @minuend_type.
|
2006-03-07 11:47:24 +00:00
|
|
|
*
|
|
|
|
* Subtract functions should be registered at startup before any pipelines are
|
|
|
|
* started, as gst_value_register_subtract_func() is not thread-safe and
|
|
|
|
* cannot be used at the same time as gst_value_subtract().
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_register_subtract_func (GType minuend_type, GType subtrahend_type,
|
|
|
|
GstValueSubtractFunc func)
|
|
|
|
{
|
|
|
|
GstValueSubtractInfo info;
|
|
|
|
|
|
|
|
/* one type must be unfixed, other subtractions can be done as comparisons */
|
|
|
|
g_return_if_fail (!gst_type_is_fixed (minuend_type)
|
|
|
|
|| !gst_type_is_fixed (subtrahend_type));
|
|
|
|
|
|
|
|
info.minuend = minuend_type;
|
|
|
|
info.subtrahend = subtrahend_type;
|
|
|
|
info.func = func;
|
|
|
|
|
|
|
|
g_array_append_val (gst_value_subtract_funcs, info);
|
|
|
|
}
|
|
|
|
|
2004-09-02 14:24:22 +00:00
|
|
|
/**
|
2003-12-23 20:58:05 +00:00
|
|
|
* gst_value_register:
|
2005-01-05 23:21:18 +00:00
|
|
|
* @table: structure containing functions to register
|
|
|
|
*
|
|
|
|
* Registers functions to perform calculations on #GValues of a given
|
|
|
|
* type.
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
* GstValueTable:
|
2005-01-06 00:45:04 +00:00
|
|
|
* @type: GType that the functions operate on.
|
|
|
|
* @compare: A function that compares two values of this type.
|
|
|
|
* @serialize: A function that transforms a value of this type to a
|
2005-01-05 23:21:18 +00:00
|
|
|
* string. Strings created by this function must be unique and should
|
|
|
|
* be human readable.
|
2005-01-06 00:45:04 +00:00
|
|
|
* @deserialize: A function that transforms a string to a value of
|
2005-01-05 23:21:18 +00:00
|
|
|
* this type. This function must transform strings created by the
|
|
|
|
* serialize function back to the original value. This function may
|
|
|
|
* optionally transform other strings into values.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_register (const GstValueTable * table)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_array_append_val (gst_value_table, *table);
|
2003-12-23 20:58:05 +00:00
|
|
|
}
|
|
|
|
|
2004-09-02 14:24:22 +00:00
|
|
|
/**
|
2003-12-23 20:58:05 +00:00
|
|
|
* gst_value_init_and_copy:
|
2005-01-05 13:17:28 +00:00
|
|
|
* @dest: the target value
|
|
|
|
* @src: the source value
|
2003-12-23 20:58:05 +00:00
|
|
|
*
|
2005-01-05 13:17:28 +00:00
|
|
|
* Initialises the target value to be of the same type as source and then copies
|
|
|
|
* the contents from source to target.
|
2003-12-23 20:58:05 +00:00
|
|
|
*/
|
|
|
|
void
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_init_and_copy (GValue * dest, const GValue * src)
|
2003-12-23 20:58:05 +00:00
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
g_value_init (dest, G_VALUE_TYPE (src));
|
2003-12-23 20:58:05 +00:00
|
|
|
g_value_copy (src, dest);
|
|
|
|
}
|
|
|
|
|
2004-09-02 14:24:22 +00:00
|
|
|
/**
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
* gst_value_serialize:
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
* @value: a #GValue to serialize
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
* tries to transform the given @value into a string representation that allows
|
|
|
|
* getting back this string later on using gst_value_deserialize().
|
|
|
|
*
|
|
|
|
* Returns: the serialization for @value or NULL if none exists
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*/
|
|
|
|
gchar *
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_serialize (const GValue * value)
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
{
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
GValue s_val = { 0 };
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
GstValueTable *table, *best = NULL;
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
char *s;
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_return_val_if_fail (G_IS_VALUE (value), NULL);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_table->len; i++) {
|
|
|
|
table = &g_array_index (gst_value_table, GstValueTable, i);
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (table->serialize == NULL)
|
2004-03-13 15:27:01 +00:00
|
|
|
continue;
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (table->type == G_VALUE_TYPE (value)) {
|
|
|
|
best = table;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (g_type_is_a (G_VALUE_TYPE (value), table->type)) {
|
|
|
|
if (!best || g_type_is_a (table->type, best->type))
|
|
|
|
best = table;
|
|
|
|
}
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
}
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (best)
|
|
|
|
return best->serialize (value);
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
|
|
|
|
g_value_init (&s_val, G_TYPE_STRING);
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (g_value_transform (value, &s_val)) {
|
|
|
|
s = gst_string_wrap (g_value_get_string (&s_val));
|
|
|
|
} else {
|
|
|
|
s = NULL;
|
|
|
|
}
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
g_value_unset (&s_val);
|
|
|
|
|
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2004-09-02 14:24:22 +00:00
|
|
|
/**
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
* gst_value_deserialize:
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
* @dest: #GValue to fill with contents of deserialization
|
|
|
|
* @src: string to deserialize
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
* Tries to deserialize a string into the type specified by the given GValue.
|
|
|
|
* If the operation succeeds, TRUE is returned, FALSE otherwise.
|
2005-06-22 10:52:18 +00:00
|
|
|
*
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
* Returns: TRUE on success
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
*/
|
|
|
|
gboolean
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_deserialize (GValue * dest, const gchar * src)
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
{
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
GstValueTable *table, *best = NULL;
|
2005-10-15 00:20:45 +00:00
|
|
|
guint i;
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
g_return_val_if_fail (src != NULL, FALSE);
|
|
|
|
g_return_val_if_fail (G_IS_VALUE (dest), FALSE);
|
|
|
|
|
2004-03-13 15:27:01 +00:00
|
|
|
for (i = 0; i < gst_value_table->len; i++) {
|
|
|
|
table = &g_array_index (gst_value_table, GstValueTable, i);
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (table->serialize == NULL)
|
2004-03-13 15:27:01 +00:00
|
|
|
continue;
|
2005-06-22 10:52:18 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (table->type == G_VALUE_TYPE (dest)) {
|
|
|
|
best = table;
|
|
|
|
break;
|
|
|
|
}
|
2005-06-22 10:52:18 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
if (g_type_is_a (G_VALUE_TYPE (dest), table->type)) {
|
|
|
|
if (!best || g_type_is_a (table->type, best->type))
|
|
|
|
best = table;
|
|
|
|
}
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
}
|
2005-06-22 10:52:18 +00:00
|
|
|
if (best) {
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
return best->deserialize (dest, src);
|
2005-06-22 10:52:18 +00:00
|
|
|
}
|
configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
Original commit message from CVS:
* configure.ac: Add detection for HAVE_PRINTF_EXTENSION and
GST_PRINTF_EXTENSION_FORMAT_DEFINE.
* docs/random/ds/0.9-suggested-changes: Notes from Company.
* gst/gstcaps.c: (gst_caps_to_string): Add comment.
* gst/gstconfig.h.in: Add define for GST_PTR_FORMAT
* gst/gstinfo.c: (_gst_debug_init), (gst_debug_print_object),
(gst_debug_log_default), (_gst_info_printf_extension),
(_gst_info_printf_extension_arginfo): Add printf extension.
* gst/gstinfo.h: remove G_GNUC_PRINTF, because it doesn't work with %P
* gst/gststructure.c: (gst_structure_to_string),
(_gst_structure_parse_value): Use gst_value_deserialize() and
remove old code.
* gst/gstvalue.c: (gst_value_deserialize_fourcc),
(gst_value_deserialize_boolean), (gst_strtoi),
(gst_value_deserialize_int), (gst_value_deserialize_double),
(gst_value_deserialize_string), (gst_value_deserialize): Implement
a bunch of deserialize functions and gst_value_deserialize.
* gst/gstvalue.h: er, _de_serialize, not unserialize
* testsuite/caps/string-conversions.c: (main): We don't currently
handle (float) in caps, so convert these to (double).
* testsuite/debug/Makefile.am: Add new test for the printf extension
* testsuite/debug/printf_extension.c: (main): same
2004-01-29 01:20:23 +00:00
|
|
|
|
gst/gststructure.c: Convert function to use gst_value_serialize().
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_to_string):
Convert function to use gst_value_serialize().
* gst/gstvalue.c: (gst_value_serialize_list),
(gst_value_serialize_fourcc), (gst_value_serialize_int_range),
(gst_value_serialize_double_range), (gst_value_serialize_boolean),
(gst_value_serialize_int), (gst_value_serialize_double),
(gst_string_wrap), (gst_value_serialize_string),
(gst_value_serialize), (gst_value_deserialize):
* gst/gstvalue.h:
Add implementations for serialize.
2004-01-20 09:14:25 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2004-11-29 17:02:09 +00:00
|
|
|
/**
|
|
|
|
* gst_value_is_fixed:
|
|
|
|
* @value: the #GValue to check
|
|
|
|
*
|
|
|
|
* Tests if the given GValue, if available in a GstStructure (or any other
|
|
|
|
* container) contains a "fixed" (which means: one value) or an "unfixed"
|
|
|
|
* (which means: multiple possible values, such as data lists or data
|
|
|
|
* ranges) value.
|
|
|
|
*
|
|
|
|
* Returns: true if the value is "fixed".
|
|
|
|
*/
|
|
|
|
|
|
|
|
gboolean
|
|
|
|
gst_value_is_fixed (const GValue * value)
|
|
|
|
{
|
|
|
|
GType type = G_VALUE_TYPE (value);
|
|
|
|
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
if (type == GST_TYPE_ARRAY) {
|
2004-11-29 17:02:09 +00:00
|
|
|
gboolean fixed = TRUE;
|
|
|
|
gint size, n;
|
|
|
|
const GValue *kid;
|
|
|
|
|
|
|
|
/* check recursively */
|
2005-11-21 12:27:01 +00:00
|
|
|
size = gst_value_array_get_size (value);
|
2004-11-29 17:02:09 +00:00
|
|
|
for (n = 0; n < size; n++) {
|
2005-11-21 12:27:01 +00:00
|
|
|
kid = gst_value_array_get_value (value, n);
|
2004-11-29 17:02:09 +00:00
|
|
|
fixed &= gst_value_is_fixed (kid);
|
|
|
|
}
|
|
|
|
|
|
|
|
return fixed;
|
|
|
|
}
|
|
|
|
|
|
|
|
return gst_type_is_fixed (type);
|
|
|
|
}
|
|
|
|
|
2004-07-15 20:27:20 +00:00
|
|
|
/************
|
|
|
|
* fraction *
|
|
|
|
************/
|
|
|
|
|
|
|
|
/* helper functions */
|
|
|
|
|
|
|
|
/* Finds the greatest common divisor.
|
|
|
|
* Returns 1 if none other found.
|
|
|
|
* This is Euclid's algorithm. */
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
static gint
|
|
|
|
gst_greatest_common_divisor (gint a, gint b)
|
2004-07-15 20:27:20 +00:00
|
|
|
{
|
|
|
|
while (b != 0) {
|
|
|
|
int temp = a;
|
|
|
|
|
|
|
|
a = b;
|
|
|
|
b = temp % b;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
return ABS (a);
|
2004-07-15 20:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_init_fraction (GValue * value)
|
|
|
|
{
|
|
|
|
value->data[0].v_int = 0;
|
|
|
|
value->data[1].v_int = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_copy_fraction (const GValue * src_value, GValue * dest_value)
|
|
|
|
{
|
|
|
|
dest_value->data[0].v_int = src_value->data[0].v_int;
|
|
|
|
dest_value->data[1].v_int = src_value->data[1].v_int;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_value_collect_fraction (GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
|
|
|
{
|
2005-11-20 17:12:49 +00:00
|
|
|
gst_value_set_fraction (value,
|
|
|
|
collect_values[0].v_int, collect_values[1].v_int);
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
gst_value_lcopy_fraction (const GValue * value, guint n_collect_values,
|
|
|
|
GTypeCValue * collect_values, guint collect_flags)
|
|
|
|
{
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
gint *numerator = collect_values[0].v_pointer;
|
|
|
|
gint *denominator = collect_values[1].v_pointer;
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
if (!numerator)
|
|
|
|
return g_strdup_printf ("numerator for `%s' passed as NULL",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
if (!denominator)
|
|
|
|
return g_strdup_printf ("denominator for `%s' passed as NULL",
|
|
|
|
G_VALUE_TYPE_NAME (value));
|
|
|
|
|
|
|
|
*numerator = value->data[0].v_int;
|
|
|
|
*denominator = value->data[1].v_int;
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_set_fraction:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @value: a GValue initialized to #GST_TYPE_FRACTION
|
2004-07-15 20:27:20 +00:00
|
|
|
* @numerator: the numerator of the fraction
|
|
|
|
* @denominator: the denominator of the fraction
|
|
|
|
*
|
|
|
|
* Sets @value to the fraction specified by @numerator over @denominator.
|
|
|
|
* The fraction gets reduced to the smallest numerator and denominator,
|
|
|
|
* and if necessary the sign is moved to the numerator.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_set_fraction (GValue * value, gint numerator, gint denominator)
|
|
|
|
{
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
gint gcd = 0;
|
|
|
|
|
2004-07-15 20:27:20 +00:00
|
|
|
g_return_if_fail (GST_VALUE_HOLDS_FRACTION (value));
|
|
|
|
g_return_if_fail (denominator != 0);
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
g_return_if_fail (denominator >= -G_MAXINT);
|
|
|
|
g_return_if_fail (numerator >= -G_MAXINT);
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
/* normalize sign */
|
|
|
|
if (denominator < 0) {
|
|
|
|
numerator = -numerator;
|
|
|
|
denominator = -denominator;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* check for reduction */
|
|
|
|
gcd = gst_greatest_common_divisor (numerator, denominator);
|
|
|
|
if (gcd) {
|
|
|
|
numerator /= gcd;
|
|
|
|
denominator /= gcd;
|
|
|
|
}
|
2005-11-20 17:12:49 +00:00
|
|
|
|
|
|
|
g_assert (denominator > 0);
|
|
|
|
|
2004-07-15 20:27:20 +00:00
|
|
|
value->data[0].v_int = numerator;
|
|
|
|
value->data[1].v_int = denominator;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_get_fraction_numerator:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @value: a GValue initialized to #GST_TYPE_FRACTION
|
2004-07-15 20:27:20 +00:00
|
|
|
*
|
|
|
|
* Gets the numerator of the fraction specified by @value.
|
|
|
|
*
|
|
|
|
* Returns: the numerator of the fraction.
|
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint
|
2004-07-15 20:27:20 +00:00
|
|
|
gst_value_get_fraction_numerator (const GValue * value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (value), 0);
|
|
|
|
|
|
|
|
return value->data[0].v_int;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_get_fraction_denominator:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @value: a GValue initialized to #GST_TYPE_FRACTION
|
2004-07-15 20:27:20 +00:00
|
|
|
*
|
|
|
|
* Gets the denominator of the fraction specified by @value.
|
|
|
|
*
|
|
|
|
* Returns: the denominator of the fraction.
|
|
|
|
*/
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gint
|
2004-07-15 20:27:20 +00:00
|
|
|
gst_value_get_fraction_denominator (const GValue * value)
|
|
|
|
{
|
2005-11-20 17:12:49 +00:00
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (value), 1);
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
return value->data[1].v_int;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_fraction_multiply:
|
2005-09-11 12:01:12 +00:00
|
|
|
* @product: a GValue initialized to #GST_TYPE_FRACTION
|
|
|
|
* @factor1: a GValue initialized to #GST_TYPE_FRACTION
|
|
|
|
* @factor2: a GValue initialized to #GST_TYPE_FRACTION
|
2004-07-15 20:27:20 +00:00
|
|
|
*
|
|
|
|
* Multiplies the two GValues containing a GstFraction and sets @product
|
|
|
|
* to the product of the two fractions.
|
|
|
|
*
|
|
|
|
* Returns: FALSE in case of an error (like integer overflow), TRUE otherwise.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_value_fraction_multiply (GValue * product, const GValue * factor1,
|
|
|
|
const GValue * factor2)
|
|
|
|
{
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
gint gcd, n1, n2, d1, d2;
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (factor1), FALSE);
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (factor2), FALSE);
|
|
|
|
|
|
|
|
n1 = factor1->data[0].v_int;
|
|
|
|
n2 = factor2->data[0].v_int;
|
|
|
|
d1 = factor1->data[1].v_int;
|
|
|
|
d2 = factor2->data[1].v_int;
|
|
|
|
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
gcd = gst_greatest_common_divisor (n1, d2);
|
|
|
|
n1 /= gcd;
|
|
|
|
d2 /= gcd;
|
|
|
|
gcd = gst_greatest_common_divisor (n2, d1);
|
|
|
|
n2 /= gcd;
|
|
|
|
d1 /= gcd;
|
2004-07-15 20:27:20 +00:00
|
|
|
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
g_return_val_if_fail (n1 == 0 || G_MAXINT / ABS (n1) >= ABS (n2), FALSE);
|
|
|
|
g_return_val_if_fail (G_MAXINT / ABS (d1) >= ABS (d2), FALSE);
|
2004-07-15 20:27:20 +00:00
|
|
|
|
gst/gstvalue.c: use ints and return ints, fractions only use ints, too, so this avoids accidently casting multiplicat...
Original commit message from CVS:
* gst/gstvalue.c: (gst_greatest_common_divisor):
use ints and return ints, fractions only use ints, too, so this
avoids accidently casting multiplications to unsigned
(gst_value_lcopy_fraction): it's ints, not uint32
(gst_value_set_fraction): disallow minint, multiplying and negation
are broken with it
(gst_value_fraction_multiply): fix to make large numbers work and get
rid of the assumption that the multiplication of two ints fits an
int64 - dunno if that's true for all systems
* testsuite/caps/Makefile.am:
* testsuite/caps/fraction-multiply-and-zero.c:
(check_multiplication), (check_equal), (zero_test), (main):
add tests for all the stuff above
* testsuite/caps/value_compare.c: (test1):
fix comment
* tests/.cvsignore:
* testsuite/caps/.cvsignore:
* testsuite/debug/.cvsignore:
* testsuite/dlopen/.cvsignore:
* testsuite/states/.cvsignore:
get up to date
2004-07-16 01:16:53 +00:00
|
|
|
gst_value_set_fraction (product, n1 * n2, d1 * d2);
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
/**
|
|
|
|
* gst_value_fraction_subtract:
|
|
|
|
* @dest: a GValue initialized to #GST_TYPE_FRACTION
|
2005-11-23 14:52:31 +00:00
|
|
|
* @minuend: a GValue initialized to #GST_TYPE_FRACTION
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
* @subtrahend: a GValue initialized to #GST_TYPE_FRACTION
|
|
|
|
*
|
|
|
|
* Subtracts the @subtrahend from the @minuend and sets @dest to the result.
|
|
|
|
*
|
|
|
|
* Returns: FALSE in case of an error (like integer overflow), TRUE otherwise.
|
|
|
|
*/
|
|
|
|
gboolean
|
|
|
|
gst_value_fraction_subtract (GValue * dest,
|
|
|
|
const GValue * minuend, const GValue * subtrahend)
|
|
|
|
{
|
2005-11-22 09:42:17 +00:00
|
|
|
gint n1, n2, d1, d2;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (minuend), FALSE);
|
|
|
|
g_return_val_if_fail (GST_VALUE_HOLDS_FRACTION (subtrahend), FALSE);
|
|
|
|
|
|
|
|
n1 = minuend->data[0].v_int;
|
|
|
|
n2 = subtrahend->data[0].v_int;
|
|
|
|
d1 = minuend->data[1].v_int;
|
|
|
|
d2 = subtrahend->data[1].v_int;
|
|
|
|
|
|
|
|
if (n1 == 0) {
|
|
|
|
gst_value_set_fraction (dest, -n2, d2);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
if (n2 == 0) {
|
|
|
|
gst_value_set_fraction (dest, n1, d1);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
g_return_val_if_fail (n1 == 0 || G_MAXINT / ABS (n1) >= ABS (d2), FALSE);
|
|
|
|
g_return_val_if_fail (G_MAXINT / ABS (d1) >= ABS (n2), FALSE);
|
|
|
|
g_return_val_if_fail (G_MAXINT / ABS (d1) >= ABS (d2), FALSE);
|
|
|
|
|
|
|
|
gst_value_set_fraction (dest, (n1 * d2) - (n2 * d1), d1 * d2);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
2004-07-15 20:27:20 +00:00
|
|
|
gst_value_serialize_fraction (const GValue * value)
|
|
|
|
{
|
|
|
|
gint32 numerator = value->data[0].v_int;
|
|
|
|
gint32 denominator = value->data[1].v_int;
|
|
|
|
gboolean positive = TRUE;
|
|
|
|
|
|
|
|
/* get the sign and make components absolute */
|
|
|
|
if (numerator < 0) {
|
|
|
|
numerator = -numerator;
|
|
|
|
positive = !positive;
|
|
|
|
}
|
|
|
|
if (denominator < 0) {
|
|
|
|
denominator = -denominator;
|
|
|
|
positive = !positive;
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_strdup_printf ("%s%d/%d",
|
|
|
|
positive ? "" : "-", numerator, denominator);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
gst_value_deserialize_fraction (GValue * dest, const gchar * s)
|
2004-07-15 20:27:20 +00:00
|
|
|
{
|
|
|
|
gint num, den;
|
|
|
|
|
2006-05-26 09:19:24 +00:00
|
|
|
if (G_UNLIKELY (s == NULL))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (G_UNLIKELY (dest == NULL || !GST_VALUE_HOLDS_FRACTION (dest)))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (sscanf (s, "%d/%d", &num, &den) == 2) {
|
2005-09-29 12:05:51 +00:00
|
|
|
gst_value_set_fraction (dest, num, den);
|
|
|
|
return TRUE;
|
|
|
|
}
|
2006-05-26 09:19:24 +00:00
|
|
|
if (sscanf (s, "%d", &num) == 1) {
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
gst_value_set_fraction (dest, num, 1);
|
|
|
|
return TRUE;
|
2005-11-22 11:56:01 +00:00
|
|
|
}
|
|
|
|
if (g_ascii_strcasecmp (s, "min") == 0) {
|
|
|
|
gst_value_set_fraction (dest, -G_MAXINT, 1);
|
|
|
|
return TRUE;
|
|
|
|
} else if (g_ascii_strcasecmp (s, "max") == 0) {
|
|
|
|
gst_value_set_fraction (dest, G_MAXINT, 1);
|
|
|
|
return TRUE;
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
}
|
2004-07-15 20:27:20 +00:00
|
|
|
|
2005-09-29 12:05:51 +00:00
|
|
|
return FALSE;
|
2004-07-15 20:27:20 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_fraction_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
|
|
|
dest_value->data[0].v_pointer = gst_value_serialize_fraction (src_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_string_fraction (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
2005-11-20 17:12:49 +00:00
|
|
|
if (!gst_value_deserialize_fraction (dest_value,
|
|
|
|
src_value->data[0].v_pointer))
|
|
|
|
/* If the deserialize fails, ensure we leave the fraction in a
|
|
|
|
* valid, if incorrect, state */
|
|
|
|
gst_value_set_fraction (dest_value, 0, 1);
|
2004-07-15 20:27:20 +00:00
|
|
|
}
|
|
|
|
|
2004-07-27 16:45:30 +00:00
|
|
|
#define MAX_TERMS 30
|
|
|
|
#define MIN_DIVISOR 1.0e-10
|
|
|
|
#define MAX_ERROR 1.0e-20
|
|
|
|
|
|
|
|
/* use continued fractions to transform a double into a fraction,
|
|
|
|
* see http://mathforum.org/dr.math/faq/faq.fractions.html#decfrac.
|
|
|
|
* This algorithm takes care of overflows.
|
|
|
|
*/
|
|
|
|
static void
|
|
|
|
gst_value_transform_double_fraction (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
|
|
|
gdouble V, F; /* double being converted */
|
|
|
|
gint N, D; /* will contain the result */
|
|
|
|
gint A; /* current term in continued fraction */
|
|
|
|
gint64 N1, D1; /* numerator, denominator of last approx */
|
|
|
|
gint64 N2, D2; /* numerator, denominator of previous approx */
|
|
|
|
gint i;
|
|
|
|
gboolean negative = FALSE;
|
|
|
|
|
|
|
|
/* initialize fraction being converted */
|
|
|
|
F = src_value->data[0].v_double;
|
|
|
|
if (F < 0.0) {
|
|
|
|
F = -F;
|
|
|
|
negative = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
V = F;
|
|
|
|
/* initialize fractions with 1/0, 0/1 */
|
|
|
|
N1 = 1;
|
|
|
|
D1 = 0;
|
|
|
|
N2 = 0;
|
|
|
|
D2 = 1;
|
|
|
|
N = 1;
|
|
|
|
D = 1;
|
|
|
|
|
|
|
|
for (i = 0; i < MAX_TERMS; i++) {
|
|
|
|
/* get next term */
|
2005-12-12 10:59:12 +00:00
|
|
|
A = (gint) F; /* no floor() needed, F is always >= 0 */
|
2004-07-27 16:45:30 +00:00
|
|
|
/* get new divisor */
|
|
|
|
F = F - A;
|
|
|
|
|
|
|
|
/* calculate new fraction in temp */
|
|
|
|
N2 = N1 * A + N2;
|
|
|
|
D2 = D1 * A + D2;
|
|
|
|
|
|
|
|
/* guard against overflow */
|
|
|
|
if (N2 > G_MAXINT || D2 > G_MAXINT) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
N = N2;
|
|
|
|
D = D2;
|
|
|
|
|
|
|
|
/* save last two fractions */
|
|
|
|
N2 = N1;
|
|
|
|
D2 = D1;
|
|
|
|
N1 = N;
|
|
|
|
D1 = D;
|
|
|
|
|
|
|
|
/* quit if dividing by zero or close enough to target */
|
|
|
|
if (F < MIN_DIVISOR || fabs (V - ((gdouble) N) / D) < MAX_ERROR) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Take reciprocal */
|
|
|
|
F = 1 / F;
|
|
|
|
}
|
|
|
|
/* fix for overflow */
|
|
|
|
if (D == 0) {
|
|
|
|
N = G_MAXINT;
|
|
|
|
D = 1;
|
|
|
|
}
|
|
|
|
/* fix for negative */
|
|
|
|
if (negative)
|
|
|
|
N = -N;
|
|
|
|
|
|
|
|
/* will also simplify */
|
|
|
|
gst_value_set_fraction (dest_value, N, D);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_fraction_double (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
|
|
|
dest_value->data[0].v_double = ((double) src_value->data[0].v_int) /
|
|
|
|
((double) src_value->data[1].v_int);
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
2004-07-15 20:27:20 +00:00
|
|
|
gst_value_compare_fraction (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
gint n1, n2;
|
|
|
|
gint d1, d2;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
gint64 new_num_1;
|
|
|
|
gint64 new_num_2;
|
2004-07-15 20:27:20 +00:00
|
|
|
|
|
|
|
n1 = value1->data[0].v_int;
|
|
|
|
n2 = value2->data[0].v_int;
|
|
|
|
d1 = value1->data[1].v_int;
|
|
|
|
d2 = value2->data[1].v_int;
|
|
|
|
|
|
|
|
/* fractions are reduced when set, so we can quickly see if they're equal */
|
|
|
|
if (n1 == n2 && d1 == d2)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
/* extend to 64 bits */
|
|
|
|
new_num_1 = ((gint64) n1) * d2;
|
|
|
|
new_num_2 = ((gint64) n2) * d1;
|
2004-07-15 20:27:20 +00:00
|
|
|
if (new_num_1 < new_num_2)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
if (new_num_1 > new_num_2)
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
check/gst/gstvalue.c: Added subtract checks.
Original commit message from CVS:
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
Added subtract checks.
* docs/design/part-events.txt:
Some more docs about newsegment
* gst/gstbin.c: (gst_bin_change_state), (bin_bus_handler):
Fix FIXME
* gst/gstcaps.c: (gst_caps_to_string):
Add comments, cleanups.
* gst/gstelement.c: (gst_element_save_thyself):
cleanups
* gst/gstvalue.c: (gst_value_collect_int_range),
(gst_string_unwrap), (gst_value_union_int_int_range),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_double_range),
(gst_value_intersect_double_range_double_range),
(gst_value_intersect_list), (gst_value_subtract_int_int_range),
(gst_value_subtract_int_range_int),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_compare), (gst_value_compare_fraction):
Cleanups, add comments, remove unneeded asserts.
2005-08-16 09:42:50 +00:00
|
|
|
|
2005-11-20 17:12:49 +00:00
|
|
|
/* new_num_1 == new_num_2 implies that both denominators must have
|
|
|
|
* been 0, beause otherwise simplification would have caught the
|
|
|
|
* equivalence */
|
2004-07-15 20:27:20 +00:00
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
/*********
|
|
|
|
* GDate *
|
|
|
|
*********/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_set_date:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_DATE
|
2005-09-23 16:35:43 +00:00
|
|
|
* @date: the date to set the value to
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
*
|
|
|
|
* Sets the contents of @value to coorespond to @date. The actual
|
|
|
|
* #GDate structure is copied before it is used.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
gst_value_set_date (GValue * value, const GDate * date)
|
|
|
|
{
|
|
|
|
g_return_if_fail (G_VALUE_TYPE (value) == GST_TYPE_DATE);
|
2006-10-18 08:54:30 +00:00
|
|
|
g_return_if_fail (g_date_valid (date));
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
|
|
|
|
g_value_set_boxed (value, date);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* gst_value_get_date:
|
|
|
|
* @value: a GValue initialized to GST_TYPE_DATE
|
|
|
|
*
|
|
|
|
* Gets the contents of @value.
|
|
|
|
*
|
|
|
|
* Returns: the contents of @value
|
|
|
|
*/
|
|
|
|
const GDate *
|
|
|
|
gst_value_get_date (const GValue * value)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (G_VALUE_TYPE (value) == GST_TYPE_DATE, NULL);
|
|
|
|
|
|
|
|
return (const GDate *) g_value_get_boxed (value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static gpointer
|
|
|
|
gst_date_copy (gpointer boxed)
|
|
|
|
{
|
|
|
|
const GDate *date = (const GDate *) boxed;
|
|
|
|
|
2006-10-18 08:54:30 +00:00
|
|
|
if (!g_date_valid (date)) {
|
|
|
|
GST_WARNING ("invalid GDate");
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
return g_date_new_julian (g_date_get_julian (date));
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gint
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
gst_value_compare_date (const GValue * value1, const GValue * value2)
|
|
|
|
{
|
|
|
|
const GDate *date1 = (const GDate *) g_value_get_boxed (value1);
|
|
|
|
const GDate *date2 = (const GDate *) g_value_get_boxed (value2);
|
|
|
|
guint32 j1, j2;
|
|
|
|
|
|
|
|
if (date1 == date2)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
|
|
|
|
if ((date1 == NULL || !g_date_valid (date1))
|
|
|
|
&& (date2 != NULL && g_date_valid (date2))) {
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ((date2 == NULL || !g_date_valid (date2))
|
|
|
|
&& (date1 != NULL && g_date_valid (date1))) {
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (date1 == NULL || date2 == NULL || !g_date_valid (date1)
|
|
|
|
|| !g_date_valid (date2)) {
|
|
|
|
return GST_VALUE_UNORDERED;
|
|
|
|
}
|
|
|
|
|
|
|
|
j1 = g_date_get_julian (date1);
|
|
|
|
j2 = g_date_get_julian (date2);
|
|
|
|
|
|
|
|
if (j1 == j2)
|
|
|
|
return GST_VALUE_EQUAL;
|
|
|
|
else if (j1 < j2)
|
|
|
|
return GST_VALUE_LESS_THAN;
|
|
|
|
else
|
|
|
|
return GST_VALUE_GREATER_THAN;
|
|
|
|
}
|
|
|
|
|
gst/gstvalue.*: Use gint, gdouble and gchar in our API instead of int, double and char (and make usage in gstvalue.c ...
Original commit message from CVS:
* gst/gstvalue.c: (gst_value_serialize_any_list),
(gst_value_transform_any_list_string),
(gst_value_deserialize_list), (gst_value_deserialize_array),
(gst_value_set_int_range), (gst_value_deserialize_int_range),
(gst_value_set_double_range), (gst_value_deserialize_double_range),
(gst_value_set_fraction_range_full),
(gst_value_deserialize_fraction_range),
(gst_value_deserialize_caps), (gst_value_deserialize_buffer),
(gst_value_deserialize_boolean),
(gst_value_deserialize_int_helper), (gst_value_deserialize_double),
(gst_value_serialize_float), (gst_value_deserialize_float),
(gst_string_wrap), (gst_value_deserialize_string),
(gst_value_deserialize_enum), (gst_value_deserialize_flags),
(gst_value_union_int_range_int_range),
(gst_value_intersect_int_range_int_range),
(gst_value_intersect_double_range_double_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double_range),
(gst_value_deserialize_fraction):
* gst/gstvalue.h:
Use gint, gdouble and gchar in our API instead of int, double and
char (and make usage in gstvalue.c more consistent).
2005-11-27 18:11:02 +00:00
|
|
|
static gchar *
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
gst_value_serialize_date (const GValue * val)
|
|
|
|
{
|
|
|
|
const GDate *date = (const GDate *) g_value_get_boxed (val);
|
|
|
|
|
|
|
|
if (date == NULL || !g_date_valid (date))
|
|
|
|
return g_strdup ("9999-99-99");
|
|
|
|
|
|
|
|
return g_strdup_printf ("%04u-%02u-%02u", g_date_get_year (date),
|
|
|
|
g_date_get_month (date), g_date_get_day (date));
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_value_deserialize_date (GValue * dest, const char *s)
|
|
|
|
{
|
|
|
|
guint year, month, day;
|
|
|
|
|
|
|
|
if (!s || sscanf (s, "%04u-%02u-%02u", &year, &month, &day) != 3)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
if (!g_date_valid_dmy (day, month, year))
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
g_value_take_boxed (dest, g_date_new_dmy (day, month, year));
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_date_string (const GValue * src_value, GValue * dest_value)
|
|
|
|
{
|
|
|
|
dest_value->data[0].v_pointer = gst_value_serialize_date (src_value);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_value_transform_string_date (const GValue * src_value, GValue * dest_value)
|
|
|
|
{
|
|
|
|
gst_value_deserialize_date (dest_value, src_value->data[0].v_pointer);
|
|
|
|
}
|
|
|
|
|
2007-02-28 16:57:49 +00:00
|
|
|
static void
|
|
|
|
gst_value_transform_object_string (const GValue * src_value,
|
|
|
|
GValue * dest_value)
|
|
|
|
{
|
|
|
|
GstObject *obj;
|
|
|
|
gchar *str;
|
|
|
|
|
|
|
|
obj = g_value_get_object (src_value);
|
|
|
|
str = obj ? GST_OBJECT_NAME (obj) : "NULL";
|
|
|
|
|
|
|
|
dest_value->data[0].v_pointer = g_strdup (str);
|
|
|
|
}
|
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
static GTypeInfo _info = {
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
static GTypeFundamentalInfo _finfo = {
|
|
|
|
0
|
|
|
|
};
|
|
|
|
|
2005-12-06 19:29:15 +00:00
|
|
|
#define FUNC_VALUE_GET_TYPE(type, name) \
|
|
|
|
GType gst_ ## type ## _get_type (void) \
|
|
|
|
{ \
|
|
|
|
static GType gst_ ## type ## _type = 0; \
|
|
|
|
\
|
2006-02-28 10:52:02 +00:00
|
|
|
if (G_UNLIKELY (gst_ ## type ## _type == 0)) { \
|
2005-12-06 19:29:15 +00:00
|
|
|
_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; \
|
2005-10-15 17:59:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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");
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
static const GTypeValueTable _gst_fraction_range_value_table = {
|
|
|
|
gst_value_init_fraction_range,
|
|
|
|
gst_value_free_fraction_range,
|
|
|
|
gst_value_copy_fraction_range,
|
|
|
|
NULL,
|
|
|
|
"iiii",
|
|
|
|
gst_value_collect_fraction_range,
|
|
|
|
"pppp",
|
|
|
|
gst_value_lcopy_fraction_range
|
|
|
|
};
|
|
|
|
|
|
|
|
FUNC_VALUE_GET_TYPE (fraction_range, "GstFractionRange");
|
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
static const GTypeValueTable _gst_value_list_value_table = {
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_init_list_or_array,
|
|
|
|
gst_value_free_list_or_array,
|
|
|
|
gst_value_copy_list_or_array,
|
|
|
|
gst_value_list_or_array_peek_pointer,
|
2005-10-15 17:59:07 +00:00
|
|
|
"p",
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_collect_list_or_array,
|
2005-10-15 17:59:07 +00:00
|
|
|
"p",
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_lcopy_list_or_array
|
2005-10-15 17:59:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
FUNC_VALUE_GET_TYPE (value_list, "GstValueList");
|
|
|
|
|
|
|
|
static const GTypeValueTable _gst_value_array_value_table = {
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_init_list_or_array,
|
|
|
|
gst_value_free_list_or_array,
|
|
|
|
gst_value_copy_list_or_array,
|
|
|
|
gst_value_list_or_array_peek_pointer,
|
2005-10-15 17:59:07 +00:00
|
|
|
"p",
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_collect_list_or_array,
|
2005-10-15 17:59:07 +00:00
|
|
|
"p",
|
2005-11-19 16:46:30 +00:00
|
|
|
gst_value_lcopy_list_or_array
|
2005-10-15 17:59:07 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
2006-06-12 08:55:21 +00:00
|
|
|
if (G_UNLIKELY (gst_date_type == 0)) {
|
configure.ac: comment about refining the xml deps
Original commit message from CVS:
* configure.ac:
comment about refining the xml deps
* docs/manuals.mak:
comments about moving away from jade for docs
* gst/gst.c:
recommit the ifdefs to use the binary registry
* gst/gstbin.c: (gst_bin_change_state_func):
this break is obsolete
* gst/gstelementfactory.h:
better GST_ELEMENT_DETAILS docs, add comment about translation
* gst/gstinfo.h:
remove eol slash
* gst/gstobject.c: (gst_signal_object_get_type):
add G_UNLIKELY as usual
* gst/gstpad.c: (gst_pad_event_default):
add fall trhu comment
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_save_string),
(gst_registry_binary_save_pad_template),
(gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic),
(gst_registry_binary_load_pad_template),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin),
(gst_registry_binary_read_cache):
comment typo and formatting
* gst/gstutils.c: (gst_element_state_get_name),
(gst_element_state_change_return_get_name):
remove obsolete breaks
* gst/gstvalue.c: (gst_date_get_type), (_gst_value_initialize):
add FIXME 0.11 and remove cpp comment
2007-01-29 15:54:09 +00:00
|
|
|
/* FIXME 0.11: we require GLib 2.8 already
|
|
|
|
* Not using G_TYPE_DATE here on purpose, even if we could
|
2005-10-15 17:59:07 +00:00
|
|
|
* if GLIB_CHECK_VERSION(2,8,0) was true: we don't want the
|
|
|
|
* serialised strings to have different type strings depending
|
configure.ac: comment about refining the xml deps
Original commit message from CVS:
* configure.ac:
comment about refining the xml deps
* docs/manuals.mak:
comments about moving away from jade for docs
* gst/gst.c:
recommit the ifdefs to use the binary registry
* gst/gstbin.c: (gst_bin_change_state_func):
this break is obsolete
* gst/gstelementfactory.h:
better GST_ELEMENT_DETAILS docs, add comment about translation
* gst/gstinfo.h:
remove eol slash
* gst/gstobject.c: (gst_signal_object_get_type):
add G_UNLIKELY as usual
* gst/gstpad.c: (gst_pad_event_default):
add fall trhu comment
* gst/gstregistrybinary.c: (gst_registry_binary_write),
(gst_registry_binary_initialize_magic),
(gst_registry_binary_save_string),
(gst_registry_binary_save_pad_template),
(gst_registry_binary_save_feature),
(gst_registry_binary_save_plugin),
(gst_registry_binary_write_cache),
(gst_registry_binary_check_magic),
(gst_registry_binary_load_pad_template),
(gst_registry_binary_load_feature),
(gst_registry_binary_load_plugin),
(gst_registry_binary_read_cache):
comment typo and formatting
* gst/gstutils.c: (gst_element_state_get_name),
(gst_element_state_change_return_get_name):
remove obsolete breaks
* gst/gstvalue.c: (gst_date_get_type), (_gst_value_initialize):
add FIXME 0.11 and remove cpp comment
2007-01-29 15:54:09 +00:00
|
|
|
* on what version is used, so FIXME when we require GLib-2.8 */
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_date_type = g_boxed_type_register_static ("GstDate",
|
|
|
|
(GBoxedCopyFunc) gst_date_copy, (GBoxedFreeFunc) g_date_free);
|
|
|
|
}
|
|
|
|
|
|
|
|
return gst_date_type;
|
|
|
|
}
|
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
void
|
|
|
|
_gst_value_initialize (void)
|
|
|
|
{
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_table = g_array_new (FALSE, FALSE, sizeof (GstValueTable));
|
|
|
|
gst_value_union_funcs = g_array_new (FALSE, FALSE,
|
|
|
|
sizeof (GstValueUnionInfo));
|
|
|
|
gst_value_intersect_funcs = g_array_new (FALSE, FALSE,
|
|
|
|
sizeof (GstValueIntersectInfo));
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
gst_value_subtract_funcs = g_array_new (FALSE, FALSE,
|
|
|
|
sizeof (GstValueSubtractInfo));
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
{
|
2003-12-23 20:58:05 +00:00
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_fourcc,
|
|
|
|
gst_value_serialize_fourcc,
|
|
|
|
gst_value_deserialize_fourcc,
|
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_fourcc_get_type ();
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_register (&gst_value);
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
2003-12-23 20:58:05 +00:00
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_int_range,
|
|
|
|
gst_value_serialize_int_range,
|
|
|
|
gst_value_deserialize_int_range,
|
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_int_range_get_type ();
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_register (&gst_value);
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2003-12-23 20:58:05 +00:00
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_double_range,
|
|
|
|
gst_value_serialize_double_range,
|
|
|
|
gst_value_deserialize_double_range,
|
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_double_range_get_type ();
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_register (&gst_value);
|
2003-11-24 02:09:23 +00:00
|
|
|
}
|
2004-03-13 15:27:01 +00:00
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
{
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_fraction_range,
|
|
|
|
gst_value_serialize_fraction_range,
|
|
|
|
gst_value_deserialize_fraction_range,
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_value.type = gst_fraction_range_get_type ();
|
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
{
|
2003-12-23 20:58:05 +00:00
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
2006-07-11 20:14:20 +00:00
|
|
|
gst_value_compare_list,
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_serialize_list,
|
|
|
|
gst_value_deserialize_list,
|
|
|
|
};
|
2004-03-15 19:27:17 +00:00
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_value_list_get_type ();
|
2003-12-23 20:58:05 +00:00
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
|
|
|
|
2004-05-20 17:03:02 +00:00
|
|
|
{
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
2006-07-11 20:14:20 +00:00
|
|
|
gst_value_compare_array,
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
gst_value_serialize_array,
|
|
|
|
gst_value_deserialize_array,
|
2004-05-20 17:03:02 +00:00
|
|
|
};
|
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_value_array_get_type ();;
|
2004-05-20 17:03:02 +00:00
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
|
|
|
|
2004-04-13 02:22:02 +00:00
|
|
|
{
|
|
|
|
#if 0
|
|
|
|
static const GTypeValueTable value_table = {
|
|
|
|
gst_value_init_buffer,
|
|
|
|
NULL,
|
|
|
|
gst_value_copy_buffer,
|
|
|
|
NULL,
|
|
|
|
"i",
|
|
|
|
NULL, /*gst_value_collect_buffer, */
|
|
|
|
"p",
|
|
|
|
NULL /*gst_value_lcopy_buffer */
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
2004-04-23 01:20:59 +00:00
|
|
|
gst_value_compare_buffer,
|
2004-04-13 02:22:02 +00:00
|
|
|
gst_value_serialize_buffer,
|
|
|
|
gst_value_deserialize_buffer,
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_value.type = GST_TYPE_BUFFER;
|
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
2004-07-15 20:27:20 +00:00
|
|
|
{
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_fraction,
|
|
|
|
gst_value_serialize_fraction,
|
|
|
|
gst_value_deserialize_fraction,
|
|
|
|
};
|
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_fraction_get_type ();
|
2004-07-15 20:27:20 +00:00
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
2005-04-24 21:16:45 +00:00
|
|
|
{
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
NULL,
|
|
|
|
gst_value_serialize_caps,
|
|
|
|
gst_value_deserialize_caps,
|
|
|
|
};
|
|
|
|
|
|
|
|
gst_value.type = GST_TYPE_CAPS;
|
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
{
|
|
|
|
static GstValueTable gst_value = {
|
|
|
|
0,
|
|
|
|
gst_value_compare_date,
|
|
|
|
gst_value_serialize_date,
|
|
|
|
gst_value_deserialize_date,
|
|
|
|
};
|
|
|
|
|
2005-10-15 17:59:07 +00:00
|
|
|
gst_value.type = gst_date_get_type ();
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
gst_value_register (&gst_value);
|
|
|
|
}
|
2004-04-13 02:22:02 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_DOUBLE, double);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_FLOAT, float);
|
2004-03-15 19:27:17 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_STRING, string);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_BOOLEAN, boolean);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_ENUM, enum);
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2005-05-10 14:50:55 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_FLAGS, flags);
|
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_INT, int);
|
2004-03-15 19:27:17 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_INT64, int64);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_LONG, long);
|
2003-12-23 20:58:05 +00:00
|
|
|
|
gst/gstvalue.c: add serialization and comparison functions for long, int64, enum and float values
Original commit message from CVS:
* gst/gstvalue.c: (gst_strtoll), (CREATE_SERIALIZATION),
(CREATE_USERIALIZATION), (_gst_value_initialize),
(gst_value_compare_float), (gst_value_serialize_float),
(gst_value_deserialize_float), (gst_value_compare_enum),
(gst_value_serialize_enum), (gst_value_deserialize_enum):
add serialization and comparison functions for long, int64, enum and
float values
* gst/gstvalue.c: (gst_value_serialize), (gst_value_deserialize):
use best serialization function in type hierarchy instead of only a
matching one. This is required for enums to work.
* gst/parse/grammar.y:
use gst_caps_deserialize
* testsuite/parse/Makefile.am:
parse1 now works
* testsuite/parse/parse1.c: (main):
remove aggregator check, aggregator is broken, this test works now
but fails because of bug #138012
* testsuite/parse/parse2.c: (main):
s/xvideosink/xvimagesink - this test looks a lot like we should
disable it
2004-05-18 01:36:14 +00:00
|
|
|
REGISTER_SERIALIZATION (G_TYPE_UINT, uint);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_UINT64, uint64);
|
|
|
|
REGISTER_SERIALIZATION (G_TYPE_ULONG, ulong);
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_FOURCC, G_TYPE_STRING,
|
|
|
|
gst_value_transform_fourcc_string);
|
|
|
|
g_value_register_transform_func (GST_TYPE_INT_RANGE, G_TYPE_STRING,
|
|
|
|
gst_value_transform_int_range_string);
|
2003-11-29 06:31:10 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_DOUBLE_RANGE, G_TYPE_STRING,
|
|
|
|
gst_value_transform_double_range_string);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_FRACTION_RANGE, G_TYPE_STRING,
|
|
|
|
gst_value_transform_fraction_range_string);
|
2003-11-29 06:31:10 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_LIST, G_TYPE_STRING,
|
|
|
|
gst_value_transform_list_string);
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_ARRAY, G_TYPE_STRING,
|
|
|
|
gst_value_transform_array_string);
|
2004-07-15 20:27:20 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_FRACTION, G_TYPE_STRING,
|
|
|
|
gst_value_transform_fraction_string);
|
|
|
|
g_value_register_transform_func (G_TYPE_STRING, GST_TYPE_FRACTION,
|
|
|
|
gst_value_transform_string_fraction);
|
2004-07-27 16:45:30 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_FRACTION, G_TYPE_DOUBLE,
|
|
|
|
gst_value_transform_fraction_double);
|
|
|
|
g_value_register_transform_func (G_TYPE_DOUBLE, GST_TYPE_FRACTION,
|
|
|
|
gst_value_transform_double_fraction);
|
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual bunch of utility functions along with a hack that che...
Original commit message from CVS:
* docs/gst/gstreamer-sections.txt:
* gst/gststructure.c: (gst_structure_set_valist),
(gst_structure_get_date):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_set_date), (gst_value_get_date),
(gst_date_copy), (gst_value_compare_date),
(gst_value_serialize_date), (gst_value_deserialize_date),
(gst_value_transform_date_string),
(gst_value_transform_string_date), (_gst_value_initialize):
* gst/gstvalue.h:
Add GST_TYPE_DATE, a boxed type that wraps GDate, and the usual
bunch of utility functions along with a hack that checks that
developers don't accidentally use G_TYPE_DATE where GST_TYPE_DATE
is required. Part of the grand scheme in #170777.
2005-09-22 15:08:02 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_DATE, G_TYPE_STRING,
|
|
|
|
gst_value_transform_date_string);
|
|
|
|
g_value_register_transform_func (G_TYPE_STRING, GST_TYPE_DATE,
|
|
|
|
gst_value_transform_string_date);
|
2007-02-28 16:57:49 +00:00
|
|
|
g_value_register_transform_func (GST_TYPE_OBJECT, G_TYPE_STRING,
|
|
|
|
gst_value_transform_object_string);
|
2003-11-04 19:00:54 +00:00
|
|
|
|
|
|
|
gst_value_register_intersect_func (G_TYPE_INT, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_intersect_int_int_range);
|
|
|
|
gst_value_register_intersect_func (GST_TYPE_INT_RANGE, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_intersect_int_range_int_range);
|
2003-12-22 01:39:35 +00:00
|
|
|
gst_value_register_intersect_func (G_TYPE_DOUBLE, GST_TYPE_DOUBLE_RANGE,
|
|
|
|
gst_value_intersect_double_double_range);
|
2004-03-13 15:27:01 +00:00
|
|
|
gst_value_register_intersect_func (GST_TYPE_DOUBLE_RANGE,
|
|
|
|
GST_TYPE_DOUBLE_RANGE, gst_value_intersect_double_range_double_range);
|
GstElement::new-pad -> pad-added, GstElement::state-change -> state-changed, GstValueFixedList -> GstValueArray, add ...
Original commit message from CVS:
* docs/manual/advanced-autoplugging.xml:
* docs/manual/basics-helloworld.xml:
* docs/manual/basics-pads.xml:
* docs/random/ds/0.9-suggested-changes:
* gst/gstelement.c: (gst_element_class_init), (gst_element_seek):
* gst/gstelement.h:
* gst/gstevent.h:
* gst/gstformat.h:
* gst/gstquery.h:
* gst/gststructure.c: (gst_structure_value_get_generic_type),
(gst_structure_parse_array), (gst_structure_parse_value):
* gst/gstvalue.c: (gst_type_is_fixed),
(gst_value_list_prepend_value), (gst_value_list_append_value),
(gst_value_list_get_size), (gst_value_list_get_value),
(gst_value_transform_array_string), (gst_value_serialize_array),
(gst_value_deserialize_array), (gst_value_intersect_array),
(gst_value_is_fixed), (_gst_value_initialize):
* gst/gstvalue.h:
GstElement::new-pad -> pad-added, GstElement::state-change ->
state-changed, GstValueFixedList -> GstValueArray, add format and
flags as their own arguments in gst_element_seek() (should improve
"bindeability"), remove function generators since they don't work
under a whole bunch of compilers (they were deprecated already
anyway).
2005-07-20 17:16:44 +00:00
|
|
|
gst_value_register_intersect_func (GST_TYPE_ARRAY,
|
|
|
|
GST_TYPE_ARRAY, gst_value_intersect_array);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
gst_value_register_intersect_func (GST_TYPE_FRACTION, GST_TYPE_FRACTION_RANGE,
|
|
|
|
gst_value_intersect_fraction_fraction_range);
|
|
|
|
gst_value_register_intersect_func (GST_TYPE_FRACTION_RANGE,
|
|
|
|
GST_TYPE_FRACTION_RANGE,
|
|
|
|
gst_value_intersect_fraction_range_fraction_range);
|
2004-03-31 21:49:19 +00:00
|
|
|
|
gst/gstcaps.c: check for ANY caps before appending/unioning
Original commit message from CVS:
* gst/gstcaps.c: (gst_caps_append), (gst_caps_union):
check for ANY caps before appending/unioning
* gst/gstcaps.c: (gst_caps_is_subset),
(gst_caps_is_equal), (gst_caps_structure_subtract_field),
(gst_caps_structure_subtract), (gst_caps_subtract):
* gst/gstcaps.h:
add gst_caps_is_equal, gst_caps_is_subset and gst_caps_subtract to
the API. deprecate gst_caps_is_equal_fixed
* gst/gstpad.c: (gst_pad_try_set_caps):
* gst/gstqueue.c: (gst_queue_link):
s/gst_caps_is_equal_fixed/gst_caps_is_equal/
* gst/gststructure.c: (gst_structure_get_name_id):
* gst/gststructure.h:
add function gst_structure_get_name_id
* gst/gstvalue.c: (gst_value_subtract_int_int_range),
(gst_value_create_new_range), (gst_value_subtract_int_range_int),
(gst_value_subtract_int_range_int_range),
(gst_value_subtract_double_double_range),
(gst_value_subtract_double_range_double),
(gst_value_subtract_double_range_double_range),
(gst_value_subtract_from_list), (gst_value_subtract_list),
(gst_value_can_intersect), (gst_value_subtract),
(gst_value_can_subtract), (gst_value_register_subtract_func),
(_gst_value_initialize):
* gst/gstvalue.h:
add support for subtracting values from each other. Note that
subtracting means subtracting as in set theory. Required for caps
stuff above.
* testsuite/caps/.cvsignore:
* testsuite/caps/Makefile.am:
* testsuite/caps/erathostenes.c: (erathostenes), (main):
* testsuite/caps/sets.c: (check_caps), (main):
* testsuite/caps/subtract.c: (check_caps), (main):
add tests for subtraction and equality code.
2004-04-21 03:25:13 +00:00
|
|
|
gst_value_register_subtract_func (G_TYPE_INT, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_subtract_int_int_range);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_INT_RANGE, G_TYPE_INT,
|
|
|
|
gst_value_subtract_int_range_int);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_INT_RANGE, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_subtract_int_range_int_range);
|
|
|
|
gst_value_register_subtract_func (G_TYPE_DOUBLE, GST_TYPE_DOUBLE_RANGE,
|
|
|
|
gst_value_subtract_double_double_range);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_DOUBLE_RANGE, G_TYPE_DOUBLE,
|
|
|
|
gst_value_subtract_double_range_double);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_DOUBLE_RANGE,
|
|
|
|
GST_TYPE_DOUBLE_RANGE, gst_value_subtract_double_range_double_range);
|
|
|
|
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
gst_value_register_subtract_func (GST_TYPE_FRACTION, GST_TYPE_FRACTION_RANGE,
|
|
|
|
gst_value_subtract_fraction_fraction_range);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_FRACTION_RANGE, GST_TYPE_FRACTION,
|
|
|
|
gst_value_subtract_fraction_range_fraction);
|
|
|
|
gst_value_register_subtract_func (GST_TYPE_FRACTION_RANGE,
|
|
|
|
GST_TYPE_FRACTION_RANGE,
|
|
|
|
gst_value_subtract_fraction_range_fraction_range);
|
|
|
|
|
2005-09-26 16:07:54 +00:00
|
|
|
/* see bug #317246, #64994, #65041 */
|
2005-09-26 16:19:27 +00:00
|
|
|
{
|
|
|
|
volatile GType date_type = G_TYPE_DATE;
|
|
|
|
|
2006-01-07 10:04:36 +00:00
|
|
|
g_type_name (date_type);
|
2005-09-26 16:19:27 +00:00
|
|
|
}
|
2005-09-26 15:43:30 +00:00
|
|
|
|
2004-03-31 21:49:19 +00:00
|
|
|
gst_value_register_union_func (G_TYPE_INT, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_union_int_int_range);
|
|
|
|
gst_value_register_union_func (GST_TYPE_INT_RANGE, GST_TYPE_INT_RANGE,
|
|
|
|
gst_value_union_int_range_int_range);
|
Implement fraction ranges and extend GstFraction to support arithmetic subtraction, as well as deserialization from i...
Original commit message from CVS:
* check/gst/capslist.h:
* check/gst/gstcaps.c: (GST_START_TEST):
* check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
* gst/gststructure.c: (gst_structure_parse_range),
(gst_structure_fixate_field_nearest_fraction):
* gst/gststructure.h:
* gst/gstvalue.c: (gst_value_init_fraction_range),
(gst_value_free_fraction_range), (gst_value_copy_fraction_range),
(gst_value_collect_fraction_range),
(gst_value_lcopy_fraction_range), (gst_value_set_fraction_range),
(gst_value_set_fraction_range_full),
(gst_value_get_fraction_range_min),
(gst_value_get_fraction_range_max),
(gst_value_serialize_fraction_range),
(gst_value_transform_fraction_range_string),
(gst_value_compare_fraction_range),
(gst_value_deserialize_fraction_range),
(gst_value_intersect_fraction_fraction_range),
(gst_value_intersect_fraction_range_fraction_range),
(gst_value_subtract_fraction_fraction_range),
(gst_value_subtract_fraction_range_fraction),
(gst_value_subtract_fraction_range_fraction_range),
(gst_value_collect_fraction), (gst_value_fraction_multiply),
(gst_value_fraction_subtract), (gst_value_deserialize_fraction),
(gst_value_transform_string_fraction), (_gst_value_initialize):
* gst/gstvalue.h:
Implement fraction ranges and extend GstFraction to support
arithmetic subtraction, as well as deserialization from integer
strings such as "100"
Add a testsuite as for int and double range set operations
2005-11-21 23:54:59 +00:00
|
|
|
|
|
|
|
#if 0
|
|
|
|
/* Implement these if needed */
|
|
|
|
gst_value_register_union_func (GST_TYPE_FRACTION, GST_TYPE_FRACTION_RANGE,
|
|
|
|
gst_value_union_fraction_fraction_range);
|
|
|
|
gst_value_register_union_func (GST_TYPE_FRACTION_RANGE,
|
|
|
|
GST_TYPE_FRACTION_RANGE, gst_value_union_fraction_range_fraction_range);
|
|
|
|
#endif
|
2003-11-03 09:10:07 +00:00
|
|
|
}
|