Skip to content

Commit

Permalink
[tools] video_synchronizer: added paparazzi icon
Browse files Browse the repository at this point in the history
closes #786
  • Loading branch information
flixr committed Aug 6, 2014
1 parent 4dea505 commit fd2482b
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions sw/ground_segment/tmtc/video_synchronizer.c
Expand Up @@ -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;

Expand Down Expand Up @@ -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];

Expand All @@ -114,8 +112,7 @@ void sendCurrentPlayingTime(void)
}


void calcCurrentPlayingTime(void)
{
void calcCurrentPlayingTime(void) {
if (replayMode == MANUAL_REPLAY) {
float syncTime;

Expand All @@ -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) {
Expand All @@ -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
Expand All @@ -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;

Expand All @@ -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);
Expand All @@ -200,21 +193,20 @@ 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);

calcCurrentPlayingTime();
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);

Expand All @@ -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;

Expand All @@ -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);
}

return pixbuf;
}

int main(int argc, char** argv)
{
int main(int argc, char** argv) {
currentPlayingTime = 0.0;
startVideoAfter = 0.0;

Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit fd2482b

Please sign in to comment.