QtGStreamer 1.2.0
Loading...
Searching...
No Matches
caps.h
1/*
2 Copyright (C) 2009-2010 George Kiagiadakis <kiagiadakis.george@gmail.com>
3
4 This library is free software; you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as published
6 by the Free Software Foundation; either version 2.1 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU Lesser General Public License for more details.
13
14 You should have received a copy of the GNU Lesser General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
16*/
17#ifndef QGST_CAPS_H
18#define QGST_CAPS_H
19
20#include "global.h"
21#include "miniobject.h"
22#include "../QGlib/value.h"
23#include "../QGlib/refpointer.h"
24#include "../QGlib/type.h"
25
26namespace QGst {
27
31class QTGSTREAMER_EXPORT Caps : public QGst::MiniObject
32{
33 QGST_WRAPPER(Caps)
34public:
35 static CapsPtr createSimple(const char *mediaType);
36 static CapsPtr createAny();
37 static CapsPtr createEmpty();
38
39 static CapsPtr fromString(const char *string);
40 static inline CapsPtr fromString(const QString & string);
41 QString toString() const;
42
43 void append(const CapsPtr & caps2);
44 CapsPtr merge(CapsPtr & caps2);
45 template <typename T>
46 inline void setValue(const char *field, const T & value);
47 void setValue(const char *field, const QGlib::Value & value);
48 bool simplify();
49 CapsPtr truncate();
50
51 StructurePtr internalStructure(uint index);
52
53 void appendStructure(const Structure & structure);
54 CapsPtr mergeStructure(Structure & structure);
55 void removeStructure(uint index);
56
57 uint size() const;
58 bool isSimple() const;
59 bool isAny() const;
60 bool isEmpty() const;
61 bool isFixed() const;
62 bool equals(const CapsPtr & caps2) const;
63 bool isAlwaysCompatibleWith(const CapsPtr & caps2) const;
64 bool isSubsetOf(const CapsPtr & superset) const;
65 bool canIntersect(const CapsPtr & caps2) const;
66 CapsPtr getIntersection(const CapsPtr & caps2) const;
67 CapsPtr getNormal();
68 CapsPtr subtract(const CapsPtr & subtrahend) const;
69
70 CapsPtr copy() const;
71 CapsPtr copyNth(uint index) const;
72
73 inline CapsPtr makeWritable() const;
74};
75
76template <typename T>
77inline void Caps::setValue(const char *field, const T & value)
78{
79 setValue(field, QGlib::Value::create(value));
80}
81
82//static
83inline CapsPtr Caps::fromString(const QString & string)
84{
85 return fromString(string.toUtf8().constData());
86}
87
88inline CapsPtr Caps::makeWritable() const
89{
90 return MiniObject::makeWritable().staticCast<Caps>();
91}
92
94QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const CapsPtr & caps);
95
96
97} //namespace QGst
98
99QGST_REGISTER_TYPE(QGst::Caps)
100
101#endif
Smart pointer class for working with wrapper classes that support reference counting.
Definition refpointer.h:91
Wrapper class for GValue.
Definition value.h:77
static Value create(const T &data)
Definition value.h:295
Wrapper class for GstCaps.
Definition caps.h:32
Wrapper class for GstMiniObject.
Definition miniobject.h:30
Wrapper for GstStructure.
Definition structure.h:50
Wrappers for GStreamer classes.