Debian Codegraph @

gstreamer/gstreamermm/context.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/context.h>
7 #include <gstreamermm/private/context_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2014-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 #include <gstreamermm/structure.h>
30
31
32 namespace
33 {
34 } // anonymous namespace
35
36
37 /* Why reinterpret_cast<Context*>(gobject) is needed:
38 *
39 * A Context instance is in fact always a GstContext instance.
40 * Unfortunately, GstContext cannot be a member of Context,
41 * because it is an opaque struct. Also, the C interface does not provide
42 * any hooks to install a destroy notification handler, thus we cannot
43 * wrap it dynamically either.
44 *
45 * The cast works because Context does not have any member data, and
46 * it is impossible to derive from it. This is ensured by using final on the
47 * class and by using = delete on the default constructor.
48 */
49
50 namespace Glib
51 {
52
53 Glib::RefPtr<Gst::Context> wrap(GstContext* object, bool take_copy)
54 {
55 if(take_copy && object)
56 gst_context_ref(object);
57
58 // See the comment at the top of this file, if you want to know why the cast works.
59 return Glib::RefPtr<Gst::Context>(reinterpret_cast<Gst::Context*>(object));
60 }
61
62 } // namespace Glib
63
64
65 namespace Gst
66 {
67
68
69 void Context::reference() const
70 {
71 // See the comment at the top of this file, if you want to know why the cast works.
72 gst_context_ref(reinterpret_cast<GstContext*>(const_cast<Context*>(this)));
73 }
74
75 void Context::unreference() const
76 {
77 // See the comment at the top of this file, if you want to know why the cast works.
78 gst_context_unref(reinterpret_cast<GstContext*>(const_cast<Context*>(this)));
79 }
80
81 GstContext* Context::gobj()
82 {
83 // See the comment at the top of this file, if you want to know why the cast works.
84 return reinterpret_cast<GstContext*>(this);
85 }
86
87 const GstContext* Context::gobj() const
88 {
89 // See the comment at the top of this file, if you want to know why the cast works.
90 return reinterpret_cast<const GstContext*>(this);
91 }
92
93 GstContext* Context::gobj_copy() const
94 {
95 // See the comment at the top of this file, if you want to know why the cast works.
96 const auto gobject = reinterpret_cast<GstContext*>(const_cast<Context*>(this));
97 gst_context_ref(gobject);
98 return gobject;
99 }
100
101
102 Glib::RefPtr<Gst::Context> Context::create(const Glib::ustring& context_type, bool persistent)
103 {
104 return Glib::wrap(gst_context_new(context_type.c_str(), static_cast<int>(persistent)));
105 }
106
107 Glib::RefPtr<Gst::Context> Context::copy() const
108 {
109 return Glib::wrap(gst_context_copy(const_cast<GstContext*>(gobj())));
110 }
111
112 Glib::ustring Context::get_context_type() const
113 {
114 return Glib::convert_const_gchar_ptr_to_ustring(gst_context_get_context_type(const_cast<GstContext*>(gobj())));
115 }
116
117 bool Context::has_context_type(const Glib::ustring& context_type) const
118 {
119 return gst_context_has_context_type(const_cast<GstContext*>(gobj()), context_type.c_str());
120 }
121
122 bool Context::is_persistent() const
123 {
124 return gst_context_is_persistent(const_cast<GstContext*>(gobj()));
125 }
126
127 Gst::Structure Context::writable_structure() const
128 {
129 return Glib::wrap(gst_context_writable_structure(const_cast<GstContext*>(gobj())));
130 }
131
132
133 } // namespace Gst
134
135