summaryrefslogtreecommitdiff
path: root/src/QGst/caps.h
blob: 40d53278b78ddcc7feb7a7d14a5957aefe481a5c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
    Copyright (C) 2009-2010  George Kiagiadakis <kiagiadakis.george@gmail.com>

    This library is free software; you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef QGST_CAPS_H
#define QGST_CAPS_H

#include "global.h"
#include "../QGlib/value.h"
#include "../QGlib/refpointer.h"
#include "../QGlib/type.h"
#include "../QGlib/string.h"

namespace QGst {

class Caps : public QGlib::RefCountedObject
{
    QGST_WRAPPER(Caps)
public:
    static CapsPtr newSimple(const QGlib::String & mediaType);
    static CapsPtr newAny();
    static CapsPtr newEmpty();

    static CapsPtr fromString(const QGlib::String & string);
    QGlib::String toString() const;

    static CapsPtr fromXml(xmlNodePtr node);
    xmlNodePtr toXml(xmlNodePtr parent) const;

    void append(const CapsPtr & caps2);
    void merge(const CapsPtr & caps2);
    void setValue(const QGlib::String & field, const QGlib::Value & value);
    bool simplify();
    void truncate();

    SharedStructure structure(uint index);
    void appendStructure(const StructureBase & structure);
    void mergeStructure(const StructureBase & structure);
    void removeStructure(uint index);

    uint size() const;
    bool isSimple() const;
    bool isAny() const;
    bool isEmpty() const;
    bool isFixed() const;
    bool equals(const CapsPtr & caps2) const;
    bool isAlwaysCompatibleWith(const CapsPtr & caps2) const;
    bool isSubsetOf(const CapsPtr & superset) const;
    bool canIntersect(const CapsPtr & caps2) const;
    CapsPtr getIntersection(const CapsPtr & caps2) const;
    CapsPtr getUnion(const CapsPtr & caps2) const;
    CapsPtr getNormal() const;
    CapsPtr subtract(const CapsPtr & subtrahend) const;

    CapsPtr copy() const;
    CapsPtr copyNth(uint index) const;

protected:
    virtual void ref();
    virtual void unref();
    virtual void makeWritable();
};

}

QGLIB_REGISTER_TYPE(QGst::Caps)

QDebug operator<<(QDebug debug, const QGst::CapsPtr & caps);

#endif