QtGStreamer  1.2.0
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Pages
query.h
1 /*
2  Copyright (C) 2010 Collabora Multimedia.
3  @author Mauricio Piacentini <mauricio.piacentini@collabora.co.uk>
4 
5  This library is free software; you can redistribute it and/or modify
6  it under the terms of the GNU Lesser General Public License as published
7  by the Free Software Foundation; either version 2.1 of the License, or
8  (at your option) any later version.
9 
10  This program is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  GNU Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QGST_QUERY_H
19 #define QGST_QUERY_H
20 
21 #include "miniobject.h"
22 #include "structure.h"
23 #include "clocktime.h"
24 
25 class QUrl;
26 
27 namespace QGst {
28 
53 class QTGSTREAMER_EXPORT Query : public MiniObject
54 {
55  QGST_WRAPPER(Query)
56 public:
57  QString typeName() const;
58  QueryType type() const;
59 
60  StructureConstPtr internalStructure();
61 };
62 
66 class QTGSTREAMER_EXPORT PositionQuery : public Query
67 {
68  QGST_WRAPPER_FAKE_SUBCLASS(Position, Query)
69 public:
70  static PositionQueryPtr create(Format format);
71 
72  Format format() const;
73  qint64 position() const;
74  void setValues(Format format, qint64 position);
75 };
76 
80 class QTGSTREAMER_EXPORT DurationQuery : public Query
81 {
82  QGST_WRAPPER_FAKE_SUBCLASS(Duration, Query)
83 public:
84  static DurationQueryPtr create(Format format);
85 
86  Format format() const;
87  qint64 duration() const;
88  void setValues(Format format, qint64 duration);
89 };
90 
94 class QTGSTREAMER_EXPORT LatencyQuery : public Query
95 {
96  QGST_WRAPPER_FAKE_SUBCLASS(Latency, Query)
97 public:
98  static LatencyQueryPtr create();
99 
100  bool hasLive() const;
101  ClockTime minimumLatency() const;
102  ClockTime maximumLatency() const;
103 
104  void setValues(bool live, ClockTime minimumLatency, ClockTime maximumLatency);
105 };
106 
110 class QTGSTREAMER_EXPORT SeekingQuery : public Query
111 {
112  QGST_WRAPPER_FAKE_SUBCLASS(Seeking, Query)
113 public:
114  static SeekingQueryPtr create(Format format);
115 
116  Format format() const;
117  bool seekable() const;
118  qint64 segmentStart() const;
119  qint64 segmentEnd() const;
120 
121  void setValues(Format format, bool seekable, qint64 segmentStart, qint64 segmentEnd);
122 };
123 
127 class QTGSTREAMER_EXPORT SegmentQuery : public Query
128 {
129  QGST_WRAPPER_FAKE_SUBCLASS(Segment, Query)
130 public:
131  static SegmentQueryPtr create(Format format);
132 
133  Format format() const;
134  double rate() const;
135  qint64 startValue() const;
136  qint64 stopValue() const;
137 
138  void setValues(Format format, double rate, qint64 startValue, qint64 stopValue);
139 };
140 
144 class QTGSTREAMER_EXPORT ConvertQuery : public Query
145 {
146  QGST_WRAPPER_FAKE_SUBCLASS(Convert, Query)
147 public:
148  static ConvertQueryPtr create(Format sourceFormat, qint64 value, Format destinationFormat);
149 
150  Format sourceFormat() const;
151  qint64 sourceValue() const;
152  Format destinationFormat() const;
153  qint64 destinationValue() const;
154 
155  void setValues(Format sourceFormat, qint64 sourcevalue, Format destinationFormat,
156  qint64 destinationValue);
157 };
158 
162 class QTGSTREAMER_EXPORT FormatsQuery : public Query
163 {
164  QGST_WRAPPER_FAKE_SUBCLASS(Formats, Query)
165 public:
166  static FormatsQueryPtr create();
167 
168  QList<Format> formats() const;
169  void setFormats(const QList<Format> & formats);
170 };
171 
175 class QTGSTREAMER_EXPORT BufferingQuery : public Query
176 {
177  QGST_WRAPPER_FAKE_SUBCLASS(Buffering, Query)
178 public:
179  static BufferingQueryPtr create(Format format);
180 
181  bool isBusy() const;
182  int percent() const;
183 
184  void setBufferingPercent(bool busy, int percent);
185 
186  BufferingMode mode() const;
187  int averageIn() const;
188  int averageOut() const;
189  qint64 bufferingLeft() const;
190 
191  void setBufferingStats(BufferingMode mode, int averageIn,
192  int averageOut, qint64 bufferingLeft);
193 
194  Format rangeFormat() const;
195  qint64 rangeStart() const;
196  qint64 rangeStop() const;
197  qint64 estimatedTotal() const;
198 
199  void setBufferingRange(Format rangeFormat, qint64 rangeStart,
200  qint64 rangeStop, qint64 estimatedTotal);
201 };
202 
206 class QTGSTREAMER_EXPORT UriQuery : public Query
207 {
208  QGST_WRAPPER_FAKE_SUBCLASS(Uri, Query)
209 public:
210  static UriQueryPtr create();
211 
212  QUrl uri() const;
213  void setUri(const QUrl & uri);
214 };
215 
216 } //namespace QGst
217 
218 QGST_REGISTER_TYPE(QGst::Query)
219 QGST_REGISTER_SUBCLASS(Query, Position)
220 QGST_REGISTER_SUBCLASS(Query, Duration)
221 QGST_REGISTER_SUBCLASS(Query, Latency)
222 QGST_REGISTER_SUBCLASS(Query, Seeking)
223 QGST_REGISTER_SUBCLASS(Query, Segment)
224 QGST_REGISTER_SUBCLASS(Query, Convert)
225 QGST_REGISTER_SUBCLASS(Query, Formats)
226 QGST_REGISTER_SUBCLASS(Query, Buffering)
227 QGST_REGISTER_SUBCLASS(Query, Uri)
228 
229 #endif
Wrapper class for queries of type QGst::UriQuery.
Definition: query.h:206
Wrapper class for queries of type QGst::SegmentQuery.
Definition: query.h:127
Wrapper class for queries of type QGst::LatencyQuery.
Definition: query.h:94
Wrapper class for queries of type QGst::PositionQuery.
Definition: query.h:66
Wrapper class for GstMiniObject.
Definition: miniobject.h:29
Smart pointer class for working with wrapper classes that support reference counting.
Definition: global.h:56
A datatype to hold a time, measured in nanoseconds.
Definition: clocktime.h:37
Wrapper for GstSegment.
Definition: segment.h:27
Wrapper class for queries of type QGst::BufferingQuery.
Definition: query.h:175
Wrapper class for queries of type QGst::FormatsQuery.
Definition: query.h:162
Wrapper class for queries of type QGst::DurationQuery.
Definition: query.h:80
Wrapper class for queries of type QGst::SeekingQuery.
Definition: query.h:110
Wrapper class for queries of type QGst::ConvertQuery.
Definition: query.h:144
Wrapper class for GstQuery.
Definition: query.h:53