2 * dv1394app.c -- GTK+ 2 dv1394d client demo
3 * Copyright (C) 2002-2003 Charles Yates <charles.yates@pandora.be>
4 * Copyright (C) 2010 Dan Dennedy <dan@dennedy.org>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software Foundation,
18 * Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
29 #include <gdk/gdkkeysyms.h>
31 #include "interface.h"
33 #include "dv1394app.h"
35 #include "gtkenhancedscale.h"
36 #include <mvcp/mvcp_remote.h>
37 #include <melted/melted_local.h>
40 /** Window close event.
43 static gboolean
on_main_window_delete_event( GtkWidget
*widget
, GdkEvent
*event
, gpointer user_data
)
49 static gboolean
instance_connect( dv1394app
this, char *server
, char *port
)
51 if ( this->parser
== NULL
)
53 if ( strstr( server
, ".conf" ) == NULL
)
54 this->parser
= mvcp_parser_init_remote( server
, atoi( port
) );
56 this->parser
= melted_parser_init_local( );
58 this->command
= mvcp_init( this->parser
);
60 if ( strstr( server
, ".conf" ) != NULL
)
61 mvcp_run( this->command
, server
);
63 if ( mvcp_connect( this->command
) == mvcp_ok
)
65 struct timespec t
= { 1, 0 };
66 nanosleep( &t
, NULL
);
67 //gdk_threads_leave( );
68 dv1394app_connect( this );
69 //gdk_threads_enter( );
73 mvcp_close( this->command
);
74 mvcp_parser_close( this->parser
);
80 return this->parser
!= NULL
;
83 /** Connection window - Connect button pressed.
86 static gboolean
on_connect_pressed( GtkWidget
*button
, gpointer user_data
)
88 dv1394app
this = user_data
;
93 if ( this->parser
== NULL
)
95 widget
= lookup_widget( this->connect
, "entry_server" );
96 server
= ( char * )gtk_entry_get_text( GTK_ENTRY( widget
) );
97 widget
= lookup_widget( this->connect
, "entry_port" );
98 port
= ( char * )gtk_entry_get_text( GTK_ENTRY( widget
) );
99 instance_connect( this, server
, port
);
101 gtk_widget_destroy( this->connect
);
103 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_connect" ) ), TRUE
);
104 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_disconnect" ) ), FALSE
);
110 /** Connection window - Cancel button pressed.
113 static gboolean
on_cancel_pressed( GtkWidget
*button
, gpointer user_data
)
115 dv1394app
this = user_data
;
116 if ( this->guard
) return FALSE
;
117 gtk_widget_destroy( this->connect
);
121 /** Main window - connect menu item selected.
124 void on_item_connect_activate( GtkMenuItem
*menuitem
, gpointer user_data
)
126 dv1394app
this = user_data
;
129 if ( this->guard
) return;
130 this->connect
= create_window_connection( );
132 /* Connection set up handling */
133 widget
= lookup_widget( this->connect
, "button_connect" );
134 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_connect_pressed
), this );
135 widget
= lookup_widget( this->connect
, "button_cancel" );
136 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_cancel_pressed
), this );
138 gtk_widget_show( this->connect
);
141 /** Main window - disconnect menu item selected.
144 void on_item_disconnect_activate( GtkMenuItem
*menuitem
, gpointer user_data
)
146 dv1394app
this = user_data
;
148 if ( this->guard
) return;
149 dv1394app_disconnect( this );
152 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_connect" ) ), FALSE
);
153 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_disconnect" ) ), TRUE
);
157 /** Main window - quit menu item selected.
160 void on_item_quit_activate( GtkMenuItem
*menuitem
, gpointer user_data
)
165 static void playlist_open(dv1394app
this, char* filename
)
169 if( this->selected_unit
>= 0 && this->command
)
171 f
= fopen(filename
, "rt");
180 fgets(l
, sizeof(l
), f
);
182 /* remove newlines */
183 if( (s
= strchr(l
, '\n')) ) *s
= 0;
184 if( (s
= strchr(l
, '\r')) ) *s
= 0;
185 if( (s
= strchr(l
, '\t')) ) *s
= 0;
187 /* check for empty line */
189 mvcp_unit_append( this->command
, this->selected_unit
, l
, -1, -1 );
198 static void playlist_save(dv1394app
this, char* filename
)
201 mvcp_list_entry_t entry
;
205 if( this->selected_unit
>= 0 && this->command
)
207 f
= fopen(filename
, "wt");
210 list
= mvcp_list_init( this->command
, this->selected_unit
);
214 for ( index
= 0; list
&& index
< mvcp_list_count( list
); index
++ )
216 mvcp_list_get( list
, index
, &entry
);
217 fprintf(f
, "%s\n", entry
.full
);
219 mvcp_list_close( list
);
227 /** Main window - playlist open menu item selected.
230 static void on_item_open_playlist_activate( GtkMenuItem
*menuitem
, gpointer user_data
)
232 dv1394app
this = user_data
;
235 dialog
= gtk_file_chooser_dialog_new ("Open File",
236 GTK_WINDOW (this->window
),
237 GTK_FILE_CHOOSER_ACTION_OPEN
,
238 GTK_STOCK_CANCEL
, GTK_RESPONSE_CANCEL
,
239 GTK_STOCK_OPEN
, GTK_RESPONSE_ACCEPT
,
242 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog
),
243 (this->playlist_folder
)?
this->playlist_folder
:getenv("HOME"));
245 if (gtk_dialog_run (GTK_DIALOG (dialog
)) == GTK_RESPONSE_ACCEPT
)
249 filename
= gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog
));
250 playlist_open(this, filename
);
252 if ( this->playlist_folder
)
253 g_free (this->playlist_folder
);
254 this->playlist_folder
= filename
;
255 if ( this->playlist_folder
)
257 char* e
= strrchr(this->playlist_folder
, '/');
262 gtk_widget_destroy (dialog
);
265 /** Main window - playlist save menu item selected.
268 static void on_item_save_playlist_activate( GtkMenuItem
*menuitem
, gpointer user_data
)
270 dv1394app
this = user_data
;
273 dialog
= gtk_file_chooser_dialog_new ("Save File",
274 GTK_WINDOW (this->window
),
275 GTK_FILE_CHOOSER_ACTION_SAVE
,
276 GTK_STOCK_CANCEL
, GTK_RESPONSE_CANCEL
,
277 GTK_STOCK_SAVE
, GTK_RESPONSE_ACCEPT
,
280 gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog
), TRUE
);
282 gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER (dialog
),
283 (this->playlist_folder
)?
this->playlist_folder
:getenv("HOME"));
284 gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog
), "Untitled document");
286 if (gtk_dialog_run (GTK_DIALOG (dialog
)) == GTK_RESPONSE_ACCEPT
)
290 filename
= gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog
));
291 playlist_save(this, filename
);
293 if ( this->playlist_folder
)
294 g_free (this->playlist_folder
);
295 this->playlist_folder
= filename
;
296 if ( this->playlist_folder
)
298 char* e
= strrchr(this->playlist_folder
, '/');
303 gtk_widget_destroy (dialog
);
306 static gboolean
on_page_switch_pressed( GtkWidget
*button
, gpointer user_data
)
308 dv1394app
this = user_data
;
310 GtkWidget
*notebook
= lookup_widget( button
, "notebook1" );
312 if ( this->guard
) return TRUE
;
314 for ( index
= 0; index
< this->page_count
; index
++ )
315 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this->page_buttons
[ index
] ), FALSE
);
316 for ( index
= 0; index
< this->page_count
; index
++ )
318 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this->page_buttons
[ index
] ), FALSE
);
319 if ( this->page_buttons
[ index
] == button
)
322 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this->page_buttons
[ index
] ), TRUE
);
323 gtk_notebook_set_current_page( GTK_NOTEBOOK( notebook
), index
);
329 static gboolean
on_transport_pressed( GtkWidget
*button
, gpointer data
)
332 dv1394app
this = ( dv1394app
)data
;
333 mvcp dv
= dv1394app_get_command( this );
334 int unit
= dv1394app_get_selected_unit( this );
336 for ( index
= 0; index
< TRANSPORT_BUTTONS_COUNT
; index
++ )
337 if ( this->buttons
[ index
] == button
)
343 mvcp_unit_clip_goto( dv
, unit
, mvcp_absolute
, 0, 0 );
347 mvcp_unit_goto( dv
, unit
, 0 );
351 mvcp_unit_rewind( dv
, unit
);
355 mvcp_unit_step( dv
, unit
, -1 );
359 mvcp_unit_pause( dv
, unit
);
363 mvcp_unit_play( dv
, unit
);
367 mvcp_unit_stop( dv
, unit
);
371 mvcp_unit_step( dv
, unit
, 1 );
375 mvcp_unit_fast_forward( dv
, unit
);
379 mvcp_unit_clip_goto( dv
, unit
, mvcp_relative
, 1, 0 );
383 mvcp_unit_clip_goto( dv
, unit
, mvcp_absolute
, 9999, -1 );
387 mvcp_unit_set( dv
, unit
, "eof", "loop");
388 this->eof
[this->selected_unit
] = 0;
392 mvcp_unit_set( dv
, unit
, "eof", "pause");
393 this->eof
[this->selected_unit
] = 0;
403 static void dv1394app_register_page( dv1394app
this, page item
)
405 GtkWidget
*toolbar
= lookup_widget( this->window
, "toolbar1" );
406 GtkIconSize size
= gtk_toolbar_get_icon_size( GTK_TOOLBAR( toolbar
) );
407 GtkWidget
*widget
= lookup_widget( this->window
, "notebook1" );
408 GtkWidget
*bin
= gtk_frame_new( NULL
);
411 this->pages
[ this->page_count
] = item
;
412 gtk_widget_reparent( GTK_BIN( page_get_widget( item
) )->child
, bin
);
413 gtk_container_add(GTK_CONTAINER( widget
), bin
);
414 gtk_frame_set_label_align( GTK_FRAME( bin
), 0, 0 );
415 gtk_frame_set_shadow_type( GTK_FRAME( bin
), GTK_SHADOW_NONE
);
416 gtk_widget_show( bin
);
418 page_get_toolbar_info( item
, size
, &widget
, &label
);
419 this->page_buttons
[ this->page_count
] = gtk_toolbar_append_element( GTK_TOOLBAR ( toolbar
), GTK_TOOLBAR_CHILD_TOGGLEBUTTON
, NULL
, label
, NULL
, NULL
, widget
, NULL
, NULL
);
420 gtk_label_set_use_underline( GTK_LABEL(((GtkToolbarChild
*)(g_list_last( GTK_TOOLBAR( toolbar
)->children
)->data
))->label
), TRUE
);
421 gtk_widget_show( widget
);
422 gtk_signal_connect( GTK_OBJECT( this->page_buttons
[ this->page_count
] ), "clicked", GTK_SIGNAL_FUNC( on_page_switch_pressed
), this );
423 gtk_signal_connect( GTK_OBJECT( this->page_buttons
[ this->page_count
] ), "activate", GTK_SIGNAL_FUNC( on_page_switch_pressed
), this );
428 static GtkAdjustment
*trim_adj
[3];
429 #define TRIM_ADJ_POS 0
430 #define TRIM_ADJ_IN 1
431 #define TRIM_ADJ_OUT 2
433 void dv1394app_show_status( dv1394app
this, mvcp_status status
)
436 for ( index
= 0; index
< this->page_count
; index
++ )
437 page_show_status( this->pages
[ index
], status
);
439 if ( status
->seek_flag
!= this->seek_flag
)
441 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_2" ), status
->seek_flag
);
442 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_3" ), status
->seek_flag
);
443 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_7" ), status
->seek_flag
);
444 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_8" ), status
->seek_flag
);
445 this->seek_flag
= status
->seek_flag
;
448 if ( !this->trim_in_use
)
450 int upper
= status
->length
> 0 ? status
->length
- 1 : 0;
451 trim_adj
[TRIM_ADJ_IN
]->upper
= upper
;
452 trim_adj
[TRIM_ADJ_IN
]->value
= status
->in
;
453 trim_adj
[TRIM_ADJ_OUT
]->upper
= upper
;
454 trim_adj
[TRIM_ADJ_OUT
]->value
= status
->out
;
455 trim_adj
[TRIM_ADJ_POS
]->upper
= upper
;
456 trim_adj
[TRIM_ADJ_POS
]->value
= status
->position
;
457 gtk_signal_emit_by_name( GTK_OBJECT(trim_adj
[TRIM_ADJ_POS
]), "value_changed" );
460 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_11" ),
461 this->eof
[this->selected_unit
] == 'p' );
462 gtk_widget_set_sensitive( lookup_widget( dv1394app_get_widget( this ), "transport_12" ),
463 this->eof
[this->selected_unit
] == 'l' );
466 static gboolean
trim_pressed( GtkWidget
*button
, GdkEventButton
*event
, gpointer user_data
)
468 dv1394app
this = (dv1394app
)user_data
;
469 mvcp_unit_pause( dv1394app_get_command( this ), this->selected_unit
);
472 this->trim_in_use
= 1;
476 static gboolean
trim_released( GtkWidget
*button
, GdkEventButton
*event
, gpointer user_data
)
478 dv1394app
this = (dv1394app
)user_data
;
479 this->trim_in_use
= 0;
480 if ( this->trim_in
!= -1 )
481 mvcp_unit_set_in( dv1394app_get_command( this ), this->selected_unit
, this->trim_in
);
482 if ( this->trim_out
!= -1 )
483 mvcp_unit_set_out( dv1394app_get_command( this ), this->selected_unit
, this->trim_out
);
487 static gboolean
on_trim_value_changed_event( GtkWidget
*button
, gpointer user_data
)
489 dv1394app
this = (dv1394app
)user_data
;
490 if ( this->trim_in_use
)
493 g_object_get( G_OBJECT( button
), "user_data", &value
, NULL
);
495 if ( !strcmp( value
, "position" ) )
497 mvcp_unit_goto( dv1394app_get_command( this ), this->selected_unit
, trim_adj
[TRIM_ADJ_POS
]->value
);
499 else if ( !strcmp( value
, "in" ) )
501 this->trim_in
= trim_adj
[TRIM_ADJ_IN
]->value
;
502 mvcp_unit_goto( dv1394app_get_command( this ), this->selected_unit
, trim_adj
[TRIM_ADJ_IN
]->value
);
504 else if ( !strcmp( value
, "out" ) )
506 this->trim_out
= trim_adj
[TRIM_ADJ_OUT
]->value
;
507 mvcp_unit_goto( dv1394app_get_command( this ), this->selected_unit
, trim_adj
[TRIM_ADJ_OUT
]->value
);
510 gtk_widget_queue_draw (lookup_widget(this->window
, "vbox_trim") );
516 /** Initialiser for application state.
519 dv1394app
dv1394app_init( GtkWidget
*window
, char *instance
)
521 dv1394app
this = calloc( 1, sizeof( dv1394app_t
) );
527 this->window
= window
;
529 /* Window destroy event */
530 gtk_signal_connect( GTK_OBJECT( this->window
), "destroy", GTK_SIGNAL_FUNC( on_main_window_delete_event
), this );
532 /* Menu item signal handling */
533 // widget = lookup_widget( this->window, "item_connect" );
534 // gtk_signal_connect( GTK_OBJECT( widget ), "activate", GTK_SIGNAL_FUNC( on_item_connect_activate ), this );
535 widget
= lookup_widget( this->window
, "button_connect" );
536 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_item_connect_activate
), this );
537 // widget = lookup_widget( this->window, "item_disconnect" );
538 // gtk_signal_connect( GTK_OBJECT( widget ), "activate", GTK_SIGNAL_FUNC( on_item_disconnect_activate ), this );
539 widget
= lookup_widget( this->window
, "button_disconnect" );
540 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_item_disconnect_activate
), this );
541 // widget = lookup_widget( this->window, "item_quit" );
542 // gtk_signal_connect( GTK_OBJECT( widget ), "activate", GTK_SIGNAL_FUNC( on_item_quit_activate ), this );
543 // widget = lookup_widget( this->window, "button_quit" );
544 // gtk_signal_connect( GTK_OBJECT( widget ), "clicked", GTK_SIGNAL_FUNC( on_item_quit_activate ), this );
545 widget
= lookup_widget( this->window
, "button_open_playlist" );
546 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_item_open_playlist_activate
), this );
547 widget
= lookup_widget( this->window
, "button_save_playlist" );
548 gtk_signal_connect( GTK_OBJECT( widget
), "clicked", GTK_SIGNAL_FUNC( on_item_save_playlist_activate
), this );
551 /* Initialise the pages. */
552 dv1394app_register_page( this, page_operate_init( this ) );
553 dv1394app_register_page( this, page_command_init( this ) );
555 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( this->page_buttons
[ 0 ] ), TRUE
);
558 /* Remove the empty page */
559 widget
= lookup_widget( this->window
, "notebook1" );
560 gtk_notebook_remove_page( GTK_NOTEBOOK( widget
), 0 );
562 guint keys
[ ] = { GDK_0
, GDK_1
, GDK_2
, GDK_3
, GDK_4
, GDK_5
, GDK_6
, GDK_7
, GDK_8
, GDK_9
, GDK_A
};
564 GtkAccelGroup
*accel_group
= gtk_accel_group_new( );
566 for ( index
= 0; index
< TRANSPORT_BUTTONS_COUNT
; index
++ )
569 sprintf( name
, "transport_%d", index
);
570 this->buttons
[ index
] = lookup_widget( dv1394app_get_widget( this ), name
);
571 gtk_signal_connect( GTK_OBJECT( this->buttons
[ index
] ), "clicked", GTK_SIGNAL_FUNC( on_transport_pressed
), this );
572 gtk_widget_add_accelerator( this->buttons
[ index
], "clicked", accel_group
, keys
[ index
], GDK_CONTROL_MASK
, GTK_ACCEL_VISIBLE
);
575 gtk_window_add_accel_group( GTK_WINDOW( dv1394app_get_widget( this ) ), accel_group
);
577 trim_adj
[TRIM_ADJ_POS
] = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 1000, 1, 10, 0 ) );
578 g_object_set( G_OBJECT( trim_adj
[TRIM_ADJ_POS
] ), "user_data", "position", NULL
);
579 trim_adj
[TRIM_ADJ_IN
] = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 1000, 1, 10, 0 ) );
580 g_object_set( G_OBJECT( trim_adj
[TRIM_ADJ_IN
] ), "user_data", "in", NULL
);
581 trim_adj
[TRIM_ADJ_OUT
] = GTK_ADJUSTMENT( gtk_adjustment_new( 0, 0, 1000, 1, 10, 0 ) );
582 g_object_set( G_OBJECT( trim_adj
[TRIM_ADJ_OUT
] ), "user_data", "out", NULL
);
585 for (i
= 0; i
< 3; i
++)
586 gtk_signal_connect (GTK_OBJECT (trim_adj
[i
]), "value_changed", GTK_SIGNAL_FUNC (on_trim_value_changed_event
), this );
588 GtkWidget
*trim
= gtk_enhanced_scale_new( (GtkObject
**) trim_adj
, 3);
591 gtk_widget_set_name (trim
, "trim");
592 GTK_WIDGET_UNSET_FLAGS( GTK_WIDGET( trim
), GTK_CAN_FOCUS
);
593 gtk_widget_ref(trim
);
594 gtk_object_set_data_full (GTK_OBJECT( this->window
), "trim", trim
, (GtkDestroyNotify
) gtk_widget_unref
);
595 GtkWidget
*vbox_trim
= lookup_widget(this->window
, "vbox_trim");
596 gtk_widget_show(trim
);
597 gtk_box_pack_start(GTK_BOX (vbox_trim
), trim
, TRUE
, TRUE
, 0);
598 gtk_signal_connect( GTK_OBJECT( trim
), "button_press_event", GTK_SIGNAL_FUNC (trim_pressed
), this );
599 gtk_signal_connect( GTK_OBJECT( trim
), "button_release_event", GTK_SIGNAL_FUNC (trim_released
), this );
604 if ( instance
!= NULL
)
606 char *server
= strdup( instance
);
607 char *port
= strchr( server
, ':' );
613 if ( instance_connect( this, server
, port
) )
614 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_connect" ) ), TRUE
);
616 gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( lookup_widget( this->window
, "button_disconnect" ) ), TRUE
);
625 /** Get the app window widget.
628 GtkWidget
*dv1394app_get_widget( dv1394app
this )
633 /** Get the applications parser.
636 mvcp_parser
dv1394app_get_parser( dv1394app
this )
641 /** Return the command parser.
644 mvcp
dv1394app_get_command( dv1394app
this )
646 return this->command
;
649 /** Issue a connect to all pages.
652 void dv1394app_connect( dv1394app
this )
655 for ( index
= 0; index
< this->page_count
; index
++ )
656 page_on_connect( this->pages
[ index
] );
659 /** Inform all pages that the unit has changed.
662 void dv1394app_on_unit_change( dv1394app
this, int unit
)
665 this->selected_unit
= unit
;
666 for ( index
= 0; index
< this->page_count
; index
++ )
667 page_on_unit_change( this->pages
[ index
], unit
);
670 /** Return the selected unit.
673 int dv1394app_get_selected_unit( dv1394app
this )
675 return this->selected_unit
;
678 /** Issue a disconnect to all pages.
681 void dv1394app_disconnect( dv1394app
this )
684 if ( this->parser
!= NULL
)
686 for ( index
= 0; index
< this->page_count
; index
++ )
687 page_on_disconnect( this->pages
[ index
] );
688 mvcp_close( this->command
);
689 this->command
= NULL
;
690 mvcp_parser_close( this->parser
);
695 /** Close application.
698 void dv1394app_close( dv1394app
this )
700 dv1394app_disconnect( this );
701 while ( this->page_count
> 0 )
702 page_close( this->pages
[ -- this->page_count
] );
706 char* frames2tc( int f
, float fps
, char* buf
)
708 int tc
[4] = { 0, 0, 0, 0 };
717 tc
[0] = (d
- t
) * fps
;
718 tc
[1] = t
% 60; t
/= 60;
719 tc
[2] = t
% 60; t
/= 60;
723 sprintf(buf
, "%.2d:%.2d:%.2d:%.2d", tc
[3], tc
[2], tc
[1], tc
[0]);