Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
luzpaz
gstreamer
Commits
0447e72c
Commit
0447e72c
authored
Sep 17, 2010
by
Wim Taymans
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bufferlist: add function to add a list of buffers
Add a function to add a list of buffers to the bufferlist.
parent
1afaa168
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
0 deletions
+79
-0
gst/gstbufferlist.c
gst/gstbufferlist.c
+46
-0
gst/gstbufferlist.h
gst/gstbufferlist.h
+1
-0
tests/check/gst/gstbufferlist.c
tests/check/gst/gstbufferlist.c
+31
-0
win32/common/libgstreamer.def
win32/common/libgstreamer.def
+1
-0
No files found.
gst/gstbufferlist.c
View file @
0447e72c
...
...
@@ -526,6 +526,52 @@ gst_buffer_list_iterator_add (GstBufferListIterator * it, GstBuffer * buffer)
buffer
);
}
/**
* gst_buffer_list_iterator_add_list:
* @it: a #GstBufferListIterator
* @list: a #GList
*
* Inserts @list of buffers into the #GstBufferList iterated with @it. The list is
* inserted into the current group, immediately before the buffer that would be
* returned by gst_buffer_list_iterator_next(). The list is inserted before
* the implicit cursor, a subsequent call to gst_buffer_list_iterator_next()
* will return the buffer after the last buffer of the inserted list, if any.
*
* This function takes ownership of @list and all its buffers.
*
* Since: 0.10.31
*/
void
gst_buffer_list_iterator_add_list
(
GstBufferListIterator
*
it
,
GList
*
list
)
{
GList
*
last
;
g_return_if_fail
(
it
!=
NULL
);
g_return_if_fail
(
it
->
next
!=
it
->
list
->
buffers
);
if
(
list
==
NULL
)
return
;
if
(
it
->
next
)
{
last
=
list
;
while
(
last
->
next
)
last
=
last
->
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
;
}
}
/**
* gst_buffer_list_iterator_add_group:
* @it: a #GstBufferListIterator
...
...
gst/gstbufferlist.h
View file @
0447e72c
...
...
@@ -220,6 +220,7 @@ GstBuffer * gst_buffer_list_iterator_next (GstBufferListIte
gboolean
gst_buffer_list_iterator_next_group
(
GstBufferListIterator
*
it
);
void
gst_buffer_list_iterator_add
(
GstBufferListIterator
*
it
,
GstBuffer
*
buffer
);
void
gst_buffer_list_iterator_add_list
(
GstBufferListIterator
*
it
,
GList
*
list
);
void
gst_buffer_list_iterator_add_group
(
GstBufferListIterator
*
it
);
void
gst_buffer_list_iterator_remove
(
GstBufferListIterator
*
it
);
GstBuffer
*
gst_buffer_list_iterator_steal
(
GstBufferListIterator
*
it
);
...
...
tests/check/gst/gstbufferlist.c
View file @
0447e72c
...
...
@@ -766,6 +766,36 @@ GST_START_TEST (test_foreach)
GST_END_TEST
;
GST_START_TEST
(
test_list
)
{
GstBufferListIterator
*
it
;
GList
*
l
=
NULL
;
gint
i
;
for
(
i
=
0
;
i
<
10
;
i
++
)
{
gchar
name
[
10
];
g_snprintf
(
name
,
10
,
"%d"
,
i
);
l
=
g_list_append
(
l
,
buffer_from_string
(
name
));
}
/* add buffers to the list */
it
=
gst_buffer_list_iterate
(
list
);
gst_buffer_list_iterator_add_group
(
it
);
gst_buffer_list_iterator_add_list
(
it
,
l
);
for
(
i
=
0
;
i
<
10
;
i
++
)
{
GstBuffer
*
buf
;
gchar
name
[
10
];
buf
=
gst_buffer_list_get
(
list
,
0
,
i
);
g_snprintf
(
name
,
10
,
"%d"
,
i
);
fail_unless
(
memcmp
(
name
,
(
gchar
*
)
GST_BUFFER_DATA
(
buf
),
GST_BUFFER_SIZE
(
buf
))
==
0
);
}
gst_buffer_list_iterator_free
(
it
);
}
GST_END_TEST
;
static
Suite
*
gst_buffer_list_suite
(
void
)
...
...
@@ -783,6 +813,7 @@ gst_buffer_list_suite (void)
tcase_add_test
(
tc_chain
,
test_do
);
tcase_add_test
(
tc_chain
,
test_merge
);
tcase_add_test
(
tc_chain
,
test_foreach
);
tcase_add_test
(
tc_chain
,
test_list
);
return
s
;
}
...
...
win32/common/libgstreamer.def
View file @
0447e72c
...
...
@@ -98,6 +98,7 @@ EXPORTS
gst_buffer_list_iterate
gst_buffer_list_iterator_add
gst_buffer_list_iterator_add_group
gst_buffer_list_iterator_add_list
gst_buffer_list_iterator_do
gst_buffer_list_iterator_free
gst_buffer_list_iterator_merge_group
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment