Fix timer function, fix slow slider in classic reloaded, fix loop recording

git-svn-id: svn://code.dyne.org/veejay/trunk@1231 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2008-11-30 20:48:36 +00:00
parent e09d4e0a9e
commit bef3e11d32
5 changed files with 40 additions and 59 deletions

View File

@@ -7927,7 +7927,7 @@ MLZO</property>
<child> <child>
<widget class="GtkHScale" id="speed_slider"> <widget class="GtkHScale" id="speed_slider">
<property name="width_request">80</property> <property name="width_request">60</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="draw_value">True</property> <property name="draw_value">True</property>
@@ -7947,6 +7947,7 @@ MLZO</property>
<child> <child>
<widget class="GtkHScale" id="slow_slider"> <widget class="GtkHScale" id="slow_slider">
<property name="width_request">60</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="draw_value">True</property> <property name="draw_value">True</property>
@@ -7955,10 +7956,11 @@ MLZO</property>
<property name="update_policy">GTK_UPDATE_CONTINUOUS</property> <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
<property name="inverted">False</property> <property name="inverted">False</property>
<property name="adjustment">0 0 0 0 0 0</property> <property name="adjustment">0 0 0 0 0 0</property>
<signal name="value_changed" handler="on_slow_slider_value_changed" last_modification_time="Sun, 30 Nov 2008 19:29:07 GMT"/>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>
<property name="expand">True</property> <property name="expand">False</property>
<property name="fill">True</property> <property name="fill">True</property>
</packing> </packing>
</child> </child>

View File

@@ -1007,38 +1007,18 @@ void on_button_sample_recordstart_clicked(GtkWidget *widget, gpointer user_data)
{ {
int base = sample_calctime(); int base = sample_calctime();
n_frames = base * dur_val; n_frames = base * dur_val;
n_frames = 0;
} }
else else
{ {
n_frames = dur_val; n_frames = dur_val;
} }
gsize br=0; gsize bw=0;
gchar *utftext = (gchar*) get_text( "entry_samplename");
gchar *text = (utftext != NULL ? g_locale_from_utf8( utftext, -1, &br, &bw,NULL) : NULL);
if(text != NULL)
{
int i = 0;
while( text[i] != '\0' )
{
if( !isalnum( text[i] ))
{
error_dialog("Error", "Only alpha numeric characters are allowed");
if( text) free(text);
return;
}
i++;
}
multi_vims( VIMS_SAMPLE_SET_DESCRIPTION, "%d %s", 0, text );
g_free(text);
}
if(format != NULL) if(format != NULL)
{ {
multi_vims( VIMS_RECORD_DATAFORMAT,"%s", multi_vims( VIMS_RECORD_DATAFORMAT,"%s",
format ); format );
} }
multi_vims( VIMS_SAMPLE_REC_START, multi_vims( VIMS_SAMPLE_REC_START,
"%d %d", "%d %d",
n_frames, n_frames,
@@ -1047,10 +1027,12 @@ void on_button_sample_recordstart_clicked(GtkWidget *widget, gpointer user_data)
vj_midi_learning_vims_msg2( info->midi, NULL, VIMS_SAMPLE_REC_START, n_frames, autoplay ); vj_midi_learning_vims_msg2( info->midi, NULL, VIMS_SAMPLE_REC_START, n_frames, autoplay );
gchar *time1 = format_time(n_frames,info->el.fps); gchar *time1 = format_time(n_frames,info->el.fps);
vj_msg(VEEJAY_MSG_INFO,"Record duration: %s", if( autoplay ) {
time1); vj_msg(VEEJAY_MSG_INFO, "Recording %s from current sample, autoplaying new sample when finished.",time1);
} else {
vj_msg(VEEJAY_MSG_INFO,"Recording %s from current sample",time1);
}
g_free(time1); g_free(time1);
g_free(format); g_free(format);
} }

View File

@@ -18,8 +18,11 @@
*/ */
#include <config.h> #include <config.h>
#include <stdio.h> #include <stdio.h>
#include <mjpeg/yuv4mpeg_intern.h>
#include <mjpeg/yuv4mpeg.h>
#include <mjpeg/mpegconsts.h> #include <mjpeg/mpegconsts.h>
#include <mjpeg/mpegtimecode.h> #include <mjpeg/mpegtimecode.h>
#include <veejay/vjmem.h> #include <veejay/vjmem.h>
#include <string.h> #include <string.h>
@@ -52,18 +55,16 @@ int status_to_arr( char *status, int *array )
return n; return n;
} }
char *format_time(int pos, float fps)
char *format_time(int pos, double fps)
{ {
static char temp[256];
MPEG_timecode_t tc; MPEG_timecode_t tc;
veejay_memset(&tc, 0,sizeof(MPEG_timecode_t)); mpeg_timecode(&tc,
char *tmp = (char*) vj_malloc( 20 ); pos,
y4m_ratio_t ratio = mpeg_conform_framerate( fps ); mpeg_framerate_code(mpeg_conform_framerate(fps)),
int n = mpeg_framerate_code( ratio ); fps );
sprintf(temp, "%d:%2.2d:%2.2d:%2.2d",tc.h, tc.m, tc.s, tc.f );
mpeg_timecode(&tc, pos, n, fps ); return strdup(temp);
snprintf(tmp, 20, "%2d:%2.2d:%2.2d:%2.2d",
tc.h, tc.m, tc.s, tc.f );
return tmp;
} }

View File

@@ -20,6 +20,6 @@
#ifndef GVRUTILS #ifndef GVRUTILS
#define GVRUTILS #define GVRUTILS
int status_to_arr( char *status, int *array ); int status_to_arr( char *status, int *array );
char *format_time( int pos , float fps); char *format_time( int pos , double fps);
#endif #endif

View File

@@ -611,7 +611,9 @@ GtkWidget *glade_xml_get_widget_( GladeXML *m, const char *name )
GtkWidget *widget = glade_xml_get_widget( m , name ); GtkWidget *widget = glade_xml_get_widget( m , name );
if(!widget) if(!widget)
{ {
#ifdef STRICT_CHECKING
veejay_msg(0,"Missing widget: %s %s ",__FUNCTION__,name); veejay_msg(0,"Missing widget: %s %s ",__FUNCTION__,name);
#endif
return NULL; return NULL;
} }
#ifdef STRICT_CHECKING #ifdef STRICT_CHECKING
@@ -918,10 +920,10 @@ static void set_tooltip(const char *name, const char *text)
{ {
GtkWidget *w = glade_xml_get_widget_(info->main_window,name); GtkWidget *w = glade_xml_get_widget_(info->main_window,name);
if(!w) { if(!w) {
#ifdef STRICT_CHECKING
veejay_msg(0, "Widget '%s' not found",name); veejay_msg(0, "Widget '%s' not found",name);
#endif
return; return;
} }
gtk_widget_set_tooltip_text( w,text ); gtk_widget_set_tooltip_text( w,text );
} }
@@ -2737,7 +2739,7 @@ static void update_record_tab(int pm)
{ {
update_spin_value( "spin_streamduration" , 1 ); update_spin_value( "spin_streamduration" , 1 );
gint n_frames = get_nums( "spin_streamduration" ); gint n_frames = get_nums( "spin_streamduration" );
gchar *time = format_time(n_frames, info->el.fps); gchar *time = format_time(n_frames, (double) info->el.fps);
update_label_str( "label_streamrecord_duration", time ); update_label_str( "label_streamrecord_duration", time );
g_free(time); g_free(time);
} }
@@ -2746,7 +2748,7 @@ static void update_record_tab(int pm)
update_spin_value( "spin_sampleduration", 1 ); update_spin_value( "spin_sampleduration", 1 );
// combo_samplecodec // combo_samplecodec
gint n_frames = sample_calctime(); gint n_frames = sample_calctime();
gchar *time = format_time( n_frames,info->el.fps ); gchar *time = format_time( n_frames,(double) info->el.fps );
update_label_str( "label_samplerecord_duration", time ); update_label_str( "label_samplerecord_duration", time );
g_free(time); g_free(time);
} }
@@ -2820,7 +2822,7 @@ static void update_current_slot(int *history, int pm, int last_pm)
} }
gchar *time = format_time( info->status_frame,info->el.fps ); gchar *time = format_time( info->status_frame,(double)info->el.fps );
update_label_str( "label_curtime", time ); update_label_str( "label_curtime", time );
g_free(time); g_free(time);
@@ -2851,7 +2853,7 @@ static void update_current_slot(int *history, int pm, int last_pm)
} }
} }
gchar *dur = format_time( info->status_tokens[SAMPLE_MARKER_END] - info->status_tokens[SAMPLE_MARKER_START], gchar *dur = format_time( info->status_tokens[SAMPLE_MARKER_END] - info->status_tokens[SAMPLE_MARKER_START],
info->el.fps ); (double)info->el.fps );
update_label_str( "label_markerduration", dur ); update_label_str( "label_markerduration", dur );
g_free(dur); g_free(dur);
} }
@@ -4879,7 +4881,6 @@ static void reload_editlist_contents()
if(nl < 0 || nl >= num_files) if(nl < 0 || nl >= num_files)
{ {
printf("exceed max files\n");
return; return;
} }
int file_len = _el_get_nframes( nl ); int file_len = _el_get_nframes( nl );
@@ -4969,6 +4970,9 @@ static void load_editlist_info()
update_spin_value( "screenshot_height", info->el.height ); update_spin_value( "screenshot_height", info->el.height );
info->el.fps = fps; info->el.fps = fps;
#ifdef STRICT_CHECKING
assert( info->el.fps > 0 );
#endif
info->el.num_files = dum[0]; info->el.num_files = dum[0];
snprintf( tmp, sizeof(tmp)-1, "%s", snprintf( tmp, sizeof(tmp)-1, "%s",
( values[2] == 0 ? "progressive" : (values[2] == 1 ? "top first" : "bottom first" ) ) ); ( values[2] == 0 ? "progressive" : (values[2] == 1 ? "top first" : "bottom first" ) ) );
@@ -5050,18 +5054,10 @@ static void enable_widget_(const char *name, const char *s, int line)
static gchar *format_selection_time(int start, int end) static gchar *format_selection_time(int start, int end)
{ {
MPEG_timecode_t tc; double fps = (double) info->el.fps;
veejay_memset( &tc, 0,sizeof(tc)); int pos = (end-start);
if( (end-start) <= 0)
veejay_memset( &tc, 0, sizeof(tc));
else
mpeg_timecode( &tc, (end-start), mpeg_framerate_code(
mpeg_conform_framerate( info->el.fps ) ), info->el.fps );
gchar *tmp = g_new( gchar, 20); return format_time( pos, fps );
snprintf( tmp, 20, "%2d:%2.2d:%2.2d:%2.2d",
tc.h, tc.m, tc.s, tc.f );
return tmp;
} }
@@ -5689,7 +5685,7 @@ static void update_globalinfo(int *history, int pm, int last_pm)
if( total_frames_ != history_frames_ || total_frames_ != (int) timeline_get_length(TIMELINE_SELECTION(info->tl))) if( total_frames_ != history_frames_ || total_frames_ != (int) timeline_get_length(TIMELINE_SELECTION(info->tl)))
{ {
gchar *time = format_time( total_frames_, info->el.fps ); gchar *time = format_time( total_frames_,(double) info->el.fps );
if( pm == MODE_STREAM ) if( pm == MODE_STREAM )
{ {
update_spin_value( "stream_length", info->status_tokens[SAMPLE_MARKER_END] ); update_spin_value( "stream_length", info->status_tokens[SAMPLE_MARKER_END] );
@@ -5728,7 +5724,7 @@ static void update_globalinfo(int *history, int pm, int last_pm)
info->status_frame = info->status_tokens[FRAME_NUM]; info->status_frame = info->status_tokens[FRAME_NUM];
timeline_set_pos( info->tl, (gdouble) info->status_frame ); timeline_set_pos( info->tl, (gdouble) info->status_frame );
gchar *current_time_ = format_time( info->status_frame,info->el.fps ); gchar *current_time_ = format_time( info->status_frame, (double) info->el.fps );
update_label_i( "label_curframe", info->status_frame ,1 ); update_label_i( "label_curframe", info->status_frame ,1 );
update_label_str( "label_curtime", current_time_ ); update_label_str( "label_curtime", current_time_ );
update_label_str( "label_sampleposition", current_time_); update_label_str( "label_sampleposition", current_time_);