[maemo-commits] [maemo-commits] r17731 - in projects/haf/trunk/hildon-welcome: . debian src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Wed Mar 18 18:12:17 EET 2009
- Previous message: [maemo-commits] r17730 - projects/haf/tags/osso-af-utils
- Next message: [maemo-commits] r17732 - projects/haf/tags/hildon-welcome
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: schulhof Date: 2009-03-18 18:12:11 +0200 (Wed, 18 Mar 2009) New Revision: 17731 Modified: projects/haf/trunk/hildon-welcome/configure.ac projects/haf/trunk/hildon-welcome/debian/changelog projects/haf/trunk/hildon-welcome/src/main.c Log: Fixed segfault Modified: projects/haf/trunk/hildon-welcome/configure.ac =================================================================== --- projects/haf/trunk/hildon-welcome/configure.ac 2009-03-18 15:51:00 UTC (rev 17730) +++ projects/haf/trunk/hildon-welcome/configure.ac 2009-03-18 16:12:11 UTC (rev 17731) @@ -1,5 +1,5 @@ # Mandatory, inits autoconf -AC_INIT(hildon-welcome, 0.14) +AC_INIT(hildon-welcome, 0.15) # Tests that source dir exists AC_CONFIG_SRCDIR([src/main.c]) Modified: projects/haf/trunk/hildon-welcome/debian/changelog =================================================================== --- projects/haf/trunk/hildon-welcome/debian/changelog 2009-03-18 15:51:00 UTC (rev 17730) +++ projects/haf/trunk/hildon-welcome/debian/changelog 2009-03-18 16:12:11 UTC (rev 17731) @@ -1,6 +1,8 @@ -hildon-welcome (0.14-2unreleased) unstable; urgency=low +hildon-welcome (0.15-1) unstable; urgency=low * Removed dependency on libxext-dev, because it is no longer necessary + * Properly init play_to, so disposing of it doesn't kill hildon-welcome + * Add timestamp to log messages the right way - by customizing g_log -- Gabriel Schulhof <gabriel.schulhof at nokia.com> Wed, 18 Mar 2009 13:06:24 +0200 Modified: projects/haf/trunk/hildon-welcome/src/main.c =================================================================== --- projects/haf/trunk/hildon-welcome/src/main.c 2009-03-18 15:51:00 UTC (rev 17730) +++ projects/haf/trunk/hildon-welcome/src/main.c 2009-03-18 16:12:11 UTC (rev 17731) @@ -43,8 +43,14 @@ static char *video_pipeline_str = DEFAULT_VIDEO_PIPELINE_STR; static char *audio_pipeline_str = DEFAULT_AUDIO_PIPELINE_STR; static char *shush_pipeline_str = DEFAULT_SHUSH_PIPELINE_STR; -static GTimer *global_timer = NULL; +#define TIMEOUT_PARAMS_STATIC_INIT { \ + .timer = NULL, \ + .to_ms = 0, \ + .pipeline = NULL, \ + .timeout_id = 0, \ + .error = NULL } + typedef struct { GTimer *timer; @@ -54,19 +60,33 @@ const char *error; } TimeoutParams; +static void +my_log_func(const gchar *log_domain, GLogLevelFlags log_level, const char *message, gpointer null) +{ + char *new_msg = NULL; + static GTimer *timer = NULL; + + if (G_UNLIKELY(!timer)) + timer = g_timer_new(); + + new_msg = g_strdup_printf("[%lf]: %s", timer ? g_timer_elapsed(timer, NULL) : G_MAXDOUBLE, message); + g_log_default_handler (log_domain, log_level, (const char *)new_msg, NULL); + g_free(new_msg); +} + static gboolean post_eos(TimeoutParams *tp) { if (tp->timer) { double diff_ms = ((double)(tp->to_ms)) - (g_timer_elapsed(tp->timer, NULL) * 1000.0); if (diff_ms > 0) { - g_warning("[%lf]: post_eos: False alarm! %lf ms () left\n", g_timer_elapsed(global_timer, NULL), diff_ms); + g_warning("post_eos: False alarm! %lf ms () left\n", diff_ms); tp->timeout_id = g_timeout_add((guint)diff_ms, (GSourceFunc)post_eos, tp); return FALSE; } } if (tp->error) - g_error("[%lf]: post_eos: %s", g_timer_elapsed(global_timer, NULL), tp->error); + g_error("post_eos: %s", tp->error); gst_bus_post(gst_pipeline_get_bus(GST_PIPELINE(tp->pipeline)), gst_message_new_eos(GST_OBJECT(tp->pipeline))); tp->timeout_id = 0; @@ -114,14 +134,14 @@ switch(GST_MESSAGE_TYPE(message)) { case GST_MESSAGE_ASYNC_DONE: - g_debug("[%lf]: wait_for_eos: Ready to play: duration = %d\n", g_timer_elapsed(global_timer, NULL), duration); + g_debug("wait_for_eos: Ready to play: duration = %d\n", duration); if ((duration > 500) && !(play_to->timeout_id)) post_eos_timeout_add(duration, pipeline, NULL, play_to); break; case GST_MESSAGE_ERROR: gst_message_parse_error(message, &err, &debug); - g_warning("[%lf]: wait_for_eos: %s: %s %s\n", g_timer_elapsed(global_timer, NULL), GST_MESSAGE_TYPE_NAME(message), err ? err->message : "", debug ? debug : ""); + g_warning("wait_for_eos: %s: %s %s\n", GST_MESSAGE_TYPE_NAME(message), err ? err->message : "", debug ? debug : ""); if (err) g_error_free(err); g_free(debug); @@ -129,7 +149,7 @@ case GST_MESSAGE_EOS: keep_looping = FALSE; gst_element_set_state(pipeline, GST_STATE_PAUSED); - g_debug("[%lf]: wait_for_eos: Gst message: %s", g_timer_elapsed(global_timer, NULL), GST_MESSAGE_TYPE_NAME(message)); + g_debug("wait_for_eos: Gst message: %s", GST_MESSAGE_TYPE_NAME(message)); break; case GST_MESSAGE_ELEMENT: @@ -168,7 +188,7 @@ GstElement* pipeline = NULL; GString *pipeline_str = g_string_new(""); - g_debug("[%lf]: play_logo: playing (video = '%s', audio = '%s', duration = '%d')", g_timer_elapsed(global_timer, NULL), video, audio, duration); + g_debug("play_logo: playing (video = '%s', audio = '%s', duration = '%d')", video, audio, duration); if (video && video[0]) g_string_append_printf(pipeline_str, video_pipeline_str, video); @@ -184,7 +204,8 @@ g_string_free(pipeline_str, TRUE); if (pipeline) { - TimeoutParams kill_to, play_to; + TimeoutParams kill_to = TIMEOUT_PARAMS_STATIC_INIT, + play_to = TIMEOUT_PARAMS_STATIC_INIT; post_eos_timeout_add(KILL_TO_LENGTH_MS, pipeline, "Absolute timeout reached!\n", &kill_to); @@ -266,6 +287,8 @@ if (!g_thread_supported ()) g_thread_init(NULL); + g_log_set_default_handler(my_log_func, NULL); + ctx = g_option_context_new(NULL); g_option_context_add_main_entries (ctx, options, NULL); g_option_context_add_group (ctx, gst_init_get_option_group()); @@ -275,12 +298,10 @@ gst_init(&argc, &argv); - global_timer = g_timer_new(); - if (!(display = XOpenDisplay(NULL))) - g_error("[%lf]: main: Failed to open display\n", g_timer_elapsed(global_timer, NULL)); + g_error("main: Failed to open display\n"); if ((dst_window = DefaultRootWindow(display)) == 0) - g_error("[%lf]: Failed to obtain root window\n", g_timer_elapsed(global_timer, NULL)); + g_error("main: Failed to obtain root window\n"); if ((xcomposite_window = XCompositeGetOverlayWindow(display, dst_window)) != 0) dst_window = xcomposite_window; @@ -312,7 +333,5 @@ gst_deinit(); - g_timer_destroy(global_timer); - return 0; }
- Previous message: [maemo-commits] r17730 - projects/haf/tags/osso-af-utils
- Next message: [maemo-commits] r17732 - projects/haf/tags/hildon-welcome
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]