Debian Codegraph @

gstreamer/gstreamermm/caps.h

raw symbols SCIP
1 // Generated by gmmproc 2.50.1 -- DO NOT MODIFY!
2 #ifndef _GSTREAMERMM_CAPS_H
3 #define _GSTREAMERMM_CAPS_H
4
5
6 #include <glibmm/ustring.h>
7 #include <sigc++/sigc++.h>
8
9 /* gstreamermm - a C++ wrapper for gstreamer
10 *
11 * Copyright 2008-2016 The gstreamermm Development Team
12 *
13 * This library is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU Lesser General Public
15 * License as published by the Free Software Foundation; either
16 * version 2.1 of the License, or (at your option) any later version.
17 *
18 * This library is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 * Lesser General Public License for more details.
22 *
23 * You should have received a copy of the GNU Lesser General Public
24 * License along with this library; if not, write to the Free
25 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28 #include <gstreamermm/miniobject.h>
29 #include <gstreamermm/structure.h>
30
31
32 namespace Gst
33 {
34 /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */
35
36 /**
37 * @var CapsIntersectMode CAPS_INTERSECT_ZIG_ZAG
38 * Zig-zags over both caps.
39 *
40 * @var CapsIntersectMode CAPS_INTERSECT_FIRST
41 * Keeps the first caps order.
42 *
43 * @enum CapsIntersectMode
44 *
45 * Modes of caps intersection
46 *
47 * @a GST_CAPS_INTERSECT_ZIG_ZAG tries to preserve overall order of both caps
48 * by iterating on the caps' structures as the following matrix shows:
49 *
50 * [C example ellipted]
51 * Used when there is no explicit precedence of one caps over the other. e.g.
52 * tee's sink pad getcaps function, it will probe its src pad peers' for their
53 * caps and intersect them with this mode.
54 *
55 * @a GST_CAPS_INTERSECT_FIRST is useful when an element wants to preserve
56 * another element's caps priority order when intersecting with its own caps.
57 * Example: If caps1 is [A, B, C] and caps2 is [E, B, D, A], the result
58 * would be [A, B], maintaining the first caps priority on the intersection.
59 *
60 * @ingroup gstreamermmEnums
61 */
62 enum CapsIntersectMode
63 {
64 CAPS_INTERSECT_ZIG_ZAG,
65 CAPS_INTERSECT_FIRST
66 };
67
68
69 /**
70 * @var CapsFlags CAPS_FLAG_ANY
71 * Caps has no specific content, but can contain
72 * anything.
73 *
74 * @enum CapsFlags
75 *
76 * Extra flags for a caps.
77 *
78 * @ingroup gstreamermmEnums
79 * @par Bitwise operators:
80 * <tt>%CapsFlags operator|(CapsFlags, CapsFlags)</tt><br>
81 * <tt>%CapsFlags operator&(CapsFlags, CapsFlags)</tt><br>
82 * <tt>%CapsFlags operator^(CapsFlags, CapsFlags)</tt><br>
83 * <tt>%CapsFlags operator~(CapsFlags)</tt><br>
84 * <tt>%CapsFlags& operator|=(CapsFlags&, CapsFlags)</tt><br>
85 * <tt>%CapsFlags& operator&=(CapsFlags&, CapsFlags)</tt><br>
86 * <tt>%CapsFlags& operator^=(CapsFlags&, CapsFlags)</tt><br>
87 */
88 enum CapsFlags
89 {
90 CAPS_FLAG_ANY = (GST_MINI_OBJECT_FLAG_LAST << 0)
91 };
92
93 /** @ingroup gstreamermmEnums */
94 inline CapsFlags operator|(CapsFlags lhs, CapsFlags rhs)
95 { return static_cast<CapsFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs)); }
96
97 /** @ingroup gstreamermmEnums */
98 inline CapsFlags operator&(CapsFlags lhs, CapsFlags rhs)
99 { return static_cast<CapsFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs)); }
100
101 /** @ingroup gstreamermmEnums */
102 inline CapsFlags operator^(CapsFlags lhs, CapsFlags rhs)
103 { return static_cast<CapsFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs)); }
104
105 /** @ingroup gstreamermmEnums */
106 inline CapsFlags operator~(CapsFlags flags)
107 { return static_cast<CapsFlags>(~static_cast<unsigned>(flags)); }
108
109 /** @ingroup gstreamermmEnums */
110 inline CapsFlags& operator|=(CapsFlags& lhs, CapsFlags rhs)
111 { return (lhs = static_cast<CapsFlags>(static_cast<unsigned>(lhs) | static_cast<unsigned>(rhs))); }
112
113 /** @ingroup gstreamermmEnums */
114 inline CapsFlags& operator&=(CapsFlags& lhs, CapsFlags rhs)
115 { return (lhs = static_cast<CapsFlags>(static_cast<unsigned>(lhs) & static_cast<unsigned>(rhs))); }
116
117 /** @ingroup gstreamermmEnums */
118 inline CapsFlags& operator^=(CapsFlags& lhs, CapsFlags rhs)
119 { return (lhs = static_cast<CapsFlags>(static_cast<unsigned>(lhs) ^ static_cast<unsigned>(rhs))); }
120
121 } // namespace Gst
122
123 #ifndef DOXYGEN_SHOULD_SKIP_THIS
124 namespace Glib
125 {
126
127 template <>
128 class Value<Gst::CapsFlags> : public Glib::Value_Flags<Gst::CapsFlags>
129 {
130 public:
131 static GType value_type() G_GNUC_CONST;
132 };
133
134 } // namespace Glib
135 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
136
137 namespace Gst
138 {
139
140
141 class CapsFeatures;
142
143 /** Structure describing sets of media formats.
144 * Caps (capabilities) are lightweight refcounted objects describing media types.
145 *
146 * They are composed of an array of Gst::Structure.
147 *
148 * Caps are exposed on Gst::PadTemplate to describe all possible types a
149 * given pad can handle. They are also stored in the Gst::Registry along with
150 * a description of the Gst::Element.
151 *
152 * Caps are exposed on the element pads using the Gst::Pad::query_caps() pad
153 * method. This function describes the possible types that the pad can
154 * handle or produce at runtime.
155 *
156 * @code
157 * Glib::RefPtr<Gst::Caps> caps = Gst::Caps::create_simple("video/x-raw",
158 * "format", Gst::Fourcc('I', '4', '2', '0'),
159 * "framerate", Gst::Fraction(25, 1),
160 * "pixel-aspect-ratio", Gst::Fraction(1, 1),
161 * "width", 320,
162 * "height", 240);
163 * @endcode
164 *
165 * A Gst::Caps is fixed when it has no properties with ranges or lists. Use
166 * Gst::Caps::is_fixed() to test for fixed caps. Fixed caps can be used in a
167 * caps event to notify downstream elements of the current media type.
168 *
169 * Various methods exist to work with the media types such as subtracting
170 * or intersecting.
171 *
172 * Be aware that the current Gst::Caps / Gst::Structure serialization into string
173 * has limited support for nested Gst::Caps / Gst::Structure fields. It can only
174 * support one level of nesting. Using more levels will lead to unexpected
175 * behavior when using serialization features, such as Gst::Caps::to_string() or
176 * gst_value_serialize() and their counterparts.
177 *
178 * Last reviewed on 2016-05-16 (1.8.0)
179 *
180 */
181 class Caps : public MiniObject
182 {
183 public:
184 #ifndef DOXYGEN_SHOULD_SKIP_THIS
185 using CppObjectType = Caps;
186 using BaseObjectType = GstCaps;
187 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
188
189 static Glib::RefPtr<Caps> create();
190
191 /** Increment the reference count for this object.
192 * You should never need to do this manually - use the object via a RefPtr instead.
193 */
194 void reference() const;
195
196 /** Decrement the reference count for this object.
197 * You should never need to do this manually - use the object via a RefPtr instead.
198 */
199 void unreference() const;
200
201 ///Provides access to the underlying C instance.
202 GstCaps* gobj();
203
204 ///Provides access to the underlying C instance.
205 const GstCaps* gobj() const;
206
207 ///Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
208 GstCaps* gobj_copy() const;
209
210 Caps() = delete;
211
212 // noncopyable
213 Caps(const Caps&) = delete;
214 Caps& operator=(const Caps&) = delete;
215
216 protected:
217 // Do not derive this. Gst::Caps can neither be constructed nor deleted.
218
219 void operator delete(void*, std::size_t);
220
221 private:
222
223
224 public:
225 #ifndef DOXYGEN_SHOULD_SKIP_THIS
226 static GType get_type() G_GNUC_CONST;
227 #endif
228
229 public:
230 /** Creates a new Gst::Caps that contains one Gst::Structure.
231 *
232 * @param media_type The media type of the structure.
233 * @param ...further_data further data to set in format: name, data (data
234 * value can be any supported C++ type).
235 *
236 * @return The new Gst::Caps.
237 */
238 template<class ...DataTypes>
239 static Glib::RefPtr<Gst::Caps> create_simple(const Glib::ustring& media_type, DataTypes... further_data);
240
241 /** Creates a new Gst::Caps and adds the given Gst::Structure.
242 * Use append_structure() to add additional structures.
243 *
244 * @param first_struct The first structure to add.
245 * @return Returns the new Gst::Caps.
246 */
247 static Glib::RefPtr<Gst::Caps> create(const Structure& first_struct);
248
249
250 /** Converts @a caps from a string representation.
251 *
252 * The current implementation of serialization will lead to unexpected results
253 * when there are nested Gst::Caps / Gst::Structure deeper than one level.
254 *
255 * @param string A string to convert to Gst::Caps.
256 * @return A newly allocated Gst::Caps.
257 */
258 static Glib::RefPtr<Gst::Caps> create_from_string(const Glib::ustring& string);
259
260
261 /** Creates a new Gst::Caps and appends a copy of the nth structure
262 * contained in @a caps.
263 *
264 * @param nth The nth structure to copy.
265 * @return The new Gst::Caps.
266 */
267 Glib::RefPtr<Gst::Caps> copy_nth(guint nth) const;
268
269
270 /** Appends the structures contained in @a caps to @a caps1. The structures in
271 * @a caps are not copied -- they are transferred to @a caps1, and then @a caps is
272 * freed. If either caps is ANY, the resulting caps will be ANY.
273 *
274 * @param caps The Gst::Caps to append.
275 */
276 void append(Glib::RefPtr<Gst::Caps>&& caps);
277
278 Glib::RefPtr<Gst::Caps> merge(Glib::RefPtr<Gst::Caps>&& caps);
279
280
281 /** Appends a structure to caps.
282 *
283 * @param structure The Gst::Structure to append.
284 */
285 void append_structure(const Structure& structure);
286
287
288 /** Appends @a structure to @a caps. The structure is not copied; @a caps
289 * becomes the owner of @a structure.
290 *
291 * @param structure The Gst::Structure to append.
292 */
293 void append_structure(Gst::Structure&& structure);
294
295 /** Appends a structure to caps.
296 *
297 * @param structure The Gst::Structure to append.
298 * @param features The Gst::CapsFeatures to append.
299 */
300 void append_structure(const Structure& structure, const CapsFeatures& features);
301
302
303 /** Appends a structure to caps if its not already expressed by caps.
304 *
305 * @param structure The Gst::Structure to merge.
306 */
307 Glib::RefPtr<Gst::Caps> merge_structure(const Structure& structure);
308
309
310 /** Appends a structure to caps if its not already expressed by caps.
311 *
312 * @param structure The Gst::Structure to merge.
313 * @param features The Gst::CapsFeatures to merge.
314 */
315 Glib::RefPtr<Gst::Caps> merge_structure(const Structure& structure, const CapsFeatures& features);
316
317
318 /** Finds the structure in caps that has the index @a idx, and returns it.
319 *
320 * @param idx The index of the structure.
321 * @return The Gst::Structure corresponding to index.
322 */
323 const Structure get_structure(guint idx) const;
324
325
326 /** removes the structure with the given index from the list of structures
327 * contained in @a caps.
328 *
329 * @param idx Index of the structure to remove.
330 */
331 void remove_structure(guint idx);
332
333 /** Gets the number of structures contained in @a caps.
334 *
335 * @return The number of structures that @a caps contains.
336 */
337 guint size() const;
338
339 // There's no need to take an extra reference because we are stealing the
340 // structure.
341
342
343 /** Retrieves the structure with the given index from the list of structures
344 * contained in @a caps. The caller becomes the owner of the returned structure.
345 *
346 * @param index Index of the structure to retrieve.
347 * @return A pointer to the Gst::Structure corresponding
348 * to @a index.
349 */
350 Structure steal_structure(guint index);
351
352 /** Sets fields in a simple Gst::Caps. A simple Gst::Caps is one that only
353 * has one structure. This method, like the Gst::Structure::set_field()
354 * methods, translates certain GTypes to GStreamer specific GTypes for
355 * functional compatibility.
356 *
357 * @param name Field to set.
358 * @param value The value which the field should be set to.
359 */
360 void set_simple(const Glib::ustring& name, const Glib::ValueBase& value);
361
362
363 /** Sets fields in a simple Gst::Caps. A simple Gst::Caps is one that only
364 * has one structure. This method, like the Gst::Structure::set_field()
365 * methods, translates certain GTypes to GStreamer specific GTypes for
366 * functional compatibility.
367 *
368 * @param name Field to set.
369 * @param data A value which the field should be set to (this can be any
370 * supported C++ type).
371 * @param ...further_data further data to set in format: name, data.
372 */
373 template<class DataType, class ...DataTypes>
374 void set_simple(const Glib::ustring & name, const DataType& data, DataTypes ...further_data);
375
376 /** Sets fields in a simple Gst::Caps. A simple Gst::Caps is one that only
377 * has one structure.
378 *
379 * @param name Field to set.
380 * @param data A C string (const char*) which the field should be set to.
381 */
382 void set_simple(const Glib::ustring& name, const char* data);
383
384
385 /** Sets the given @a field on all structures of @a caps to the given @a value.
386 * This is a convenience function for calling Gst::Structure::set_value() on
387 * all structures of @a caps.
388 *
389 * @param field Name of the field to set.
390 * @param value Value to set the field to.
391 */
392 void set_value(const Glib::ustring& field, const Glib::ValueBase& value);
393
394 /** Sets the given @a field on all structures to the given value. This is a
395 * convenience function for calling Gst::Structure::set_value() on all
396 * structures.
397 *
398 * @param name Field to set.
399 * @param data A value which the field should be set to (this can be any
400 * supported C++ type).
401 */
402 template <class DataType>
403 void set_value(const Glib::ustring& name, const DataType& data);
404
405
406 /** Determines if @a caps represents any media format.
407 *
408 * @return <tt>true</tt> if @a caps represents any format.
409 */
410 bool is_any() const;
411
412 /** Determines if @a caps represents no media formats.
413 *
414 * @return <tt>true</tt> if @a caps represents no formats.
415 */
416 bool empty() const;
417
418 /** Fixed Gst::Caps describe exactly one format, that is, they have exactly
419 * one structure, and each field in the structure describes a fixed type.
420 * Examples of non-fixed types are GST_TYPE_INT_RANGE and GST_TYPE_LIST.
421 *
422 * @return <tt>true</tt> if @a caps is fixed.
423 */
424 bool is_fixed() const;
425
426 /** Checks if the given caps represent the same set of caps.
427 *
428 * @param other_caps Another Gst::Caps.
429 * @return <tt>true</tt> if both caps are equal.
430 */
431 bool equals(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
432
433 /** Tests if two Gst::Caps are equal. This function only works on fixed
434 * Gst::Caps.
435 *
436 * @param other_caps The Gst::Caps to test.
437 * @return <tt>true</tt> if the arguments represent the same format.
438 */
439 bool equals_fixed(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
440
441 /** A given Gst::Caps structure is always compatible with another if
442 * every media format that is in the first is also contained in the
443 * second. That is, @a caps1 is a subset of @a other_caps.
444 *
445 * @param other_caps The Gst::Caps to test.
446 * @return <tt>true</tt> if @a caps1 is a subset of @a other_caps.
447 */
448 bool is_always_compatible(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
449
450 /** Checks if all caps represented by @a subset are also represented by @a superset_caps.
451 *
452 * @param superset_caps A potentially greater Gst::Caps.
453 * @return <tt>true</tt> if @a subset is a subset of @a superset_caps.
454 */
455 bool is_subset(const Glib::RefPtr<const Gst::Caps>& superset_caps) const;
456
457 /** Tries intersecting @a caps1 and @a caps2 and reports whether the result would not
458 * be empty
459 *
460 * @param caps2 A Gst::Caps to intersect.
461 * @return <tt>true</tt> if intersection would be not empty.
462 */
463 bool can_intersect(const Glib::RefPtr<const Gst::Caps>& caps2) const;
464
465 /** Modifies the given @a caps into a representation with only fixed
466 * values. First the caps will be truncated and then the first structure will be
467 * fixated with Gst::Structure::fixate().
468 *
469 * This function takes ownership of @a caps and will call gst_caps_make_writable()
470 * on it so you must not use @a caps afterwards unless you keep an additional
471 * reference to it with ref().
472 *
473 * @return The fixated caps.
474 */
475 Glib::RefPtr<Gst::Caps> fixate() const;
476
477 /** Checks if the given caps are exactly the same set of caps.
478 *
479 * @param caps2 Another Gst::Caps.
480 * @return <tt>true</tt> if both caps are strictly equal.
481 */
482 bool is_strictly_equal(const Glib::RefPtr<const Gst::Caps>& caps2) const;
483
484 /** Creates a new Gst::Caps as a copy of the old @a caps. The new caps will have a
485 * refcount of 1, owned by the caller. The structures are copied as well.
486 *
487 * Note that this function is the semantic equivalent of a ref()
488 * followed by a gst_caps_make_writable(). If you only want to hold on to a
489 * reference to the data, you should use ref().
490 *
491 * When you are finished with the caps, call unref() on it.
492 *
493 * @return The new Gst::Caps.
494 */
495 Glib::RefPtr<Gst::Caps> copy() const;
496
497 /** Checks if @a structure is a subset of @a caps. See is_subset()
498 * for more information.
499 *
500 * @param structure A potential Gst::Structure subset of @a caps.
501 * @return <tt>true</tt> if @a structure is a subset of @a caps.
502 */
503 bool is_subset_structure(const Gst::Structure& structure) const;
504
505 /** Checks if @a structure is a subset of @a caps. See is_subset()
506 * for more information.
507 *
508 * @param structure A potential Gst::Structure subset of @a caps.
509 * @param features A Gst::CapsFeatures for @a structure.
510 * @return <tt>true</tt> if @a structure is a subset of @a caps.
511 */
512 bool is_subset_structure(const Gst::Structure& structure, const Gst::CapsFeatures& features) const;
513
514
515 /** Creates a new Gst::Caps that indicates that it is compatible with
516 * any media format.
517 *
518 * @return The new Gst::Caps.
519 */
520 static Glib::RefPtr<Gst::Caps> create_any();
521
522 //This is const (returns a non const) because it always creates a new instance:
523
524 /** Creates a new Gst::Caps that contains all the formats that are common
525 * to both @a caps1 and @a other_caps. Defaults to Gst::CAPS_INTERSECT_ZIG_ZAG mode.
526 *
527 * @param other_caps A Gst::Caps to intersect.
528 * @return The new Gst::Caps.
529 */
530 Glib::RefPtr<Gst::Caps> get_intersect(const Glib::RefPtr<const Gst::Caps>& other_caps) const;
531
532 //This is const (returns a non const) because it always creates a new instance:
533
534 /** Creates a new Gst::Caps that contains all the formats that are common
535 * to both @a caps1 and @a other_caps, the order is defined by the Gst::CapsIntersectMode
536 * used.
537 *
538 * @param other_caps A Gst::Caps to intersect.
539 * @param p2 The intersection algorithm/mode to use.
540 * @return The new Gst::Caps.
541 */
542 Glib::RefPtr<Gst::Caps> get_intersect(const Glib::RefPtr<const Gst::Caps>& other_caps, CapsIntersectMode p2) const;
543
544 //This is const (returns a non const) because it always creates a new instance:
545
546 /** Returns a Gst::Caps that represents the same set of formats as
547 * @a caps, but contains no lists. Each list is expanded into separate
548 * @a GstStructures.
549 *
550 * This function takes ownership of @a caps and will call gst_caps_make_writable()
551 * on it so you must not use @a caps afterwards unless you keep an additional
552 * reference to it with ref().
553 *
554 * @return The normalized Gst::Caps.
555 */
556 Glib::RefPtr<Gst::Caps> get_normal() const;
557
558 //This is const (returns a non const) because it always creates a new instance:
559
560 /** Converts the given @a caps into a representation that represents the
561 * same set of formats, but in a simpler form. Component structures that are
562 * identical are merged. Component structures that have values that can be
563 * merged are also merged.
564 *
565 * This function takes ownership of @a caps and will call gst_caps_make_writable()
566 * on it if necessary, so you must not use @a caps afterwards unless you keep an
567 * additional reference to it with ref().
568 *
569 * This method does not preserve the original order of @a caps.
570 *
571 * @return The simplified caps.
572 */
573 Glib::RefPtr<Gst::Caps> simplify();
574
575
576 /** Converts @a caps to a string representation. This string representation
577 * can be converted back to a Gst::Caps by from_string().
578 *
579 * For debugging purposes its easier to do something like this:
580 *
581 * [C example ellipted]
582 * This prints the caps in human readable form.
583 *
584 * The current implementation of serialization will lead to unexpected results
585 * when there are nested Gst::Caps / Gst::Structure deeper than one level.
586 *
587 * @return A newly allocated string representing @a caps.
588 */
589 Glib::ustring to_string() const;
590
591 //This is const (returns a non const) because it always creates a new instance:
592
593 /** Subtracts the @a subtrahend_caps from the @a minuend.
594 * <note>This function does not work reliably if optional properties for caps
595 * are included on one caps and omitted on the other.</note>
596 *
597 * @param subtrahend_caps Gst::Caps to subtract.
598 * @return The resulting caps.
599 */
600 Glib::RefPtr<Gst::Caps> get_difference(const Glib::RefPtr<const Gst::Caps>& subtrahend_caps) const;
601
602 /**
603 * Returns a writable copy of @a caps.
604 *
605 * If there is only one reference count on Gst::Caps object , the caller must be
606 * the owner, and so this function will return the caps object unchanged. If on
607 * the other hand there is more than one reference on the object, a new caps object
608 * will be returned.
609 * @return A buffer (possibly the same pointer) that is writable.
610 */
611 Glib::RefPtr<Gst::Caps> create_writable();
612
613 /** Discard all but the first structure from @a caps. Useful when
614 * fixating.
615 *
616 * @return Truncated caps.
617 */
618 Glib::RefPtr<Gst::Caps> truncate();
619
620
621 /**
622 * Finds the features in caps that has the index index , and returns it.
623 *
624 * @param index the index of the structure.
625 * @return The new Gst::CapsFeatures corresponding to index.
626 */
627 CapsFeatures get_features(guint index) const;
628
629
630 /**
631 * Sets the Gst::CapsFeatures for the structure at index.
632 *
633 * @param index The index of the structure.
634 * @param features The Gst::CapsFeatures to set.
635 */
636 void set_features(guint index, const CapsFeatures& features);
637
638
639 private:
640 // This method is used for varadic template recursion
641 void set_simple() {}
642
643
644 };
645
646 /******************************* Gst::Caps *******************************/
647
648 #ifndef DOXYGEN_SHOULD_SKIP_THIS
649
650 template<class DataType, class ...DataTypes>
651 void Caps::set_simple(const Glib::ustring & name, const DataType& data, DataTypes ...further_data)
652 {
653 this->set_value(name, data);
654 this->set_simple(further_data...);
655 }
656
657 template<class ...DataTypes>
658 Glib::RefPtr<Gst::Caps> Caps::create_simple(const Glib::ustring& media_type, DataTypes... data)
659 {
660 /*
661 This method is implemented because gst_caps_new_simple is a variable argument
662 function and cannot be wrapped. In addition, because gst_caps_new_simple
663 creates a GstStructure for the GstCaps and will not be called, we must create
664 our own GstStructure here and append it to the GstCaps.
665 */
666 Glib::RefPtr<Gst::Caps> result(reinterpret_cast<Gst::Caps*>(gst_caps_new_empty()));
667 Gst::Structure gst_struct(media_type, data...);
668 result->append_structure(gst_struct);
669 return result;
670 }
671
672 template <class DataType>
673 void Caps::set_value(const Glib::ustring& name, const DataType& data)
674 {
675 typedef Glib::Value<DataType> ValueType;
676
677 ValueType value;
678 value.init(ValueType::value_type());
679 value.set(data);
680 this->set_value(name, reinterpret_cast<Glib::ValueBase&>(value));
681 }
682
683 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
684
685 } //namespace Gst
686
687 #ifndef DOXYGEN_SHOULD_SKIP_THIS
688 namespace Glib
689 {
690
691 template <>
692 class Value< Glib::RefPtr<Gst::Caps> > : public ValueBase_Boxed
693 {
694 public:
695 static GType value_type() { return Gst::Caps::get_type(); }
696 void set(const Glib::RefPtr<Gst::Caps>& caps) { set_boxed(Glib::unwrap(caps)); }
697 Glib::RefPtr<Gst::Caps> get();
698 };
699
700 }
701 #endif /* DOXYGEN_SHOULD_SKIP_THIS */
702
703
704 namespace Glib
705 {
706
707 /** A Glib::wrap() method for this object.
708 *
709 * @param object The C instance.
710 * @param take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
711 * @result A C++ instance that wraps this C instance.
712 *
713 * @relates Gst::Caps
714 */
715 Glib::RefPtr<Gst::Caps> wrap(GstCaps* object, bool take_copy = false);
716
717 } // namespace Glib
718
719
720 #endif /* _GSTREAMERMM_CAPS_H */
721