git-svn-id: svn://code.dyne.org/veejay/trunk@849 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-03-14 17:43:20 +00:00
parent 0631bfee93
commit 943e64016e
4 changed files with 77 additions and 86 deletions

View File

@@ -32,6 +32,7 @@ static int bg_[4];
static int fg_[4]; static int fg_[4];
static int ln_[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 ); 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"))); 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); 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; gsize br=0; gsize bw=0;
gchar *utftext = (gchar*) get_text( "entry_samplename"); gchar *utftext = (gchar*) get_text( "entry_samplename");
gchar *text = (utftext != NULL ? g_locale_from_utf8( utftext, -1, &br, &bw,NULL) : NULL); 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, multi_vims( VIMS_SAMPLE_REC_START,
"%d %d", "%d %d",
nframes, n_frames,
autoplay ); 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", vj_msg(VEEJAY_MSG_INFO,"Record duration: %s",
time1); time1);
g_free(time1); g_free(time1);
@@ -950,17 +962,6 @@ void on_button_sample_recordstop_clicked(GtkWidget *widget, gpointer user_data)
static int sample_calctime() 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]; int n_frames = info->status_tokens[SAMPLE_END] - info->status_tokens[SAMPLE_START];
if( info->status_tokens[SAMPLE_LOOP] == 2 ) if( info->status_tokens[SAMPLE_LOOP] == 2 )
n_frames *= 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 // get num and display label_samplerecord_duration
gint n_frames = sample_calctime(); 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 ); gchar *time = format_time( n_frames,info->el.fps );
update_label_str( "label_samplerecord_duration", time ); update_label_str( "label_samplerecord_duration", time );
info->uc.sample_rec_duration = n_frames;
g_free(time); g_free(time);
} }
void on_sample_mulloop_clicked(GtkWidget *w, gpointer user_data) void on_sample_mulloop_clicked(GtkWidget *w, gpointer user_data)
{ {
gint n_frames = sample_calctime(); 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 ); gchar *time = format_time( n_frames,info->el.fps );
update_label_str( "label_samplerecord_duration", time ); update_label_str( "label_samplerecord_duration", time );
info->uc.sample_rec_duration = n_frames;
g_free(time); g_free(time);
} }
void on_sample_mulframes_clicked(GtkWidget *w, gpointer user_data) 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 ); gchar *time = format_time( n_frames,info->el.fps );
update_label_str( "label_samplerecord_duration", time ); update_label_str( "label_samplerecord_duration", time );
info->uc.sample_rec_duration = n_frames;
g_free(time); g_free(time);
} }

View File

@@ -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_start", 0, n_frames ,0);
update_spin_range( "spin_text_end", 0, n_frames,n_frames ); 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; info->uc.reload_hint[HINT_KF] = 1;
} }

View File

@@ -433,20 +433,16 @@ int vj_avcodec_encode_frame(void *encoder, int nframe,int format, uint8_t *src[
pict.quality = 1; pict.quality = 1;
pict.pts = (int64_t)( (int64_t)nframe ); 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 ); int src_fmt = get_ffmpeg_pixfmt( out_pixel_format );
if(av->context->pix_fmt != src_fmt ) if(av->context->pix_fmt != src_fmt )
{ {
pict.data[0] = av->data[0]; pict.data[0] = av->data[0];
pict.data[1] = av->data[1]; pict.data[1] = av->data[1];
pict.data[2] = av->data[2]; pict.data[2] = av->data[2];
pict.linesize[0] = av->context->width; pict.linesize[0] = av->context->width;
pict.linesize[1] = av->context->width /2; pict.linesize[1] = av->context->width >> 1;
pict.linesize[2] = av->context->width /2; 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 *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, 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[1] = src[1];
pict.data[2] = src[2]; pict.data[2] = src[2];
pict.linesize[0] = av->context->width; pict.linesize[0] = av->context->width;
pict.linesize[1] = pict.linesize[0]/2; pict.linesize[1] = pict.linesize[0]>>1;
pict.linesize[2] = pict.linesize[0]/2; pict.linesize[2] = pict.linesize[0]>>1;
} }
res = avcodec_encode_video( av->context, buf, buf_len, &pict ); res = avcodec_encode_video( av->context, buf, buf_len, &pict );

View File

@@ -1596,28 +1596,6 @@
</packing> </packing>
</child> </child>
<child>
<widget class="GtkSpinButton" id="spin_sampleduration">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 9999999 1 10 10</property>
<signal name="value_changed" handler="on_spin_sampleduration_value_changed" last_modification_time="Thu, 31 Mar 2005 03:33:17 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="label708"> <widget class="GtkLabel" id="label708">
<property name="visible">True</property> <property name="visible">True</property>
@@ -1673,43 +1651,6 @@ MLZO</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkFrame" id="frame198">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="label_yalign">0.5</property>
<property name="shadow_type">GTK_SHADOW_NONE</property>
<child>
<widget class="GtkLabel" id="label_samplerecord_duration">
<property name="visible">True</property>
<property name="label" translatable="yes">00:00:00</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">7</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
<child> <child>
<widget class="GtkCheckButton" id="button_sample_autoplay"> <widget class="GtkCheckButton" id="button_sample_autoplay">
<property name="visible">True</property> <property name="visible">True</property>
@@ -1834,6 +1775,56 @@ MLZO</property>
<property name="x_options">fill</property> <property name="x_options">fill</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="label_samplerecord_duration">
<property name="visible">True</property>
<property name="label" translatable="yes">00:00:00</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">7</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="spin_sampleduration">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">False</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 9999999 1 10 10</property>
<signal name="value_changed" handler="on_spin_sampleduration_value_changed" last_modification_time="Thu, 31 Mar 2005 03:33:17 GMT"/>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="y_options"></property>
</packing>
</child>
</widget> </widget>
<packing> <packing>
<property name="padding">0</property> <property name="padding">0</property>