X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmain.C;h=b1f1fb6995c38537c5573bcd2b565ae414f41e6f;hb=86950895295c76a58e22d7a770092bf327309437;hp=472578718657664d7b230ca445cd08622e8c7931;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 47257871..b1f1fb69 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -1,6 +1,7 @@ /* * CINELERRA * Copyright (C) 2010 Adam Williams + * Copyright (C) 2003-2016 Cinelerra CV contributors * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -22,6 +23,7 @@ #include "arraylist.h" #include "batchrender.h" #include "bcsignals.h" +#include "cstrdup.h" #include "edl.h" #include "file.h" #include "filexml.h" @@ -42,9 +44,28 @@ #include #include #include +#include +#include #ifdef LEAKER -#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n) +#if 0 // track allocators +#include +#define BT_BUF_SIZE 100 +static void leaker() +{ + void *buffer[BT_BUF_SIZE]; + int nptrs = backtrace(buffer, BT_BUF_SIZE); + char **trace = backtrace_symbols(buffer, nptrs); + if( !trace ) return; + for( int i=0; igui->lock_window("main"); //PRINT_TRACE - mwindow->load_filenames(filenames, LOADMODE_REPLACE); + mwindow->load_filenames(filenames, + LOADMODE_REPLACE, LOADMODE_EDL_CLIP); //PRINT_TRACE if( filenames->size() == 1 ) mwindow->gui->mainmenu->add_load(filenames->get(0)); @@ -102,11 +124,40 @@ public: long cin_timezone; +static float get_layout_scale() +{ + char config_path[BCTEXTLEN]; + sprintf(config_path,"%s/%s", File::get_config_path(), CONFIG_FILE); + FILE *fp = fopen(config_path,"r"); + if( !fp ) return 0; + float scale = 0; + char line[BCTEXTLEN]; + line[BCTEXTLEN-1] = 0; + while( fgets(line, BCTEXTLEN-1, fp) ) { + if( !strncmp(line, "LAYOUT_SCALE ",12+1) ) { + scale = atof(line+12); + break; + } + } + fclose(fp); + return scale; +} + +/******************************************************************* +* @mainpage +* Cinelerra-GG is a professional video editor for Linux. It is timeline +* based, supports hundreds of (de)coders, LADSPA and LV2 audio plugins, +* FFMPEG audio/video plugins, plus built-in audio/video plugins. +* Screen sizes up to 8K, any frame rate, extensive compositing features, +* title generator and more. +* +********************************************************************/ int main(int argc, char *argv[]) { // handle command line arguments first srand(time(0)); ArrayList filenames; + filenames.set_array_delete(); FileSystem fs; time_t st; time(&st); @@ -127,8 +178,9 @@ int main(int argc, char *argv[]) batch_path[0] = 0; deamon_path[0] = 0; Units::init(); - - File::init_cin_path(); + const char *lang = getenv("LANGUAGE"); + if( lang ) lang = cstrdup(lang); + File::init_cin_env_vars(); const char *locale_path = File::get_locale_path(); const char *cin = File::get_cin(); @@ -239,7 +291,10 @@ int main(int argc, char *argv[]) } } - + float scale = operation == DO_GUI ? + get_layout_scale() : 1; + // runs XInitThreads + BC_WindowBase::init_resources(scale); if( operation == DO_GUI || operation == DO_DEAMON || operation == DO_DEAMON_FG || @@ -254,9 +309,18 @@ int main(int argc, char *argv[]) #ifndef COPYRIGHTTEXT2 #define COPYRIGHTTEXT2 "" #endif +#ifndef COPYRIGHTTEXT3 +#define COPYRIGHTTEXT3 "" +#endif + fprintf(stderr, "%s %s - %s\n%s", PROGRAM_NAME,CINELERRA_VERSION, AboutPrefs::build_timestamp, REPOMAINTXT COPYRIGHTTEXT1 COPYRIGHTTEXT2); + fprintf(stderr, "%s", COPYRIGHTTEXT3); + fprintf(stderr, "%s", COPYRIGHTTEXT4); + fprintf(stderr,"\n"); + fprintf(stderr, "%s \n", AboutPrefs::ffmpeg_version); + fprintf(stderr,"\n"); fprintf(stderr, "%s is free software, covered by the GNU General Public License,\n" "and you are welcome to change it and/or distribute copies of it under\n" "certain conditions. There is absolutely no warranty for %s.\n\n", @@ -308,7 +372,7 @@ int main(int argc, char *argv[]) break; } case DO_BATCHRENDER: { - BatchRenderThread *thread = new BatchRenderThread; + BatchRenderThread *thread = new BatchRenderThread(0); thread->start_rendering(config_path, batch_path); break; } @@ -320,7 +384,7 @@ int main(int argc, char *argv[]) MWindow mwindow; mwindow.create_objects(1, !filenames.total, config_path); CommandLineThread *thread = 0; - if( mwindow.preferences->perpetual_session && load_perpetual ) + if( load_perpetual ) mwindow.load_undo_data(); //SET_TRACE // load the initial files on seperate tracks @@ -354,16 +418,18 @@ int main(int argc, char *argv[]) } if( restart <= 0 ) done = 1; - mwindow.save_defaults(); - if( mwindow.preferences->perpetual_session ) - mwindow.save_undo_data(); + mwindow.save_undo_data(); //PRINT_TRACE filenames.remove_all_objects(); delete thread; } if( restart < 0 ) { + if( lang ) // reset to cmdline state + setenv("LANGUAGE", lang, 1); + else + unsetenv("LANGUAGE"); char exe_path[BCTEXTLEN]; int len = readlink("/proc/self/exe", exe_path, sizeof(exe_path)-1); if( len < 0 ) break; @@ -381,11 +447,21 @@ DISABLE_BUFFER } filenames.remove_all_objects(); + delete [] lang; Units::finit(); + BC_WindowBase::finit_resources(); time_t et; time(&et); long dt = et - st; printf("Session time: %ld:%02ld:%02ld\n", dt/3600, dt%3600/60, dt%60); + struct rusage ru; + getrusage(RUSAGE_SELF, &ru); + long usr_ms = ru.ru_utime.tv_sec*1000 + ru.ru_utime.tv_usec/1000; + long us = usr_ms/1000; int ums = usr_ms%1000; + long sys_ms = ru.ru_stime.tv_sec*1000 + ru.ru_stime.tv_usec/1000; + long ss = sys_ms/1000; int sms = sys_ms%1000; + printf("Cpu time: user: %ld:%02ld:%02ld.%03d sys: %ld:%02ld:%02ld.%03d\n", + us/3600, us%3600/60, us%60, ums, ss/3600, ss%3600/60, ss%60, sms); return 0; }