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