QtGStreamer  0.10.2
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
bufferlist.cpp
1 /*
2  Copyright (C) 2011 Collabora Ltd. <info@collabora.co.uk>
3  @author George Kiagiadakis <george.kiagiadakis@collabora.co.uk>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #include "bufferlist.h"
19 #include <gst/gstbufferlist.h>
20 
21 namespace QGst {
22 
23 BufferListPtr BufferList::create()
24 {
25  return BufferListPtr::wrap(gst_buffer_list_new(), false);
26 }
27 
28 uint BufferList::groupsCount() const
29 {
30  return gst_buffer_list_n_groups(object<GstBufferList>());
31 }
32 
33 BufferPtr BufferList::bufferAt(uint group, uint index) const
34 {
35  return BufferPtr::wrap(gst_buffer_list_get(object<GstBufferList>(), group, index));
36 }
37 
38 
39 BufferListIterator::BufferListIterator(const BufferListPtr & list)
40 {
41  m_it = gst_buffer_list_iterate(list);
42 }
43 
44 BufferListIterator::~BufferListIterator()
45 {
46  gst_buffer_list_iterator_free(m_it);
47 }
48 
50 {
51  return gst_buffer_list_iterator_n_buffers(m_it);
52 }
53 
55 {
56  return BufferPtr::wrap(gst_buffer_list_iterator_next(m_it));
57 }
58 
60 {
61  gst_buffer_list_iterator_add(m_it, gst_buffer_ref(buffer));
62 }
63 
65 {
66  gst_buffer_list_iterator_remove(m_it);
67 }
68 
70 {
71  BufferPtr buf = BufferPtr::wrap(gst_buffer_list_iterator_steal(m_it), false);
72  gst_buffer_list_iterator_remove(m_it);
73  return buf;
74 }
75 
77 {
78  gst_buffer_list_iterator_take(m_it, gst_buffer_ref(other));
79 }
80 
82 {
83  gst_buffer_list_iterator_add_group(m_it);
84 }
85 
87 {
88  return gst_buffer_list_iterator_next_group(m_it);
89 }
90 
92 {
93  return BufferPtr::wrap(gst_buffer_list_iterator_merge_group(m_it), false);
94 }
95 
96 } //namespace QGst
97