Debian Codegraph @

gstreamer/gstreamermm/memory.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/memory.h>
7 #include <gstreamermm/private/memory_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008-2016 The gstreamermm Development Team
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public
16 * License as published by the Free Software Foundation; either
17 * version 2.1 of the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful,
20 * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free
26 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27 */
28
29
30 #include <gstreamermm/allocator.h>
31
32 namespace Gst
33 {
34
35 Glib::RefPtr<Gst::Memory> Memory::create(Gst::MemoryFlags flags, gpointer data, gsize maxsize, gsize offset, gsize size)
36 {
37 return Glib::RefPtr<Memory>(reinterpret_cast<Memory*>(gst_memory_new_wrapped(GstMemoryFlags(flags), data, maxsize, offset, size, 0, 0)));
38 }
39
40 Glib::RefPtr<Gst::Memory> Memory::make_mapped(Gst::MapInfo& info, Gst::MapFlags flags)
41 {
42 reference();
43 GstMemory* new_mem = gst_memory_make_mapped(gobj(), info.gobj(), static_cast<GstMapFlags>(flags));
44 return Glib::wrap(new_mem, gobj() != new_mem);
45 }
46
47 }
48
49 namespace
50 {
51 } // anonymous namespace
52
53 // static
54 GType Glib::Value<Gst::MemoryFlags>::value_type()
55 {
56 return gst_memory_flags_get_type();
57 }
58
59
60 /* Why reinterpret_cast<Memory*>(gobject) is needed:
61 *
62 * A Memory instance is in fact always a GstMemory instance.
63 * Unfortunately, GstMemory cannot be a member of Memory,
64 * because it is an opaque struct. Also, the C interface does not provide
65 * any hooks to install a destroy notification handler, thus we cannot
66 * wrap it dynamically either.
67 *
68 * The cast works because Memory does not have any member data, and
69 * it is impossible to derive from it. This is ensured by using final on the
70 * class and by using = delete on the default constructor.
71 */
72
73 namespace Glib
74 {
75
76 Glib::RefPtr<Gst::Memory> wrap(GstMemory* object, bool take_copy)
77 {
78 if(take_copy && object)
79 gst_memory_ref(object);
80
81 // See the comment at the top of this file, if you want to know why the cast works.
82 return Glib::RefPtr<Gst::Memory>(reinterpret_cast<Gst::Memory*>(object));
83 }
84
85 } // namespace Glib
86
87
88 namespace Gst
89 {
90
91
92 void Memory::reference() const
93 {
94 // See the comment at the top of this file, if you want to know why the cast works.
95 gst_memory_ref(reinterpret_cast<GstMemory*>(const_cast<Memory*>(this)));
96 }
97
98 void Memory::unreference() const
99 {
100 // See the comment at the top of this file, if you want to know why the cast works.
101 gst_memory_unref(reinterpret_cast<GstMemory*>(const_cast<Memory*>(this)));
102 }
103
104 GstMemory* Memory::gobj()
105 {
106 // See the comment at the top of this file, if you want to know why the cast works.
107 return reinterpret_cast<GstMemory*>(this);
108 }
109
110 const GstMemory* Memory::gobj() const
111 {
112 // See the comment at the top of this file, if you want to know why the cast works.
113 return reinterpret_cast<const GstMemory*>(this);
114 }
115
116 GstMemory* Memory::gobj_copy() const
117 {
118 // See the comment at the top of this file, if you want to know why the cast works.
119 const auto gobject = reinterpret_cast<GstMemory*>(const_cast<Memory*>(this));
120 gst_memory_ref(gobject);
121 return gobject;
122 }
123
124
125 gsize Memory::get_maxsize() const
126 {
127 return gobj()->maxsize;
128 }
129
130 gsize Memory::get_align() const
131 {
132 return gobj()->align;
133 }
134
135 gsize Memory::get_offset() const
136 {
137 return gobj()->offset;
138 }
139
140 gsize Memory::get_size() const
141 {
142 return gobj()->size;
143 }
144
145 Glib::RefPtr<Gst::Memory> Memory::get_parent()
146 {
147 Glib::RefPtr<Gst::Memory> ref_ptr(Glib::wrap(gobj()->parent));
148
149 if(ref_ptr)
150 ref_ptr->reference();
151
152 return ref_ptr;
153 }
154
155 Glib::RefPtr<const Gst::Memory> Memory::get_parent() const
156 {
157 Glib::RefPtr<const Gst::Memory> ref_ptr(Glib::wrap(gobj()->parent));
158
159 if(ref_ptr)
160 ref_ptr->reference();
161
162 return ref_ptr;
163 }
164
165 Glib::RefPtr<Gst::Allocator> Memory::get_allocator()
166 {
167 Glib::RefPtr<Gst::Allocator> ref_ptr(Glib::wrap(gobj()->allocator));
168
169 if(ref_ptr)
170 ref_ptr->reference();
171
172 return ref_ptr;
173 }
174
175 Glib::RefPtr<const Gst::Allocator> Memory::get_allocator() const
176 {
177 Glib::RefPtr<const Gst::Allocator> ref_ptr(Glib::wrap(gobj()->allocator));
178
179 if(ref_ptr)
180 ref_ptr->reference();
181
182 return ref_ptr;
183 }
184
185 bool Memory::is_type(const Glib::ustring& mem_type) const
186 {
187 return gst_memory_is_type(const_cast<GstMemory*>(gobj()), mem_type.c_str());
188 }
189
190 Glib::RefPtr<Gst::Memory> Memory::share(gssize offset, gssize size)
191 {
192 return Glib::wrap(gst_memory_share(gobj(), offset, size));
193 }
194
195 void Memory::resize(gssize offset, gsize size)
196 {
197 gst_memory_resize(gobj(), offset, size);
198 }
199
200 bool Memory::is_span(const Glib::RefPtr<Gst::Memory>& mem2, gsize& offset)
201 {
202 return gst_memory_is_span(gobj(), Glib::unwrap(mem2), &(offset));
203 }
204
205 bool Memory::map(Gst::MapInfo& info, Gst::MapFlags flags)
206 {
207 return gst_memory_map(gobj(), (info.gobj()), ((GstMapFlags)(flags)));
208 }
209
210 void Memory::unmap(Gst::MapInfo& info)
211 {
212 gst_memory_unmap(gobj(), (info.gobj()));
213 }
214
215 Glib::RefPtr<Gst::Memory> Memory::copy(gssize offset, gssize size)
216 {
217 return Glib::wrap(gst_memory_copy(gobj(), offset, size));
218 }
219
220 void Memory::init(Gst::MemoryFlags flags, const Glib::RefPtr<Gst::Allocator>& allocator, const Glib::RefPtr<Gst::Memory>& parent, gsize maxsize, gsize align, gsize offset, gsize size)
221 {
222 gst_memory_init(gobj(), ((GstMemoryFlags)(flags)), const_cast<GstAllocator*>(Glib::unwrap(allocator)), Glib::unwrap(parent), maxsize, align, offset, size);
223 }
224
225 gsize Memory::get_sizes(gsize& offset, gsize& maxsize)
226 {
227 return gst_memory_get_sizes(gobj(), &(offset), &(maxsize));
228 }
229
230
231 } // namespace Gst
232
233