}
+extern long cin_timezone;
ArrayList<PluginServer*>* MWindow::plugindb = 0;
Commercials* MWindow::commercials = 0;
strcpy(cin_lang,"en");
channeldb_buz = new ChannelDB;
channeldb_v4l2jpeg = new ChannelDB;
- //file_server = 0;
plugin_guis = 0;
dead_plugins = 0;
keyframe_threads = 0;
screens = 1;
in_destructor = 0;
speed_edl = 0;
+ proxy_beep = 0;
}
#ifdef HAVE_DVB
gui->channel_info->stop();
#endif
+ delete proxy_beep;
delete create_bd; create_bd = 0;
delete create_dvd; create_dvd = 0;
delete batch_render; batch_render = 0;
delete gwindow; gwindow = 0;
delete cwindow; cwindow = 0;
delete gui; gui = 0;
- //delete file_server; file_server = 0; // reusable
delete mainindexes; mainindexes = 0;
delete mainprogress; mainprogress = 0;
delete audio_cache; audio_cache = 0; // delete the cache after the assets
}
}
-//__timezone: Seconds west of UTC. 240sec/deg
- double tz_deg = -__timezone / 240.;
+// cin_timezone: Seconds west of UTC. 240sec/deg
+ double tz_deg = -cin_timezone / 240.;
// from Honolulu = -10, to New York = -5, 15deg/hr lat -150..-75
return tz_deg >= -10*15 && tz_deg <= -5*15 ? "NTSC" : "PAL";
}
else
create_defaults_path(path, CONFIG_FILE);
+ delete defaults;
defaults = new BC_Hash(path);
defaults->load();
}
case PLUGIN_TYPE_FFMPEG: {
server = new_ffmpeg_server(mwindow, path);
break; }
+ case PLUGIN_TYPE_LV2: {
+ server = new_lv2_server(mwindow, path);
+ break; }
}
if( !server ) continue;
plugins.append(server);
fprintf(fp, "%s\n", plugin_path);
init_plugin_index(mwindow, preferences, fp, plugin_path);
init_ffmpeg_index(mwindow, preferences, fp);
+ init_lv2_index(mwindow, preferences, fp);
fclose(fp);
return load_plugin_index(mwindow, index_path, plugin_path);
}
scan_plugin_index(mwindow, preferences, fp, plugin_dir, ".", idx);
}
-int MWindow::init_ladspa_index(MWindow *mwindow, Preferences *preferences,
- const char *index_path, const char *plugin_dir)
-{
- char plugin_path[BCTEXTLEN], *path = FileSystem::basepath(plugin_dir);
- strcpy(plugin_path, path); delete [] path;
- printf("init ladspa index: %s\n", plugin_dir);
- FILE *fp = fopen(index_path,"w");
- if( !fp ) {
- fprintf(stderr,_("MWindow::init_ladspa_index: "
- "can't create plugin index: %s\n"), index_path);
- return 1;
- }
- fprintf(fp, "%d\n", PLUGIN_FILE_VERSION);
- fprintf(fp, "%s\n", plugin_dir);
- init_plugin_index(mwindow, preferences, fp, plugin_path);
- fclose(fp);
- return 0;
-}
-
void MWindow::scan_plugin_index(MWindow *mwindow, Preferences *preferences, FILE *fp,
const char *plug_dir, const char *plug_path, int &idx)
{
void MWindow::init_plugin_tips(ArrayList<PluginServer*> &plugins, const char *lang)
{
- const char *cfg_path = File::get_cindat_path();
+ const char *dat_path = File::get_cindat_path();
char msg_path[BCTEXTLEN];
FILE *fp = 0;
if( BC_Resources::language[0] ) {
snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.%s",
- cfg_path, lang);
+ dat_path, lang);
fp = fopen(msg_path, "r");
}
if( !fp ) {
snprintf(msg_path, sizeof(msg_path), "%s/info/plugins.txt",
- cfg_path);
+ dat_path);
fp = fopen(msg_path, "r");
}
if( !fp ) return;
return !plugindb ? 0 : plugin_exists(plugin_path, *plugindb);
}
+void MWindow::remove_plugin_index()
+{
+ char index_path[BCTEXTLEN];
+ MWindow::create_defaults_path(index_path, PLUGIN_FILE);
+ ::remove(index_path);
+}
+
void MWindow::init_preferences()
{
preferences = new Preferences;
preferences->load_defaults(defaults);
+ const char *lv2_path = getenv("LV2_PATH");
+ if( lv2_path && strcmp(lv2_path, preferences->lv2_path) ) {
+ strncpy(preferences->lv2_path, lv2_path, sizeof(preferences->lv2_path));
+ remove_plugin_index();
+ }
+ else if( !lv2_path && preferences->lv2_path[0] ) {
+ File::setenv_path("LV2_PATH",preferences->lv2_path, 0);
+ }
session = new MainSession(this);
session->load_defaults(defaults);
// set x11_host, screens, window_config
{
zwindows_lock->lock("MWindow::del_mixer 0");
edl->mixers.del_mixer(zwindow->idx);
- zwindow->idx = -1;
if( session->selected_zwindow >= 0 ) {
int i = zwindows.number_of(zwindow);
if( i >= 0 && i < session->selected_zwindow )
}
}
-void MWindow::close_mixers()
+void MWindow::close_mixers(int destroy)
{
zwindows_lock->lock("MWindow::close_mixers");
- for( int i=0; i<zwindows.size(); ++i ) {
+ for( int i=zwindows.size(); --i>=0; ) {
ZWindow *zwindow = zwindows[i];
if( zwindow->idx < 0 ) continue;
+ zwindow->destroy = destroy;
ZWindowGUI *zgui = zwindow->zgui;
zgui->lock_window("MWindow::select_zwindow 0");
zgui->set_done(0);
for( int i=0; i<session->drag_assets->size(); ++i ) {
Indexable *indexable = session->drag_assets->get(i);
+ if( !indexable->have_video() ) continue;
ZWindow *zwindow = create_mixer(indexable);
new_mixers.append(zwindow);
}
for( int i=0; i<session->drag_clips->size(); ++i ) {
Indexable *indexable = (Indexable*)session->drag_clips->get(i);
+ if( !indexable->have_video() ) continue;
ZWindow *zwindow = create_mixer(indexable);
new_mixers.append(zwindow);
}
int MWindow::has_commercials()
{
+#ifdef HAVE_COMMERCIAL
return theme->use_commercials;
+#else
+ return 0;
+#endif
}
void MWindow::init_commercials()
{
+#ifdef HAVE_COMMERCIAL
if( !commercials ) {
commercials = new Commercials(this);
commercial_active = 0;
}
else
commercials->add_user();
+#endif
}
void MWindow::commit_commercial()
{
+#ifdef HAVE_COMMERCIAL
if( !commercial_active ) return;
commercial_active = 0;
if( !commercials ) return;
commercials->commitDb();
+#endif
}
void MWindow::undo_commercial()
{
+#ifdef HAVE_COMMERCIAL
if( !commercial_active ) return;
commercial_active = 0;
if( !commercials ) return;
commercials->undoDb();
+#endif
}
int MWindow::put_commercial()
{
+ int result = 0;
+#ifdef HAVE_COMMERCIAL
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
if( start >= end ) return 0;
const char *errmsg = 0;
int count = 0;
Tracks *tracks = edl->tracks;
- int result = 0;
//check it
for(Track *track=tracks->first; track && !errmsg; track=track->next) {
if( track->data_type != TRACK_VIDEO ) continue;
undo_commercial();
result = 1;
}
+#endif
return result;
}
gui->stop_transport(gui->get_window_lock() ? "MWindow::stop_transport" : 0);
}
+void MWindow::beep(double freq, double secs, double gain)
+{
+ if( !proxy_beep ) proxy_beep = new ProxyBeep(this);
+ proxy_beep->tone(freq, secs, gain);
+}
+
int MWindow::load_filenames(ArrayList<char*> *filenames,
int load_mode,
int update_filename)
edl->session->proxy_scale = 1;
edl->session->proxy_use_scaler = 0;
edl->session->proxy_auto_scale = 0;
+ edl->session->proxy_beep = 0;
edl->local_session->preview_start = 0;
edl->local_session->preview_end = 0;
edl->local_session->loop_playback = 0;
}
}
gui->unlock_window(); // to update progress bar
- render_proxy(orig_idxbls);
+ int ret = render_proxy(orig_idxbls);
gui->lock_window("MWindow::load_filenames");
+ if( ret >= 0 && edl->session->proxy_beep ) {
+ if( ret > 0 )
+ beep(2000., 1.5, 0.5);
+ else
+ beep(4000., 0.25, 0.5);
+ }
}
// need to update undo before project, since mwindow is unlocked & a new load
return 0;
}
-void MWindow::render_proxy(ArrayList<Indexable *> &new_idxbls)
+int MWindow::render_proxy(ArrayList<Indexable *> &new_idxbls)
{
Asset *format_asset = new Asset;
format_asset->format = FILE_FFMPEG;
&proxy_render.orig_idxbls, &proxy_render.orig_proxies);
}
format_asset->remove_user();
+ return !result ? proxy_render.needed_proxies.size() : -1;
}
void MWindow::test_plugins(EDL *new_edl, char *path)
}
fd = fopen(pfn, "w");
- if( fd ) {
- fprintf(fd, "0x%jx", min);
- fclose(fd);
- }
+ if( !fd ) return;
+ fprintf(fd, "0x%jx", min);
+ fclose(fd);
fd = fopen(pfn, "r");
if( !fd ) {
BC_Resources::init_fontconfig(string);
if(debug) PRINT_TRACE
-// Initialize before too much else is running
-// Preferences & theme are required for building MPEG table of contents
-
// Default project created here
init_edl();
if(debug) PRINT_TRACE
}
if(debug) PRINT_TRACE
select_zwindow(0);
- close_mixers();
+ close_mixers(0);
for( int i=0; i<edl->mixers.size(); ++i ) {
Mixer *mixer = edl->mixers[i];