20 #include "../QGlib/error.h"
21 #include "../QGlib/string_p.h"
22 #include <QtCore/QUrl>
23 #include <QtCore/QDebug>
28 QString Query::typeName()
const
30 return QString::fromUtf8(GST_QUERY_TYPE_NAME(object<GstQuery>()));
33 QueryType Query::type()
const
35 return static_cast<QueryType
>(GST_QUERY_TYPE(object<GstQuery>()));
38 StructureConstPtr Query::internalStructure()
40 const GstStructure *structure = gst_query_get_structure(object<GstQuery>());
41 return SharedStructure::fromMiniObject(
const_cast<GstStructure *
>(structure), MiniObjectPtr(
this));
46 PositionQueryPtr PositionQuery::create(Format format)
51 Format PositionQuery::format()
const
54 gst_query_parse_position(object<GstQuery>(), &f, NULL);
55 return static_cast<Format
>(f);
58 qint64 PositionQuery::position()
const
61 gst_query_parse_position(object<GstQuery>(), NULL, &p);
65 void PositionQuery::setValues(Format format, qint64 position)
67 gst_query_set_position(object<GstQuery>(),
static_cast<GstFormat
>(format), position);
72 DurationQueryPtr DurationQuery::create(Format format)
77 Format DurationQuery::format()
const
80 gst_query_parse_duration(object<GstQuery>(), &f, NULL);
81 return static_cast<Format
>(f);
84 qint64 DurationQuery::duration()
const
87 gst_query_parse_duration(object<GstQuery>(), NULL, &d);
91 void DurationQuery::setValues(Format format, qint64 duration)
93 gst_query_set_duration(object<GstQuery>(),
static_cast<GstFormat
>(format), duration);
98 LatencyQueryPtr LatencyQuery::create()
103 bool LatencyQuery::hasLive()
const
106 gst_query_parse_latency(object<GstQuery>(), &l, NULL, NULL);
110 ClockTime LatencyQuery::minimumLatency()
const
113 gst_query_parse_latency(object<GstQuery>(), NULL, &c, NULL);
117 ClockTime LatencyQuery::maximumLatency()
const
120 gst_query_parse_latency(object<GstQuery>(), NULL, NULL, &c);
124 void LatencyQuery::setValues(
bool live, ClockTime minimumLatency, ClockTime maximumLatency)
126 gst_query_set_latency(object<GstQuery>(), live, minimumLatency, maximumLatency);
131 SeekingQueryPtr SeekingQuery::create(Format format)
136 Format SeekingQuery::format()
const
139 gst_query_parse_seeking(object<GstQuery>(), &f, NULL, NULL, NULL);
140 return static_cast<Format
>(f);
143 bool SeekingQuery::seekable()
const
146 gst_query_parse_seeking(object<GstQuery>(), NULL, &s, NULL, NULL);
150 qint64 SeekingQuery::segmentStart()
const
153 gst_query_parse_seeking(object<GstQuery>(), NULL, NULL, &s, NULL);
157 qint64 SeekingQuery::segmentEnd()
const
160 gst_query_parse_seeking(object<GstQuery>(), NULL, NULL, NULL, &s);
164 void SeekingQuery::setValues(Format format,
bool seekable, qint64 segmentStart, qint64 segmentEnd)
166 gst_query_set_seeking(object<GstQuery>(),
static_cast<GstFormat
>(format), seekable,
167 segmentStart, segmentEnd);
172 SegmentQueryPtr SegmentQuery::create(Format format)
177 double SegmentQuery::rate()
const
180 gst_query_parse_segment(object<GstQuery>(), &r, NULL, NULL, NULL);
184 Format SegmentQuery::format()
const
187 gst_query_parse_segment(object<GstQuery>(), NULL, &f, NULL, NULL);
188 return static_cast<Format
>(f);
191 qint64 SegmentQuery::startValue()
const
194 gst_query_parse_segment(object<GstQuery>(), NULL, NULL, &s, NULL);
198 qint64 SegmentQuery::stopValue()
const
201 gst_query_parse_segment(object<GstQuery>(), NULL, NULL, NULL, &s);
205 void SegmentQuery::setValues(Format format,
double rate, qint64 startValue, qint64 stopValue)
207 gst_query_set_segment(object<GstQuery>(), rate,
static_cast<GstFormat
>(format), startValue,
213 ConvertQueryPtr ConvertQuery::create(Format sourceFormat, qint64 value, Format destinationFormat)
216 static_cast<GstFormat
>(destinationFormat)),
false);
219 Format ConvertQuery::sourceFormat()
const
222 gst_query_parse_convert(object<GstQuery>(), &f, NULL, NULL, NULL);
223 return static_cast<Format
>(f);
226 qint64 ConvertQuery::sourceValue()
const
229 gst_query_parse_convert(object<GstQuery>(), NULL, &v, NULL, NULL);
233 Format ConvertQuery::destinationFormat()
const
236 gst_query_parse_convert(object<GstQuery>(), NULL, NULL, &f, NULL);
237 return static_cast<Format
>(f);
240 qint64 ConvertQuery::destinationValue()
const
243 gst_query_parse_convert(object<GstQuery>(), NULL, NULL, NULL, &v);
247 void ConvertQuery::setValues(Format sourceFormat, qint64 sourceValue, Format destinationFormat,
248 qint64 destinationValue)
250 gst_query_set_convert(object<GstQuery>(),
static_cast<GstFormat
>(sourceFormat), sourceValue,
251 static_cast<GstFormat
>(destinationFormat), destinationValue);
256 FormatsQueryPtr FormatsQuery::create()
261 QList<Format> FormatsQuery::formats()
const
264 QList<Format> formats;
265 gst_query_parse_n_formats(object<GstQuery>(), &cnt);
267 for (uint i=0; i<cnt; i++) {
268 gst_query_parse_nth_format(object<GstQuery>(), i, &f);
269 formats << static_cast<Format>(f);
274 void FormatsQuery::setFormats(
const QList<Format> & formats)
276 int cnt = formats.count();
278 GstFormat *f =
new GstFormat[cnt];
279 for (
int i=0; i<cnt; i++) {
280 f[i] =
static_cast<GstFormat
>(formats.at(i));
282 gst_query_set_formatsv(object<GstQuery>(), cnt, f);
288 BufferingQueryPtr BufferingQuery::create(Format format)
293 bool BufferingQuery::isBusy()
const
296 gst_query_parse_buffering_percent(object<GstQuery>(), &b, NULL);
300 int BufferingQuery::percent()
const
303 gst_query_parse_buffering_percent(object<GstQuery>(), NULL, &p);
307 void BufferingQuery::setBufferingPercent(
bool busy,
int percent)
309 gst_query_set_buffering_percent(object<GstQuery>(), busy, percent);
312 BufferingMode BufferingQuery::mode()
const
315 gst_query_parse_buffering_stats(object<GstQuery>(), &m, NULL, NULL, NULL);
316 return static_cast<BufferingMode
>(m);
319 int BufferingQuery::averageIn()
const
322 gst_query_parse_buffering_stats(object<GstQuery>(), NULL, &a, NULL, NULL);
326 int BufferingQuery::averageOut()
const
329 gst_query_parse_buffering_stats(object<GstQuery>(), NULL, NULL, &a, NULL);
334 qint64 BufferingQuery::bufferingLeft()
const
337 gst_query_parse_buffering_stats(object<GstQuery>(), NULL, NULL, NULL, &l);
341 void BufferingQuery::setBufferingStats(BufferingMode mode,
int averageIn,
342 int averageOut, qint64 bufferingLeft)
344 gst_query_set_buffering_stats(object<GstQuery>(),
static_cast<GstBufferingMode
>(mode),
345 averageIn, averageOut, bufferingLeft);
348 Format BufferingQuery::rangeFormat()
const
351 gst_query_parse_buffering_range(object<GstQuery>(), &f, NULL, NULL, NULL);
352 return static_cast<Format
>(f);
355 qint64 BufferingQuery::rangeStart()
const
358 gst_query_parse_buffering_range(object<GstQuery>(), NULL, &r, NULL, NULL);
362 qint64 BufferingQuery::rangeStop()
const
365 gst_query_parse_buffering_range(object<GstQuery>(), NULL, NULL, &r, NULL);
369 qint64 BufferingQuery::estimatedTotal()
const
372 gst_query_parse_buffering_range(object<GstQuery>(), NULL, NULL, NULL, &r);
376 void BufferingQuery::setBufferingRange(Format rangeFormat, qint64 rangeStart,
377 qint64 rangeStop, qint64 estimatedTotal)
379 gst_query_set_buffering_range(object<GstQuery>(),
static_cast<GstFormat
>(rangeFormat),
380 rangeStart, rangeStop, estimatedTotal);
385 UriQueryPtr UriQuery::create()
390 QUrl UriQuery::uri()
const
393 gst_query_parse_uri(object<GstQuery>(), &uri);
394 return QUrl::fromPercentEncoding(uri);
397 void UriQuery::setUri(
const QUrl & uri)
399 gst_query_set_uri(object<GstQuery>(), uri.toEncoded());
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Wrappers for GStreamer classes.