Debian Codegraph @

gstreamer/gstreamermm/value.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/value.h>
7 #include <gstreamermm/private/value_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 namespace Gst
30 {
31
32 Fourcc::Fourcc()
33 : first(0), second(0), third(0), fourth(0)
34 {}
35
36 Fourcc& Fourcc::operator=(const Fourcc& src)
37 {
38 first = src.first;
39 second = src.second;
40 third = src.third;
41 fourth = src.fourth;
42
43 return *this;
44 }
45
46 Fourcc::Fourcc(char first, char second, char third, char fourth)
47 : first(first), second(second), third(third), fourth(fourth)
48 {}
49
50 Fourcc::Fourcc(const Glib::ustring& s)
51 : first(0), second(0), third(0), fourth(0)
52 {
53 guint32 fourcc = GST_STR_FOURCC(s.c_str());
54 set_ccs(fourcc);
55
56 }
57
58 Fourcc::Fourcc(guint32 fourcc)
59 : first(0), second(0), third(0), fourth(0)
60 {
61 set_ccs(fourcc);
62 }
63
64 Fourcc::Fourcc(const Fourcc& f)
65 : first(f.first), second(f.second), third(f.third), fourth(f.fourth)
66 {}
67
68 void Fourcc::set_ccs(guint32 fourcc)
69 {
70 first = fourcc & 0xff;
71 second = (fourcc >> 8) & 0xff;
72 third = (fourcc >> 16) & 0xff;
73 fourth = (fourcc >> 24) & 0xff;
74 }
75
76
77 Fraction::Fraction()
78 : num(0), denom(1)
79 {}
80
81 Fraction::Fraction(int num, int denom)
82 : num(num), denom(denom)
83 {}
84
85 Fraction::Fraction(const Fraction& src)
86 : num(src.num), denom(src.denom)
87 {}
88
89 Fraction::Fraction(const Glib::ValueBase& value)
90 : num(0), denom(1)
91 {
92 if(GST_VALUE_HOLDS_FRACTION(value.gobj()))
93 {
94 num = gst_value_get_fraction_numerator(value.gobj());
95 denom = gst_value_get_fraction_denominator(value.gobj());
96 }
97 }
98
99 Fraction::Fraction(const GValue& value)
100 : num(0), denom(1)
101 {
102 //if(GST_VALUE_HOLDS_FRACTION(&value))
103 {
104 num = gst_value_get_fraction_numerator(&value);
105 denom = gst_value_get_fraction_denominator(&value);
106 }
107 }
108
109 Fraction& Fraction::operator=(const Fraction& src)
110 {
111 num = src.num;
112 denom = src.denom;
113
114 return *this;
115 }
116
117 template <>
118 void Range<int>::init_range(const GValue& value)
119 {
120 if(G_VALUE_HOLDS(&value, GST_TYPE_INT_RANGE))
121 {
122 min = gst_value_get_int_range_min(&value);
123 max = gst_value_get_int_range_max(&value);
124 }
125 }
126
127 template <>
128 void Range<double>::init_range(const GValue& value)
129 {
130 if(G_VALUE_HOLDS(&value, GST_TYPE_DOUBLE_RANGE))
131 {
132 min = gst_value_get_double_range_min(&value);
133 max = gst_value_get_double_range_max(&value);
134 }
135 }
136
137 template <>
138 void Range<Gst::Fraction>::init_range(const GValue& value)
139 {
140 if(G_VALUE_HOLDS(&value, GST_TYPE_FRACTION_RANGE))
141 {
142 const GValue* min = gst_value_get_fraction_range_min(&value);
143 const GValue* max = gst_value_get_fraction_range_max(&value);
144
145 this->min.num = gst_value_get_fraction_numerator(min);
146 this->min.denom = gst_value_get_fraction_denominator(min);
147
148 this->max.num = gst_value_get_fraction_numerator(max);
149 this->max.denom = gst_value_get_fraction_denominator(max);
150 }
151 }
152
153 } //namespace Gst
154
155 namespace Glib
156 {
157
158 // static
159 GType Value<Gst::Range<int>>::value_type()
160 {
161 return GST_TYPE_INT_RANGE;
162 }
163
164 void Value<Gst::Range<int>>::set(const Gst::Range<int>& data)
165 {
166 gst_value_set_int_range(&gobject_, data.min, data.max);
167 }
168
169 Gst::Range<int> Value<Gst::Range<int>>::get() const
170 {
171 return Gst::Range<int>(gobject_);
172 }
173
174 // static
175 GType Value<Gst::Range<double>>::value_type()
176 {
177 return GST_TYPE_DOUBLE_RANGE;
178 }
179
180 void Value<Gst::Range<double>>::set(const Gst::Range<double>& data)
181 {
182 gst_value_set_double_range(&gobject_, data.min, data.max);
183 }
184
185 Gst::Range<double> Value<Gst::Range<double>>::get() const
186 {
187 return Gst::Range<double>(gobject_);
188 }
189
190 // static
191 GType Value<Gst::Fraction>::value_type()
192 {
193 return GST_TYPE_FRACTION;
194 }
195
196 void Value<Gst::Fraction>::set(const Gst::Fraction& data)
197 {
198 gst_value_set_fraction(&gobject_, data.num, data.denom);
199 }
200
201 Gst::Fraction Value<Gst::Fraction>::get() const
202 {
203 return Gst::Fraction(gobject_);
204 }
205
206 // static
207 GType Value<Gst::Range<Gst::Fraction>>::value_type()
208 {
209 return GST_TYPE_FRACTION_RANGE;
210 }
211
212 void Value<Gst::Range<Gst::Fraction>>::set(const Gst::Range<Gst::Fraction>& data)
213 {
214 gst_value_set_fraction_range_full(&gobject_, data.min.num, data.min.denom,
215 data.max.num, data.max.denom);
216 }
217
218 Gst::Range<Gst::Fraction> Value<Gst::Range<Gst::Fraction>>::get() const
219 {
220 return Gst::Range<Gst::Fraction>(gobject_);
221 }
222
223 } // namespace Glib
224
225 namespace
226 {
227 } // anonymous namespace
228
229