00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef QGST_STRUCTS_H
00018 #define QGST_STRUCTS_H
00019
00020 #include "global.h"
00021
00022 namespace QGst {
00023
00027 struct QTGSTREAMER_EXPORT Fourcc
00028 {
00029 inline Fourcc() { value.as_integer = 0; }
00030
00031 inline Fourcc (char first, char second, char third, char fourth)
00032 {
00033 value.as_integer = first | second << 8 | third << 16 | fourth << 24;
00034 }
00035
00036 inline Fourcc(const char str[4])
00037 {
00038 value.as_integer = str[0] | str[1] << 8 | str[2] << 16 | str[3] << 24;
00039 }
00040
00041 inline Fourcc(quint32 fourcc)
00042 {
00043 value.as_integer = fourcc;
00044 }
00045
00046 union {
00047 #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN
00048 struct {
00049 char first;
00050 char second;
00051 char third;
00052 char fourth;
00053 } as_bytes;
00054 #else
00055 struct {
00056 char fourth;
00057 char third;
00058 char second;
00059 char first;
00060 } as_bytes;
00061 #endif
00062 quint32 as_integer;
00063 } value;
00064 };
00065 }
00066 QGST_REGISTER_TYPE(QGst::Fourcc)
00067
00068 namespace QGst {
00072 struct QTGSTREAMER_EXPORT Fraction
00073 {
00074 inline Fraction() {}
00075 inline Fraction(int numerator, int denominator)
00076 : numerator(numerator), denominator(denominator) {}
00077
00078 int numerator;
00079 int denominator;
00080 };
00081 }
00082 QGST_REGISTER_TYPE(QGst::Fraction)
00083
00084 namespace QGst {
00085 namespace Private {
00090 template <typename T>
00091 struct Range
00092 {
00093 inline Range()
00094 : start(T()), end(T()) {}
00095 inline Range(const T & start, const T & end)
00096 : start(start), end(end) {}
00097
00098 T start;
00099 T end;
00100 };
00101 }
00102
00106 typedef Private::Range<int> IntRange;
00107
00111 typedef Private::Range<qint64> Int64Range;
00112
00116 typedef Private::Range<double> DoubleRange;
00117
00121 typedef Private::Range<Fraction> FractionRange;
00122 }
00123 QGST_REGISTER_TYPE(QGst::IntRange)
00124 QGST_REGISTER_TYPE(QGst::Int64Range)
00125 QGST_REGISTER_TYPE(QGst::DoubleRange)
00126 QGST_REGISTER_TYPE(QGst::FractionRange)
00127
00128 #endif // QGST_STRUCTS_H