gst/gstbuffer.c: some debugging

Original commit message from CVS:

* gst/gstbuffer.c: (gst_buffer_new_and_alloc):
some debugging
* gst/gstcaps.h:
whitespace fixes
* gst/gstpad.c: (gst_pad_activate_push), (gst_pad_alloc_buffer):
more debugging
* gst/gststructure.c: (gst_caps_structure_fixate_field_boolean):
* gst/gststructure.h:
add a fixate function for booleans; add a FIXME that these func
names should probably be gst_structure_fixate_*
This commit is contained in:
Thomas Vander Stichele 2005-08-23 11:38:28 +00:00
parent 650687b449
commit 4b0a255e95
5 changed files with 82 additions and 10 deletions

View file

@ -1,3 +1,16 @@
2005-08-23 Thomas Vander Stichele <thomas at apestaart dot org>
* gst/gstbuffer.c: (gst_buffer_new_and_alloc):
some debugging
* gst/gstcaps.h:
whitespace fixes
* gst/gstpad.c: (gst_pad_activate_push), (gst_pad_alloc_buffer):
more debugging
* gst/gststructure.c: (gst_caps_structure_fixate_field_boolean):
* gst/gststructure.h:
add a fixate function for booleans; add a FIXME that these func
names should probably be gst_structure_fixate_*
2005-08-23 Stefan Kost <ensonic@users.sf.net>
* docs/gst/gstreamer-docs.sgml:

View file

@ -92,10 +92,10 @@ GstCaps * gst_caps_new_full_valist (GstStru
va_list var_args);
/* reference counting */
GstCaps * gst_caps_ref (GstCaps* caps);
GstCaps * gst_caps_ref (GstCaps* caps);
GstCaps * gst_caps_copy (const GstCaps * caps);
GstCaps * gst_caps_make_writable (GstCaps *caps);
void gst_caps_unref (GstCaps* caps);
GstCaps * gst_caps_make_writable (GstCaps *caps);
void gst_caps_unref (GstCaps* caps);
GstCaps * gst_static_caps_get (GstStaticCaps *static_caps);
@ -107,7 +107,7 @@ void gst_caps_append_structure (GstCaps
int gst_caps_get_size (const GstCaps *caps);
GstStructure * gst_caps_get_structure (const GstCaps *caps,
int index);
GstCaps * gst_caps_copy_nth (const GstCaps * caps, gint nth);
GstCaps * gst_caps_copy_nth (const GstCaps * caps, gint nth);
void gst_caps_truncate (GstCaps * caps);
void gst_caps_set_simple (GstCaps *caps,
char *field, ...);
@ -120,11 +120,11 @@ gboolean gst_caps_is_any (const G
gboolean gst_caps_is_empty (const GstCaps *caps);
gboolean gst_caps_is_fixed (const GstCaps *caps);
gboolean gst_caps_is_always_compatible (const GstCaps *caps1,
const GstCaps *caps2);
const GstCaps *caps2);
gboolean gst_caps_is_subset (const GstCaps *subset,
const GstCaps *superset);
gboolean gst_caps_is_equal (const GstCaps *caps1,
const GstCaps *caps2);
const GstCaps *caps2);
/* operations */
GstCaps * gst_caps_intersect (const GstCaps *caps1,

View file

@ -2302,9 +2302,9 @@ no_peer:
* @buf: a newly allocated buffer
*
* Allocates a new, empty buffer optimized to push to pad @pad. This
* function only works if @pad is a source pad and has a peer.
* function only works if @pad is a source pad and has a peer.
*
* You need to check the caps of the buffer after performing this
* You need to check the caps of the buffer after performing this
* function and renegotiate to the format if needed.
*
* A new, empty #GstBuffer will be put in the @buf argument.
@ -2346,9 +2346,9 @@ gst_pad_alloc_buffer (GstPad * pad, guint64 offset, gint size, GstCaps * caps,
goto flushing;
GST_CAT_DEBUG (GST_CAT_PADS,
"calling bufferallocfunc &%s (@%p) of peer pad %s:%s",
"calling bufferallocfunc &%s (@%p) of peer pad %s:%s for size %d",
GST_DEBUG_FUNCPTR_NAME (bufferallocfunc),
&bufferallocfunc, GST_DEBUG_PAD_NAME (peer));
&bufferallocfunc, GST_DEBUG_PAD_NAME (peer), size);
GST_UNLOCK (peer);
ret = bufferallocfunc (peer, offset, size, caps, buf);

View file

@ -1592,6 +1592,7 @@ gst_structure_copy_conditional (const GstStructure * structure)
*
* Returns: TRUE if the structure could be fixated
*/
/* FIXME: rename to gst_structure_... */
gboolean
gst_caps_structure_fixate_field_nearest_int (GstStructure * structure,
const char *field_name, int target)
@ -1709,3 +1710,57 @@ gst_caps_structure_fixate_field_nearest_double (GstStructure * structure,
return FALSE;
}
/**
* gst_caps_structure_fixate_field_boolean:
* @structure: a #GstStructure
* @field_name: a field in @structure
* @target: the target value of the fixation
*
* Fixates a #GstStructure by changing the given @field_name field to the given
* @target boolean if that field is not fixed yet.
*
* Returns: TRUE if the structure could be fixated
*/
/* FIXME: rename to gst_structure_... */
gboolean
gst_caps_structure_fixate_field_boolean (GstStructure * structure,
const char *field_name, gboolean target)
{
const GValue *value;
g_return_val_if_fail (gst_structure_has_field (structure, field_name), FALSE);
g_return_val_if_fail (IS_MUTABLE (structure), FALSE);
value = gst_structure_get_value (structure, field_name);
if (G_VALUE_TYPE (value) == G_TYPE_BOOLEAN) {
/* already fixed */
return FALSE;
} else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) {
const GValue *list_value;
int i, n;
int best = 0;
int best_index = -1;
n = gst_value_list_get_size (value);
for (i = 0; i < n; i++) {
list_value = gst_value_list_get_value (value, i);
if (G_VALUE_TYPE (list_value) == G_TYPE_BOOLEAN) {
gboolean x = g_value_get_boolean (list_value);
if (best_index == -1 || x == target) {
best_index = i;
best = x;
}
}
}
if (best_index != -1) {
gst_structure_set (structure, field_name, G_TYPE_BOOLEAN, best, NULL);
return TRUE;
}
return FALSE;
}
return FALSE;
}

View file

@ -144,6 +144,10 @@ gboolean gst_caps_structure_fixate_field_nearest_double (GstStru
const char *field_name,
double target);
gboolean gst_caps_structure_fixate_field_boolean (GstStructure *structure,
const char *field_name,
gboolean target);
G_END_DECLS