diff --git a/gst/gstbufferlist.c b/gst/gstbufferlist.c index 02c6aaa8ed..7bcc7468d3 100644 --- a/gst/gstbufferlist.c +++ b/gst/gstbufferlist.c @@ -142,7 +142,7 @@ struct _GstBufferList { GstMiniObject mini_object; - GList *buffers; + GQueue *buffers; }; /** @@ -173,17 +173,16 @@ static GstBufferList * _gst_buffer_list_copy (GstBufferList * list) { GstBufferList *list_copy; + GQueue *buffers_copy; GList *tmp; g_return_val_if_fail (list != NULL, NULL); - list_copy = gst_buffer_list_new (); - /* shallow copy of list and pointers */ - list_copy->buffers = g_list_copy (list->buffers); + buffers_copy = g_queue_copy (list->buffers); /* ref all buffers in the list */ - tmp = list_copy->buffers; + tmp = list->buffers->head; while (tmp) { if (tmp->data != GROUP_START && tmp->data != STOLEN) { tmp->data = gst_buffer_ref (GST_BUFFER_CAST (tmp->data)); @@ -191,6 +190,10 @@ _gst_buffer_list_copy (GstBufferList * list) tmp = g_list_next (tmp); } + list_copy = gst_buffer_list_new (); + g_queue_free (list_copy->buffers); + list_copy->buffers = buffers_copy; + return list_copy; } @@ -203,14 +206,14 @@ _gst_buffer_list_free (GstBufferList * list) GST_LOG ("free %p", list); - tmp = list->buffers; + tmp = list->buffers->head; while (tmp) { if (tmp->data != GROUP_START && tmp->data != STOLEN) { gst_buffer_unref (GST_BUFFER_CAST (tmp->data)); } tmp = tmp->next; } - g_list_free (list->buffers); + g_queue_free (list->buffers); g_slice_free1 (GST_MINI_OBJECT_SIZE (list), list); } @@ -223,6 +226,10 @@ gst_buffer_list_init (GstBufferList * list, gsize size) list->mini_object.copy = (GstMiniObjectCopyFunction) _gst_buffer_list_copy; list->mini_object.free = (GstMiniObjectFreeFunction) _gst_buffer_list_free; + + list->buffers = g_queue_new (); + + GST_LOG ("init %p", list); } /** @@ -270,7 +277,7 @@ gst_buffer_list_n_groups (GstBufferList * list) g_return_val_if_fail (list != NULL, 0); - tmp = list->buffers; + tmp = list->buffers->head; n = 0; while (tmp) { if (tmp->data == GROUP_START) { @@ -307,7 +314,7 @@ gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func, g_return_if_fail (list != NULL); g_return_if_fail (func != NULL); - next = list->buffers; + next = list->buffers->head; group = idx = 0; while (next) { GstBuffer *buffer; @@ -333,7 +340,7 @@ gst_buffer_list_foreach (GstBufferList * list, GstBufferListFunc func, /* the function changed the buffer */ if (buffer == NULL) { /* we were asked to remove the item */ - list->buffers = g_list_delete_link (list->buffers, tmp); + g_queue_delete_link (list->buffers, tmp); idx--; } else { /* change the buffer */ @@ -378,7 +385,7 @@ gst_buffer_list_get (GstBufferList * list, guint group, guint idx) g_return_val_if_fail (list != NULL, NULL); - tmp = list->buffers; + tmp = list->buffers->head; cgroup = 0; while (tmp) { if (tmp->data == GROUP_START) { @@ -430,7 +437,7 @@ gst_buffer_list_iterate (GstBufferList * list) it = g_slice_new (GstBufferListIterator); it->list = list; - it->next = list->buffers; + it->next = list->buffers->head; it->last_returned = NULL; return it; @@ -509,11 +516,14 @@ gst_buffer_list_iterator_add (GstBufferListIterator * it, GstBuffer * buffer) g_return_if_fail (buffer != NULL); /* adding before the first group start is not allowed */ - g_return_if_fail (it->next != it->list->buffers); + g_return_if_fail (it->next != it->list->buffers->head); - /* cheap insert into the GList */ - it->list->buffers = g_list_insert_before (it->list->buffers, it->next, - buffer); + /* cheap insert into the GQueue */ + if (it->next != NULL) { + g_queue_insert_before (it->list->buffers, it->next, buffer); + } else { + g_queue_push_tail (it->list->buffers, buffer); + } } /** @@ -535,31 +545,33 @@ void gst_buffer_list_iterator_add_list (GstBufferListIterator * it, GList * list) { GList *last; + guint len; g_return_if_fail (it != NULL); - g_return_if_fail (it->next != it->list->buffers); + g_return_if_fail (it->next != it->list->buffers->head); if (list == NULL) return; - if (it->next) { - last = list; - while (last->next) - last = last->next; + last = list; + len = 1; + while (last->next) { + last = last->next; + len++; + } + if (it->next) { last->next = it->next; list->prev = it->next->prev; it->next->prev = last; if (list->prev) list->prev->next = list; } else { - last = it->list->buffers; - while (last->next) - last = last->next; - - last->next = list; - list->prev = last; + it->list->buffers->tail->next = list; + list->prev = it->list->buffers->tail; + it->list->buffers->tail = last; } + it->list->buffers->length += len; } /** @@ -584,9 +596,12 @@ gst_buffer_list_iterator_add_group (GstBufferListIterator * it) it->next = g_list_next (it->next); } - /* cheap insert of a group start into the GList */ - it->list->buffers = g_list_insert_before (it->list->buffers, it->next, - GROUP_START); + /* cheap insert of a group start into the GQueue */ + if (it->next != NULL) { + g_queue_insert_before (it->list->buffers, it->next, GROUP_START); + } else { + g_queue_push_tail (it->list->buffers, GROUP_START); + } } /** @@ -691,7 +706,7 @@ gst_buffer_list_iterator_remove (GstBufferListIterator * it) if (it->last_returned->data != STOLEN) { gst_buffer_unref (it->last_returned->data); } - it->list->buffers = g_list_delete_link (it->list->buffers, it->last_returned); + g_queue_delete_link (it->list->buffers, it->last_returned); it->last_returned = NULL; } diff --git a/gst/gstghostpad.c b/gst/gstghostpad.c index 722c568459..451123b16e 100644 --- a/gst/gstghostpad.c +++ b/gst/gstghostpad.c @@ -124,11 +124,12 @@ static GstIterator * gst_proxy_pad_do_iterate_internal_links (GstPad * pad) { GstIterator *res = NULL; - GstPad *target = gst_proxy_pad_get_target (pad); + GstPad *internal = GST_PROXY_PAD_INTERNAL (pad); - if (target) { - res = gst_pad_iterate_internal_links (target); - gst_object_unref (target); + if (internal) { + res = + gst_iterator_new_single (GST_TYPE_PAD, internal, + (GstCopyFunction) gst_object_ref, (GFreeFunc) gst_object_unref); } return res; diff --git a/gst/gstpad.c b/gst/gstpad.c index 90a3711f8a..829aaf0180 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -991,6 +991,11 @@ gst_pad_is_active (GstPad * pad) * You can pass NULL as the callback to make this call block. Be careful with * this blocking call as it might not return for reasons stated above. * + * + * Pad block handlers are only called for source pads in push mode + * and sink pads in pull mode. + * + * * Returns: TRUE if the pad could be blocked. This function can fail if the * wrong parameters were passed or the pad was already in the requested state. * @@ -1085,6 +1090,11 @@ had_right_state: * take an indeterminate amount of time. * You can pass NULL as the callback to make this call block. Be careful with * this blocking call as it might not return for reasons stated above. + * + * + * Pad block handlers are only called for source pads in push mode + * and sink pads in pull mode. + * * * Returns: TRUE if the pad could be blocked. This function can fail if the * wrong parameters were passed or the pad was already in the requested state. @@ -1108,6 +1118,11 @@ gst_pad_set_blocked_async (GstPad * pad, gboolean blocked, * a shortcut for gst_pad_set_blocked_async() with a NULL * callback. * + * + * Pad blocks are only possible for source pads in push mode + * and sink pads in pull mode. + * + * * Returns: TRUE if the pad could be blocked. This function can fail if the * wrong parameters were passed or the pad was already in the requested state. * diff --git a/gst/gstutils.c b/gst/gstutils.c index 4517044541..2160cf1358 100644 --- a/gst/gstutils.c +++ b/gst/gstutils.c @@ -1321,7 +1321,6 @@ gst_element_factory_can_accept_any_caps_in_direction (GstElementFactory * return FALSE; } -#ifndef GST_DISABLE_DEPRECATED /** * gst_element_factory_can_src_caps: * @factory: factory to query @@ -1333,6 +1332,11 @@ gst_element_factory_can_accept_any_caps_in_direction (GstElementFactory * * * Deprecated: use gst_element_factory_can_src_all_caps() instead. */ +#ifndef GST_REMOVE_DEPRECATED +#ifdef GST_DISABLE_DEPRECATED +gboolean gst_element_factory_can_src_caps (GstElementFactory * factory, + const GstCaps * caps); +#endif gboolean gst_element_factory_can_src_caps (GstElementFactory * factory, const GstCaps * caps) @@ -1340,6 +1344,7 @@ gst_element_factory_can_src_caps (GstElementFactory * factory, return gst_element_factory_can_accept_all_caps_in_direction (factory, caps, GST_PAD_SRC); } +#endif /* GST_REMOVE_DEPRECATED */ /** * gst_element_factory_can_sink_caps: @@ -1352,6 +1357,11 @@ gst_element_factory_can_src_caps (GstElementFactory * factory, * * Deprecated: use gst_element_factory_can_sink_all_caps() instead. */ +#ifndef GST_REMOVE_DEPRECATED +#ifdef GST_DISABLE_DEPRECATED +gboolean gst_element_factory_can_sink_caps (GstElementFactory * factory, + const GstCaps * caps); +#endif gboolean gst_element_factory_can_sink_caps (GstElementFactory * factory, const GstCaps * caps) @@ -1359,7 +1369,7 @@ gst_element_factory_can_sink_caps (GstElementFactory * factory, return gst_element_factory_can_accept_all_caps_in_direction (factory, caps, GST_PAD_SINK); } -#endif /* GST_DISABLE_DEPRECATED */ +#endif /* GST_REMOVE_DEPRECATED */ /** * gst_element_factory_can_sink_all_caps: diff --git a/tests/check/gst/gstbufferlist.c b/tests/check/gst/gstbufferlist.c index 6d3d7d623a..0885644fa3 100644 --- a/tests/check/gst/gstbufferlist.c +++ b/tests/check/gst/gstbufferlist.c @@ -783,7 +783,14 @@ GST_START_TEST (test_list) gst_buffer_list_iterator_add_group (it); gst_buffer_list_iterator_add_list (it, l); - for (i = 0; i < 10; i++) { + /* add a buffer */ + gst_buffer_list_iterator_add (it, buffer_from_string ("10")); + + /* add another list */ + l = g_list_append (NULL, buffer_from_string ("11")); + gst_buffer_list_iterator_add_list (it, l); + + for (i = 0; i < 12; i++) { GstBuffer *buf; gchar name[10]; diff --git a/win32/common/libgstreamer.def b/win32/common/libgstreamer.def index d53a57a1cd..7e49062d7f 100644 --- a/win32/common/libgstreamer.def +++ b/win32/common/libgstreamer.def @@ -303,12 +303,12 @@ EXPORTS gst_element_class_set_metadata gst_element_continue_state gst_element_create_all_pads - gst_element_factory_can_sink_caps - gst_element_factory_can_src_caps gst_element_factory_can_sink_all_caps gst_element_factory_can_sink_any_caps + gst_element_factory_can_sink_caps gst_element_factory_can_src_all_caps gst_element_factory_can_src_any_caps + gst_element_factory_can_src_caps gst_element_factory_create gst_element_factory_find gst_element_factory_get_element_type