| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | |
| 3 | |
| 4 | #include <glibmm.h> |
| 5 | |
| 6 | #include <gstreamermm/buffer.h> |
| 7 | #include <gstreamermm/private/buffer_p.h> |
| 8 | |
| 9 | |
| 10 | /* gstreamermm - a C++ wrapper for gstreamer |
| 11 | * |
| 12 | * Copyright 2008-2015 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 | namespace Gst |
| 31 | { |
| 32 | Glib::RefPtr<Gst::Buffer> Buffer::create(guint size) |
| 33 | { |
| 34 | return Glib::wrap(gst_buffer_new_allocate(nullptr, size, nullptr)); |
| 35 | } |
| 36 | |
| 37 | Glib::RefPtr<Buffer> Buffer::create_writable() |
| 38 | { |
| 39 | return Glib::RefPtr<Buffer>::cast_static(MiniObject::create_writable()); |
| 40 | } |
| 41 | |
| 42 | guint64 Buffer::offset_none() |
| 43 | { |
| 44 | return GST_BUFFER_OFFSET_NONE; |
| 45 | } |
| 46 | |
| 47 | Glib::RefPtr<Gst::Buffer> Buffer::append_region(Glib::RefPtr<Gst::Buffer>&& buf, gssize offset, gssize size) |
| 48 | { |
| 49 | if (is_writable()) |
| 50 | { |
| 51 | return Glib::wrap(gst_buffer_append_region(gobj(), buf.release()->gobj(), offset, size), true); |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | reference(); |
| 56 | return Glib::wrap(gst_buffer_append_region(gobj(), buf.release()->gobj(), offset, size), false); |
| 57 | } |
| 58 | } |
| 59 | |
| 60 | Glib::RefPtr<Gst::Buffer> Buffer::append(Glib::RefPtr<Gst::Buffer>&& buf) |
| 61 | { |
| 62 | return append_region(std::move(buf), 0, -1); |
| 63 | } |
| 64 | |
| 65 | } // namespace Gst |
| 66 | |
| 67 | namespace |
| 68 | { |
| 69 | } // anonymous namespace |
| 70 | |
| 71 | // static |
| 72 | GType Glib::Value<Gst::BufferFlags>::value_type() |
| 73 | { |
| 74 | return gst_buffer_flags_get_type(); |
| 75 | } |
| 76 | |
| 77 | // static |
| 78 | GType Glib::Value<Gst::BufferCopyFlags>::value_type() |
| 79 | { |
| 80 | return gst_buffer_copy_flags_get_type(); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | /* Why reinterpret_cast<Buffer*>(gobject) is needed: |
| 85 | * |
| 86 | * A Buffer instance is in fact always a GstBuffer instance. |
| 87 | * Unfortunately, GstBuffer cannot be a member of Buffer, |
| 88 | * because it is an opaque struct. Also, the C interface does not provide |
| 89 | * any hooks to install a destroy notification handler, thus we cannot |
| 90 | * wrap it dynamically either. |
| 91 | * |
| 92 | * The cast works because Buffer does not have any member data, and |
| 93 | * it is impossible to derive from it. This is ensured by using final on the |
| 94 | * class and by using = delete on the default constructor. |
| 95 | */ |
| 96 | |
| 97 | namespace Glib |
| 98 | { |
| 99 | |
| 100 | Glib::RefPtr<Gst::Buffer> wrap(GstBuffer* object, bool take_copy) |
| 101 | { |
| 102 | if(take_copy && object) |
| 103 | gst_buffer_ref(object); |
| 104 | |
| 105 | // See the comment at the top of this file, if you want to know why the cast works. |
| 106 | return Glib::RefPtr<Gst::Buffer>(reinterpret_cast<Gst::Buffer*>(object)); |
| 107 | } |
| 108 | |
| 109 | } // namespace Glib |
| 110 | |
| 111 | |
| 112 | namespace Gst |
| 113 | { |
| 114 | |
| 115 | |
| 116 | // static |
| 117 | Glib::RefPtr<Buffer> Buffer::create() |
| 118 | { |
| 119 | // See the comment at the top of this file, if you want to know why the cast works. |
| 120 | return Glib::RefPtr<Buffer>(reinterpret_cast<Buffer*>(gst_buffer_new())); |
| 121 | } |
| 122 | |
| 123 | void Buffer::reference() const |
| 124 | { |
| 125 | // See the comment at the top of this file, if you want to know why the cast works. |
| 126 | gst_buffer_ref(reinterpret_cast<GstBuffer*>(const_cast<Buffer*>(this))); |
| 127 | } |
| 128 | |
| 129 | void Buffer::unreference() const |
| 130 | { |
| 131 | // See the comment at the top of this file, if you want to know why the cast works. |
| 132 | gst_buffer_unref(reinterpret_cast<GstBuffer*>(const_cast<Buffer*>(this))); |
| 133 | } |
| 134 | |
| 135 | GstBuffer* Buffer::gobj() |
| 136 | { |
| 137 | // See the comment at the top of this file, if you want to know why the cast works. |
| 138 | return reinterpret_cast<GstBuffer*>(this); |
| 139 | } |
| 140 | |
| 141 | const GstBuffer* Buffer::gobj() const |
| 142 | { |
| 143 | // See the comment at the top of this file, if you want to know why the cast works. |
| 144 | return reinterpret_cast<const GstBuffer*>(this); |
| 145 | } |
| 146 | |
| 147 | GstBuffer* Buffer::gobj_copy() const |
| 148 | { |
| 149 | // See the comment at the top of this file, if you want to know why the cast works. |
| 150 | const auto gobject = reinterpret_cast<GstBuffer*>(const_cast<Buffer*>(this)); |
| 151 | gst_buffer_ref(gobject); |
| 152 | return gobject; |
| 153 | } |
| 154 | |
| 155 | |
| 156 | Glib::RefPtr<Gst::Buffer> Buffer::copy() const |
| 157 | { |
| 158 | return Glib::wrap(gst_buffer_copy(const_cast<GstBuffer*>(gobj()))); |
| 159 | } |
| 160 | |
| 161 | Glib::RefPtr<Gst::Buffer> Buffer::copy_deep() const |
| 162 | { |
| 163 | return Glib::wrap(gst_buffer_copy_deep(const_cast<GstBuffer*>(gobj()))); |
| 164 | } |
| 165 | |
| 166 | void Buffer::copy_into(const Glib::RefPtr<Gst::Buffer>& destination_buffer, const Glib::RefPtr<Gst::Buffer>& source_buffer, BufferCopyFlags flags, gsize offset, gsize size) |
| 167 | { |
| 168 | gst_buffer_copy_into(Glib::unwrap(destination_buffer), Glib::unwrap(source_buffer), ((GstBufferCopyFlags)(flags)), offset, size); |
| 169 | } |
| 170 | |
| 171 | Glib::RefPtr<Gst::Buffer> Buffer::copy_region(Gst::BufferCopyFlags flags, gsize offset, gsize size) |
| 172 | { |
| 173 | return Glib::wrap(gst_buffer_copy_region(gobj(), ((GstBufferCopyFlags)(flags)), offset, size)); |
| 174 | } |
| 175 | |
| 176 | Glib::RefPtr<Gst::Memory> Buffer::get_memory(guint idx) const |
| 177 | { |
| 178 | return Glib::wrap(gst_buffer_get_memory(const_cast<GstBuffer*>(gobj()), idx)); |
| 179 | } |
| 180 | |
| 181 | gsize Buffer::get_size() const |
| 182 | { |
| 183 | return gst_buffer_get_size(const_cast<GstBuffer*>(gobj())); |
| 184 | } |
| 185 | |
| 186 | gsize Buffer::get_sizes(gsize& offset, gsize& max_size) const |
| 187 | { |
| 188 | return gst_buffer_get_sizes(const_cast<GstBuffer*>(gobj()), &(offset), &(max_size)); |
| 189 | } |
| 190 | |
| 191 | gsize Buffer::get_sizes_range(guint idx, gint length, gsize& offset, gsize& max_size) const |
| 192 | { |
| 193 | return gst_buffer_get_sizes_range(const_cast<GstBuffer*>(gobj()), idx, length, &(offset), &(max_size)); |
| 194 | } |
| 195 | |
| 196 | bool Buffer::resize_range(guint idx, gint length, gssize offset, gssize size) |
| 197 | { |
| 198 | return gst_buffer_resize_range(gobj(), idx, length, offset, size); |
| 199 | } |
| 200 | |
| 201 | void Buffer::resize(gssize offset, gssize size) |
| 202 | { |
| 203 | gst_buffer_resize(gobj(), offset, size); |
| 204 | } |
| 205 | |
| 206 | void Buffer::set_size(gssize size) |
| 207 | { |
| 208 | gst_buffer_set_size(gobj(), size); |
| 209 | } |
| 210 | |
| 211 | Glib::RefPtr<Gst::Memory> Buffer::peek_memory(guint idx) |
| 212 | { |
| 213 | Glib::RefPtr<Gst::Memory> retvalue = Glib::wrap(gst_buffer_peek_memory(gobj(), idx)); |
| 214 | if(retvalue) |
| 215 | retvalue->reference(); //The function does not do a ref for us. |
| 216 | return retvalue; |
| 217 | } |
| 218 | |
| 219 | guint Buffer::n_memory() const |
| 220 | { |
| 221 | return gst_buffer_n_memory(const_cast<GstBuffer*>(gobj())); |
| 222 | } |
| 223 | |
| 224 | void Buffer::insert_memory(gint idx, Glib::RefPtr<Gst::Memory>&& mem) |
| 225 | { |
| 226 | gst_buffer_insert_memory(gobj(), idx, (mem) ? mem.release()->gobj() : nullptr); |
| 227 | } |
| 228 | |
| 229 | Glib::RefPtr<Gst::Memory> Buffer::get_all_memory() const |
| 230 | { |
| 231 | return Glib::wrap(gst_buffer_get_all_memory(const_cast<GstBuffer*>(gobj()))); |
| 232 | } |
| 233 | |
| 234 | gsize Buffer::fill(gsize offset, gconstpointer src, gsize size) |
| 235 | { |
| 236 | return gst_buffer_fill(gobj(), offset, src, size); |
| 237 | } |
| 238 | |
| 239 | void Buffer::replace_memory_range(guint idx, gint length, Glib::RefPtr<Gst::Memory>&& mem) |
| 240 | { |
| 241 | gst_buffer_replace_memory_range(gobj(), idx, length, (mem) ? mem.release()->gobj() : nullptr); |
| 242 | } |
| 243 | |
| 244 | Glib::RefPtr<Gst::Memory> Buffer::get_memory_range(guint idx, gint length) |
| 245 | { |
| 246 | return Glib::wrap(gst_buffer_get_memory_range(gobj(), idx, length)); |
| 247 | } |
| 248 | |
| 249 | void Buffer::remove_memory_range(guint idx, gint length) |
| 250 | { |
| 251 | gst_buffer_remove_memory_range(gobj(), idx, length); |
| 252 | } |
| 253 | |
| 254 | bool Buffer::find_memory(gsize offset, gsize size, guint& idx, guint& length, gsize& skip) |
| 255 | { |
| 256 | return gst_buffer_find_memory(gobj(), offset, size, &(idx), &(length), &(skip)); |
| 257 | } |
| 258 | |
| 259 | void Buffer::prepend_memory(Glib::RefPtr<Gst::Memory>&& mem) |
| 260 | { |
| 261 | gst_buffer_prepend_memory(gobj(), (mem) ? mem.release()->gobj() : nullptr); |
| 262 | } |
| 263 | |
| 264 | void Buffer::append_memory(Glib::RefPtr<Gst::Memory>&& mem) |
| 265 | { |
| 266 | gst_buffer_append_memory(gobj(), (mem) ? mem.release()->gobj() : nullptr); |
| 267 | } |
| 268 | |
| 269 | void Buffer::remove_memory(guint idx) |
| 270 | { |
| 271 | gst_buffer_remove_memory(gobj(), idx); |
| 272 | } |
| 273 | |
| 274 | void Buffer::remove_all_memory() |
| 275 | { |
| 276 | gst_buffer_remove_all_memory(gobj()); |
| 277 | } |
| 278 | |
| 279 | gsize Buffer::memset(gsize offset, guint8 val, gsize size) |
| 280 | { |
| 281 | return gst_buffer_memset(gobj(), offset, val, size); |
| 282 | } |
| 283 | |
| 284 | void Buffer::replace_memory(guint idx, Glib::RefPtr<Gst::Memory>&& mem) |
| 285 | { |
| 286 | gst_buffer_replace_memory(gobj(), idx, (mem) ? mem.release()->gobj() : nullptr); |
| 287 | } |
| 288 | |
| 289 | void Buffer::replace_all_memory(Glib::RefPtr<Gst::Memory>&& mem) |
| 290 | { |
| 291 | gst_buffer_replace_all_memory(gobj(), (mem) ? mem.release()->gobj() : nullptr); |
| 292 | } |
| 293 | |
| 294 | gsize Buffer::extract(gsize offset, gpointer dest, gsize size) |
| 295 | { |
| 296 | return gst_buffer_extract(gobj(), offset, dest, size); |
| 297 | } |
| 298 | |
| 299 | void Buffer::extract_dup(gsize offset, gsize size, gpointer& dest, gsize& dest_size) |
| 300 | { |
| 301 | gst_buffer_extract_dup(gobj(), offset, size, &(dest), &(dest_size)); |
| 302 | } |
| 303 | |
| 304 | int Buffer::memcmp(gsize offset, gconstpointer mem, gsize size) |
| 305 | { |
| 306 | return gst_buffer_memcmp(gobj(), offset, mem, size); |
| 307 | } |
| 308 | |
| 309 | bool Buffer::is_all_memory_writable() const |
| 310 | { |
| 311 | return gst_buffer_is_all_memory_writable(const_cast<GstBuffer*>(gobj())); |
| 312 | } |
| 313 | |
| 314 | bool Buffer::is_memory_range_writable(guint idx, gint length) const |
| 315 | { |
| 316 | return gst_buffer_is_memory_range_writable(const_cast<GstBuffer*>(gobj()), idx, length); |
| 317 | } |
| 318 | |
| 319 | bool Buffer::map(Gst::MapInfo& info, Gst::MapFlags flags) |
| 320 | { |
| 321 | return gst_buffer_map(gobj(), (info.gobj()), ((GstMapFlags)(flags))); |
| 322 | } |
| 323 | |
| 324 | bool Buffer::map_range(guint idx, gint length, Gst::MapInfo& info, MapFlags flags) |
| 325 | { |
| 326 | return gst_buffer_map_range(gobj(), idx, length, (info.gobj()), ((GstMapFlags)(flags))); |
| 327 | } |
| 328 | |
| 329 | void Buffer::unmap(Gst::MapInfo& info) |
| 330 | { |
| 331 | gst_buffer_unmap(gobj(), (info.gobj())); |
| 332 | } |
| 333 | |
| 334 | ClockTime Buffer::get_pts() const |
| 335 | { |
| 336 | return ((ClockTime)(gobj()->pts)); |
| 337 | } |
| 338 | |
| 339 | void Buffer::set_pts(const ClockTime& value) |
| 340 | { |
| 341 | gobj()->pts = ((GstClockTime)(value)); |
| 342 | } |
| 343 | |
| 344 | ClockTime Buffer::get_dts() const |
| 345 | { |
| 346 | return ((ClockTime)(gobj()->dts)); |
| 347 | } |
| 348 | |
| 349 | void Buffer::set_dts(const ClockTime& value) |
| 350 | { |
| 351 | gobj()->dts = ((GstClockTime)(value)); |
| 352 | } |
| 353 | |
| 354 | ClockTime Buffer::get_duration() const |
| 355 | { |
| 356 | return ((ClockTime)(gobj()->duration)); |
| 357 | } |
| 358 | |
| 359 | void Buffer::set_duration(const ClockTime& value) |
| 360 | { |
| 361 | gobj()->duration = ((GstClockTime)(value)); |
| 362 | } |
| 363 | |
| 364 | guint64 Buffer::get_offset() const |
| 365 | { |
| 366 | return gobj()->offset; |
| 367 | } |
| 368 | |
| 369 | guint64 Buffer::get_offset_end() const |
| 370 | { |
| 371 | return gobj()->offset_end; |
| 372 | } |
| 373 | |
| 374 | |
| 375 | } // namespace Gst |
| 376 | |
| 377 |