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 StructurePtr Message::internalStructure()
48 return SharedStructure::fromMiniObject(object<GstMessage>()->structure, MiniObjectPtr(
this));
51 quint32 Message::sequenceNumber()
const
53 return gst_message_get_seqnum(object<GstMessage>());
56 void Message::setSequenceNumber(quint32 num)
58 gst_message_set_seqnum(object<GstMessage>(), num);
63 EosMessagePtr EosMessage::create(
const ObjectPtr & source)
70 ErrorMessagePtr ErrorMessage::create(
const ObjectPtr & source,
74 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
81 gst_message_parse_error(object<GstMessage>(), &e, NULL);
85 QString ErrorMessage::debugMessage()
const
90 gst_message_parse_error(object<GstMessage>(), &e, &debug);
94 return QGlib::Private::stringFromGCharPtr(debug);
99 WarningMessagePtr WarningMessage::create(
const ObjectPtr & source,
103 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
110 gst_message_parse_warning(object<GstMessage>(), &e, NULL);
114 QString WarningMessage::debugMessage()
const
119 gst_message_parse_warning(object<GstMessage>(), &e, &debug);
123 return QGlib::Private::stringFromGCharPtr(debug);
128 InfoMessagePtr InfoMessage::create(
const ObjectPtr & source,
132 GError *e =
const_cast<GError*
>(
static_cast<const GError*
>(error));
139 gst_message_parse_info(object<GstMessage>(), &e, NULL);
143 QString InfoMessage::debugMessage()
const
148 gst_message_parse_info(object<GstMessage>(), &e, &debug);
152 return QGlib::Private::stringFromGCharPtr(debug);
157 TagMessagePtr TagMessage::create(
const ObjectPtr & source,
const TagList & taglist)
159 GstMessage *m = gst_message_new_tag(source, gst_tag_list_copy(taglist));
163 TagList TagMessage::taglist()
const
166 gst_message_parse_tag(object<GstMessage>(), &t);
168 gst_tag_list_free(t);
174 BufferingMessagePtr BufferingMessage::create(
const ObjectPtr & source,
int percent)
176 GstMessage *m = gst_message_new_buffering(source, percent);
180 int BufferingMessage::percent()
const
183 gst_message_parse_buffering(object<GstMessage>(), &p);
187 BufferingMode BufferingMessage::mode()
const
190 gst_message_parse_buffering_stats(object<GstMessage>(), &m, NULL, NULL, NULL);
191 return static_cast<BufferingMode
>(m);
194 int BufferingMessage::averageInputRate()
const
197 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, &a, NULL, NULL);
201 int BufferingMessage::averageOutputRate()
const
204 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, NULL, &a, NULL);
208 qint64 BufferingMessage::bufferingTimeLeft()
const
211 gst_message_parse_buffering_stats(object<GstMessage>(), NULL, NULL, NULL, &a);
215 void BufferingMessage::setStats(BufferingMode mode,
int avgIn,
int avgOut, qint64 bufferingLeft)
217 gst_message_set_buffering_stats(object<GstMessage>(), static_cast<GstBufferingMode>(mode),
218 avgIn, avgOut, bufferingLeft);
223 StateChangedMessagePtr StateChangedMessage::create(
const ObjectPtr & source,
224 State oldState, State newState, State pending)
226 GstMessage *m = gst_message_new_state_changed(source, static_cast<GstState>(oldState),
227 static_cast<GstState>(newState),
228 static_cast<GstState>(pending));
232 State StateChangedMessage::oldState()
const
235 gst_message_parse_state_changed(object<GstMessage>(), &s, NULL, NULL);
236 return static_cast<State
>(s);
239 State StateChangedMessage::newState()
const
242 gst_message_parse_state_changed(object<GstMessage>(), NULL, &s, NULL);
243 return static_cast<State
>(s);
246 State StateChangedMessage::pendingState()
const
249 gst_message_parse_state_changed(object<GstMessage>(), NULL, NULL, &s);
250 return static_cast<State
>(s);
255 StepDoneMessagePtr StepDoneMessage::create(
const ObjectPtr & source, Format format,
256 quint64 amount,
double rate,
bool flush,
257 bool intermediate, quint64 duration,
bool eos)
259 GstMessage *m = gst_message_new_step_done(source, static_cast<GstFormat>(format), amount,
260 rate, flush, intermediate, duration, eos);
264 Format StepDoneMessage::format()
const
267 gst_message_parse_step_done(object<GstMessage>(), &f, NULL, NULL, NULL, NULL, NULL, NULL);
268 return static_cast<Format
>(f);
271 quint64 StepDoneMessage::amount()
const
274 gst_message_parse_step_done(object<GstMessage>(), NULL, &a, NULL, NULL, NULL, NULL, NULL);
278 double StepDoneMessage::rate()
const
281 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, &d, NULL, NULL, NULL, NULL);
285 bool StepDoneMessage::isFlushingStep()
const
288 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, &b, NULL, NULL, NULL);
292 bool StepDoneMessage::isIntermediateStep()
const
295 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, &b, NULL, NULL);
299 quint64 StepDoneMessage::duration()
const
302 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, &d, NULL);
306 bool StepDoneMessage::causedEos()
const
309 gst_message_parse_step_done(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, NULL, &e);
315 StreamStatusMessagePtr StreamStatusMessage::create(
const ObjectPtr & source,
316 StreamStatusType type,
const ElementPtr & owner)
318 GstMessage *m = gst_message_new_stream_status(source, static_cast<GstStreamStatusType>(type), owner);
322 StreamStatusType StreamStatusMessage::statusType()
const
324 GstStreamStatusType t;
325 gst_message_parse_stream_status(object<GstMessage>(), &t, NULL);
326 return static_cast<StreamStatusType
>(t);
329 ElementPtr StreamStatusMessage::owner()
const
332 gst_message_parse_stream_status(object<GstMessage>(), NULL, &e);
336 QGlib::Value StreamStatusMessage::streamStatusObject()
const
338 return QGlib::Value(gst_message_get_stream_status_object(object<GstMessage>()));
341 void StreamStatusMessage::setStreamStatusObject(
const QGlib::Value & obj)
343 gst_message_set_stream_status_object(object<GstMessage>(), obj);
348 ApplicationMessagePtr ApplicationMessage::create(
const ObjectPtr & source,
const Structure & structure)
350 GstStructure *s = structure.isValid() ? gst_structure_copy(structure) : NULL;
356 ElementMessagePtr ElementMessage::create(
const ObjectPtr & source,
const Structure & structure)
358 GstStructure *s = structure.isValid() ? gst_structure_copy(structure) : NULL;
364 SegmentDoneMessagePtr SegmentDoneMessage::create(
const ObjectPtr & source, Format format, qint64 position)
366 GstMessage *m = gst_message_new_segment_done(source, static_cast<GstFormat>(format), position);
370 Format SegmentDoneMessage::format()
const
373 gst_message_parse_segment_done(object<GstMessage>(), &f, NULL);
374 return static_cast<Format
>(f);
377 qint64 SegmentDoneMessage::position()
const
380 gst_message_parse_segment_done(object<GstMessage>(), NULL, &p);
386 DurationMessagePtr DurationMessage::create(
const ObjectPtr & source, Format format, qint64 duration)
388 GstMessage *m = gst_message_new_duration(source, static_cast<GstFormat>(format), duration);
392 Format DurationMessage::format()
const
395 gst_message_parse_duration(object<GstMessage>(), &f, NULL);
396 return static_cast<Format
>(f);
399 qint64 DurationMessage::duration()
const
402 gst_message_parse_duration(object<GstMessage>(), NULL, &d);
408 LatencyMessagePtr LatencyMessage::create(
const ObjectPtr & source)
415 AsyncDoneMessagePtr AsyncDoneMessage::create(
const ObjectPtr & source)
422 RequestStateMessagePtr RequestStateMessage::create(
const ObjectPtr & source, State state)
424 GstMessage *m = gst_message_new_request_state(source, static_cast<GstState>(state));
428 State RequestStateMessage::state()
const
431 gst_message_parse_request_state(object<GstMessage>(), &s);
432 return static_cast<State
>(s);
437 StepStartMessagePtr StepStartMessage::create(
const ObjectPtr & source,
bool active, Format format,
438 quint64 amount,
double rate,
bool flush,
bool intermediate)
440 GstMessage *m = gst_message_new_step_start(source, active, static_cast<GstFormat>(format),
441 amount, rate, flush, intermediate);
445 bool StepStartMessage::isActive()
const
448 gst_message_parse_step_start(object<GstMessage>(), &a, NULL, NULL, NULL, NULL, NULL);
452 Format StepStartMessage::format()
const
455 gst_message_parse_step_start(object<GstMessage>(), NULL, &f, NULL, NULL, NULL, NULL);
456 return static_cast<Format
>(f);
459 quint64 StepStartMessage::amount()
const
462 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, &a, NULL, NULL, NULL);
466 double StepStartMessage::rate()
const
469 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, &d, NULL, NULL);
473 bool StepStartMessage::isFlushingStep()
const
476 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, NULL, &b, NULL);
480 bool StepStartMessage::isIntermediateStep()
const
483 gst_message_parse_step_start(object<GstMessage>(), NULL, NULL, NULL, NULL, NULL, &b);
489 QosMessagePtr QosMessage::create(
const ObjectPtr & source,
bool live, quint64 runningTime,
490 quint64 streamTime, quint64 timestamp, quint64 duration)
492 GstMessage *m = gst_message_new_qos(source, live, runningTime, streamTime, timestamp, duration);
496 bool QosMessage::live()
const
499 gst_message_parse_qos(object<GstMessage>(), &l, NULL, NULL, NULL, NULL);
503 quint64 QosMessage::runningTime()
const
506 gst_message_parse_qos(object<GstMessage>(), NULL, &t, NULL, NULL, NULL);
510 quint64 QosMessage::streamTime()
const
513 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, &t, NULL, NULL);
517 quint64 QosMessage::timestamp()
const
520 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, NULL, &t, NULL);
524 quint64 QosMessage::duration()
const
527 gst_message_parse_qos(object<GstMessage>(), NULL, NULL, NULL, NULL, &t);
531 qint64 QosMessage::jitter()
const
534 gst_message_parse_qos_values(object<GstMessage>(), &j, NULL, NULL);
538 double QosMessage::proportion()
const
541 gst_message_parse_qos_values(object<GstMessage>(), NULL, &d, NULL);
545 int QosMessage::quality()
const
548 gst_message_parse_qos_values(object<GstMessage>(), NULL, NULL, &q);
552 void QosMessage::setValues(qint64 jitter,
double proportion,
int quality)
554 gst_message_set_qos_values(object<GstMessage>(), jitter, proportion, quality);
557 Format QosMessage::format()
const
560 gst_message_parse_qos_stats(object<GstMessage>(), &f, NULL, NULL);
561 return static_cast<Format
>(f);
564 quint64 QosMessage::processed()
const
567 gst_message_parse_qos_stats(object<GstMessage>(), NULL, &p, NULL);
571 quint64 QosMessage::dropped()
const
574 gst_message_parse_qos_stats(object<GstMessage>(), NULL, NULL, &p);
578 void QosMessage::setStats(Format format, quint64 processed, quint64 dropped)
580 gst_message_set_qos_stats(object<GstMessage>(), static_cast<GstFormat>(format), processed,