X-Git-Url: http://research.m1stereo.tv/gitweb?a=blobdiff_plain;f=src%2Fpage_status.c;h=1ca948788910c6cdbeb917c0a7f21ffb734d176f;hb=a3add8d78fbe7c397316520f7e5edf84a8a516ca;hp=6ea56613ca811c41b82e0f22037e974c989e6750;hpb=1862bc53805aba6e7079ab48a3cb6d89332a0cb1;p=rugen diff --git a/src/page_status.c b/src/page_status.c index 6ea5661..1ca9487 100644 --- a/src/page_status.c +++ b/src/page_status.c @@ -51,45 +51,38 @@ static GtkWidget *this_page_get_widget( page ); /** Show the status associated to a unit. */ +static char* status_to_text( mvcp_status status ) +{ + switch( status->status ) + { + case unit_offline: return "offline"; break; + case unit_undefined: return "undefined"; break; + case unit_not_loaded: return "unloaded"; break; + case unit_stopped: return "stopped"; break; + case unit_playing: return "playing"; break; + case unit_paused: return "paused"; break; + case unit_disconnected: return "disconnect"; break; + case unit_unknown: return "unknown"; break; + } + return "unknown"; +} + static int show_status( page_status this, mvcp_status status ) { GtkWidget *widget = this_page_get_widget( ( page )this ); char temp[ 1024 ] = ""; char temp2[ 1024 ]; char label_name[ 256 ]; + char tc1[12], tc2[12], tc3[12]; - sprintf( temp, "%05d %05d %05d %s [", status->in, status->position, status->out, status->clip ); - - switch( status->status ) - { - case unit_offline: - strcat( temp, "offline" ); - break; - case unit_undefined: - strcat( temp, "undefined" ); - break; - case unit_not_loaded: - strcat( temp, "unloaded" ); - break; - case unit_stopped: - strcat( temp, "stopped" ); - break; - case unit_playing: - strcat( temp, "playing" ); - break; - case unit_paused: - strcat( temp, "paused" ); - break; - case unit_disconnected: - strcat( temp, "disconnect" ); - break; - default: - strcat( temp, "unknown" ); - break; - } + sprintf( temp, "[%s] IN:%s POS:%s OUT:%s %s", + status_to_text( status ), + frames2tc(status->in, status->fps, tc1), + frames2tc(status->position, status->fps, tc2), + frames2tc(status->out, status->fps, tc3), + status->clip + ); - strcat( temp, "]" ); - sprintf( label_name, "label_unit_%d", status->unit ); gdk_threads_enter(); @@ -214,13 +207,15 @@ static void *status_thread( void *arg ) char buf[32]; if ( status.status == unit_disconnected ) + { + this->app->eof = 0; break; + } if ( show_status( this, &status ) ) show_units( this, TRUE ); - if ( mvcp_unit_get( this->app->command, this->app->selected_unit, "eof", buf, sizeof(buf) ) != -1) - this->app->eof = buf[0]; - else - this->app->eof = 0; + if ( !this->app->eof && mvcp_unit_get( this->app->command, this->app->selected_unit, + "eof", buf, sizeof(buf) ) != -1) + this->app->eof = buf[0]; } }