Add a few new functions

Original commit message from CVS:
Add a few new functions
This commit is contained in:
David Schleef 2003-12-03 10:21:00 +00:00
parent ce5bdf5ce4
commit 2d78d942c3
3 changed files with 38 additions and 0 deletions

View file

@ -265,6 +265,33 @@ GstCaps2 *gst_caps2_copy_1 (const GstCaps2 *caps)
return newcaps;
}
void gst_caps2_set_simple (GstCaps2 *caps, char *field, ...)
{
GstStructure *structure;
va_list var_args;
g_return_if_fail (caps != NULL);
g_return_if_fail (caps->structs->len != 1);
structure = gst_caps2_get_nth_cap (caps, 0);
va_start (var_args, field);
gst_structure_set_valist (structure, field, var_args);
va_end(var_args);
}
void gst_caps2_set_simple_valist (GstCaps2 *caps, char *field, va_list varargs)
{
GstStructure *structure;
g_return_if_fail (caps != NULL);
g_return_if_fail (caps->structs->len != 1);
structure = gst_caps2_get_nth_cap (caps, 0);
gst_structure_set_valist (structure, field, varargs);
}
/* tests */
gboolean gst_caps2_is_any (const GstCaps2 *caps)
{

View file

@ -58,6 +58,14 @@ struct _GstStaticCaps2 {
#define GST_TYPE_CAPS2 gst_caps2_get_type()
/* FIXME Company should decide the best way to do this */
#define GST_DEBUG_CAPS(string, caps) do { \
char *s = gst_caps2_to_string(caps); \
GST_DEBUG ( "%s: %s", (string), s); \
g_free(s); \
}while(0)
void _gst_caps2_initialize (void);
GType gst_caps2_get_type (void);
@ -78,6 +86,8 @@ GstCaps2 *gst_caps2_split_one (GstCaps2 *caps);
int gst_caps2_get_n_structures (const GstCaps2 *caps);
GstStructure *gst_caps2_get_nth_cap (const GstCaps2 *caps, int index);
GstCaps2 *gst_caps2_copy_1 (const GstCaps2 *caps);
void gst_caps2_set_simple (GstCaps2 *caps, char *field, ...);
void gst_caps2_set_simple_valist (GstCaps2 *caps, char *field, va_list varargs);
/* tests */
gboolean gst_caps2_is_any (const GstCaps2 *caps);

View file

@ -32,6 +32,7 @@ typedef void (*GstStructureForeachFunc) (GstStructure *structure,
GQuark field_id, GValue *value, gpointer user_data);
struct _GstStructure {
GType type;
int len;
GQuark name;