Merge branch 'master' into 0.11

This commit is contained in:
Sebastian Dröge 2011-04-16 08:59:58 +02:00
commit f51a23a83c
32 changed files with 282 additions and 71 deletions

View file

@ -763,6 +763,7 @@ init_post (GOptionContext * context, GOptionGroup * group, gpointer data,
_gst_value_initialize ();
g_type_class_ref (gst_param_spec_fraction_get_type ());
_gst_tag_initialize ();
gst_parse_context_get_type ();
_gst_plugin_initialize ();

View file

@ -180,7 +180,7 @@ gst_buffer_list_len (GstBufferList * list)
* gst_buffer_list_foreach:
* @list: a #GstBufferList
* @func: (scope call): a #GstBufferListFunc to call
* @user_data: user data passed to @func
* @user_data: (closure): user data passed to @func
*
* Call @func with @data for each buffer in @list.
*

View file

@ -42,9 +42,9 @@
/**
* gst_filter_run:
* @list: a linked list
* @func: the function to execute for each item
* @func: (scope call): the function to execute for each item
* @first: flag to stop execution after a successful item
* @user_data: user data
* @user_data: (closure): user data
*
* Iterates over the elements in @list, calling @func with the
* list item data for each item. If @func returns TRUE, @data is

View file

@ -73,6 +73,7 @@ struct _GstProxyPadPrivate
G_DEFINE_TYPE (GstProxyPad, gst_proxy_pad, GST_TYPE_PAD);
static GstPad *gst_proxy_pad_get_target (GstPad * pad);
static GstPad *gst_proxy_pad_get_internal (GstPad * pad);
static void gst_proxy_pad_dispose (GObject * object);
static void gst_proxy_pad_finalize (GObject * object);
@ -99,9 +100,12 @@ static gboolean
gst_proxy_pad_do_event (GstPad * pad, GstEvent * event)
{
gboolean res = FALSE;
GstPad *internal = GST_PROXY_PAD_INTERNAL (pad);
GstPad *internal = gst_proxy_pad_get_internal (pad);
res = gst_pad_push_event (internal, event);
if (internal) {
res = gst_pad_push_event (internal, event);
gst_object_unref (internal);
}
return res;
}
@ -139,10 +143,13 @@ static GstFlowReturn
gst_proxy_pad_do_bufferalloc (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
{
GstFlowReturn result;
GstPad *internal = GST_PROXY_PAD_INTERNAL (pad);
GstFlowReturn result = GST_FLOW_WRONG_STATE;
GstPad *internal = gst_proxy_pad_get_internal (pad);
result = gst_pad_alloc_buffer (internal, offset, size, caps, buf);
if (internal) {
result = gst_pad_alloc_buffer (internal, offset, size, caps, buf);
gst_object_unref (internal);
}
return result;
}
@ -349,6 +356,20 @@ gst_proxy_pad_get_target (GstPad * pad)
return target;
}
static GstPad *
gst_proxy_pad_get_internal (GstPad * pad)
{
GstPad *internal;
GST_PROXY_LOCK (pad);
internal = GST_PROXY_PAD_INTERNAL (pad);
if (internal)
gst_object_ref (internal);
GST_PROXY_UNLOCK (pad);
return internal;
}
static void
gst_proxy_pad_do_unlink (GstPad * pad)
{

View file

@ -136,7 +136,7 @@ gst_element_implements_interface (GstElement * element, GType iface_type)
* cast a given object to an interface type, and check whether this
* interface is supported for this specific instance.
*
* Returns: a gpointer to the interface type
* Returns: (transfer none): a gpointer to the interface type
*/
gpointer

View file

@ -471,8 +471,8 @@ filter_free (GstIteratorFilter * it)
/**
* gst_iterator_filter:
* @it: The #GstIterator to filter
* @func: the compare function to select elements
* @user_data: user data passed to the compare function
* @func: (scope call): the compare function to select elements
* @user_data: (closure): user data passed to the compare function
*
* Create a new iterator from an existing iterator. The new iterator
* will only return those elements that match the given compare function @func.
@ -481,7 +481,7 @@ filter_free (GstIteratorFilter * it)
*
* When this iterator is freed, @it will also be freed.
*
* Returns: a new #GstIterator.
* Returns: (transfer full): a new #GstIterator.
*
* MT safe.
*/
@ -510,9 +510,9 @@ gst_iterator_filter (GstIterator * it, GCompareFunc func, gpointer user_data)
/**
* gst_iterator_fold:
* @it: The #GstIterator to fold over
* @func: the fold function
* @func: (scope call): the fold function
* @ret: the seed value passed to the fold function
* @user_data: user data passed to the fold function
* @user_data: (closure): user data passed to the fold function
*
* Folds @func over the elements of @iter. That is to say, @func will be called
* as @func (object, @ret, @user_data) for each object in @it. The normal use
@ -578,8 +578,8 @@ foreach_fold_func (gpointer item, GValue * unused, ForeachFoldData * data)
/**
* gst_iterator_foreach:
* @it: The #GstIterator to iterate
* @func: the function to call for each element.
* @user_data: user data passed to the function
* @func: (scope call): the function to call for each element.
* @user_data: (closure): user data passed to the function
*
* Iterate over all element of @it and call the given function @func for
* each element. As in gst_iterator_fold(), the refcount of a refcounted
@ -630,8 +630,8 @@ find_custom_fold_func (gpointer item, GValue * ret, FindCustomFoldData * data)
/**
* gst_iterator_find_custom:
* @it: The #GstIterator to iterate
* @func: the compare function to use
* @user_data: user data passed to the compare function
* @func: (scope call): the compare function to use
* @user_data: (closure): user data passed to the compare function
*
* Find the first element in @it that matches the compare function @func.
* @func should return 0 when the element is found. As in gst_iterator_fold(),
@ -643,7 +643,7 @@ find_custom_fold_func (gpointer item, GValue * ret, FindCustomFoldData * data)
*
* This function will return NULL if an error happened to the iterator.
*
* Returns: The element in the iterator that matches the compare
* Returns: (transfer full): The element in the iterator that matches the compare
* function or NULL when no element matched.
*
* MT safe.

View file

@ -202,7 +202,7 @@ gst_mini_object_make_writable (GstMiniObject * mini_object)
* of memcpy operations in a pipeline, especially if the miniobject
* is a #GstBuffer.
*
* Returns: the mini-object.
* Returns: (transfer full): the mini-object.
*/
GstMiniObject *
gst_mini_object_ref (GstMiniObject * mini_object)

View file

@ -3750,7 +3750,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data,
goto no_function;
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"calling chainfunction &%s", GST_DEBUG_FUNCPTR_NAME (chainfunc));
"calling chainfunction &%s with buffer %p",
GST_DEBUG_FUNCPTR_NAME (chainfunc), data);
if (cache) {
cache->peer = gst_object_ref (pad);
@ -3760,8 +3761,8 @@ gst_pad_chain_data_unchecked (GstPad * pad, gboolean is_buffer, void *data,
ret = chainfunc (pad, GST_BUFFER_CAST (data));
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"called chainfunction &%s, returned %s",
GST_DEBUG_FUNCPTR_NAME (chainfunc), gst_flow_get_name (ret));
"called chainfunction &%s with buffer %p, returned %s",
GST_DEBUG_FUNCPTR_NAME (chainfunc), data, gst_flow_get_name (ret));
} else {
GstPadChainListFunction chainlistfunc;
@ -4170,14 +4171,15 @@ gst_pad_push (GstPad * pad, GstBuffer * buffer)
if (G_UNLIKELY (g_atomic_pointer_get (cache_ptr) == PAD_CACHE_INVALID))
goto invalid;
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad, "calling chainfunction &%s",
GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)));
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"calling chainfunction &%s with buffer %p",
GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)), buffer);
ret = GST_PAD_CHAINFUNC (peer) (peer, buffer);
GST_CAT_LOG_OBJECT (GST_CAT_SCHEDULING, pad,
"called chainfunction &%s, returned %s",
GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)),
"called chainfunction &%s with buffer %p, returned %s",
GST_DEBUG_FUNCPTR_NAME (GST_PAD_CHAINFUNC (peer)), buffer,
gst_flow_get_name (ret));
GST_PAD_STREAM_UNLOCK (peer);

View file

@ -44,6 +44,42 @@
#include "parse/types.h"
#endif
static void
_prepend_missing_element (gchar * element, GList ** list)
{
*list = g_list_prepend (*list, g_strdup (element));
}
static GstParseContext *
gst_parse_context_copy (const GstParseContext * context)
{
GstParseContext *ret = NULL;
#ifndef GST_DISABLE_PARSE
ret = gst_parse_context_new ();
if (context) {
g_list_foreach (context->missing_elements, (GFunc) _prepend_missing_element,
&ret->missing_elements);
ret->missing_elements = g_list_reverse (ret->missing_elements);
}
#endif
return ret;
}
GType
gst_parse_context_get_type (void)
{
static GType type = 0;
if (G_UNLIKELY (type == 0)) {
type = g_boxed_type_register_static ("GstParseContext",
(GBoxedCopyFunc) gst_parse_context_copy,
(GBoxedFreeFunc) gst_parse_context_free);
}
return type;
}
/**
* gst_parse_error_quark:
*

View file

@ -75,6 +75,8 @@ typedef enum
GST_PARSE_FLAG_FATAL_ERRORS = (1 << 0)
} GstParseFlags;
#define GST_TYPE_PARSE_CONTEXT (gst_parse_context_get_type())
/**
* GstParseContext:
*
@ -86,6 +88,7 @@ typedef struct _GstParseContext GstParseContext;
/* create, process and free a parse context */
GType gst_parse_context_get_type (void);
GstParseContext * gst_parse_context_new (void);
gchar ** gst_parse_context_get_missing_elements (GstParseContext * context);

View file

@ -353,9 +353,36 @@ plugin_loader_create_blacklist_plugin (GstPluginLoader * l,
static gboolean
gst_plugin_loader_try_helper (GstPluginLoader * loader, gchar * location)
{
#ifdef __APPLE__
#if defined(__x86_64__)
char *argv[] = { (char *) "/usr/bin/arch", (char *) "-x86_64",
location, (char *) "-l", NULL
};
#elif defined(__i386__)
char *argv[] = { (char *) "/usr/bin/arch", (char *) "-i386",
location, (char *) "-l", NULL
};
#elif defined(__ppc__)
char *argv[] = { (char *) "/usr/bin/arch", (char *) "-ppc",
location, (char *) "-l", NULL
};
#elif defined(__ppc64__)
char *argv[] = { (char *) "/usr/bin/arch", (char *) "-ppc64",
location, (char *) "-l", NULL
};
#endif
#else /* ! __APPLE__ */
char *argv[] = { location, (char *) "-l", NULL };
#endif
#ifdef __APPLE__
GST_LOG ("Trying to spawn gst-plugin-scanner helper at %s with arch %s",
location, argv[1]);
#else
GST_LOG ("Trying to spawn gst-plugin-scanner helper at %s", location);
#endif
if (!g_spawn_async_with_pipes (NULL, argv, NULL,
G_SPAWN_DO_NOT_REAP_CHILD /* | G_SPAWN_STDERR_TO_DEV_NULL */ ,
NULL, NULL, &loader->child_pid, &loader->fd_w.fd, &loader->fd_r.fd,

View file

@ -606,7 +606,7 @@ gst_registry_remove_feature (GstRegistry * registry, GstPluginFeature * feature)
/**
* gst_registry_plugin_filter:
* @registry: registry to query
* @filter: the filter to use
* @filter: (scope call): the filter to use
* @first: only return first match
* @user_data: (closure): user data passed to the filter function
*
@ -726,7 +726,7 @@ gst_registry_get_typefind_factory_list (GstRegistry * registry)
/**
* gst_registry_feature_filter:
* @registry: registry to query
* @filter: the filter to use
* @filter: (scope call): the filter to use
* @first: only return first match
* @user_data: (closure): user data passed to the filter function
*

View file

@ -1074,7 +1074,7 @@ gst_structure_nth_field_name (const GstStructure * structure, guint index)
/**
* gst_structure_foreach:
* @structure: a #GstStructure
* @func: a function to call for each field
* @func: (scope call): a function to call for each field
* @user_data: (closure): private data
*
* Calls the provided function once for each field in the #GstStructure. The
@ -1110,7 +1110,7 @@ gst_structure_foreach (const GstStructure * structure,
/**
* gst_structure_map_in_place:
* @structure: a #GstStructure
* @func: a function to call for each field
* @func: (scope call): a function to call for each field
* @user_data: (closure): private data
*
* Calls the provided function once for each field in the #GstStructure. In

View file

@ -1286,9 +1286,13 @@ gst_element_factory_can_accept_all_caps_in_direction (GstElementFactory *
GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data;
if (template->direction == direction) {
if (gst_caps_is_always_compatible (caps,
gst_static_caps_get (&template->static_caps)))
GstCaps *templcaps = gst_static_caps_get (&template->static_caps);
if (gst_caps_is_always_compatible (caps, templcaps)) {
gst_caps_unref (templcaps);
return TRUE;
}
gst_caps_unref (templcaps);
}
templates = g_list_next (templates);
}
@ -1311,9 +1315,13 @@ gst_element_factory_can_accept_any_caps_in_direction (GstElementFactory *
GstStaticPadTemplate *template = (GstStaticPadTemplate *) templates->data;
if (template->direction == direction) {
if (gst_caps_can_intersect (caps,
gst_static_caps_get (&template->static_caps)))
GstCaps *templcaps = gst_static_caps_get (&template->static_caps);
if (gst_caps_can_intersect (caps, templcaps)) {
gst_caps_unref (templcaps);
return TRUE;
}
gst_caps_unref (templcaps);
}
templates = g_list_next (templates);
}
@ -3821,7 +3829,7 @@ gst_util_get_timestamp (void)
* @array: the sorted input array
* @num_elements: number of elements in the array
* @element_size: size of every element in bytes
* @search_func: function to compare two elements, @search_data will always be passed as second argument
* @search_func: (scope call): function to compare two elements, @search_data will always be passed as second argument
* @mode: search mode that should be used
* @search_data: element that should be found
* @user_data: (closure): data to pass to @search_func
@ -3834,7 +3842,7 @@ gst_util_get_timestamp (void)
*
* The complexity of this search function is O(log (num_elements)).
*
* Returns: The address of the found element or %NULL if nothing was found
* Returns: (transfer none): The address of the found element or %NULL if nothing was found
*
* Since: 0.10.23
*/

View file

@ -35,7 +35,7 @@ PRINT (const char *format, ...)
%}
_operator [(){}.!,;=]
_identifier [[:alpha:]][[:alnum:]\-_%:]*
_identifier [[:alnum:]_][[:alnum:]\-_%:]*
_char ("\\".)|([^[:space:]])
_string {_char}+|("\""([^\"]|"\\\"")*"\"")|("'"([^']|"\\\'")*"'")

View file

@ -1216,14 +1216,11 @@ gst_base_parse_update_bitrates (GstBaseParse * parse, GstBaseParseFrame * frame)
/* Only update the tag on a 10 kbps delta */
static const gint update_threshold = 10000;
GstBaseParseClass *klass;
guint64 data_len, frame_dur;
gint overhead, frame_bitrate, old_avg_bitrate;
gboolean update_min = FALSE, update_avg = FALSE, update_max = FALSE;
GstBuffer *buffer = frame->buffer;
klass = GST_BASE_PARSE_GET_CLASS (parse);
overhead = frame->overhead;
if (overhead == -1)
return;

View file

@ -653,6 +653,8 @@ gst_base_sink_pad_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstFlowReturn result = GST_FLOW_OK;
bsink = GST_BASE_SINK (gst_pad_get_parent (pad));
if (G_UNLIKELY (bsink == NULL))
return GST_FLOW_WRONG_STATE;
bclass = GST_BASE_SINK_GET_CLASS (bsink);
if (bclass->buffer_alloc)
@ -3402,6 +3404,10 @@ gst_base_sink_event (GstPad * pad, GstEvent * event)
GstBaseSinkClass *bclass;
basesink = GST_BASE_SINK (gst_pad_get_parent (pad));
if (G_UNLIKELY (basesink == NULL)) {
gst_event_unref (event);
return FALSE;
}
bclass = GST_BASE_SINK_GET_CLASS (basesink);

View file

@ -1225,8 +1225,13 @@ static gboolean
gst_base_transform_query (GstPad * pad, GstQuery * query)
{
gboolean ret = FALSE;
GstBaseTransform *trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
GstPad *otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
GstBaseTransform *trans;
GstPad *otherpad;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL))
return FALSE;
otherpad = (pad == trans->srcpad) ? trans->sinkpad : trans->srcpad;
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_POSITION:{
@ -1716,6 +1721,8 @@ gst_base_transform_buffer_alloc (GstPad * pad, guint64 offset, guint size,
gsize size_suggest;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL))
return GST_FLOW_WRONG_STATE;
klass = GST_BASE_TRANSFORM_GET_CLASS (trans);
priv = trans->priv;
@ -1997,6 +2004,10 @@ gst_base_transform_sink_event (GstPad * pad, GstEvent * event)
gboolean forward = TRUE;
trans = GST_BASE_TRANSFORM (gst_pad_get_parent (pad));
if (G_UNLIKELY (trans == NULL)) {
gst_event_unref (event);
return FALSE;
}
bclass = GST_BASE_TRANSFORM_GET_CLASS (trans);
if (bclass->event)

View file

@ -191,7 +191,10 @@ gst_funnel_sink_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstCaps * caps, GstBuffer ** buf)
{
GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent_element (pad));
GstFlowReturn ret = GST_FLOW_OK;
GstFlowReturn ret;
if (G_UNLIKELY (funnel == NULL))
return GST_FLOW_WRONG_STATE;
ret = gst_pad_alloc_buffer (funnel->srcpad, offset, size, caps, buf);
@ -246,6 +249,9 @@ gst_funnel_sink_getcaps (GstPad * pad)
GstFunnel *funnel = GST_FUNNEL (gst_pad_get_parent (pad));
GstCaps *caps;
if (G_UNLIKELY (funnel == NULL))
return gst_caps_new_any ();
caps = gst_pad_peer_get_caps_reffed (funnel->srcpad);
if (caps == NULL)
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
@ -327,6 +333,11 @@ gst_funnel_sink_event (GstPad * pad, GstEvent * event)
gboolean forward = TRUE;
gboolean res = TRUE;
if (G_UNLIKELY (funnel == NULL)) {
gst_event_unref (event);
return FALSE;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:
{
@ -346,7 +357,6 @@ gst_funnel_sink_event (GstPad * pad, GstEvent * event)
GST_OBJECT_UNLOCK (funnel);
forward = FALSE;
gst_event_unref (event);
}
break;
case GST_EVENT_FLUSH_STOP:
@ -363,6 +373,8 @@ gst_funnel_sink_event (GstPad * pad, GstEvent * event)
if (forward)
res = gst_pad_push_event (funnel->srcpad, event);
else
gst_event_unref (event);
gst_object_unref (funnel);
@ -379,7 +391,10 @@ gst_funnel_src_event (GstPad * pad, GstEvent * event)
gboolean done = FALSE;
funnel = gst_pad_get_parent_element (pad);
g_return_val_if_fail (funnel != NULL, FALSE);
if (G_UNLIKELY (funnel == NULL)) {
gst_event_unref (event);
return FALSE;
}
iter = gst_element_iterate_sink_pads (funnel);

View file

@ -386,6 +386,10 @@ gst_selector_pad_event (GstPad * pad, GstEvent * event)
GstPad *active_sinkpad;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL)) {
gst_event_unref (event);
return FALSE;
}
selpad = GST_SELECTOR_PAD_CAST (pad);
GST_INPUT_SELECTOR_LOCK (sel);
@ -513,6 +517,8 @@ gst_selector_pad_getcaps (GstPad * pad)
GstCaps *caps;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return gst_caps_new_any ();
GST_DEBUG_OBJECT (sel, "Getting caps of srcpad peer");
caps = gst_pad_peer_get_caps_reffed (sel->srcpad);
@ -531,6 +537,8 @@ gst_selector_pad_acceptcaps (GstPad * pad, GstCaps * caps)
gboolean res;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return FALSE;
GST_DEBUG_OBJECT (sel, "Checking acceptcaps of srcpad peer");
res = gst_pad_peer_accept_caps (sel->srcpad, caps);
@ -550,6 +558,9 @@ gst_selector_pad_bufferalloc (GstPad * pad, guint64 offset,
GstSelectorPad *selpad;
sel = GST_INPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return GST_FLOW_WRONG_STATE;
selpad = GST_SELECTOR_PAD_CAST (pad);
GST_LOG_OBJECT (pad, "received alloc");

View file

@ -1780,8 +1780,8 @@ gst_single_queue_new (GstMultiQueue * mqueue, gint id)
sq->src_tainted = TRUE;
name = g_strdup_printf ("sink%d", sq->id);
sq->sinkpad = gst_pad_new_from_static_template (&sinktemplate, name);
g_free (name);
gst_pad_set_chain_function (sq->sinkpad,
GST_DEBUG_FUNCPTR (gst_multi_queue_chain));

View file

@ -294,10 +294,13 @@ gst_output_selector_get_property (GObject * object, guint prop_id,
static GstCaps *
gst_output_selector_sink_getcaps (GstPad * pad)
{
GstOutputSelector *sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad));
GstOutputSelector *sel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
GstPad *active = NULL;
GstCaps *caps = NULL;
if (G_UNLIKELY (sel == NULL))
return gst_caps_new_any ();
GST_OBJECT_LOCK (sel);
if (sel->pending_srcpad)
active = gst_object_ref (sel->pending_srcpad);
@ -312,6 +315,8 @@ gst_output_selector_sink_getcaps (GstPad * pad)
if (caps == NULL) {
caps = gst_caps_new_any ();
}
gst_object_unref (sel);
return caps;
}
@ -363,7 +368,9 @@ gst_output_selector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstFlowReturn res;
GstPad *allocpad;
sel = GST_OUTPUT_SELECTOR (GST_PAD_PARENT (pad));
sel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL))
return GST_FLOW_WRONG_STATE;
res = GST_FLOW_NOT_LINKED;
GST_OBJECT_LOCK (sel);
@ -390,6 +397,7 @@ gst_output_selector_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GST_DEBUG_OBJECT (sel, "buffer alloc finished: %s", gst_flow_get_name (res));
gst_object_unref (sel);
return res;
}
@ -579,6 +587,10 @@ gst_output_selector_handle_sink_event (GstPad * pad, GstEvent * event)
GstPad *output_pad = NULL;
sel = GST_OUTPUT_SELECTOR (gst_pad_get_parent (pad));
if (G_UNLIKELY (sel == NULL)) {
gst_event_unref (event);
return FALSE;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:

View file

@ -472,11 +472,15 @@ gst_queue_acceptcaps (GstPad * pad, GstCaps * caps)
GstQueue *queue;
GstPad *otherpad;
queue = GST_QUEUE (GST_PAD_PARENT (pad));
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return FALSE;
otherpad = (pad == queue->srcpad ? queue->sinkpad : queue->srcpad);
result = gst_pad_peer_accept_caps (otherpad, caps);
gst_object_unref (queue);
return result;
}
@ -545,11 +549,14 @@ gst_queue_bufferalloc (GstPad * pad, guint64 offset, guint size, GstCaps * caps,
GstQueue *queue;
GstFlowReturn result;
queue = GST_QUEUE (GST_PAD_PARENT (pad));
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL))
return GST_FLOW_WRONG_STATE;
/* Forward to src pad, without setting caps on the src pad */
result = gst_pad_alloc_buffer (queue->srcpad, offset, size, caps, buf);
gst_object_unref (queue);
return result;
}
@ -804,7 +811,11 @@ gst_queue_handle_sink_event (GstPad * pad, GstEvent * event)
{
GstQueue *queue;
queue = GST_QUEUE (GST_OBJECT_PARENT (pad));
queue = GST_QUEUE (gst_pad_get_parent (pad));
if (G_UNLIKELY (queue == NULL)) {
gst_event_unref (event);
return FALSE;
}
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_START:
@ -865,6 +876,7 @@ gst_queue_handle_sink_event (GstPad * pad, GstEvent * event)
break;
}
done:
gst_object_unref (queue);
return TRUE;
/* ERRORS */
@ -873,6 +885,7 @@ out_flushing:
GST_CAT_LOG_OBJECT (queue_dataflow, queue,
"refusing event, we are flushing");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_object_unref (queue);
gst_event_unref (event);
return FALSE;
}
@ -880,6 +893,7 @@ out_eos:
{
GST_CAT_LOG_OBJECT (queue_dataflow, queue, "refusing event, we are EOS");
GST_QUEUE_MUTEX_UNLOCK (queue);
gst_object_unref (queue);
gst_event_unref (event);
return FALSE;
}

View file

@ -368,7 +368,7 @@ gst_queue2_class_init (GstQueue2Class * klass)
g_object_class_install_property (gobject_class, PROP_RING_BUFFER_MAX_SIZE,
g_param_spec_uint64 ("ring-buffer-max-size",
"Max. ring buffer size (bytes)",
"Max. amount of data in the ring buffer (bytes, 0 = disabled",
"Max. amount of data in the ring buffer (bytes, 0 = disabled)",
0, G_MAXUINT64, DEFAULT_RING_BUFFER_MAX_SIZE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
@ -699,7 +699,9 @@ update_time_level (GstQueue2 * queue)
GST_DEBUG_OBJECT (queue, "sink %" GST_TIME_FORMAT ", src %" GST_TIME_FORMAT,
GST_TIME_ARGS (queue->sinktime), GST_TIME_ARGS (queue->srctime));
if (queue->sinktime >= queue->srctime)
if (queue->sinktime != GST_CLOCK_TIME_NONE
&& queue->srctime != GST_CLOCK_TIME_NONE
&& queue->sinktime >= queue->srctime)
queue->cur_level.time = queue->sinktime - queue->srctime;
else
queue->cur_level.time = 0;
@ -2821,7 +2823,7 @@ gst_queue2_src_activate_pull (GstPad * pad, gboolean active)
result = gst_queue2_open_temp_location_file (queue);
} else if (!queue->ring_buffer) {
queue->ring_buffer = g_malloc (queue->ring_buffer_max_size);
result = !!queue->ring_buffer;
result = ! !queue->ring_buffer;
} else {
result = TRUE;
}

View file

@ -551,7 +551,9 @@ gst_tee_buffer_alloc (GstPad * pad, guint64 offset, guint size,
GstFlowReturn res;
GstPad *allocpad;
tee = GST_TEE_CAST (GST_PAD_PARENT (pad));
tee = GST_TEE_CAST (gst_pad_get_parent (pad));
if (G_UNLIKELY (tee == NULL))
return GST_FLOW_WRONG_STATE;
res = GST_FLOW_NOT_LINKED;
@ -587,6 +589,7 @@ gst_tee_buffer_alloc (GstPad * pad, guint64 offset, guint size,
}
GST_OBJECT_UNLOCK (tee);
gst_object_unref (tee);
return res;
}

View file

@ -93,7 +93,7 @@ setup_multiqueue (GstElement * pipe, GstElement * inputs[],
GST_START_TEST (test_simple_pipeline)
{
GstElement *pipe, *mq;
GstElement *pipe;
GstElement *inputs[1];
GstElement *outputs[1];
GstMessage *msg;
@ -107,7 +107,7 @@ GST_START_TEST (test_simple_pipeline)
outputs[0] = gst_element_factory_make ("fakesink", NULL);
fail_unless (outputs[0] != NULL, "failed to create 'fakesink' element");
mq = setup_multiqueue (pipe, inputs, outputs, 1);
setup_multiqueue (pipe, inputs, outputs, 1);
gst_element_set_state (pipe, GST_STATE_PLAYING);
@ -128,7 +128,7 @@ GST_END_TEST;
GST_START_TEST (test_simple_shutdown_while_running)
{
GstElement *pipe, *mq;
GstElement *pipe;
GstElement *inputs[1];
GstElement *outputs[1];
GstMessage *msg;
@ -141,7 +141,7 @@ GST_START_TEST (test_simple_shutdown_while_running)
outputs[0] = gst_element_factory_make ("fakesink", NULL);
fail_unless (outputs[0] != NULL, "failed to create 'fakesink' element");
mq = setup_multiqueue (pipe, inputs, outputs, 1);
setup_multiqueue (pipe, inputs, outputs, 1);
gst_element_set_state (pipe, GST_STATE_PAUSED);
@ -282,6 +282,8 @@ GST_START_TEST (test_request_pads_named)
GST_LOG ("Cleaning up");
gst_object_unref (sink1);
gst_object_unref (sink2);
gst_object_unref (sink3);
gst_object_unref (sink4);
gst_object_unref (mq);
}

View file

@ -59,7 +59,7 @@ setup_queue2 (GstElement * pipe, GstElement * input, GstElement * output)
GST_START_TEST (test_simple_pipeline)
{
GstElement *pipe, *queue2, *input, *output;
GstElement *pipe, *input, *output;
GstMessage *msg;
pipe = gst_pipeline_new ("pipeline");
@ -71,7 +71,7 @@ GST_START_TEST (test_simple_pipeline)
output = gst_element_factory_make ("fakesink", NULL);
fail_unless (output != NULL, "failed to create 'fakesink' element");
queue2 = setup_queue2 (pipe, input, output);
setup_queue2 (pipe, input, output);
gst_element_set_state (pipe, GST_STATE_PLAYING);

View file

@ -1137,11 +1137,15 @@ GST_START_TEST (test_many_bins)
fail_unless (gst_element_link (last_bin, sink));
ret = gst_element_set_state (pipeline, GST_STATE_PLAYING);
fail_unless (ret == GST_STATE_CHANGE_ASYNC, "did not get state change async");
fail_unless_equals_int (ret, GST_STATE_CHANGE_ASYNC);
ret = gst_element_get_state (pipeline, NULL, NULL, 5 * GST_SECOND);
fail_unless (ret == GST_STATE_CHANGE_SUCCESS,
"did not get state change success");
for (i = 0; i < 15; ++i) {
GST_INFO ("waiting for preroll ...");
ret = gst_element_get_state (pipeline, NULL, NULL, GST_SECOND);
if (ret != GST_STATE_CHANGE_ASYNC)
break;
}
fail_unless_equals_int (ret, GST_STATE_CHANGE_SUCCESS);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
@ -1172,7 +1176,10 @@ gst_bin_suite (void)
tcase_add_test (tc_chain, test_iterate_sorted);
tcase_add_test (tc_chain, test_link_structure_change);
tcase_add_test (tc_chain, test_state_failure_remove);
tcase_add_test (tc_chain, test_many_bins);
/* fails on OSX build bot for some reason, and is a bit silly anyway */
if (0)
tcase_add_test (tc_chain, test_many_bins);
return s;
}

View file

@ -1031,6 +1031,28 @@ GST_START_TEST (test_pad_proxy_getcaps_aggregation)
GST_END_TEST;
GST_START_TEST (test_greatest_common_divisor)
{
fail_if (gst_util_greatest_common_divisor (1, 1) != 1);
fail_if (gst_util_greatest_common_divisor (2, 3) != 1);
fail_if (gst_util_greatest_common_divisor (3, 5) != 1);
fail_if (gst_util_greatest_common_divisor (-1, 1) != 1);
fail_if (gst_util_greatest_common_divisor (-2, 3) != 1);
fail_if (gst_util_greatest_common_divisor (-3, 5) != 1);
fail_if (gst_util_greatest_common_divisor (-1, -1) != 1);
fail_if (gst_util_greatest_common_divisor (-2, -3) != 1);
fail_if (gst_util_greatest_common_divisor (-3, -5) != 1);
fail_if (gst_util_greatest_common_divisor (1, -1) != 1);
fail_if (gst_util_greatest_common_divisor (2, -3) != 1);
fail_if (gst_util_greatest_common_divisor (3, -5) != 1);
fail_if (gst_util_greatest_common_divisor (2, 2) != 2);
fail_if (gst_util_greatest_common_divisor (2, 4) != 2);
fail_if (gst_util_greatest_common_divisor (1001, 11) != 11);
}
GST_END_TEST;
static Suite *
gst_utils_suite (void)
{
@ -1063,6 +1085,7 @@ gst_utils_suite (void)
tcase_add_test (tc_chain, test_binary_search);
tcase_add_test (tc_chain, test_pad_proxy_getcaps_aggregation);
tcase_add_test (tc_chain, test_greatest_common_divisor);
return s;
}

View file

@ -624,7 +624,6 @@ GST_START_TEST (test_deserialize_string)
};
guint i;
GValue v = { 0, };
gboolean ret = TRUE;
g_value_init (&v, G_TYPE_STRING);
for (i = 0; i < G_N_ELEMENTS (tests); i++) {
@ -635,7 +634,6 @@ GST_START_TEST (test_deserialize_string)
"\nwanted: %s\ngot : %s", tests[i].to, g_value_get_string (&v));
} else {
fail_if (tests[i].to != NULL, "failed, but wanted: %s", tests[i].to);
ret = FALSE;
}
}
g_value_unset (&v);

View file

@ -95,10 +95,8 @@ gst_test_trans_base_init (gpointer g_class)
static void
gst_test_trans_class_init (GstTestTransClass * klass)
{
GObjectClass *gobject_class;
GstBaseTransformClass *trans_class;
gobject_class = (GObjectClass *) klass;
trans_class = (GstBaseTransformClass *) klass;
trans_class->passthrough_on_same_caps = klass_passthrough_on_same_caps;

View file

@ -99,6 +99,8 @@ static const gchar *test_lines[] = {
"fakesrc ! video/raw, format=(fourcc)YUY2; video/raw, format=(fourcc)YV12 ! fakesink silent=true",
"fakesrc ! audio/x-raw-int, width=[16, 32], depth={16, 24, 32}, signed=TRUE ! fakesink silent=true",
"fakesrc ! identity silent=true ! identity silent=true ! identity silent=true ! fakesink silent=true",
"fakesrc name=100 fakesink name=101 silent=true 100. ! 101.",
"fakesrc ! 1dentity ! fakesink silent=true",
NULL
};
@ -106,6 +108,18 @@ GST_START_TEST (test_launch_lines)
{
GstElement *pipeline;
const gchar **s;
GType type;
GstElementFactory *efac;
efac = gst_element_factory_find ("identity");
fail_unless (efac != NULL);
efac =
GST_ELEMENT_FACTORY (gst_plugin_feature_load (GST_PLUGIN_FEATURE (efac)));
fail_unless (efac != NULL);
type = gst_element_factory_get_element_type (efac);
fail_unless (type != 0);
g_object_unref (efac);
fail_unless (gst_element_register (NULL, "1dentity", GST_RANK_NONE, type));
for (s = test_lines; *s != NULL; s++) {
pipeline = setup_pipeline (*s);