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);
456 switch (G_VALUE_TYPE(value)) {
458 return dbg << g_value_get_string(value);
460 return dbg << g_value_get_boolean(value);
462 return dbg << g_value_get_ulong(value);
464 return dbg << g_value_get_long(value);
466 return dbg << g_value_get_uint(value);
468 return dbg << g_value_get_int(value);
470 return dbg << g_value_get_uint64(value);
472 return dbg << g_value_get_int64(value);
474 return dbg << g_value_get_float(value);
476 return dbg << g_value_get_double(value);
481 if (GST_VALUE_HOLDS_BITMASK(value)) {
482 QDebugStateSaver saver(dbg);
483 return dbg << Qt::hex << gst_value_get_bitmask(value);
486 if (GST_VALUE_HOLDS_FRACTION(value))
487 return dbg << gst_value_get_fraction_numerator(value) <<
"/"
488 << gst_value_get_fraction_denominator(value);
490 if (GST_VALUE_HOLDS_CAPS(value))
491 return dbg << gst_value_get_caps(value);
493 if (GST_VALUE_HOLDS_STRUCTURE(value))
494 return dbg << gst_value_get_structure(value);
496 if (GST_VALUE_HOLDS_ARRAY(value)) {
497 const guint size = gst_value_array_get_size(value);
498 const guint last = size - 1;
500 for (guint index = 0; index != size; ++index) {
501 dbg << gst_value_array_get_value(value, index);
509 if (G_VALUE_TYPE(value) == GST_TYPE_PAD_DIRECTION) {
510 GstPadDirection direction =
static_cast<GstPadDirection>(g_value_get_enum(value));
511 return dbg << direction;
514 if (G_VALUE_TYPE(value) == GST_TYPE_PAD_TEMPLATE) {
515 GstPadTemplate *padTemplate =
static_cast<GstPadTemplate *>(g_value_get_object(value));
516 return dbg << padTemplate;
519 dbg <<
"(not implemented: " << G_VALUE_TYPE_NAME(value) <<
")";
545 std::optional<QDebugStateSaver> saver(dbg);
548 switch (GST_MESSAGE_TYPE(m.msg)) {
549 case GST_MESSAGE_ERROR: {
550 QUniqueGErrorHandle err;
552 gst_message_parse_error(m.msg, &err, &debug);
553 dbg << err <<
" (" << debug <<
")";
557 case GST_MESSAGE_WARNING: {
558 QUniqueGErrorHandle err;
560 gst_message_parse_warning(m.msg, &err, &debug);
561 dbg << err <<
" (" << debug <<
")";
565 case GST_MESSAGE_INFO: {
566 QUniqueGErrorHandle err;
568 gst_message_parse_info(m.msg, &err, &debug);
570 dbg << err <<
" (" << debug <<
")";
574 case GST_MESSAGE_STATE_CHANGED: {
579 gst_message_parse_state_changed(m.msg, &oldState, &newState, &pending);
581 dbg << oldState <<
" -> " << newState;
582 if (pending != GST_STATE_VOID_PENDING)
583 dbg <<
" (pending: " << pending <<
")";
620 using namespace std::chrono;
621 Q_ASSERT(gst_play_is_play_message(m.msg));
623 std::optional<QDebugStateSaver> saver(dbg);
626 gst_play_message_parse_type(m.msg, &type);
629 case GST_PLAY_MESSAGE_URI_LOADED:
630 case GST_PLAY_MESSAGE_END_OF_STREAM:
631 case GST_PLAY_MESSAGE_MEDIA_INFO_UPDATED:
632 case GST_PLAY_MESSAGE_VOLUME_CHANGED:
633 case GST_PLAY_MESSAGE_MUTE_CHANGED:
634 case GST_PLAY_MESSAGE_SEEK_DONE:
637 case GST_PLAY_MESSAGE_POSITION_UPDATED: {
638 GstClockTime position;
639 gst_play_message_parse_position_updated(m.msg, &position);
640 return dbg << type << nanoseconds(position);
642 case GST_PLAY_MESSAGE_DURATION_CHANGED: {
643 GstClockTime duration;
644 gst_play_message_parse_duration_updated(m.msg, &duration);
645 return dbg << type << nanoseconds(duration);
648 case GST_PLAY_MESSAGE_STATE_CHANGED: {
650 gst_play_message_parse_state_changed(m.msg, &state);
651 return dbg << type << state;
653 case GST_PLAY_MESSAGE_BUFFERING: {
655 gst_play_message_parse_buffering_percent(m.msg, &percent);
656 return dbg << type << percent;
658 case GST_PLAY_MESSAGE_ERROR: {
659 QUniqueGErrorHandle err;
660 QUniqueGstStructureHandle details;
661 gst_play_message_parse_error(m.msg, &err, &details);
662 return dbg << type << err << details.get();
664 case GST_PLAY_MESSAGE_WARNING: {
665 QUniqueGErrorHandle err;
666 QUniqueGstStructureHandle details;
667 gst_play_message_parse_warning(m.msg, &err, &details);
668 return dbg << type << err << details.get();
671 case GST_PLAY_MESSAGE_VIDEO_DIMENSIONS_CHANGED: {
673 gst_play_message_parse_video_dimensions_changed(m.msg, &width, &height);
674 return dbg << type << QSize(width, height);
677 Q_UNREACHABLE_RETURN(dbg);