Debian Codegraph @

gstreamer/gstreamermm/taglist.cc

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2
3
4 #include <glibmm.h>
5
6 #include <gstreamermm/taglist.h>
7 #include <gstreamermm/private/taglist_p.h>
8
9
10 /* gstreamermm - a C++ wrapper for gstreamer
11 *
12 * Copyright 2008 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 <gst/gst.h>
30
31 namespace
32 {
33
34 extern "C"
35 {
36
37 static void TagList_foreach_gstreamermm_callback(const GstTagList*, const char *tag, void* data)
38 {
39 Gst::TagList::SlotForeach& slot_foreach = *static_cast<Gst::TagList::SlotForeach*>(data);
40
41 try
42 {
43 slot_foreach(Glib::convert_const_gchar_ptr_to_ustring(tag));
44 }
45 catch (...)
46 {
47 Glib::exception_handlers_invoke();
48 }
49 }
50
51 } // extern "C"
52
53 } // anonymous namespace
54
55 namespace Gst
56 {
57
58 // Make sure the order here is the same order as in Gst::Tag.
59 static const char* const _tag_strings[] =
60 {
61 GST_TAG_TITLE,
62 GST_TAG_TITLE_SORTNAME,
63 GST_TAG_ARTIST,
64 GST_TAG_ARTIST_SORTNAME,
65 GST_TAG_ALBUM,
66 GST_TAG_ALBUM_SORTNAME,
67 GST_TAG_DATE,
68 GST_TAG_GENRE,
69 GST_TAG_COMMENT,
70 GST_TAG_EXTENDED_COMMENT,
71 GST_TAG_TRACK_NUMBER,
72 GST_TAG_TRACK_COUNT,
73 GST_TAG_ALBUM_VOLUME_NUMBER,
74 GST_TAG_ALBUM_VOLUME_COUNT,
75 GST_TAG_LOCATION,
76 GST_TAG_DESCRIPTION,
77 GST_TAG_VERSION,
78 GST_TAG_ISRC,
79 GST_TAG_ORGANIZATION,
80 GST_TAG_COPYRIGHT,
81 GST_TAG_COPYRIGHT_URI,
82 GST_TAG_COMPOSER,
83 GST_TAG_CONTACT,
84 GST_TAG_LICENSE,
85 GST_TAG_LICENSE_URI,
86 GST_TAG_PERFORMER,
87 GST_TAG_DURATION,
88 GST_TAG_CODEC,
89 GST_TAG_VIDEO_CODEC,
90 GST_TAG_AUDIO_CODEC,
91 GST_TAG_BITRATE,
92 GST_TAG_NOMINAL_BITRATE,
93 GST_TAG_MINIMUM_BITRATE,
94 GST_TAG_MAXIMUM_BITRATE,
95 GST_TAG_SERIAL,
96 GST_TAG_ENCODER,
97 GST_TAG_ENCODER_VERSION,
98 GST_TAG_TRACK_GAIN,
99 GST_TAG_TRACK_PEAK,
100 GST_TAG_ALBUM_GAIN,
101 GST_TAG_ALBUM_PEAK,
102 GST_TAG_REFERENCE_LEVEL,
103 GST_TAG_LANGUAGE_CODE,
104 GST_TAG_IMAGE,
105 GST_TAG_PREVIEW_IMAGE,
106 GST_TAG_ATTACHMENT,
107 GST_TAG_BEATS_PER_MINUTE,
108 GST_TAG_KEYWORDS,
109 GST_TAG_GEO_LOCATION_NAME,
110 GST_TAG_GEO_LOCATION_LATITUDE,
111 GST_TAG_GEO_LOCATION_LONGITUDE,
112 GST_TAG_GEO_LOCATION_ELEVATION
113 };
114
115 const char* gstreamermm_get_stock_tag(Tag tag)
116 {
117 return _tag_strings[tag];
118 }
119
120 TagList::operator bool() const
121 {
122 return gobject_ != nullptr;
123 }
124
125 std::ostream& operator<<(std::ostream& stream, Tag tag)
126 {
127 stream << _tag_strings[tag];
128 return stream;
129 }
130
131 void TagList::add_value(Tag tag, const Glib::ValueBase& value, TagMergeMode mode)
132 {
133 add_value(_tag_strings[tag], value, mode);
134 }
135
136 void TagList::add_value(const Glib::ustring& tag, const Glib::ValueBase& value, TagMergeMode mode)
137 {
138 gst_tag_list_add_value(gobj(), static_cast<GstTagMergeMode>(mode),
139 tag.c_str(), value.gobj());
140 }
141
142 void TagList::add(Tag tag, const char* data, TagMergeMode mode)
143 {
144 add(_tag_strings[tag], data, mode);
145 }
146
147 void TagList::add(const Glib::ustring& tag, const char* data, TagMergeMode mode)
148 {
149 gst_tag_list_add(gobj(), static_cast<GstTagMergeMode>(mode), tag.c_str(), data,
150 static_cast<void*>(0));
151 }
152
153 void TagList::add(Tag tag, const Glib::Date& date, TagMergeMode mode)
154 {
155 add(_tag_strings[tag], date, mode);
156 }
157
158 void TagList::add(const Glib::ustring& tag, const Glib::Date& date, TagMergeMode mode)
159 {
160 gst_tag_list_add(gobj(), static_cast<GstTagMergeMode>(mode), tag.c_str(), date.gobj(), nullptr);
161 }
162
163 void TagList::foreach(const SlotForeach& slot)
164 {
165 gst_tag_list_foreach(gobj(), &TagList_foreach_gstreamermm_callback,
166 const_cast<SlotForeach*>(&slot));
167 }
168
169 bool TagList::get_value(Tag tag, Glib::ValueBase& dest) const
170 {
171 return get_value(_tag_strings[tag], dest);
172 }
173
174 bool TagList::get_value(const Glib::ustring& tag, Glib::ValueBase& dest) const
175 {
176 GValue gst_value = G_VALUE_INIT;
177 if(gst_tag_list_copy_value(&gst_value, const_cast<GstTagList*>(gobj()), tag.c_str()))
178 {
179 g_value_copy(&gst_value, dest.gobj());
180 g_value_unset(&gst_value);
181 return true;
182 }
183 return false;
184 }
185
186 bool TagList::get_value(Tag tag, guint index, Glib::ValueBase& value) const
187 {
188 return get_value(_tag_strings[tag], index, value);
189 }
190
191 bool TagList::get_value(const Glib::ustring& tag, guint index, Glib::ValueBase& value) const
192 {
193 const GValue* gst_value =
194 gst_tag_list_get_value_index(const_cast<GstTagList*>(gobj()),
195 tag.c_str(), index);
196
197 if(gst_value)
198 {
199 g_value_copy(gst_value, value.gobj());
200 return true;
201 }
202
203 return false;
204 }
205
206 } // namespace Gst
207
208 namespace
209 {
210 } // anonymous namespace
211
212 // static
213 GType Glib::Value<Gst::TagMergeMode>::value_type()
214 {
215 return gst_tag_merge_mode_get_type();
216 }
217
218 // static
219 GType Glib::Value<Gst::TagFlag>::value_type()
220 {
221 return gst_tag_flag_get_type();
222 }
223
224
225 namespace Glib
226 {
227
228 Gst::TagList wrap_taglist(GstTagList* object, bool take_copy)
229 {
230 return Gst::TagList(object, take_copy);
231 }
232
233 } // namespace Glib
234
235
236 namespace Gst
237 {
238
239
240 // static
241 GType TagList::get_type()
242 {
243 return gst_tag_list_get_type();
244 }
245
246 TagList::TagList()
247 :
248 gobject_ (gst_tag_list_new_empty())
249 {}
250
251 TagList::TagList(const TagList& other)
252 :
253 gobject_ ((other.gobject_) ? gst_tag_list_copy(other.gobject_) : 0)
254 {}
255
256 TagList::TagList(GstTagList* gobject, bool make_a_copy)
257 :
258 // For BoxedType wrappers, make_a_copy is true by default. The static
259 // BoxedType wrappers must always take a copy, thus make_a_copy = true
260 // ensures identical behaviour if the default argument is used.
261 gobject_ ((make_a_copy && gobject) ? gst_tag_list_copy(gobject) : gobject)
262 {}
263
264 TagList& TagList::operator=(const TagList& other)
265 {
266 TagList temp (other);
267 swap(temp);
268 return *this;
269 }
270
271 TagList::~TagList()
272 {
273 if(gobject_)
274 gst_tag_list_free(gobject_);
275 }
276
277 void TagList::swap(TagList& other)
278 {
279 GstTagList *const temp = gobject_;
280 gobject_ = other.gobject_;
281 other.gobject_ = temp;
282 }
283
284 GstTagList* TagList::gobj_copy() const
285 {
286 return gst_tag_list_copy(gobject_);
287 }
288
289
290 bool TagList::exists(const Glib::ustring& tag)
291 {
292 return gst_tag_exists(tag.c_str());
293 }
294
295 GType TagList::get_type(const Glib::ustring& tag)
296 {
297 return gst_tag_get_type(tag.c_str());
298 }
299
300 Glib::ustring TagList::get_nick(const Glib::ustring& tag)
301 {
302 return Glib::convert_const_gchar_ptr_to_ustring(gst_tag_get_nick(tag.c_str()));
303 }
304
305 Glib::ustring TagList::get_description(const Glib::ustring& tag)
306 {
307 return Glib::convert_const_gchar_ptr_to_ustring(gst_tag_get_description(tag.c_str()));
308 }
309
310 Gst::TagFlag TagList::get_flag(const Glib::ustring& tag)
311 {
312 return (Gst::TagFlag)(gst_tag_get_flag(tag.c_str()));
313 }
314
315 bool TagList::is_fixed(const Glib::ustring& tag)
316 {
317 return gst_tag_is_fixed(tag.c_str());
318 }
319
320 bool TagList::is_empty() const
321 {
322 return gst_tag_list_is_empty(const_cast<GstTagList*>(gobj()));
323 }
324
325 void TagList::insert(const Gst::TagList& other, TagMergeMode mode)
326 {
327 gst_tag_list_insert(gobj(), other.gobj(), ((GstTagMergeMode)(mode)));
328 }
329
330 Gst::TagList TagList::merge(const Gst::TagList& other, TagMergeMode mode)
331 {
332 return Glib::wrap_taglist(gst_tag_list_merge(gobj(), other.gobj(), ((GstTagMergeMode)(mode))));
333 }
334
335 guint TagList::size(const Glib::ustring& tag) const
336 {
337 return gst_tag_list_get_tag_size(const_cast<GstTagList*>(gobj()), tag.c_str());
338 }
339
340 void TagList::remove_tag(Tag tag)
341 {
342 gst_tag_list_remove_tag(gobj(), gstreamermm_get_stock_tag(tag));
343 }
344
345 void TagList::remove_tag(const Glib::ustring& tag)
346 {
347 gst_tag_list_remove_tag(gobj(), tag.c_str());
348 }
349
350
351 } // namespace Gst
352
353