#include #include #include "config.h" #include "common.h" #include "player.h" #include "rtsp.h" #include "rtp.h" #include "dacp.h" #include "metadata_hub.h" #include "dbus-diagnostics.h" #include "dbus-diagnostics-interface.h" ShairportSyncDiagnostics *shairportSyncDiagnosticsSkeleton; gboolean notify_elapsed_time_callback(ShairportSyncDiagnostics *skeleton, __attribute__((unused)) gpointer user_data) { // debug(1, "\"notify_elapsed_time_callback\" called."); if (shairport_sync_diagnostics_get_elapsed_time(skeleton)) { config.debugger_show_elapsed_time = 1; debug(1, ">> start including elapsed time in logs"); } else { config.debugger_show_elapsed_time = 0; debug(1, ">> stop including elapsed time in logs"); } return TRUE; } gboolean notify_delta_time_callback(ShairportSyncDiagnostics *skeleton, __attribute__((unused)) gpointer user_data) { // debug(1, "\"notify_delta_time_callback\" called."); if (shairport_sync_diagnostics_get_delta_time(skeleton)) { config.debugger_show_relative_time = 1; debug(1, ">> start including delta time in logs"); } else { config.debugger_show_relative_time = 0; debug(1, ">> stop including delta time in logs"); } return TRUE; } gboolean notify_statistics_callback(ShairportSyncDiagnostics *skeleton, __attribute__((unused)) gpointer user_data) { // debug(1, "\"notify_statistics_callback\" called."); if (shairport_sync_diagnostics_get_statistics(skeleton)) { debug(1, ">> start logging statistics"); config.statistics_requested = 1; } else { debug(1, ">> stop logging statistics"); config.statistics_requested = 0; } return TRUE; } gboolean notify_verbosity_callback(ShairportSyncDiagnostics *skeleton, __attribute__((unused)) gpointer user_data) { gint th = shairport_sync_diagnostics_get_verbosity(skeleton); if ((th >= 0) && (th <= 3)) { if (th==0) debug(1, ">> log verbosity set to %d.", th); debuglev = th; debug(1, ">> log verbosity set to %d.", th); } else { debug(1, ">> invalid log verbosity: %d. Ignored.", th); } return TRUE; } void dbus_diagnostics_on_dbus_name_acquired(GDBusConnection *connection, __attribute__((unused)) const gchar *name, __attribute__((unused)) gpointer user_data) { // debug(1,"dbus_diagnostics_on_dbus_name_acquired"); shairportSyncDiagnosticsSkeleton = shairport_sync_diagnostics_skeleton_new(); g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(shairportSyncDiagnosticsSkeleton), connection, "/org/gnome/ShairportSync", NULL); shairport_sync_diagnostics_set_verbosity(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), debuglev); // debug(2,">> log verbosity is %d.",debuglev); if (config.statistics_requested == 0) { shairport_sync_diagnostics_set_statistics(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), FALSE); // debug(1, ">> statistics logging is off"); } else { shairport_sync_diagnostics_set_statistics(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), TRUE); // debug(1, ">> statistics logging is on"); } if (config.debugger_show_elapsed_time == 0) { shairport_sync_diagnostics_set_elapsed_time(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), FALSE); // debug(1, ">> elapsed time is included in log entries"); } else { shairport_sync_diagnostics_set_elapsed_time(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), TRUE); // debug(1, ">> elapsed time is not included in log entries"); } if (config.debugger_show_relative_time == 0) { shairport_sync_diagnostics_set_delta_time(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), FALSE); // debug(1, ">> delta time is included in log entries"); } else { shairport_sync_diagnostics_set_delta_time(SHAIRPORT_SYNC_DIAGNOSTICS(shairportSyncDiagnosticsSkeleton), TRUE); // debug(1, ">> delta time is not included in log entries"); } g_signal_connect(shairportSyncDiagnosticsSkeleton, "notify::verbosity", G_CALLBACK(notify_verbosity_callback), NULL); g_signal_connect(shairportSyncDiagnosticsSkeleton, "notify::statistics", G_CALLBACK(notify_statistics_callback), NULL); g_signal_connect(shairportSyncDiagnosticsSkeleton, "notify::elapsed-time", G_CALLBACK(notify_elapsed_time_callback), NULL); g_signal_connect(shairportSyncDiagnosticsSkeleton, "notify::delta-time", G_CALLBACK(notify_delta_time_callback), NULL); }