/*
* CINELERRA
* Copyright (C) 2010 Adam Williams <broadcast at earthling dot net>
+ * 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
#include "arraylist.h"
#include "batchrender.h"
#include "bcsignals.h"
+#include "cstrdup.h"
#include "edl.h"
#include "file.h"
#include "filexml.h"
#include <sys/resource.h>
#ifdef LEAKER
-#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n)
+#if 0 // track allocators
+#include <execinfo.h>
+#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; i<nptrs; ) printf("%s ", trace[i++]);
+ printf("\n");
+ free(trace);
+}
+#define STRB ;leaker()
+#else
+#define STRB
+#endif
+#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n)STRB
#define STRD(v) printf("==del %p from %p\n", v, __builtin_return_address(0))
void *operator new(size_t n) { void *vp = malloc(n); STRC(vp); bzero(vp,n); return vp; }
void operator delete(void *t) { STRD(t); free(t); }
//PRINT_TRACE
mwindow->gui->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));
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<char*> filenames;
+ filenames.set_array_delete();
FileSystem fs;
time_t st; time(&st);
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();
}
}
-
+ 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 ||
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
}
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;
}
filenames.remove_all_objects();
+ delete [] lang;
Units::finit();
+ BC_WindowBase::finit_resources();
time_t et; time(&et);
long dt = et - st;