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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __GST_VALUE_H__
|
|
|
|
#define __GST_VALUE_H__
|
|
|
|
|
|
|
|
#include <gst/gstconfig.h>
|
2003-12-22 01:58:20 +00:00
|
|
|
#include <gst/gstcaps.h>
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
|
|
|
typedef int (* GstValueCompareFunc) (const GValue *value1,
|
|
|
|
const GValue *value2);
|
|
|
|
typedef char * (* GstValueSerializeFunc) (const GValue *value1);
|
|
|
|
typedef gboolean (* GstValueDeserializeFunc) (GValue *dest, const char *s);
|
|
|
|
typedef int (* GstValueUnionFunc) (GValue *dest, const GValue *value1,
|
|
|
|
const GValue *value2);
|
|
|
|
typedef int (* GstValueIntersectFunc) (GValue *dest, const GValue *value1,
|
|
|
|
const GValue *value2);
|
2003-11-04 19:00:54 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
typedef struct _GstValueTable GstValueTable;
|
2004-03-15 14:43:35 +00:00
|
|
|
struct _GstValueTable {
|
2003-12-23 20:58:05 +00:00
|
|
|
GType type;
|
|
|
|
GstValueCompareFunc compare;
|
|
|
|
GstValueSerializeFunc serialize;
|
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
|
|
|
GstValueDeserializeFunc deserialize;
|
2003-12-23 20:58:05 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void *_gst_reserved [GST_PADDING];
|
2003-12-23 20:58:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2003-11-24 02:09:23 +00:00
|
|
|
#define GST_MAKE_FOURCC(a,b,c,d) (guint32)((a)|(b)<<8|(c)<<16|(d)<<24)
|
|
|
|
#define GST_STR_FOURCC(f) (guint32)(((f)[0])|((f)[1]<<8)|((f)[2]<<16)|((f)[3]<<24))
|
|
|
|
|
|
|
|
#define GST_FOURCC_FORMAT "%c%c%c%c"
|
|
|
|
#define GST_FOURCC_ARGS(fourcc) \
|
|
|
|
((gchar) ((fourcc) &0xff)), \
|
|
|
|
((gchar) (((fourcc)>>8 )&0xff)), \
|
|
|
|
((gchar) (((fourcc)>>16)&0xff)), \
|
|
|
|
((gchar) (((fourcc)>>24)&0xff))
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-11-29 06:31:10 +00:00
|
|
|
#define GST_VALUE_HOLDS_FOURCC(x) (G_VALUE_HOLDS(x, gst_type_fourcc))
|
|
|
|
#define GST_VALUE_HOLDS_INT_RANGE(x) (G_VALUE_HOLDS(x, gst_type_int_range))
|
|
|
|
#define GST_VALUE_HOLDS_DOUBLE_RANGE(x) (G_VALUE_HOLDS(x, gst_type_double_range))
|
|
|
|
#define GST_VALUE_HOLDS_LIST(x) (G_VALUE_HOLDS(x, gst_type_list))
|
2004-02-20 00:38:24 +00:00
|
|
|
#define GST_VALUE_HOLDS_CAPS(x) (G_VALUE_HOLDS(x, GST_TYPE_CAPS))
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
#define GST_TYPE_FOURCC gst_type_fourcc
|
|
|
|
#define GST_TYPE_INT_RANGE gst_type_int_range
|
|
|
|
#define GST_TYPE_DOUBLE_RANGE gst_type_double_range
|
2003-11-29 06:31:10 +00:00
|
|
|
#define GST_TYPE_LIST gst_type_list
|
2003-11-24 02:09:23 +00:00
|
|
|
|
|
|
|
#define GST_VALUE_LESS_THAN (-1)
|
|
|
|
#define GST_VALUE_EQUAL 0
|
|
|
|
#define GST_VALUE_GREATER_THAN 1
|
|
|
|
#define GST_VALUE_UNORDERED 2
|
2003-11-03 09:10:07 +00:00
|
|
|
|
|
|
|
extern GType gst_type_fourcc;
|
|
|
|
extern GType gst_type_int_range;
|
|
|
|
extern GType gst_type_double_range;
|
2003-11-29 06:31:10 +00:00
|
|
|
extern GType gst_type_list;
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* list */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_value_list_prepend_value (GValue *value, const GValue *prepend_value);
|
|
|
|
void gst_value_list_append_value (GValue *value, const GValue *append_value);
|
|
|
|
guint gst_value_list_get_size (const GValue *value);
|
|
|
|
G_CONST_RETURN GValue *gst_value_list_get_value (const GValue *value, guint index);
|
|
|
|
void gst_value_list_concat (GValue *dest, const GValue *value1, const GValue *value2);
|
2003-12-23 20:58:05 +00:00
|
|
|
|
|
|
|
/* fourcc */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_value_set_fourcc (GValue *value, guint32 fourcc);
|
|
|
|
guint32 gst_value_get_fourcc (const GValue *value);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* int range */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_value_set_int_range (GValue *value, int start, int end);
|
|
|
|
int gst_value_get_int_range_min (const GValue *value);
|
|
|
|
int gst_value_get_int_range_max (const GValue *value);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* double range */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_value_set_double_range (GValue *value, double start, double end);
|
|
|
|
double gst_value_get_double_range_min (const GValue *value);
|
|
|
|
double gst_value_get_double_range_max (const GValue *value);
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* caps */
|
2004-03-15 14:43:35 +00:00
|
|
|
G_CONST_RETURN GstCaps *gst_value_get_caps (const GValue *value);
|
|
|
|
void gst_value_set_caps (GValue *value, const GstCaps *caps);
|
2003-11-29 06:31:10 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* compare */
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
gboolean gst_value_can_compare (const GValue *value1, const GValue *value2);
|
|
|
|
int gst_value_compare (const GValue *value1, const GValue *value2);
|
2003-11-03 09:10:07 +00:00
|
|
|
|
2003-12-23 20:58:05 +00:00
|
|
|
/* union */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
gboolean gst_value_can_union (const GValue *value1, const GValue *value2);
|
|
|
|
gboolean gst_value_union (GValue *dest, const GValue *value1, const GValue *value2);
|
|
|
|
void gst_value_register_union_func (GType type1, GType type2, GstValueUnionFunc func);
|
2003-12-23 20:58:05 +00:00
|
|
|
|
|
|
|
/* intersection */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
gboolean gst_value_can_intersect (const GValue *value1, const GValue *value2);
|
|
|
|
gboolean gst_value_intersect (GValue *dest, const GValue *value1, const GValue *value2);
|
|
|
|
void gst_value_register_intersect_func (GType type1, GType type2, GstValueIntersectFunc func);
|
2003-12-23 20:58:05 +00:00
|
|
|
|
|
|
|
/* */
|
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
void gst_value_register (const GstValueTable *table);
|
|
|
|
void gst_value_init_and_copy (GValue *dest, const GValue *src);
|
2003-12-23 20:58:05 +00:00
|
|
|
void _gst_value_initialize (void);
|
2003-11-24 02:09:23 +00:00
|
|
|
|
2004-03-15 14:43:35 +00:00
|
|
|
gchar * gst_value_serialize (const GValue *value);
|
|
|
|
gboolean 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
|
|
|
|
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
G_END_DECLS
|
2004-03-15 14:43:35 +00:00
|
|
|
|
2003-11-03 09:10:07 +00:00
|
|
|
#endif
|
2004-03-15 14:43:35 +00:00
|
|
|
|
|
|
|
|