diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-05-21 11:12:23 +0200 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-05-21 11:12:23 +0200 |
commit | 50f12103f5a136f45bd274ac6a99006a3db5ca4d (patch) | |
tree | cb44f58b9f1cc9256a83b87d28d6cdaf10b2c4b4 /gst | |
parent | 54399760aad93cb3ec36162ced7649c8cd8286db (diff) |
Imported Upstream version 0.11.91upstream/0.11.91
Diffstat (limited to 'gst')
34 files changed, 513 insertions, 193 deletions
diff --git a/gst/Makefile.in b/gst/Makefile.in index 5553d5b..008347b 100644 --- a/gst/Makefile.in +++ b/gst/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.4 from Makefile.am. +# Makefile.in generated by automake 1.11.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, @@ -824,7 +824,7 @@ install-libLTLIBRARIES: $(lib_LTLIBRARIES) done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ - $(MKDIR_P) '$(DESTDIR)$(libdir)' || exit 1; \ + $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } @@ -1359,7 +1359,7 @@ install-girDATA: $(gir_DATA) @list='$(gir_DATA)'; test -n "$(girdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(girdir)'"; \ - $(MKDIR_P) '$(DESTDIR)$(girdir)' || exit 1; \ + $(MKDIR_P) "$(DESTDIR)$(girdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ @@ -1380,7 +1380,7 @@ install-typelibsDATA: $(typelibs_DATA) @list='$(typelibs_DATA)'; test -n "$(typelibsdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(typelibsdir)'"; \ - $(MKDIR_P) '$(DESTDIR)$(typelibsdir)' || exit 1; \ + $(MKDIR_P) "$(DESTDIR)$(typelibsdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ @@ -1401,7 +1401,7 @@ install-libgstreamer_@GST_API_VERSION@includeHEADERS: $(libgstreamer_@GST_API_VE @list='$(libgstreamer_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstreamer_@GST_API_VERSION@includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)'"; \ - $(MKDIR_P) '$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)' || exit 1; \ + $(MKDIR_P) "$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ @@ -1422,7 +1422,7 @@ install-nodist_libgstreamer_@GST_API_VERSION@includeHEADERS: $(nodist_libgstream @list='$(nodist_libgstreamer_@GST_API_VERSION@include_HEADERS)'; test -n "$(libgstreamer_@GST_API_VERSION@includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)'"; \ - $(MKDIR_P) '$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)' || exit 1; \ + $(MKDIR_P) "$(DESTDIR)$(libgstreamer_@GST_API_VERSION@includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ @@ -635,7 +635,9 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data, llf = G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_ERROR | G_LOG_FLAG_FATAL; g_log_set_handler (g_log_domain_gstreamer, llf, debug_log_handler, NULL); +#ifndef GST_DISABLE_TRACE _priv_gst_alloc_trace_initialize (); +#endif _priv_gst_mini_object_initialize (); _priv_gst_quarks_initialize (); @@ -1011,7 +1013,9 @@ gst_deinit (void) _priv_gst_registry_cleanup (); +#ifndef GST_DISABLE_TRACE _priv_gst_alloc_trace_deinit (); +#endif g_type_class_unref (g_type_class_peek (gst_object_get_type ())); g_type_class_unref (g_type_class_peek (gst_pad_get_type ())); diff --git a/gst/gst_private.h b/gst/gst_private.h index 19f02d3..f44c6f3 100644 --- a/gst/gst_private.h +++ b/gst/gst_private.h @@ -257,5 +257,68 @@ extern GstDebugCategory *_priv_GST_CAT_POLL; #endif +/**** objects made opaque until the private bits have been made private ****/ + +#include <gmodule.h> +#include <time.h> /* time_t */ +#include <sys/types.h> /* off_t */ +#include <sys/stat.h> /* off_t */ + +typedef struct _GstPluginPrivate GstPluginPrivate; + +struct _GstPlugin { + GstObject object; + + /*< private >*/ + GstPluginDesc desc; + + GstPluginDesc *orig_desc; + + gchar * filename; + gchar * basename; /* base name (non-dir part) of plugin path */ + + GModule * module; /* contains the module if plugin is loaded */ + + off_t file_size; + time_t file_mtime; + gboolean registered; /* TRUE when the registry has seen a filename + * that matches the plugin's basename */ + + GstPluginPrivate *priv; + + gpointer _gst_reserved[GST_PADDING]; +}; + +struct _GstPluginClass { + GstObjectClass object_class; + + /*< private >*/ + gpointer _gst_reserved[GST_PADDING]; +}; + +#include "gsttypefind.h" + +struct _GstTypeFindFactory { + GstPluginFeature feature; + /* <private> */ + + GstTypeFindFunction function; + gchar ** extensions; + GstCaps * caps; /* FIXME: not yet saved in registry */ + + gpointer user_data; + GDestroyNotify user_data_notify; + + gpointer _gst_reserved[GST_PADDING]; +}; + +struct _GstTypeFindFactoryClass { + GstPluginFeatureClass parent; + /* <private> */ + + gpointer _gst_reserved[GST_PADDING]; +}; + + G_END_DECLS #endif /* __GST_PRIVATE_H__ */ diff --git a/gst/gstbuffer.c b/gst/gstbuffer.c index 54bb950..b9783c5 100644 --- a/gst/gstbuffer.c +++ b/gst/gstbuffer.c @@ -235,7 +235,8 @@ _get_merged_memory (GstBuffer * buffer, guint idx, guint length) gst_memory_map (mem[i], &sinfo, GST_MAP_READ); tocopy = MIN (sinfo.size, left); GST_CAT_DEBUG (GST_CAT_PERFORMANCE, - "memcpy for merge %p from memory %p", result, mem[i]); + "memcpy %" G_GSIZE_FORMAT " bytes for merge %p from memory %p", + tocopy, result, mem[i]); memcpy (ptr, (guint8 *) sinfo.data, tocopy); left -= tocopy; ptr += tocopy; @@ -827,8 +828,8 @@ gst_buffer_get_memory_range (GstBuffer * buffer, guint idx, gint length) g_return_val_if_fail (GST_IS_BUFFER (buffer), NULL); len = GST_BUFFER_MEM_LEN (buffer); - g_return_val_if_fail ((length == -1 && idx < len) || - (length > 0 && length + idx <= len), NULL); + g_return_val_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || (length > 0 && length + idx <= len), NULL); if (length == -1) length = len - idx; @@ -859,8 +860,8 @@ gst_buffer_replace_memory_range (GstBuffer * buffer, guint idx, gint length, g_return_if_fail (GST_IS_BUFFER (buffer)); g_return_if_fail (gst_buffer_is_writable (buffer)); len = GST_BUFFER_MEM_LEN (buffer); - g_return_if_fail ((length == -1 && idx < len) || (length > 0 - && length + idx <= len)); + g_return_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || (length > 0 && length + idx <= len)); if (length == -1) length = len - idx; @@ -887,7 +888,8 @@ gst_buffer_remove_memory_range (GstBuffer * buffer, guint idx, gint length) g_return_if_fail (gst_buffer_is_writable (buffer)); len = GST_BUFFER_MEM_LEN (buffer); - g_return_if_fail ((length == -1 && idx < len) || length + idx <= len); + g_return_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || length + idx <= len); if (length == -1) length = len - idx; @@ -997,8 +999,8 @@ gst_buffer_get_sizes_range (GstBuffer * buffer, guint idx, gint length, g_return_val_if_fail (GST_IS_BUFFER (buffer), 0); len = GST_BUFFER_MEM_LEN (buffer); - g_return_val_if_fail (len == 0 || (length == -1 && idx < len) - || (length + idx <= len), 0); + g_return_val_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || (length + idx <= len), 0); if (length == -1) length = len - idx; @@ -1062,7 +1064,8 @@ gst_buffer_resize_range (GstBuffer * buffer, guint idx, gint length, g_return_if_fail (gst_buffer_is_writable (buffer)); g_return_if_fail (size >= -1); len = GST_BUFFER_MEM_LEN (buffer); - g_return_if_fail ((length == -1 && idx < len) || (length + idx <= len)); + g_return_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || (length + idx <= len)); if (length == -1) length = len - idx; @@ -1166,9 +1169,8 @@ gst_buffer_map_range (GstBuffer * buffer, guint idx, gint length, g_return_val_if_fail (GST_IS_BUFFER (buffer), FALSE); g_return_val_if_fail (info != NULL, FALSE); len = GST_BUFFER_MEM_LEN (buffer); - if (len == 0) - goto no_memory; - g_return_val_if_fail ((length == -1 && idx < len) || (length > 0 + g_return_val_if_fail ((len == 0 && idx == 0 && length == -1) || + (length == -1 && idx < len) || (length > 0 && length + idx <= len), FALSE); write = (flags & GST_MAP_WRITE) != 0; @@ -1623,6 +1625,8 @@ gst_buffer_remove_meta (GstBuffer * buffer, GstMeta * meta) g_return_val_if_fail (buffer != NULL, FALSE); g_return_val_if_fail (meta != NULL, FALSE); g_return_val_if_fail (gst_buffer_is_writable (buffer), FALSE); + g_return_val_if_fail (!GST_META_FLAG_IS_SET (meta, GST_META_FLAG_LOCKED), + FALSE); /* find the metadata and delete */ prev = GST_BUFFER_META (buffer); @@ -1722,6 +1726,7 @@ gst_buffer_foreach_meta (GstBuffer * buffer, GstBufferForeachMetaFunc func, g_type_name (info->type)); g_return_if_fail (gst_buffer_is_writable (buffer)); + g_return_if_fail (!GST_META_FLAG_IS_SET (m, GST_META_FLAG_LOCKED)); /* remove from list */ if (GST_BUFFER_META (buffer) == walk) diff --git a/gst/gstbuffer.h b/gst/gstbuffer.h index 0b3a7f8..5b0a854 100644 --- a/gst/gstbuffer.h +++ b/gst/gstbuffer.h @@ -184,7 +184,7 @@ typedef struct _GstBufferPool GstBufferPool; * @GST_BUFFER_FLAG_CORRUPTED: the buffer data is corrupted. * @GST_BUFFER_FLAG_MARKER: the buffer contains a media specific marker. for * video this is typically the end of a frame boundary, for audio - * this is usually the end of a talkspurt. + * this is usually the start of a talkspurt. * @GST_BUFFER_FLAG_HEADER: the buffer contains header information that is * needed to decode the following data. The buffer * is also part of the headers of the STREAM_CONFIG event. diff --git a/gst/gstbufferpool.c b/gst/gstbufferpool.c index 7020345..d7a09d1 100644 --- a/gst/gstbufferpool.c +++ b/gst/gstbufferpool.c @@ -130,8 +130,7 @@ static GstFlowReturn default_alloc_buffer (GstBufferPool * pool, GstBuffer ** buffer, GstBufferPoolAcquireParams * params); static GstFlowReturn default_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer, GstBufferPoolAcquireParams * params); -static void default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer, - GstBufferPoolAcquireParams * params); +static void default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer); static void default_free_buffer (GstBufferPool * pool, GstBuffer * buffer); static void default_release_buffer (GstBufferPool * pool, GstBuffer * buffer); @@ -243,6 +242,7 @@ mark_meta_pooled (GstBuffer * buffer, GstMeta ** meta, gpointer user_data) GST_DEBUG_OBJECT (pool, "marking meta %p as POOLED in buffer %p", *meta, buffer); GST_META_FLAG_SET (*meta, GST_META_FLAG_POOLED); + GST_META_FLAG_SET (*meta, GST_META_FLAG_LOCKED); return TRUE; } @@ -988,14 +988,15 @@ dec_outstanding (GstBufferPool * pool) static gboolean remove_meta_unpooled (GstBuffer * buffer, GstMeta ** meta, gpointer user_data) { - if (!GST_META_FLAG_IS_SET (*meta, GST_META_FLAG_POOLED)) + if (!GST_META_FLAG_IS_SET (*meta, GST_META_FLAG_POOLED)) { + GST_META_FLAG_UNSET (*meta, GST_META_FLAG_LOCKED); *meta = NULL; + } return TRUE; } static void -default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer, - GstBufferPoolAcquireParams * params) +default_reset_buffer (GstBufferPool * pool, GstBuffer * buffer) { GST_BUFFER_FLAGS (buffer) = 0; @@ -1048,9 +1049,6 @@ gst_buffer_pool_acquire_buffer (GstBufferPool * pool, GstBuffer ** buffer, /* all buffers from the pool point to the pool and have the refcount of the * pool incremented */ (*buffer)->pool = gst_object_ref (pool); - /* now reset the buffer when needed */ - if (G_LIKELY (pclass->reset_buffer)) - pclass->reset_buffer (pool, *buffer, params); } else { dec_outstanding (pool); } @@ -1093,6 +1091,10 @@ gst_buffer_pool_release_buffer (GstBufferPool * pool, GstBuffer * buffer) pclass = GST_BUFFER_POOL_GET_CLASS (pool); + /* reset the buffer when needed */ + if (G_LIKELY (pclass->reset_buffer)) + pclass->reset_buffer (pool, buffer); + if (G_LIKELY (pclass->release_buffer)) pclass->release_buffer (pool, buffer); diff --git a/gst/gstbufferpool.h b/gst/gstbufferpool.h index aad3b22..ed26bb5 100644 --- a/gst/gstbufferpool.h +++ b/gst/gstbufferpool.h @@ -129,11 +129,12 @@ struct _GstBufferPool { * @alloc_buffer: allocate a buffer. the default implementation allocates * buffers from the configured memory allocator and with the configured * parameters. All metadata that is present on the allocated buffer will - * be marked as #GST_META_FLAG_POOLED and will not be removed from the - * buffer in @reset_buffer. + * be marked as #GST_META_FLAG_POOLED and #GST_META_FLAG_LOCKED and will + * not be removed from the buffer in @reset_buffer. * @reset_buffer: reset the buffer to its state when it was freshly allocated. * The default implementation will clear the flags, timestamps and - * will remove the metadata without the #GST_META_FLAG_POOLED flag. + * will remove the metadata without the #GST_META_FLAG_POOLED flag (even + * the metadata with #GST_META_FLAG_LOCKED). * @release_buffer: release a buffer back in the pool. The default * implementation will put the buffer back in the queue and notify any * blocking acquire_buffer calls. @@ -155,8 +156,7 @@ struct _GstBufferPoolClass { GstBufferPoolAcquireParams *params); GstFlowReturn (*alloc_buffer) (GstBufferPool *pool, GstBuffer **buffer, GstBufferPoolAcquireParams *params); - void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer, - GstBufferPoolAcquireParams *params); + void (*reset_buffer) (GstBufferPool *pool, GstBuffer *buffer); void (*release_buffer) (GstBufferPool *pool, GstBuffer *buffer); void (*free_buffer) (GstBufferPool *pool, GstBuffer *buffer); diff --git a/gst/gstcaps.c b/gst/gstcaps.c index 57f8ae6..2f4a341 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -1037,8 +1037,6 @@ gst_caps_is_subset_structure (const GstCaps * caps, * <note>This function does not work reliably if optional properties for caps * are included on one caps and omitted on the other.</note> * - * This function deals correctly with passing NULL for any of the caps. - * * Returns: TRUE if both caps are equal. */ gboolean diff --git a/gst/gstcontrolbinding.c b/gst/gstcontrolbinding.c index 74d078e..b7cc8d5 100644 --- a/gst/gstcontrolbinding.c +++ b/gst/gstcontrolbinding.c @@ -25,6 +25,20 @@ * * A value mapping object that attaches control sources to gobject properties. */ +/* FIXME(ensonic): should we make gst_object_add_control_binding() internal + * - we create the control_binding for a certain object anyway + * - we could call gst_object_add_control_binding() at the end of + * gst_control_binding_constructor() + * - the weak-ref on object is not nice, as is the same as gst_object_parent() + * once the object is added to the parent + * + * - another option would be do defer what I am doing in _constructor to when + * the parent is set (need to listen to the signal then) + * then basically I could + * a) remove the obj arg and wait the binding to be added or + * b) add the binding from constructor, unref object there and make obj + * writeonly + */ #include "gst_private.h" @@ -130,8 +144,10 @@ gst_control_binding_dispose (GObject * object) { GstControlBinding *self = GST_CONTROL_BINDING (object); - if (self->object) - gst_object_replace (&self->object, NULL); + /* we did not took a reference */ + g_object_remove_weak_pointer ((GObject *) self->object, + (gpointer *) & self->object); + self->object = NULL; ((GObjectClass *) gst_control_binding_parent_class)->dispose (object); } @@ -154,7 +170,10 @@ gst_control_binding_set_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_OBJECT: - self->object = g_value_dup_object (value); + /* do not ref to avoid a ref cycle */ + self->object = g_value_get_object (value); + g_object_add_weak_pointer ((GObject *) self->object, + (gpointer *) & self->object); break; case PROP_NAME: self->name = g_value_dup_string (value); @@ -261,19 +280,23 @@ gst_control_binding_get_value (GstControlBinding * self, GstClockTime timestamp) * @n_values: the number of values * @values: array to put control-values in * - * Gets a number of values for the given controllered property starting at the + * Gets a number of values for the given controlled property starting at the * requested time. The array @values need to hold enough space for @n_values of * the same type as the objects property's type. * * This function is useful if one wants to e.g. draw a graph of the control * curve or apply a control curve sample by sample. * + * The values are unboxed and ready to be used. The similar function + * gst_control_binding_get_g_value_array() returns the array as #GValues and is + * better suites for bindings. + * * Returns: %TRUE if the given array could be filled, %FALSE otherwise */ gboolean gst_control_binding_get_value_array (GstControlBinding * self, GstClockTime timestamp, GstClockTime interval, guint n_values, - GValue * values) + gpointer values) { GstControlBindingClass *klass; gboolean ret = FALSE; @@ -293,6 +316,117 @@ gst_control_binding_get_value_array (GstControlBinding * self, return ret; } +#define CONVERT_ARRAY(type,TYPE) \ +{ \ + g##type *v = g_new (g##type,n_values); \ + ret = gst_control_binding_get_value_array (self, timestamp, interval, \ + n_values, v); \ + if (ret) { \ + for (i = 0; i < n_values; i++) { \ + g_value_init (&values[i], G_TYPE_##TYPE); \ + g_value_set_##type (&values[i], v[i]); \ + } \ + } \ + g_free (v); \ +} + +/** + * gst_control_binding_get_g_value_array: + * @self: the control binding + * @timestamp: the time that should be processed + * @interval: the time spacing between subsequent values + * @n_values: the number of values + * @values: array to put control-values in + * + * Gets a number of #GValues for the given controlled property starting at the + * requested time. The array @values need to hold enough space for @n_values of + * #GValue. + * + * This function is useful if one wants to e.g. draw a graph of the control + * curve or apply a control curve sample by sample. + * + * Returns: %TRUE if the given array could be filled, %FALSE otherwise + */ +gboolean +gst_control_binding_get_g_value_array (GstControlBinding * self, + GstClockTime timestamp, GstClockTime interval, guint n_values, + GValue * values) +{ + GstControlBindingClass *klass; + gboolean ret = FALSE; + + g_return_val_if_fail (GST_IS_CONTROL_BINDING (self), FALSE); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE); + g_return_val_if_fail (values, FALSE); + + klass = GST_CONTROL_BINDING_GET_CLASS (self); + + if (G_LIKELY (klass->get_g_value_array != NULL)) { + ret = + klass->get_g_value_array (self, timestamp, interval, n_values, values); + } else { + guint i; + GType type, base; + + base = type = G_PARAM_SPEC_VALUE_TYPE (GST_CONTROL_BINDING_PSPEC (self)); + while ((type = g_type_parent (type))) + base = type; + + GST_INFO_OBJECT (self, "missing get_g_value_array implementation, we're " + "emulating it"); + switch (base) { + case G_TYPE_INT: + CONVERT_ARRAY (int, INT); + break; + case G_TYPE_UINT: + CONVERT_ARRAY (uint, UINT); + break; + case G_TYPE_LONG: + CONVERT_ARRAY (long, LONG); + break; + case G_TYPE_ULONG: + CONVERT_ARRAY (ulong, ULONG); + break; + case G_TYPE_INT64: + CONVERT_ARRAY (int64, INT64); + break; + case G_TYPE_UINT64: + CONVERT_ARRAY (uint64, UINT64); + break; + case G_TYPE_FLOAT: + CONVERT_ARRAY (float, FLOAT); + break; + case G_TYPE_DOUBLE: + CONVERT_ARRAY (double, DOUBLE); + break; + case G_TYPE_BOOLEAN: + CONVERT_ARRAY (boolean, BOOLEAN); + break; + case G_TYPE_ENUM: + { + gint *v = g_new (gint, n_values); + ret = gst_control_binding_get_value_array (self, timestamp, interval, + n_values, v); + if (ret) { + for (i = 0; i < n_values; i++) { + g_value_init (&values[i], type); + g_value_set_enum (&values[i], v[i]); + } + } + g_free (v); + } + break; + default: + GST_WARNING ("incomplete implementation for paramspec type '%s'", + G_PARAM_SPEC_TYPE_NAME (GST_CONTROL_BINDING_PSPEC (self))); + GST_CONTROL_BINDING_PSPEC (self) = NULL; + break; + } + } + return ret; +} + /** * gst_control_binding_set_disabled: * @self: the control binding diff --git a/gst/gstcontrolbinding.h b/gst/gstcontrolbinding.h index 96652fa..7f83d3d 100644 --- a/gst/gstcontrolbinding.h +++ b/gst/gstcontrolbinding.h @@ -93,7 +93,8 @@ struct _GstControlBindingClass /* virtual methods */ gboolean (* sync_values) (GstControlBinding *self, GstObject *object, GstClockTime timestamp, GstClockTime last_sync); GValue * (* get_value) (GstControlBinding *self, GstClockTime timestamp); - gboolean (* get_value_array) (GstControlBinding *self, GstClockTime timestamp,GstClockTime interval, guint n_values, GValue *values); + gboolean (* get_value_array) (GstControlBinding *self, GstClockTime timestamp,GstClockTime interval, guint n_values, gpointer values); + gboolean (* get_g_value_array) (GstControlBinding *self, GstClockTime timestamp,GstClockTime interval, guint n_values, GValue *values); /*< private >*/ gpointer _gst_reserved[GST_PADDING]; @@ -110,6 +111,8 @@ gboolean gst_control_binding_sync_values (GstControlBinding * GValue * gst_control_binding_get_value (GstControlBinding *binding, GstClockTime timestamp); gboolean gst_control_binding_get_value_array (GstControlBinding *binding, GstClockTime timestamp, + GstClockTime interval, guint n_values, gpointer values); +gboolean gst_control_binding_get_g_value_array (GstControlBinding *binding, GstClockTime timestamp, GstClockTime interval, guint n_values, GValue *values); void gst_control_binding_set_disabled (GstControlBinding * self, gboolean disabled); diff --git a/gst/gstcontrolsource.c b/gst/gstcontrolsource.c index b75c2ee..611784f 100644 --- a/gst/gstcontrolsource.c +++ b/gst/gstcontrolsource.c @@ -122,7 +122,8 @@ gst_control_source_get_value (GstControlSource * self, GstClockTime timestamp, * @n_values: the number of values to fetch * @value_array: array to put control-values in * - * Gets an array of values for for this #GstControlSource. + * Gets an array of values for for this #GstControlSource. Values that are + * undefined contain NANs. * * Returns: %TRUE if the given array could be filled, %FALSE otherwise */ diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 7a8947d..f9b8368 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -207,6 +207,7 @@ gst_proxy_pad_query_default (GstPad * pad, GstObject * parent, GstQuery * query) GST_DEBUG_OBJECT (pad, "no target"); /* We don't have a target, we return TRUE and we assume that any future * target will be able to deal with any configured caps. */ + gst_query_set_accept_caps_result (query, TRUE); res = TRUE; } break; diff --git a/gst/gstmemory.c b/gst/gstmemory.c index 5a7f289..8eb112e 100644 --- a/gst/gstmemory.c +++ b/gst/gstmemory.c @@ -222,7 +222,7 @@ _default_alloc_alloc (GstAllocator * allocator, gsize size, } static gpointer -_default_mem_map (GstMemoryDefault * mem, GstMapFlags flags) +_default_mem_map (GstMemoryDefault * mem, gsize maxsize, GstMapFlags flags) { return mem->data; } @@ -258,8 +258,10 @@ _default_mem_copy (GstMemoryDefault * mem, gssize offset, gsize size) copy = _default_mem_new_block (0, mem->mem.maxsize, 0, mem->mem.offset + offset, size); + GST_CAT_DEBUG (GST_CAT_PERFORMANCE, + "memcpy %" G_GSIZE_FORMAT " memory %p -> %p", mem->mem.maxsize, mem, + copy); memcpy (copy->data, mem->data, mem->mem.maxsize); - GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy memory %p -> %p", mem, copy); return copy; } @@ -324,8 +326,9 @@ _fallback_mem_copy (GstMemory * mem, gssize offset, gssize size) return NULL; } + GST_CAT_DEBUG (GST_CAT_PERFORMANCE, + "memcpy %" G_GSSIZE_FORMAT " memory %p -> %p", size, mem, copy); memcpy (dinfo.data, sinfo.data + offset, size); - GST_CAT_DEBUG (GST_CAT_PERFORMANCE, "copy memory %p -> %p", mem, copy); gst_memory_unmap (copy, &dinfo); gst_memory_unmap (mem, &sinfo); diff --git a/gst/gstmessage.h b/gst/gstmessage.h index aadb646..b7046e1 100644 --- a/gst/gstmessage.h +++ b/gst/gstmessage.h @@ -264,7 +264,7 @@ typedef enum { GST_PROGRESS_TYPE_CONTINUE = 1, GST_PROGRESS_TYPE_COMPLETE = 2, GST_PROGRESS_TYPE_CANCELED = 3, - GST_PROGRESS_TYPE_ERROR = 4, + GST_PROGRESS_TYPE_ERROR = 4 } GstProgressType; /** diff --git a/gst/gstmeta.h b/gst/gstmeta.h index bd7b2e2..e6d4f00 100644 --- a/gst/gstmeta.h +++ b/gst/gstmeta.h @@ -34,8 +34,8 @@ typedef struct _GstMetaInfo GstMetaInfo; * GstMetaFlags: * @GST_META_FLAG_NONE: no flags * @GST_META_FLAG_READONLY: metadata should not be modified - * @GST_META_FLAG_POOLED: metadata is managed by a bufferpool and should not - * be removed + * @GST_META_FLAG_POOLED: metadata is managed by a bufferpool + * @GST_META_FLAG_LOCKED: metadata should not be removed * @GST_META_FLAG_LAST: additional flags can be added starting from this flag. * * Extra metadata flags. @@ -44,6 +44,7 @@ typedef enum { GST_META_FLAG_NONE = 0, GST_META_FLAG_READONLY = (1 << 0), GST_META_FLAG_POOLED = (1 << 1), + GST_META_FLAG_LOCKED = (1 << 2), GST_META_FLAG_LAST = (1 << 16) } GstMetaFlags; diff --git a/gst/gstobject.c b/gst/gstobject.c index f830402..e8d4880 100644 --- a/gst/gstobject.c +++ b/gst/gstobject.c @@ -340,7 +340,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj) return FALSE; if (newobj) - g_object_ref (newobj); + gst_object_ref (newobj); while (G_UNLIKELY (!g_atomic_pointer_compare_and_exchange ((gpointer *) oldobj, oldptr, newobj))) { @@ -350,7 +350,7 @@ gst_object_replace (GstObject ** oldobj, GstObject * newobj) } if (oldptr) - g_object_unref (oldptr); + gst_object_unref (oldptr); return oldptr != newobj; } @@ -559,7 +559,14 @@ gst_object_set_name_default (GstObject * object) type_name = g_quark_to_string (q); if (strncmp (type_name, "Gst", 3) == 0) type_name += 3; - name = g_strdup_printf ("%s%d", type_name, count); + /* give the 20th "queue" element and the first "queue2" different names */ + l = strlen (type_name); + if (l > 0 && g_ascii_isdigit (type_name[l - 1])) { + name = g_strdup_printf ("%s-%d", type_name, count); + } else { + name = g_strdup_printf ("%s%d", type_name, count); + } + l = strlen (name); for (i = 0; i < l; i++) name[i] = g_ascii_tolower (name[i]); @@ -1220,7 +1227,7 @@ gst_object_get_control_binding (GstObject * object, const gchar * property_name) GST_OBJECT_LOCK (object); if ((binding = gst_object_find_control_binding (object, property_name))) { - g_object_ref (binding); + gst_object_ref (binding); } GST_OBJECT_UNLOCK (object); @@ -1300,19 +1307,23 @@ gst_object_get_value (GstObject * object, const gchar * property_name, * @n_values: the number of values * @values: array to put control-values in * - * Gets a number of values for the given controllered property starting at the + * Gets a number of values for the given controlled property starting at the * requested time. The array @values need to hold enough space for @n_values of * the same type as the objects property's type. * * This function is useful if one wants to e.g. draw a graph of the control * curve or apply a control curve sample by sample. * + * The values are unboxed and ready to be used. The similar function + * gst_object_get_g_value_array() returns the array as #GValues and is + * better suites for bindings. + * * Returns: %TRUE if the given array could be filled, %FALSE otherwise */ gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name, GstClockTime timestamp, GstClockTime interval, guint n_values, - GValue * values) + gpointer values) { gboolean res = FALSE; GstControlBinding *binding; @@ -1332,6 +1343,47 @@ gst_object_get_value_array (GstObject * object, const gchar * property_name, return res; } +/** + * gst_object_get_g_value_array: + * @object: the object that has controlled properties + * @property_name: the name of the property to get + * @timestamp: the time that should be processed + * @interval: the time spacing between subsequent values + * @n_values: the number of values + * @values: array to put control-values in + * + * Gets a number of #GValues for the given controlled property starting at the + * requested time. The array @values need to hold enough space for @n_values of + * #GValue. + * + * This function is useful if one wants to e.g. draw a graph of the control + * curve or apply a control curve sample by sample. + * + * Returns: %TRUE if the given array could be filled, %FALSE otherwise + */ +gboolean +gst_object_get_g_value_array (GstObject * object, const gchar * property_name, + GstClockTime timestamp, GstClockTime interval, guint n_values, + GValue * values) +{ + gboolean res = FALSE; + GstControlBinding *binding; + + g_return_val_if_fail (GST_IS_OBJECT (object), FALSE); + g_return_val_if_fail (property_name, FALSE); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (timestamp), FALSE); + g_return_val_if_fail (GST_CLOCK_TIME_IS_VALID (interval), FALSE); + g_return_val_if_fail (values, FALSE); + + GST_OBJECT_LOCK (object); + if ((binding = gst_object_find_control_binding (object, property_name))) { + res = gst_control_binding_get_g_value_array (binding, timestamp, interval, + n_values, values); + } + GST_OBJECT_UNLOCK (object); + return res; +} + /** * gst_object_get_control_rate: diff --git a/gst/gstobject.h b/gst/gstobject.h index e753516..6c9f9f5 100644 --- a/gst/gstobject.h +++ b/gst/gstobject.h @@ -253,6 +253,9 @@ GValue * gst_object_get_value (GstObject * object, const gch GstClockTime timestamp); gboolean gst_object_get_value_array (GstObject * object, const gchar * property_name, GstClockTime timestamp, GstClockTime interval, + guint n_values, gpointer values); +gboolean gst_object_get_g_value_array (GstObject * object, const gchar * property_name, + GstClockTime timestamp, GstClockTime interval, guint n_values, GValue *values); GstClockTime gst_object_get_control_rate (GstObject * object); diff --git a/gst/gstplugin.c b/gst/gstplugin.c index 413ffd7..a7542fc 100644 --- a/gst/gstplugin.c +++ b/gst/gstplugin.c @@ -90,18 +90,17 @@ static char *_gst_plugin_fault_handler_filename = NULL; * MIT/X11: http://www.opensource.org/licenses/mit-license.php * 3-clause BSD: http://www.opensource.org/licenses/bsd-license.php */ -static const gchar *const valid_licenses[] = { - "LGPL", /* GNU Lesser General Public License */ - "GPL", /* GNU General Public License */ - "QPL", /* Trolltech Qt Public License */ - "GPL/QPL", /* Combi-license of GPL + QPL */ - "MPL", /* MPL 1.1 license */ - "BSD", /* 3-clause BSD license */ - "MIT/X11", /* MIT/X11 license */ - "Proprietary", /* Proprietary license */ - GST_LICENSE_UNKNOWN, /* some other license */ - NULL -}; +static const gchar valid_licenses[] = "LGPL\000" /* GNU Lesser General Public License */ + "GPL\000" /* GNU General Public License */ + "QPL\000" /* Trolltech Qt Public License */ + "GPL/QPL\000" /* Combi-license of GPL + QPL */ + "MPL\000" /* MPL 1.1 license */ + "BSD\000" /* 3-clause BSD license */ + "MIT/X11\000" /* MIT/X11 license */ + "Proprietary\000" /* Proprietary license */ + GST_LICENSE_UNKNOWN; /* some other license */ + +static const guint8 valid_licenses_idx[] = { 0, 5, 9, 13, 21, 25, 29, 37, 49 }; static GstPlugin *gst_plugin_register_func (GstPlugin * plugin, const GstPluginDesc * desc, gpointer user_data); @@ -460,14 +459,11 @@ priv_gst_plugin_loading_get_whitelist_hash (void) static gboolean gst_plugin_check_license (const gchar * license) { - const gchar *const *check_license = valid_licenses; + gint i; - g_assert (check_license); - - while (*check_license) { - if (strcmp (license, *check_license) == 0) + for (i = 0; i < G_N_ELEMENTS (valid_licenses_idx); ++i) { + if (strcmp (license, valid_licenses + valid_licenses_idx[i]) == 0) return TRUE; - check_license++; } return FALSE; } @@ -993,21 +989,26 @@ gst_plugin_get_origin (GstPlugin * plugin) } /** - * gst_plugin_get_module: - * @plugin: plugin to query + * gst_plugin_get_release_date_string: + * @plugin: plugin to get the release date of + * + * Get the release date (and possibly time) in form of a string, if available. + * + * For normal GStreamer plugin releases this will usually just be a date in + * the form of "YYYY-MM-DD", while pre-releases and builds from git may contain + * a time component after the date as well, in which case the string will be + * formatted like "YYYY-MM-DDTHH:MMZ" (e.g. "2012-04-30T09:30Z"). * - * Gets the #GModule of the plugin. If the plugin isn't loaded yet, NULL is - * returned. + * There may be plugins that do not have a valid release date set on them. * - * Returns: (transfer none): module belonging to the plugin or NULL if the - * plugin isn't loaded yet. + * Returns: the date string of the plugin, or %NULL if not available. */ -GModule * -gst_plugin_get_module (GstPlugin * plugin) +const gchar * +gst_plugin_get_release_date_string (GstPlugin * plugin) { g_return_val_if_fail (plugin != NULL, NULL); - return plugin->module; + return plugin->desc.release_datetime; } /** @@ -1154,26 +1155,8 @@ gst_plugin_list_feature_filter (GList * list, return data.result; } -#endif /** - * gst_plugin_name_filter: - * @plugin: the plugin to check - * @name: the name of the plugin - * - * A standard filter that returns TRUE when the plugin is of the - * given name. - * - * Returns: TRUE if the plugin is of the given name. - */ -gboolean -gst_plugin_name_filter (GstPlugin * plugin, const gchar * name) -{ - return (plugin->desc.name && !strcmp (plugin->desc.name, name)); -} - -#if 0 -/** * gst_plugin_find_feature: * @plugin: plugin to get the feature from * @name: The name of the feature to find diff --git a/gst/gstplugin.h b/gst/gstplugin.h index f1be63b..8d5f6c7 100644 --- a/gst/gstplugin.h +++ b/gst/gstplugin.h @@ -26,19 +26,19 @@ #include <gst/gstconfig.h> -#include <time.h> /* time_t */ -#include <sys/types.h> /* off_t */ -#include <sys/stat.h> /* off_t */ -#include <gmodule.h> #include <gst/gstobject.h> #include <gst/gstmacros.h> #include <gst/gststructure.h> G_BEGIN_DECLS +/** + * GstPlugin: + * + * The opaque plugin object + */ typedef struct _GstPlugin GstPlugin; typedef struct _GstPluginClass GstPluginClass; -typedef struct _GstPluginPrivate GstPluginPrivate; typedef struct _GstPluginDesc GstPluginDesc; /** @@ -80,8 +80,8 @@ typedef enum */ typedef enum { - GST_PLUGIN_FLAG_CACHED = (1<<0), - GST_PLUGIN_FLAG_BLACKLISTED = (1<<1) + GST_PLUGIN_FLAG_CACHED = (GST_OBJECT_FLAG_LAST << 0), + GST_PLUGIN_FLAG_BLACKLISTED = (GST_OBJECT_FLAG_LAST << 1) } GstPluginFlags; /** @@ -187,43 +187,6 @@ struct _GstPluginDesc { #define GST_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_PLUGIN, GstPluginClass)) #define GST_PLUGIN_CAST(obj) ((GstPlugin*)(obj)) -/** - * GstPlugin: - * - * The plugin object - */ -struct _GstPlugin { - GstObject object; - - /*< private >*/ - GstPluginDesc desc; - - GstPluginDesc *orig_desc; - - unsigned int flags; - - gchar * filename; - gchar * basename; /* base name (non-dir part) of plugin path */ - - GModule * module; /* contains the module if plugin is loaded */ - - off_t file_size; - time_t file_mtime; - gboolean registered; /* TRUE when the registry has seen a filename - * that matches the plugin's basename */ - - GstPluginPrivate *priv; - - gpointer _gst_reserved[GST_PADDING]; -}; - -struct _GstPluginClass { - GstObjectClass object_class; - - /*< private >*/ - gpointer _gst_reserved[GST_PADDING]; -}; - #ifdef GST_PACKAGE_RELEASE_DATETIME #define __GST_PACKAGE_RELEASE_DATETIME GST_PACKAGE_RELEASE_DATETIME #else @@ -276,8 +239,7 @@ G_END_DECLS /** * GST_LICENSE_UNKNOWN: * - * To be used in GST_PLUGIN_DEFINE or GST_PLUGIN_DEFINE_STATIC if usure about - * the licence. + * To be used in GST_PLUGIN_DEFINE if usure about the licence. */ #define GST_LICENSE_UNKNOWN "unknown" @@ -329,14 +291,12 @@ const gchar* gst_plugin_get_license (GstPlugin *plugin); const gchar* gst_plugin_get_source (GstPlugin *plugin); const gchar* gst_plugin_get_package (GstPlugin *plugin); const gchar* gst_plugin_get_origin (GstPlugin *plugin); +const gchar* gst_plugin_get_release_date_string (GstPlugin *plugin); const GstStructure* gst_plugin_get_cache_data (GstPlugin * plugin); void gst_plugin_set_cache_data (GstPlugin * plugin, GstStructure *cache_data); -GModule * gst_plugin_get_module (GstPlugin *plugin); gboolean gst_plugin_is_loaded (GstPlugin *plugin); -gboolean gst_plugin_name_filter (GstPlugin *plugin, const gchar *name); - GstPlugin * gst_plugin_load_file (const gchar *filename, GError** error); GstPlugin * gst_plugin_load (GstPlugin *plugin); diff --git a/gst/gstpluginfeature.c b/gst/gstpluginfeature.c index 5b86fd3..e61fee2 100644 --- a/gst/gstpluginfeature.c +++ b/gst/gstpluginfeature.c @@ -221,7 +221,7 @@ gst_plugin_feature_list_copy (GList * list) GList *last; new_list = g_list_alloc (); - new_list->data = g_object_ref ((GObject *) list->data); + new_list->data = gst_object_ref (list->data); new_list->prev = NULL; last = new_list; list = list->next; @@ -229,7 +229,7 @@ gst_plugin_feature_list_copy (GList * list) last->next = g_list_alloc (); last->next->prev = last; last = last->next; - last->data = g_object_ref ((GObject *) list->data); + last->data = gst_object_ref (list->data); list = list->next; } last->next = NULL; diff --git a/gst/gstpluginloader.c b/gst/gstpluginloader.c index 4539421..a51fa89 100644 --- a/gst/gstpluginloader.c +++ b/gst/gstpluginloader.c @@ -339,7 +339,7 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l, plugin->filename = g_strdup (entry->filename); plugin->file_mtime = entry->file_mtime; plugin->file_size = entry->file_size; - plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED; + GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED); plugin->basename = g_path_get_basename (plugin->filename); plugin->desc.name = g_intern_string (plugin->basename); @@ -849,7 +849,7 @@ handle_rx_packet (GstPluginLoader * l, return FALSE; } - newplugin->flags &= ~GST_PLUGIN_FLAG_CACHED; + GST_OBJECT_FLAG_UNSET (newplugin, GST_PLUGIN_FLAG_CACHED); GST_LOG_OBJECT (l->registry, "marking plugin %p as registered as %s", newplugin, newplugin->filename); diff --git a/gst/gstpoll.c b/gst/gstpoll.c index 7aab1d1..77be7e3 100644 --- a/gst/gstpoll.c +++ b/gst/gstpoll.c @@ -72,7 +72,6 @@ #ifdef G_OS_WIN32 #include <winsock2.h> -#define EINPROGRESS WSAEINPROGRESS #else #define _GNU_SOURCE 1 #ifdef HAVE_SYS_POLL_H diff --git a/gst/gstregistry.c b/gst/gstregistry.c index 6f41dcf..0575709 100644 --- a/gst/gstregistry.c +++ b/gst/gstregistry.c @@ -438,7 +438,7 @@ gst_registry_add_plugin (GstRegistry * registry, GstPlugin * plugin) GST_STR_NULL (plugin->filename)); /* If the new plugin is blacklisted and the existing one isn't cached, do not * accept if it's from a different location than the existing one */ - if ((plugin->flags & GST_PLUGIN_FLAG_BLACKLISTED) && + if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED) && strcmp (plugin->filename, existing_plugin->filename)) { GST_WARNING_OBJECT (registry, "Not replacing plugin because new one (%s) is blacklisted but for a different location than existing one (%s)", @@ -816,6 +816,12 @@ gst_registry_feature_filter (GstRegistry * registry, return list; } +static gboolean +gst_registry_plugin_name_filter (GstPlugin * plugin, const gchar * name) +{ + return (plugin->desc.name && !strcmp (plugin->desc.name, name)); +} + /** * gst_registry_find_plugin: * @registry: the registry to search @@ -839,7 +845,7 @@ gst_registry_find_plugin (GstRegistry * registry, const gchar * name) g_return_val_if_fail (name != NULL, NULL); walk = gst_registry_plugin_filter (registry, - (GstPluginFilter) gst_plugin_name_filter, TRUE, (gpointer) name); + (GstPluginFilter) gst_registry_plugin_name_filter, TRUE, (gpointer) name); if (walk) { result = GST_PLUGIN_CAST (walk->data); @@ -1272,7 +1278,7 @@ gst_registry_scan_path_level (GstRegistryScanContext * context, !(deps_changed = _priv_plugin_deps_files_changed (plugin)) && !strcmp (plugin->filename, filename)) { GST_LOG_OBJECT (context->registry, "file %s cached", filename); - plugin->flags &= ~GST_PLUGIN_FLAG_CACHED; + GST_OBJECT_FLAG_UNSET (plugin, GST_PLUGIN_FLAG_CACHED); GST_LOG_OBJECT (context->registry, "marking plugin %p as registered as %s", plugin, filename); plugin->registered = TRUE; @@ -1481,7 +1487,7 @@ gst_registry_remove_cache_plugins (GstRegistry * registry) while (g) { g_next = g->next; plugin = g->data; - if (plugin->flags & GST_PLUGIN_FLAG_CACHED) { + if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) { GST_DEBUG_OBJECT (registry, "removing cached plugin \"%s\"", GST_STR_NULL (plugin->filename)); registry->priv->plugins = g_list_delete_link (registry->priv->plugins, g); @@ -1593,7 +1599,9 @@ scan_and_update_registry (GstRegistry * default_registry, g_win32_get_package_installation_directory_of_module (_priv_gst_dll_handle); - dir = g_build_filename (base_dir, "lib", "gstreamer-0.10", NULL); + dir = + g_build_filename (base_dir, "lib", "gstreamer-" GST_API_VERSION, + NULL); GST_DEBUG ("scanning DLL dir %s", dir); changed |= gst_registry_scan_path_internal (&context, dir); diff --git a/gst/gstregistrybinary.c b/gst/gstregistrybinary.c index c358f31..fe1710a 100644 --- a/gst/gstregistrybinary.c +++ b/gst/gstregistrybinary.c @@ -378,7 +378,7 @@ priv_gst_registry_binary_write_cache (GstRegistry * registry, GList * plugins, if (!plugin->filename) continue; - if (plugin->flags & GST_PLUGIN_FLAG_CACHED) { + if (GST_OBJECT_FLAG_IS_SET (plugin, GST_PLUGIN_FLAG_CACHED)) { GStatBuf statbuf; if (g_stat (plugin->filename, &statbuf) < 0 || diff --git a/gst/gstregistrychunks.c b/gst/gstregistrychunks.c index 0c58dab..683738d 100644 --- a/gst/gstregistrychunks.c +++ b/gst/gstregistrychunks.c @@ -768,7 +768,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in, plugin = g_object_newv (GST_TYPE_PLUGIN, 0, NULL); /* TODO: also set GST_PLUGIN_FLAG_CONST */ - plugin->flags |= GST_PLUGIN_FLAG_CACHED; + GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_CACHED); plugin->file_mtime = pe->file_mtime; plugin->file_size = pe->file_size; @@ -804,7 +804,7 @@ _priv_gst_registry_chunks_load_plugin (GstRegistry * registry, gchar ** in, /* If the license string is 'BLACKLIST', mark this as a blacklisted * plugin */ if (strcmp (plugin->desc.license, "BLACKLIST") == 0) - plugin->flags |= GST_PLUGIN_FLAG_BLACKLISTED; + GST_OBJECT_FLAG_SET (plugin, GST_PLUGIN_FLAG_BLACKLISTED); plugin->basename = g_path_get_basename (plugin->filename); diff --git a/gst/gstsegment.h b/gst/gstsegment.h index 65f9210..9d3a8d1 100644 --- a/gst/gstsegment.h +++ b/gst/gstsegment.h @@ -59,6 +59,17 @@ typedef enum { * @GST_SEEK_FLAG_SKIP: when doing fast foward or fast reverse playback, allow * elements to skip frames instead of generating all * frames. Since 0.10.22. + * @GST_SEEK_FLAG_SNAP_BEFORE: go to a location before the requested position, + * if KEY_UNIT this means the keyframe at or before the + * requested position the one at or before the seek target. + * Since 0.10.37. + * @GST_SEEK_FLAG_SNAP_AFTER: go to a location after the requested position, + * if KEY_UNIT this means the keyframe at of after the + * requested position. Since 0.10.37. + * @GST_SEEK_FLAG_SNAP_NEAREST: go to a position near the requested position, + * if KEY_UNIT this means the keyframe closest to the + * requested position, if both keyframes are at an equal + * distance, behaves like SNAP_BEFORE. Since 0.10.37. * * Flags to be used with gst_element_seek() or gst_event_new_seek(). All flags * can be used together. @@ -82,6 +93,16 @@ typedef enum { * and demuxers to adjust the playback rate by skipping frames. This can improve * performance and decrease CPU usage because not all frames need to be decoded. * + * The @GST_SEEK_FLAG_SNAP_BEFORE flag can be used to snap to the previous + * relevant location, and the @GST_SEEK_FLAG_SNAP_AFTER flag can be used to + * select the next relevant location. If KEY_UNIT is specified, the relevant + * location is a keyframe. If both flags are specified, the nearest of these + * locations will be selected. If none are specified, the implementation is + * free to select whichever it wants. + * The before and after here are in running time, so when playing backwards, + * the next location refers to the one that will played in next, and not the + * one that is located after in the actual source stream. + * * Also see part-seeking.txt in the GStreamer design documentation for more * details on the meaning of these flags and the behaviour expected of * elements that handle them. @@ -92,7 +113,11 @@ typedef enum { GST_SEEK_FLAG_ACCURATE = (1 << 1), GST_SEEK_FLAG_KEY_UNIT = (1 << 2), GST_SEEK_FLAG_SEGMENT = (1 << 3), - GST_SEEK_FLAG_SKIP = (1 << 4) + GST_SEEK_FLAG_SKIP = (1 << 4), + GST_SEEK_FLAG_SNAP_BEFORE = (1 << 5), + GST_SEEK_FLAG_SNAP_AFTER = (1 << 6), + GST_SEEK_FLAG_SNAP_NEAREST = GST_SEEK_FLAG_SNAP_BEFORE | GST_SEEK_FLAG_SNAP_AFTER, + /* Careful to restart next flag with 1<<7 here */ } GstSeekFlags; /** diff --git a/gst/gstsystemclock.c b/gst/gstsystemclock.c index 7c461c9..9cac9ee 100644 --- a/gst/gstsystemclock.c +++ b/gst/gstsystemclock.c @@ -52,7 +52,9 @@ # define WIN32_LEAN_AND_MEAN /* prevents from including too many things */ # include <windows.h> /* QueryPerformance* stuff */ # undef WIN32_LEAN_AND_MEAN +# ifndef EWOULDBLOCK # define EWOULDBLOCK EAGAIN /* This is just to placate gcc */ +# endif #endif /* G_OS_WIN32 */ #define GET_ENTRY_STATUS(e) ((GstClockReturn) g_atomic_int_get(&GST_CLOCK_ENTRY_STATUS(e))) diff --git a/gst/gsttrace.c b/gst/gsttrace.c index a6e4d95..d4fd262 100644 --- a/gst/gsttrace.c +++ b/gst/gsttrace.c @@ -63,7 +63,11 @@ _priv_gst_alloc_trace_initialize (void) trace = g_getenv ("GST_TRACE"); if (trace != NULL) { - _gst_trace_flags = atoi (trace); + const GDebugKey keys[] = { + {"live", GST_ALLOC_TRACE_LIVE}, + {"mem-live", GST_ALLOC_TRACE_MEM_LIVE}, + }; + _gst_trace_flags = g_parse_debug_string (trace, keys, G_N_ELEMENTS (keys)); atexit (_at_exit); } diff --git a/gst/gsttypefindfactory.c b/gst/gsttypefindfactory.c index aca0698..c8f9d60 100644 --- a/gst/gsttypefindfactory.c +++ b/gst/gsttypefindfactory.c @@ -186,12 +186,12 @@ gst_type_find_factory_get_caps (GstTypeFindFactory * factory) * Returns: (transfer none) (array zero-terminated=1) (element-type utf8): a * NULL-terminated array of extensions associated with this factory */ -gchar ** +const gchar *const * gst_type_find_factory_get_extensions (GstTypeFindFactory * factory) { g_return_val_if_fail (GST_IS_TYPE_FIND_FACTORY (factory), NULL); - return factory->extensions; + return (const gchar * const *) factory->extensions; } /** @@ -222,3 +222,21 @@ gst_type_find_factory_call_function (GstTypeFindFactory * factory, gst_object_unref (new_factory); } } + +/** + * gst_type_find_factory_has_function: + * @factory: A #GstTypeFindFactory + * + * Check whether the factory has a typefind function. Typefind factories + * without typefind functions are a last-effort fallback mechanism to + * e.g. assume a certain media type based on the file extension. + * + * Returns: TRUE if the factory has a typefind functions set, otherwise FALSE + */ +gboolean +gst_type_find_factory_has_function (GstTypeFindFactory * factory) +{ + g_return_val_if_fail (GST_IS_TYPE_FIND_FACTORY (factory), FALSE); + + return (factory->function != NULL); +} diff --git a/gst/gsttypefindfactory.h b/gst/gsttypefindfactory.h index 3d8ff31..332134b 100644 --- a/gst/gsttypefindfactory.h +++ b/gst/gsttypefindfactory.h @@ -36,34 +36,13 @@ G_BEGIN_DECLS #define GST_IS_TYPE_FIND_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_TYPE_FIND_FACTORY)) #define GST_TYPE_FIND_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_TYPE_FIND_FACTORY, GstTypeFindFactoryClass)) -typedef struct _GstTypeFindFactory GstTypeFindFactory; -typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass; - /** * GstTypeFindFactory: * - * Object that stores information about a typefind function. + * Opaque object that stores information about a typefind function. */ -struct _GstTypeFindFactory { - GstPluginFeature feature; - /* <private> */ - - GstTypeFindFunction function; - gchar ** extensions; - GstCaps * caps; /* FIXME: not yet saved in registry */ - - gpointer user_data; - GDestroyNotify user_data_notify; - - gpointer _gst_reserved[GST_PADDING]; -}; - -struct _GstTypeFindFactoryClass { - GstPluginFeatureClass parent; - /* <private> */ - - gpointer _gst_reserved[GST_PADDING]; -}; +typedef struct _GstTypeFindFactory GstTypeFindFactory; +typedef struct _GstTypeFindFactoryClass GstTypeFindFactoryClass; /* typefinding interface */ @@ -71,8 +50,10 @@ GType gst_type_find_factory_get_type (void); GList * gst_type_find_factory_get_list (void); -gchar ** gst_type_find_factory_get_extensions (GstTypeFindFactory *factory); +const gchar * const * gst_type_find_factory_get_extensions (GstTypeFindFactory *factory); + GstCaps * gst_type_find_factory_get_caps (GstTypeFindFactory *factory); +gboolean gst_type_find_factory_has_function (GstTypeFindFactory *factory); void gst_type_find_factory_call_function (GstTypeFindFactory *factory, GstTypeFind *find); diff --git a/gst/gsturi.c b/gst/gsturi.c index 75c3440..afe2907 100644 --- a/gst/gsturi.c +++ b/gst/gsturi.c @@ -313,7 +313,7 @@ gst_uri_protocol_is_valid (const gchar * protocol) gst_uri_protocol_check_internal (protocol, &endptr); - return *endptr == '\0' && endptr != protocol; + return *endptr == '\0' && ((gsize) (endptr - protocol)) >= 3; } /** @@ -334,7 +334,7 @@ gst_uri_is_valid (const gchar * uri) gst_uri_protocol_check_internal (uri, &endptr); - return *endptr == ':'; + return *endptr == ':' && ((gsize) (endptr - uri)) >= 3; } /** diff --git a/gst/gstvalue.c b/gst/gstvalue.c index 9910265..c9f344b 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -1841,6 +1841,65 @@ gst_value_deserialize_caps (GValue * dest, const gchar * s) return FALSE; } +/************** + * GstSegment * + **************/ +static gchar * +gst_value_serialize_segment (const GValue * value) +{ + GstSegment *seg = g_value_get_boxed (value); + gchar *t, *res; + GstStructure *s; + + s = gst_structure_new ("GstSegment", + "flags", GST_TYPE_SEGMENT_FLAGS, seg->flags, + "rate", G_TYPE_DOUBLE, seg->rate, + "applied-rate", G_TYPE_DOUBLE, seg->applied_rate, + "format", GST_TYPE_FORMAT, seg->format, + "base", G_TYPE_UINT64, seg->base, + "start", G_TYPE_UINT64, seg->start, + "stop", G_TYPE_UINT64, seg->stop, + "time", G_TYPE_UINT64, seg->time, + "position", G_TYPE_UINT64, seg->position, + "duration", G_TYPE_UINT64, seg->duration, NULL); + t = gst_structure_to_string (s); + res = g_strdup_printf ("\"%s\"", t); + g_free (t); + gst_structure_free (s); + + return res; +} + +static gboolean +gst_value_deserialize_segment (GValue * dest, const gchar * s) +{ + GstStructure *str; + GstSegment seg; + gboolean res; + + str = gst_structure_from_string (s, NULL); + if (str == NULL) + return FALSE; + + res = gst_structure_get (str, + "flags", GST_TYPE_SEGMENT_FLAGS, &seg.flags, + "rate", G_TYPE_DOUBLE, &seg.rate, + "applied-rate", G_TYPE_DOUBLE, &seg.applied_rate, + "format", GST_TYPE_FORMAT, &seg.format, + "base", G_TYPE_UINT64, &seg.base, + "start", G_TYPE_UINT64, &seg.start, + "stop", G_TYPE_UINT64, &seg.stop, + "time", G_TYPE_UINT64, &seg.time, + "position", G_TYPE_UINT64, &seg.position, + "duration", G_TYPE_UINT64, &seg.duration, NULL); + gst_structure_free (str); + + if (res) + g_value_set_boxed (dest, &seg); + + return res; +} + /**************** * GstStructure * ****************/ @@ -5730,6 +5789,17 @@ _priv_gst_value_initialize (void) static GstValueTable gst_value = { 0, NULL, + gst_value_serialize_segment, + gst_value_deserialize_segment, + }; + + gst_value.type = GST_TYPE_SEGMENT; + gst_value_register (&gst_value); + } + { + static GstValueTable gst_value = { + 0, + NULL, gst_value_serialize_structure, gst_value_deserialize_structure, }; diff --git a/gst/parse/Makefile.in b/gst/parse/Makefile.in index 6b0e37d..5915f4d 100644 --- a/gst/parse/Makefile.in +++ b/gst/parse/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.11.4 from Makefile.am. +# Makefile.in generated by automake 1.11.5 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, diff --git a/gst/parse/grammar.y b/gst/parse/grammar.y index 70d8c7b..30c37a9 100644 --- a/gst/parse/grammar.y +++ b/gst/parse/grammar.y @@ -379,7 +379,7 @@ out: return; error: - GST_CAT_ERROR (GST_CAT_PIPELINE, "could not set property \"%s\" in " + GST_CAT_ERROR (GST_CAT_PIPELINE, "could not set property \"%s\" in %" GST_PTR_FORMAT, pspec->name, target); goto out; } |