From fd2482beaaa76d990a6bdf7bfb628f035ebfe697 Mon Sep 17 00:00:00 2001 From: Felix Ruess Date: Wed, 6 Aug 2014 14:34:59 +0200 Subject: [PATCH] [tools] video_synchronizer: added paparazzi icon closes #786 --- sw/ground_segment/tmtc/video_synchronizer.c | 55 +++++++++++---------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/sw/ground_segment/tmtc/video_synchronizer.c b/sw/ground_segment/tmtc/video_synchronizer.c index a4b286eaf1..291a82fa5c 100644 --- a/sw/ground_segment/tmtc/video_synchronizer.c +++ b/sw/ground_segment/tmtc/video_synchronizer.c @@ -61,8 +61,7 @@ uint16_t airframeID; //function taken from the mplayer project -void send_udp(const char *send_to_ip, int port, char *mesg) -{ +void send_udp(const char *send_to_ip, int port, char *mesg) { static int16_t sockfd = -1; static struct sockaddr_in socketinfo; @@ -98,8 +97,7 @@ void send_udp(const char *send_to_ip, int port, char *mesg) } -void sendCurrentPlayingTime(void) -{ +void sendCurrentPlayingTime(void) { if (currentMode == MODE_REPLAY) { char current_time[256]; @@ -114,8 +112,7 @@ void sendCurrentPlayingTime(void) } -void calcCurrentPlayingTime(void) -{ +void calcCurrentPlayingTime(void) { if (replayMode == MANUAL_REPLAY) { float syncTime; @@ -134,8 +131,7 @@ void calcCurrentPlayingTime(void) -static void on_Message(IvyClientPtr app, void *user_data, int argc, char *argv[]) -{ +static void on_Message(IvyClientPtr app, void *user_data, int argc, char *argv[]) { logCurrentTime = atof(argv[1]); if (videoSyncTagFlag) { @@ -147,20 +143,17 @@ static void on_Message(IvyClientPtr app, void *user_data, int argc, char *argv[] sendCurrentPlayingTime(); } -static void on_Message_Video(IvyClientPtr app, void *user_data, int argc, char *argv[]) -{ +static void on_Message_Video(IvyClientPtr app, void *user_data, int argc, char *argv[]) { videoSyncTagFlag = TRUE; } -static void on_Airframe_ID(IvyClientPtr app, void *user_data, int argc, char *argv[]) -{ +static void on_Airframe_ID(IvyClientPtr app, void *user_data, int argc, char *argv[]) { airframeID = atoi(argv[0]); } -static gboolean __timeout_func(gpointer data) -{ +static gboolean __timeout_func(gpointer data) { #if DEBUGMESSAGES g_print("timeout_callback\n"); #endif @@ -170,7 +163,7 @@ static gboolean __timeout_func(gpointer data) } -static gboolean __timeout_flashing_window(gpointer data){ +static gboolean __timeout_flashing_window(gpointer data) { static uint8_t i=0; @@ -185,8 +178,8 @@ static gboolean __timeout_flashing_window(gpointer data){ white.blue = 0xFFFF; if (i<10) { - if (i%2) gtk_widget_modify_bg(flashWindow, GTK_STATE_NORMAL, &black); - else gtk_widget_modify_bg(flashWindow, GTK_STATE_NORMAL, &white); + if (i%2) gtk_widget_modify_bg(flashWindow, GTK_STATE_NORMAL, &black); + else gtk_widget_modify_bg(flashWindow, GTK_STATE_NORMAL, &white); } else { gtk_widget_destroy(flashWindow); @@ -200,13 +193,12 @@ static gboolean __timeout_flashing_window(gpointer data){ } -static void on_quit(GtkWidget *object, gpointer user_data) -{ +static void on_quit(GtkWidget *object, gpointer user_data) { gtk_main_quit(); } -static void on_video_sync_changed(GtkWidget *widget, gpointer data){ +static void on_video_sync_changed(GtkWidget *widget, gpointer data) { startVideoAfter = gtk_spin_button_get_value_as_float((GtkSpinButton *)spinButton); @@ -214,7 +206,7 @@ static void on_video_sync_changed(GtkWidget *widget, gpointer data){ sendCurrentPlayingTime(); } -static void on_video_time_tag_changed(GtkWidget *widget, gpointer data){ +static void on_video_time_tag_changed(GtkWidget *widget, gpointer data) { timeTagInVideo = gtk_spin_button_get_value_as_float((GtkSpinButton *)spinButtonVideo); @@ -225,7 +217,7 @@ static void on_video_time_tag_changed(GtkWidget *widget, gpointer data){ -static void on_sync_clicked(GtkButton *button, gpointer user_data){ +static void on_sync_clicked(GtkButton *button, gpointer user_data) { static uint8_t syncID = 1; @@ -249,20 +241,30 @@ static void on_sync_clicked(GtkButton *button, gpointer user_data){ //TODO : play a sound (the number of the synchronisation). see speech option of the GCS } -static void on_change_mode(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data){ +static void on_change_mode(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data) { currentMode = page_num; } -static void on_change_replay(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data){ +static void on_change_replay(GtkNotebook *notebook, GtkWidget *page, guint page_num, gpointer user_data) { replayMode = page_num; } +GdkPixbuf *create_pixbuf(const gchar * filename) { + GdkPixbuf *pixbuf; + GError *error = NULL; + pixbuf = gdk_pixbuf_new_from_file(filename, &error); + if (!pixbuf) { + fprintf(stderr, "%s\n", error->message); + g_error_free(error); + } -int main(int argc, char** argv) -{ + return pixbuf; +} + +int main(int argc, char** argv) { currentPlayingTime = 0.0; startVideoAfter = 0.0; @@ -370,6 +372,7 @@ int main(int argc, char** argv) gtk_notebook_append_page(tab, (GtkWidget*)captureBox, gtk_label_new("Capture")); gtk_container_add(GTK_CONTAINER(window), (GtkWidget*)tab); + gtk_window_set_icon(GTK_WINDOW(window), create_pixbuf("data/pictures/penguin_icon.png")); gtk_widget_show_all(window); gtk_main();