510
515
img_stop_export( img_window_struct *img )
512
517
/* Do any additional tasks */
518
if( img->export_is_running > 3 )
520
kill( img->ffmpeg_export, SIGINT );
521
g_source_remove( img->source_id );
523
close(img->file_desc);
524
g_spawn_close_pid( img->ffmpeg_export );
526
/* Destroy images that were used */
527
cairo_surface_destroy( img->image1 );
528
cairo_surface_destroy( img->image2 );
529
cairo_surface_destroy( img->image_from );
530
cairo_surface_destroy( img->image_to );
531
cairo_surface_destroy( img->exported_image );
533
/* Close export dialog */
534
gtk_widget_destroy( img->export_dialog );
513
537
if( img->export_is_running > 1 )
515
539
/* Kill sox thread */
520
544
if( g_atomic_int_get( &img->sox_flags ) != 2 )
522
549
g_atomic_int_set( &img->sox_flags, 1 );
524
/* Export some more frames to unblock write on audio pipe */
525
for( i = 0; i < 10; i++ )
526
img_export_frame_to_ppm( img->exported_image,
551
/* Flush any buffered audio data from pipe */
552
fd = open( img->fifo, O_RDONLY );
553
while( read( fd, buf, sizeof( buf ) ) )
530
558
/* Wait for thread to finish */
541
if( img->export_is_running > 3 )
543
kill( img->ffmpeg_export, SIGINT );
544
g_source_remove( img->source_id );
546
close(img->file_desc);
547
g_spawn_close_pid( img->ffmpeg_export );
549
/* Destroy images that were used */
550
cairo_surface_destroy( img->image1 );
551
cairo_surface_destroy( img->image2 );
552
cairo_surface_destroy( img->image_from );
553
cairo_surface_destroy( img->image_to );
554
cairo_surface_destroy( img->exported_image );
556
/* Close export dialog */
557
gtk_widget_destroy( img->export_dialog );
560
569
/* If we created FIFO, we need to destroy it now */
614
623
g_list_last( img->work_slide->points )->data :
617
if( gtk_tree_model_iter_next( model, &img->cur_ss_iter ) )
626
if( last_transition && gtk_tree_model_iter_next( model, &img->cur_ss_iter ) )
619
628
/* We have next iter, so prepare for next round */
620
629
cairo_surface_destroy( img->image1 );
621
630
img->image1 = img->image2;
622
631
gtk_tree_model_get( model, &img->cur_ss_iter, 1, &img->work_slide, -1 );
624
if( ! img->work_slide->filename )
633
if( ! img->work_slide->o_filename )
626
635
img_scale_gradient( img->work_slide->gradient,
627
636
img->work_slide->g_start_point,
632
641
img->video_size[1], NULL, &img->image2 );
634
643
else if( preview && img->low_quality )
635
img_scale_image( img->work_slide->filename, img->video_ratio,
644
img_scale_image( img->work_slide->r_filename, img->video_ratio,
636
645
0, img->video_size[1], img->distort_images,
637
646
img->background_color, NULL, &img->image2 );
639
img_scale_image( img->work_slide->filename, img->video_ratio,
648
img_scale_image( img->work_slide->r_filename, img->video_ratio,
640
649
0, 0, img->distort_images,
641
650
img->background_color, NULL, &img->image2 );
1601
1610
gtk_widget_destroy( dialog );
1614
img_exporter_3gp( img_window_struct *img )
1617
const gchar *filename;
1622
/* Additional options - 3GP only */
1623
GtkWidget *frame1, *frame2;
1626
GtkWidget *normal_combo;
1629
/* This function call should be the first thing exporter does, since this
1630
* function will take some preventive measures. */
1631
dialog = img_create_export_dialog( img, _("3GP export"),
1632
GTK_WINDOW( img->imagination_window ),
1635
/* If dialog is NULL, abort. */
1636
if( dialog == NULL )
1639
/* Add any export format specific GUI elements here */
1640
hbox = gtk_hbox_new( TRUE, 5 );
1641
gtk_container_add( GTK_CONTAINER( vbox ), hbox );
1643
frame1 = gtk_frame_new( NULL );
1644
gtk_box_pack_start( GTK_BOX( hbox ), frame1, FALSE, FALSE, 0 );
1646
label = gtk_label_new( _("<b>Video Size</b>") );
1647
gtk_label_set_use_markup( GTK_LABEL( label ), TRUE );
1648
gtk_frame_set_label_widget( GTK_FRAME( frame1 ), label );
1650
normal_combo = _gtk_combo_box_new_text(FALSE);
1651
gtk_container_add (GTK_CONTAINER (frame1), normal_combo);
1654
GtkListStore *store = GTK_LIST_STORE( gtk_combo_box_get_model(GTK_COMBO_BOX( normal_combo ) ) );
1656
gtk_list_store_append( store, &iter );
1657
gtk_list_store_set( store, &iter, 0, "128 x 96", -1 );
1658
gtk_list_store_append( store, &iter );
1659
gtk_list_store_set( store, &iter, 0, "176 x 144", -1 );
1660
gtk_list_store_append( store, &iter );
1661
gtk_list_store_set( store, &iter, 0, "352 x 288", -1 );
1662
gtk_list_store_append( store, &iter );
1663
gtk_list_store_set( store, &iter, 0, "704 x 576", -1 );
1665
gtk_combo_box_set_active( GTK_COMBO_BOX( normal_combo ), 0 );
1666
gtk_widget_show_all( dialog );
1668
/* Run dialog and abort if needed */
1669
if( gtk_dialog_run( GTK_DIALOG( dialog ) ) != GTK_RESPONSE_ACCEPT )
1671
gtk_widget_destroy( dialog );
1675
/* User is serious, so we better prepare ffmpeg command line;) */
1676
img->export_is_running = 1;
1677
img->export_fps = 25;
1678
filename = gtk_entry_get_text( entry );
1680
/* Any additional calculation can be placed here. */
1681
switch(gtk_combo_box_get_active(GTK_COMBO_BOX(normal_combo)) )
1704
cmd_line = g_strdup_printf( "ffmpeg -f image2pipe -vcodec ppm -r %.02f "
1705
"-i pipe: <#AUDIO#> -f 3gp -s %dx%d "
1706
"-vcodec h263 -acodec libfaac -b 192k -ab 32k "
1707
"-ar 8000 -ac 1 -y \"%s.3gp\"",
1709
width, height, filename );
1710
img->export_cmd_line = cmd_line;
1712
/* Initiate stage 2 of export - audio processing */
1713
g_idle_add( (GSourceFunc)img_prepare_audio, img );
1715
gtk_widget_destroy( dialog );
1603
1717
/* ****************************************************************************
1604
1718
* End exporters
1605
1719
* ************************************************************************* */