QtGStreamer 0.10.1
|
00001 /* 00002 Copyright (C) 2009-2010 George Kiagiadakis <kiagiadakis.george@gmail.com> 00003 00004 This library is free software; you can redistribute it and/or modify 00005 it under the terms of the GNU Lesser General Public License as published 00006 by the Free Software Foundation; either version 2.1 of the License, or 00007 (at your option) any later version. 00008 00009 This program is distributed in the hope that it will be useful, 00010 but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 GNU General Public License for more details. 00013 00014 You should have received a copy of the GNU Lesser General Public License 00015 along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 #ifndef QGST_CAPS_H 00018 #define QGST_CAPS_H 00019 00020 #include "global.h" 00021 #include "../QGlib/value.h" 00022 #include "../QGlib/refpointer.h" 00023 #include "../QGlib/type.h" 00024 00025 namespace QGst { 00026 00030 class QTGSTREAMER_EXPORT Caps : public QGlib::RefCountedObject 00031 { 00032 QGST_WRAPPER(Caps) 00033 public: 00034 static CapsPtr createSimple(const char *mediaType); 00035 static CapsPtr createAny(); 00036 static CapsPtr createEmpty(); 00037 00038 static CapsPtr fromString(const char *string); 00039 static inline CapsPtr fromString(const QString & string); 00040 QString toString() const; 00041 00042 void append(const CapsPtr & caps2); 00043 void merge(const CapsPtr & caps2); 00044 template <typename T> 00045 inline void setValue(const char *field, const T & value); 00046 void setValue(const char *field, const QGlib::Value & value); 00047 bool simplify(); 00048 void truncate(); 00049 00050 StructurePtr internalStructure(uint index); 00051 00052 void appendStructure(const Structure & structure); 00053 void mergeStructure(const Structure & structure); 00054 void removeStructure(uint index); 00055 00056 uint size() const; 00057 bool isSimple() const; 00058 bool isAny() const; 00059 bool isEmpty() const; 00060 bool isFixed() const; 00061 bool equals(const CapsPtr & caps2) const; 00062 bool isAlwaysCompatibleWith(const CapsPtr & caps2) const; 00063 bool isSubsetOf(const CapsPtr & superset) const; 00064 bool canIntersect(const CapsPtr & caps2) const; 00065 CapsPtr getIntersection(const CapsPtr & caps2) const; 00066 CapsPtr getUnion(const CapsPtr & caps2) const; 00067 CapsPtr getNormal() const; 00068 CapsPtr subtract(const CapsPtr & subtrahend) const; 00069 00070 CapsPtr copy() const; 00071 CapsPtr copyNth(uint index) const; 00072 00073 bool isWritable() const; 00074 CapsPtr makeWritable() const; 00075 00076 protected: 00077 virtual void ref(bool increaseRef); 00078 virtual void unref(); 00079 }; 00080 00081 template <typename T> 00082 inline void Caps::setValue(const char *field, const T & value) 00083 { 00084 setValue(field, QGlib::Value::create(value)); 00085 } 00086 00087 //static 00088 inline CapsPtr Caps::fromString(const QString & string) 00089 { 00090 return fromString(string.toUtf8().constData()); 00091 } 00092 00094 QTGSTREAMER_EXPORT QDebug operator<<(QDebug debug, const CapsPtr & caps); 00095 00096 00097 namespace Private { 00098 00099 QTGSTREAMER_EXPORT QGlib::RefCountedObject *wrapCaps(void *caps); 00100 00101 } //namespace Private 00102 } //namespace QGst 00103 00104 QGST_REGISTER_TYPE(QGst::Caps) 00105 QGLIB_REGISTER_WRAPIMPL_FOR_SUBCLASSES_OF(QGst::Caps, QGst::Private::wrapCaps) 00106 00107 #endif