19 #include "../QGlib/error.h"
20 #include "../QGlib/string_p.h"
21 #include <QtCore/QDebug>
26 ObjectPtr Message::source()
const
31 quint64 Message::timestamp()
const
33 return object<GstMessage>()->timestamp;
36 QString Message::typeName()
const
38 return QString::fromUtf8(GST_MESSAGE_TYPE_NAME(object<GstMessage>()));
41 MessageType Message::type()
const
43 return static_cast<MessageType
>(GST_MESSAGE_TYPE(object<GstMessage>()));
46 StructureConstPtr Message::internalStructure()
48 const GstStructure *structure = gst_message_get_structure(object<GstMessage>());
49 return SharedStructure::fromMiniObject(
const_cast<GstStructure *
>(structure), MiniObjectPtr(
this));
52 quint32 Message::sequenceNumber()
const
54 return gst_message_get_seqnum(object<GstMessage>());
57 void Message::setSequenceNumber(quint32 num)
59 gst_message_set_seqnum(object<GstMessage>(), num);
64 EosMessagePtr EosMessage::create(
const ObjectPtr & source)
71 ErrorMessagePtr ErrorMessage::create(
const ObjectPtr & source,
75 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
82 gst_message_parse_error(object<GstMessage>(), &e, NULL);
86 QString ErrorMessage::debugMessage()
const
91 gst_message_parse_error(object<GstMessage>(), &e, &debug);
95 return QGlib::Private::stringFromGCharPtr(debug);
100 WarningMessagePtr WarningMessage::create(
const ObjectPtr & source,
104 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
111 gst_message_parse_warning(object<GstMessage>(), &e, NULL);
115 QString WarningMessage::debugMessage()
const
120 gst_message_parse_warning(object<GstMessage>(), &e, &debug);
124 return QGlib::Private::stringFromGCharPtr(debug);
129 InfoMessagePtr InfoMessage::create(
const ObjectPtr & source,
133 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
140 gst_message_parse_info(object<GstMessage>(), &e, NULL);
144 QString InfoMessage::debugMessage()
const
149 gst_message_parse_info(object<GstMessage>(), &e, &debug);
153 return QGlib::Private::stringFromGCharPtr(debug);
158 TagMessagePtr TagMessage::create(
const ObjectPtr & source,
const TagList & taglist)
160 GstMessage *m = gst_message_new_tag(source, gst_tag_list_copy(&taglist));
164 TagList TagMessage::taglist()
const
167 gst_message_parse_tag(object<GstMessage>(), &t);
169 gst_tag_list_free(t);
175 BufferingMessagePtr BufferingMessage::create(
const ObjectPtr & source,
int percent)
177 GstMessage *m = gst_message_new_buffering(source, percent);
181 int BufferingMessage::percent()
const
184 gst_message_parse_buffering(object<GstMessage>(), &p);
188 BufferingMode BufferingMessage::mode()
const
191 gst_message_parse_buffering_stats(object<GstMessage>(), &m, NULL, NULL, NULL);
192 return static_cast<BufferingMode
>(m);
195 int BufferingMessage::averageInputRate()
const
198 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, &a, NULL, NULL);
202 int BufferingMessage::averageOutputRate()
const
205 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, NULL, &a, NULL);
209 qint64 BufferingMessage::bufferingTimeLeft()
const
212 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, NULL, NULL, &a);
216 void BufferingMessage::setStats(BufferingMode mode,
int avgIn,
int avgOut, qint64 bufferingLeft)
218 gst_message_set_buffering_stats(object<GstMessage>(),
static_cast<GstBufferingMode
>(mode),
219 avgIn, avgOut, bufferingLeft);
224 StateChangedMessagePtr StateChangedMessage::create(
const ObjectPtr & source,
225 State oldState, State newState, State pending)
227 GstMessage *m = gst_message_new_state_changed(source,
static_cast<GstState
>(oldState),
228 static_cast<GstState
>(newState),
229 static_cast<GstState
>(pending));
233 State StateChangedMessage::oldState()
const
236 gst_message_parse_state_changed(object<GstMessage>(), &s, NULL, NULL);
237 return static_cast<State
>(s);
240 State StateChangedMessage::newState()
const
243 gst_message_parse_state_changed(object<GstMessage>(), NULL, &s, NULL);
244 return static_cast<State
>(s);
247 State StateChangedMessage::pendingState()
const
250 gst_message_parse_state_changed(object<GstMessage>(), NULL, NULL, &s);
251 return static_cast<State
>(s);
256 StepDoneMessagePtr StepDoneMessage::create(
const ObjectPtr & source, Format format,
257 quint64 amount,
double rate,
bool flush,
258 bool intermediate, quint64 duration,
bool eos)
260 GstMessage *m = gst_message_new_step_done(source,
static_cast<GstFormat
>(format), amount,
261 rate, flush, intermediate, duration, eos);
265 Format StepDoneMessage::format()
const
268 gst_message_parse_step_done(object<GstMessage>(), &f, NULL, NULL, NULL, NULL, NULL, NULL);
269 return static_cast<Format
>(f);
272 quint64 StepDoneMessage::amount()
const
275 gst_message_parse_step_done(object<GstMessage>(), NULL, &a, NULL, NULL, NULL, NULL, NULL);
279 double StepDoneMessage::rate()
const
282 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, &d, NULL, NULL, NULL, NULL);
286 bool StepDoneMessage::isFlushingStep()
const
289 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, &b, NULL, NULL, NULL);
293 bool StepDoneMessage::isIntermediateStep()
const
296 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, &b, NULL, NULL);
300 quint64 StepDoneMessage::duration()
const
303 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, &d, NULL);
307 bool StepDoneMessage::causedEos()
const
310 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, NULL, &e);
316 StreamStatusMessagePtr StreamStatusMessage::create(
const ObjectPtr & source,
317 StreamStatusType type,
const ElementPtr & owner)
319 GstMessage *m = gst_message_new_stream_status(source,
static_cast<GstStreamStatusType
>(type), owner);
323 StreamStatusType StreamStatusMessage::statusType()
const
325 GstStreamStatusType t;
326 gst_message_parse_stream_status(object<GstMessage>(), &t, NULL);
327 return static_cast<StreamStatusType
>(t);
330 ElementPtr StreamStatusMessage::owner()
const
333 gst_message_parse_stream_status(object<GstMessage>(), NULL, &e);
337 QGlib::Value StreamStatusMessage::streamStatusObject()
const
339 return QGlib::Value(gst_message_get_stream_status_object(object<GstMessage>()));
342 void StreamStatusMessage::setStreamStatusObject(
const QGlib::Value & obj)
344 gst_message_set_stream_status_object(object<GstMessage>(), obj);
349 ApplicationMessagePtr ApplicationMessage::create(
const ObjectPtr & source,
const Structure & structure)
351 GstStructure *s = structure.isValid() ? gst_structure_copy(structure) : NULL;
357 ElementMessagePtr ElementMessage::create(
const ObjectPtr & source,
const Structure & structure)
359 GstStructure *s = structure.isValid() ? gst_structure_copy(structure) : NULL;
365 SegmentDoneMessagePtr SegmentDoneMessage::create(
const ObjectPtr & source, Format format, qint64 position)
367 GstMessage *m = gst_message_new_segment_done(source,
static_cast<GstFormat
>(format), position);
371 Format SegmentDoneMessage::format()
const
374 gst_message_parse_segment_done(object<GstMessage>(), &f, NULL);
375 return static_cast<Format
>(f);
378 qint64 SegmentDoneMessage::position()
const
381 gst_message_parse_segment_done(object<GstMessage>(), NULL, &p);
387 DurationChangedMessagePtr DurationChangedMessage::create(
const ObjectPtr & source)
389 GstMessage *m = gst_message_new_duration_changed(source);
395 LatencyMessagePtr LatencyMessage::create(
const ObjectPtr & source)
402 AsyncDoneMessagePtr AsyncDoneMessage::create(
const ObjectPtr & source, ClockTime running_time)
407 ClockTime AsyncDoneMessage::runningTime()
const
410 gst_message_parse_async_done(object<GstMessage>(), &c);
411 return static_cast<ClockTime
>(c);
416 RequestStateMessagePtr RequestStateMessage::create(
const ObjectPtr & source, State state)
418 GstMessage *m = gst_message_new_request_state(source,
static_cast<GstState
>(state));
422 State RequestStateMessage::state()
const
425 gst_message_parse_request_state(object<GstMessage>(), &s);
426 return static_cast<State
>(s);
431 StepStartMessagePtr StepStartMessage::create(
const ObjectPtr & source,
bool active, Format format,
432 quint64 amount,
double rate,
bool flush,
bool intermediate)
434 GstMessage *m = gst_message_new_step_start(source, active,
static_cast<GstFormat
>(format),
435 amount, rate, flush, intermediate);
439 bool StepStartMessage::isActive()
const
442 gst_message_parse_step_start(object<GstMessage>(), &a, NULL, NULL, NULL, NULL, NULL);
446 Format StepStartMessage::format()
const
449 gst_message_parse_step_start(object<GstMessage>(), NULL, &f, NULL, NULL, NULL, NULL);
450 return static_cast<Format
>(f);
453 quint64 StepStartMessage::amount()
const
456 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, &a, NULL, NULL, NULL);
460 double StepStartMessage::rate()
const
463 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, &d, NULL, NULL);
467 bool StepStartMessage::isFlushingStep()
const
470 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, NULL, &b, NULL);
474 bool StepStartMessage::isIntermediateStep()
const
477 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, &b);
483 QosMessagePtr QosMessage::create(
const ObjectPtr & source,
bool live, quint64 runningTime,
484 quint64 streamTime, quint64 timestamp, quint64 duration)
486 GstMessage *m = gst_message_new_qos(source, live, runningTime, streamTime, timestamp, duration);
490 bool QosMessage::live()
const
493 gst_message_parse_qos(object<GstMessage>(), &l, NULL, NULL, NULL, NULL);
497 quint64 QosMessage::runningTime()
const
500 gst_message_parse_qos(object<GstMessage>(), NULL, &t, NULL, NULL, NULL);
504 quint64 QosMessage::streamTime()
const
507 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, &t, NULL, NULL);
511 quint64 QosMessage::timestamp()
const
514 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, NULL, &t, NULL);
518 quint64 QosMessage::duration()
const
521 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, NULL, NULL, &t);
525 qint64 QosMessage::jitter()
const
528 gst_message_parse_qos_values(object<GstMessage>(), &j, NULL, NULL);
532 double QosMessage::proportion()
const
535 gst_message_parse_qos_values(object<GstMessage>(), NULL, &d, NULL);
539 int QosMessage::quality()
const
542 gst_message_parse_qos_values(object<GstMessage>(), NULL, NULL, &q);
546 void QosMessage::setValues(qint64 jitter,
double proportion,
int quality)
548 gst_message_set_qos_values(object<GstMessage>(), jitter, proportion, quality);
551 Format QosMessage::format()
const
554 gst_message_parse_qos_stats(object<GstMessage>(), &f, NULL, NULL);
555 return static_cast<Format
>(f);
558 quint64 QosMessage::processed()
const
561 gst_message_parse_qos_stats(object<GstMessage>(), NULL, &p, NULL);
565 quint64 QosMessage::dropped()
const
568 gst_message_parse_qos_stats(object<GstMessage>(), NULL, NULL, &p);
572 void QosMessage::setStats(Format format, quint64 processed, quint64 dropped)
574 gst_message_set_qos_stats(object<GstMessage>(),
static_cast<GstFormat
>(format), processed,
Wrapper class for GError.
static RefPointer< T > wrap(typename T::CType *nativePtr, bool increaseRef=true)
Wrapper class for GValue.
Wrappers for GStreamer classes.