QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
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 
26 namespace QGst {
27 
31 class QTGSTREAMER_EXPORT Caps : public QGst::MiniObject
32 {
33  QGST_WRAPPER(Caps)
34 public:
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 
76 template <typename T>
77 inline void Caps::setValue(const char *field, const T & value)
78 {
79  setValue(field, QGlib::Value::create(value));
80 }
81 
82 //static
83 inline CapsPtr Caps::fromString(const QString & string)
84 {
85  return fromString(string.toUtf8().constData());
86 }
87 
88 inline CapsPtr Caps::makeWritable() const
89 {
90  return MiniObject::makeWritable().staticCast<Caps>();
91 }
92 
94 QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const CapsPtr & caps);
95 
96 
97 } //namespace QGst
98 
99 QGST_REGISTER_TYPE(QGst::Caps)
100 
101 #endif
Wrapper class for GstMiniObject.
Definition: miniobject.h:29
static Value create(const T &data)
Definition: value.h:293
Smart pointer class for working with wrapper classes that support reference counting.
Definition: global.h:56
Wrapper class for GValue.
Definition: value.h:74
Wrapper for GstStructure.
Definition: structure.h:49
Wrapper class for GstCaps.
Definition: caps.h:31