+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:
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);
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, ...);
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,
* @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.
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);
*
* 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)
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;
+}
const char *field_name,
double target);
+gboolean gst_caps_structure_fixate_field_boolean (GstStructure *structure,
+ const char *field_name,
+ gboolean target);
+
G_END_DECLS