105 return dbg <<
"null";
107 dbg <<
QGString{gst_object_get_name(
const_cast<GstObject*>(object))};
110 QDebugStateSaver saver(dbg);
116 GParamSpec **properties = g_object_class_list_properties(G_OBJECT_GET_CLASS(object), &numProperties);
118 for (guint i = 0; i < numProperties; i++) {
119 GParamSpec *param = properties[i];
121 const gchar *name = g_param_spec_get_name(param);
122 constexpr bool trace_blurb =
false;
123 if constexpr (trace_blurb) {
124 const gchar *blurb = g_param_spec_get_blurb(param);
125 dbg << name <<
" (" << blurb <<
"): ";
129 bool readable =
bool(param->flags & G_PARAM_READABLE);
131 dbg <<
"(not readable)";
132 }
else if (QLatin1StringView(name) == QLatin1StringView(
"parent")) {
134 dbg <<
QGString{ gst_object_get_name(object->parent) };
139 g_object_get_property(&
const_cast<GstObject *>(object)->object, param->name,
143 if (i != numProperties - 1)
199 QDebugStateSaver saver(dbg);
202 dbg << GST_MESSAGE_TYPE_NAME(msg) <<
", Source: " << GST_MESSAGE_SRC_NAME(msg);
203 if (GST_MESSAGE_TIMESTAMP(msg) != 0xFFFFFFFFFFFFFFFF)
204 dbg <<
", Timestamp: " << GST_MESSAGE_TIMESTAMP(msg);
207 case GST_MESSAGE_ERROR: {
208 QUniqueGErrorHandle err;
210 gst_message_parse_error(
const_cast<GstMessage *>(msg), &err, &debug);
212 dbg <<
", Error: " << err <<
" (" << debug <<
")";
216 case GST_MESSAGE_WARNING: {
217 QUniqueGErrorHandle err;
219 gst_message_parse_warning(
const_cast<GstMessage *>(msg), &err, &debug);
221 dbg <<
", Warning: " << err <<
" (" << debug <<
")";
225 case GST_MESSAGE_INFO: {
226 QUniqueGErrorHandle err;
228 gst_message_parse_info(
const_cast<GstMessage *>(msg), &err, &debug);
230 dbg <<
", Info: " << err <<
" (" << debug <<
")";
234 case GST_MESSAGE_TAG: {
235 QGstTagListHandle tagList;
236 gst_message_parse_tag(
const_cast<GstMessage *>(msg), &tagList);
238 dbg <<
", Tags: " << tagList;
242 case GST_MESSAGE_QOS: {
244 guint64 running_time;
249 gst_message_parse_qos(
const_cast<GstMessage *>(msg), &live, &running_time, &stream_time,
250 ×tamp, &duration);
252 dbg <<
", Live: " <<
bool(live) <<
", Running time: " << Timepoint{ running_time }
253 <<
", Stream time: " << Timepoint{ stream_time }
254 <<
", Timestamp: " << Timepoint{ timestamp } <<
", Duration: " << Timepoint{ duration };
258 case GST_MESSAGE_STATE_CHANGED: {
263 gst_message_parse_state_changed(
const_cast<GstMessage *>(msg), &oldState, &newState,
266 dbg <<
", Transition: " << oldState <<
"->" << newState;
268 if (pending != GST_STATE_VOID_PENDING)
269 dbg <<
", Pending State: " << pending;
273 case GST_MESSAGE_STREAM_COLLECTION: {
274 QGstStreamCollectionHandle collection;
275 gst_message_parse_stream_collection(
const_cast<GstMessage *>(msg), &collection);
277 dbg <<
", " << collection;
281 case GST_MESSAGE_STREAMS_SELECTED: {
282 QGstStreamCollectionHandle collection;
283 gst_message_parse_streams_selected(
const_cast<GstMessage *>(msg), &collection);
285 dbg <<
", " << collection;
289 case GST_MESSAGE_STREAM_STATUS: {
290 GstStreamStatusType streamStatus;
291 gst_message_parse_stream_status(
const_cast<GstMessage *>(msg), &streamStatus,
nullptr);
293 dbg <<
", Stream Status: " << streamStatus;
297 case GST_MESSAGE_BUFFERING: {
299 gst_message_parse_buffering(
const_cast<GstMessage *>(msg), &progress);
301 dbg <<
", Buffering: " << progress <<
"%";
305 case GST_MESSAGE_SEGMENT_START: {
308 gst_message_parse_segment_start(
const_cast<GstMessage *>(msg), &fmt, &pos);
311 case GST_FORMAT_TIME: {
312 dbg <<
", Position: " <<
std::chrono::nanoseconds{ pos };
315 case GST_FORMAT_BYTES: {
316 dbg <<
", Position: " << pos <<
"Bytes";
320 dbg <<
", Position: " << pos;
441 Q_UNREACHABLE_RETURN(dbg);
457 return dbg <<
"null";
459 switch (G_VALUE_TYPE(value)) {
461 return dbg << g_value_get_string(value);
463 return dbg << g_value_get_boolean(value);
465 return dbg << g_value_get_ulong(value);
467 return dbg << g_value_get_long(value);
469 return dbg << g_value_get_uint(value);
471 return dbg << g_value_get_int(value);
473 return dbg << g_value_get_uint64(value);
475 return dbg << g_value_get_int64(value);
477 return dbg << g_value_get_float(value);
479 return dbg << g_value_get_double(value);
484 if (GST_VALUE_HOLDS_BITMASK(value)) {
485 QDebugStateSaver saver(dbg);
486 return dbg << Qt::hex << gst_value_get_bitmask(value);
489 if (GST_VALUE_HOLDS_FRACTION(value))
490 return dbg << gst_value_get_fraction_numerator(value) <<
"/"
491 << gst_value_get_fraction_denominator(value);
493 if (GST_VALUE_HOLDS_CAPS(value))
494 return dbg << gst_value_get_caps(value);
496 if (GST_VALUE_HOLDS_STRUCTURE(value))
497 return dbg << gst_value_get_structure(value);
499 if (GST_VALUE_HOLDS_ARRAY(value)) {
500 const guint size = gst_value_array_get_size(value);
501 const guint last = size - 1;
503 for (guint index = 0; index != size; ++index) {
504 dbg << gst_value_array_get_value(value, index);
512 if (G_VALUE_TYPE(value) == GST_TYPE_PAD_DIRECTION) {
513 GstPadDirection direction =
static_cast<GstPadDirection>(g_value_get_enum(value));
514 return dbg << direction;
517 if (G_VALUE_TYPE(value) == GST_TYPE_PAD_TEMPLATE) {
518 GstPadTemplate *padTemplate =
static_cast<GstPadTemplate *>(g_value_get_object(value));
519 return dbg << padTemplate;
522 dbg <<
"(not implemented: " << G_VALUE_TYPE_NAME(value) <<
")";
548 std::optional<QDebugStateSaver> saver(dbg);
551 switch (GST_MESSAGE_TYPE(m.msg)) {
552 case GST_MESSAGE_ERROR: {
553 QUniqueGErrorHandle err;
555 gst_message_parse_error(m.msg, &err, &debug);
556 dbg << err <<
" (" << debug <<
")";
560 case GST_MESSAGE_WARNING: {
561 QUniqueGErrorHandle err;
563 gst_message_parse_warning(m.msg, &err, &debug);
564 dbg << err <<
" (" << debug <<
")";
568 case GST_MESSAGE_INFO: {
569 QUniqueGErrorHandle err;
571 gst_message_parse_info(m.msg, &err, &debug);
573 dbg << err <<
" (" << debug <<
")";
577 case GST_MESSAGE_STATE_CHANGED: {
582 gst_message_parse_state_changed(m.msg, &oldState, &newState, &pending);
584 dbg << oldState <<
" -> " << newState;
585 if (pending != GST_STATE_VOID_PENDING)
586 dbg <<
" (pending: " << pending <<
")";
623 using namespace std::chrono;
624 Q_ASSERT(gst_play_is_play_message(m.msg));
626 std::optional<QDebugStateSaver> saver(dbg);
629 gst_play_message_parse_type(m.msg, &type);
632 case GST_PLAY_MESSAGE_URI_LOADED:
633 case GST_PLAY_MESSAGE_END_OF_STREAM:
634 case GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED:
635 case GST_PLAY_MESSAGE_VOLUME_CHANGED:
636 case GST_PLAY_MESSAGE_MUTE_CHANGED:
637 case GST_PLAY_MESSAGE_SEEK_DONE:
640 case GST_PLAY_MESSAGE_POSITION_UPDATED: {
641 GstClockTime position;
642 gst_play_message_parse_position_updated(m.msg, &position);
643 return dbg << type << nanoseconds(position);
645 case GST_PLAY_MESSAGE_DURATION_CHANGED: {
646 GstClockTime duration;
647 gst_play_message_parse_duration_updated(m.msg, &duration);
648 return dbg << type << nanoseconds(duration);
651 case GST_PLAY_MESSAGE_STATE_CHANGED: {
653 gst_play_message_parse_state_changed(m.msg, &state);
654 return dbg << type << state;
656 case GST_PLAY_MESSAGE_BUFFERING: {
658 gst_play_message_parse_buffering_percent(m.msg, &percent);
659 return dbg << type << percent;
661 case GST_PLAY_MESSAGE_ERROR: {
662 QUniqueGErrorHandle err;
663 QUniqueGstStructureHandle details;
664 gst_play_message_parse_error(m.msg, &err, &details);
665 return dbg << type << err << details.get();
667 case GST_PLAY_MESSAGE_WARNING: {
668 QUniqueGErrorHandle err;
669 QUniqueGstStructureHandle details;
670 gst_play_message_parse_warning(m.msg, &err, &details);
671 return dbg << type << err << details.get();
674 case GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED: {
676 gst_play_message_parse_video_dimensions_changed(m.msg, &width, &height);
677 return dbg << type << QSize(width, height);
680 Q_UNREACHABLE_RETURN(dbg);