From 943e64016e30ebd45b8cc88b43e66a6e6ce2bd84 Mon Sep 17 00:00:00 2001 From: Niels Elburg Date: Wed, 14 Mar 2007 17:43:20 +0000 Subject: [PATCH] cleanup git-svn-id: svn://code.dyne.org/veejay/trunk@849 eb8d1916-c9e9-0310-b8de-cf0c9472ead5 --- veejay-current/gveejay-reloaded/callback.c | 40 +++---- veejay-current/gveejay-reloaded/vj-api.c | 2 +- veejay-current/libel/vj-avcodec.c | 12 +-- veejay-current/share/gveejay.reloaded.glade | 109 +++++++++----------- 4 files changed, 77 insertions(+), 86 deletions(-) diff --git a/veejay-current/gveejay-reloaded/callback.c b/veejay-current/gveejay-reloaded/callback.c index 789f27f9..4768b45d 100644 --- a/veejay-current/gveejay-reloaded/callback.c +++ b/veejay-current/gveejay-reloaded/callback.c @@ -32,6 +32,7 @@ static int bg_[4]; static int fg_[4]; static int ln_[4]; +static int sample_calctime(); static void change_box_color_rgb( GtkWidget *box, int r, int g, int b,int a, int fill ); @@ -902,8 +903,19 @@ void on_button_sample_recordstart_clicked(GtkWidget *widget, gpointer user_data) GtkComboBox *combo = GTK_COMBO_BOX( GTK_WIDGET(glade_xml_get_widget(info->main_window,"combo_samplecodec"))); gchar *format = (gchar*) gtk_combo_box_get_active_text(combo); + gint n_frames = 0; + + gint dur_val = get_nums( "spin_sampleduration" ); + if( is_button_toggled( "sample_mulloop" ) ) + { + int base = sample_calctime(); + n_frames = base * dur_val; + } + else + { + n_frames = dur_val; + } - gint nframes = info->uc.sample_rec_duration; 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); @@ -931,10 +943,10 @@ void on_button_sample_recordstart_clicked(GtkWidget *widget, gpointer user_data) } multi_vims( VIMS_SAMPLE_REC_START, "%d %d", - nframes, + n_frames, autoplay ); - gchar *time1 = format_time(nframes,info->el.fps); + gchar *time1 = format_time(n_frames,info->el.fps); vj_msg(VEEJAY_MSG_INFO,"Record duration: %s", time1); g_free(time1); @@ -950,17 +962,6 @@ void on_button_sample_recordstop_clicked(GtkWidget *widget, gpointer user_data) static int sample_calctime() { -/* gint n_frames = get_nums( "spin_sampleduration"); - if( is_button_toggled( "sample_mulloop" ) ) - { - if(n_frames > 0) - { - n_frames *= (info->status_tokens[SAMPLE_END] - info->status_tokens[SAMPLE_START]); - if( info->status_tokens[SAMPLE_LOOP] == 2 ) - n_frames *= 2; - } - }*/ - int n_frames = info->status_tokens[SAMPLE_END] - info->status_tokens[SAMPLE_START]; if( info->status_tokens[SAMPLE_LOOP] == 2 ) n_frames *= 2; @@ -971,27 +972,30 @@ void on_spin_sampleduration_value_changed(GtkWidget *widget , gpointer user_data { // get num and display label_samplerecord_duration gint n_frames = sample_calctime(); + if( is_button_toggled( "sample_mulloop" )) + n_frames *= get_nums( "spin_sampleduration" ); + else + n_frames = get_nums( "spin_sampleduration" ); gchar *time = format_time( n_frames,info->el.fps ); update_label_str( "label_samplerecord_duration", time ); - info->uc.sample_rec_duration = n_frames; g_free(time); } void on_sample_mulloop_clicked(GtkWidget *w, gpointer user_data) { gint n_frames = sample_calctime(); + if( is_button_toggled( "sample_mulloop" )) + n_frames *= get_nums( "spin_sampleduration"); gchar *time = format_time( n_frames,info->el.fps ); update_label_str( "label_samplerecord_duration", time ); - info->uc.sample_rec_duration = n_frames; g_free(time); } void on_sample_mulframes_clicked(GtkWidget *w, gpointer user_data) { - gint n_frames = sample_calctime(); + gint n_frames = get_nums( "spin_sampleduration" ); gchar *time = format_time( n_frames,info->el.fps ); update_label_str( "label_samplerecord_duration", time ); - info->uc.sample_rec_duration = n_frames; g_free(time); } diff --git a/veejay-current/gveejay-reloaded/vj-api.c b/veejay-current/gveejay-reloaded/vj-api.c index 0c876b18..10587796 100644 --- a/veejay-current/gveejay-reloaded/vj-api.c +++ b/veejay-current/gveejay-reloaded/vj-api.c @@ -3000,7 +3000,7 @@ static void update_current_slot(int *history, int pm, int last_pm) update_spin_range( "spin_text_start", 0, n_frames ,0); update_spin_range( "spin_text_end", 0, n_frames,n_frames ); - info->uc.sample_rec_duration = n_frames; + // info->uc.sample_rec_duration = n_frames; info->uc.reload_hint[HINT_KF] = 1; } diff --git a/veejay-current/libel/vj-avcodec.c b/veejay-current/libel/vj-avcodec.c index 75906e2c..28ae5388 100644 --- a/veejay-current/libel/vj-avcodec.c +++ b/veejay-current/libel/vj-avcodec.c @@ -433,20 +433,16 @@ int vj_avcodec_encode_frame(void *encoder, int nframe,int format, uint8_t *src[ pict.quality = 1; pict.pts = (int64_t)( (int64_t)nframe ); - veejay_msg(0, "context pixfmt = %d, out_format = %d", - av->context->pix_fmt, get_ffmpeg_pixfmt( out_pixel_format )); - int src_fmt = get_ffmpeg_pixfmt( out_pixel_format ); - if(av->context->pix_fmt != src_fmt ) { pict.data[0] = av->data[0]; pict.data[1] = av->data[1]; pict.data[2] = av->data[2]; pict.linesize[0] = av->context->width; - pict.linesize[1] = av->context->width /2; - pict.linesize[2] = av->context->width /2; + pict.linesize[1] = av->context->width >> 1; + pict.linesize[2] = av->context->width >> 1; VJFrame *srci = yuv_yuv_template( src[0],src[1],src[2], av->context->width,av->context->height, src_fmt ); VJFrame *dsti = yuv_yuv_template( av->data[0],av->data[1],av->data[2],av->context->width,av->context->height, @@ -463,8 +459,8 @@ int vj_avcodec_encode_frame(void *encoder, int nframe,int format, uint8_t *src[ pict.data[1] = src[1]; pict.data[2] = src[2]; pict.linesize[0] = av->context->width; - pict.linesize[1] = pict.linesize[0]/2; - pict.linesize[2] = pict.linesize[0]/2; + pict.linesize[1] = pict.linesize[0]>>1; + pict.linesize[2] = pict.linesize[0]>>1; } res = avcodec_encode_video( av->context, buf, buf_len, &pict ); diff --git a/veejay-current/share/gveejay.reloaded.glade b/veejay-current/share/gveejay.reloaded.glade index dc45c46c..160c2432 100644 --- a/veejay-current/share/gveejay.reloaded.glade +++ b/veejay-current/share/gveejay.reloaded.glade @@ -1596,28 +1596,6 @@ - - - True - True - 1 - 0 - False - GTK_UPDATE_ALWAYS - False - False - 0 0 9999999 1 10 10 - - - - 1 - 2 - 1 - 2 - - - - True @@ -1673,43 +1651,6 @@ MLZO - - - True - 0 - 0.5 - GTK_SHADOW_NONE - - - - True - 00:00:00 - False - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - 7 - False - 0 - - - - - 2 - 3 - 1 - 2 - - fill - - - True @@ -1834,6 +1775,56 @@ MLZO fill + + + + True + 00:00:00 + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + 7 + False + 0 + + + 1 + 3 + 0 + 1 + fill + + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 0 0 9999999 1 10 10 + + + + 1 + 3 + 1 + 2 + + + 0