X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=4884c641fa4383242efe4f63a9ddb7f6c4381343;hb=5a1b2bb96f2bd6b7ef4f8031763683726c02219d;hp=7e44e5098ff9c5069a0e517576d45738a28f4846;hpb=6fd57106820e676e368399d16b925bdc78d34621;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 7e44e509..4884c641 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -20,6 +20,7 @@ #include "asset.h" #include "assets.h" +#include "atrack.h" #include "audioalsa.h" #include "autos.h" #include "awindowgui.h" @@ -28,6 +29,7 @@ #include "bcdisplayinfo.h" #include "bcsignals.h" #include "bctimer.h" +#include "bctrace.h" #include "bdcreate.h" #include "brender.h" #include "cache.h" @@ -53,11 +55,13 @@ #include "file.h" #include "filesystem.h" #include "filexml.h" +#include "floatautos.h" #include "framecache.h" #include "gwindow.h" #include "gwindowgui.h" #include "keyframegui.h" #include "indexfile.h" +#include "intautos.h" #include "interlacemodes.h" #include "language.h" #include "levelwindowgui.h" @@ -77,6 +81,7 @@ #include "mwindow.h" #include "nestededls.h" #include "new.h" +#include "panautos.h" #include "patchbay.h" #include "playback3d.h" #include "playbackengine.h" @@ -107,6 +112,7 @@ #include "transition.h" #include "transportque.h" #include "vframe.h" +#include "vtrack.h" #include "versioninfo.h" #include "videodevice.inc" #include "videowindow.h" @@ -170,6 +176,7 @@ Commercials* MWindow::commercials = 0; MWindow::MWindow() : Thread(1, 0, 0) { + run_lock = new Mutex("MWindow::run_lock"); plugin_gui_lock = new Mutex("MWindow::plugin_gui_lock"); dead_plugin_lock = new Mutex("MWindow::dead_plugin_lock"); vwindows_lock = new Mutex("MWindow::vwindows_lock"); @@ -221,9 +228,8 @@ MWindow::MWindow() // Need to delete brender temporary here. MWindow::~MWindow() { + run_lock->lock("MWindow::~MWindow"); in_destructor = 1; - stop_playback(1); - stop_brender(); //printf("MWindow::~MWindow %d\n", __LINE__); gui->stop_drawing(); gui->remote_control->deactivate(); @@ -231,9 +237,6 @@ MWindow::~MWindow() #ifdef HAVE_DVB gui->channel_info->stop(); #endif - brender_lock->lock("MWindow::quit"); - delete brender; brender = 0; - brender_lock->unlock(); delete create_bd; create_bd = 0; delete create_dvd; create_dvd = 0; delete batch_render; batch_render = 0; @@ -336,23 +339,13 @@ MWindow::~MWindow() interlace_asset_fixmethods.remove_all_objects(); sighandler->terminate(); delete sighandler; + delete run_lock; } -void MWindow::quit(int unlock) +void MWindow::quit() { - if(unlock) gui->unlock_window(); - stop_playback(1); - - brender_lock->lock("MWindow::quit"); - delete brender; brender = 0; - brender_lock->unlock(); - - interrupt_indexes(); - clean_indexes(); - save_defaults(); gui->set_done(0); - if(unlock) gui->lock_window("MWindow::quit"); } void MWindow::init_error() @@ -641,14 +634,14 @@ int MWindow::init_ladspa_index(MWindow *mwindow, Preferences *preferences, strcpy(plugin_path, path); delete [] path; printf("init ladspa index: %s\n", plugin_dir); FILE *fp = fopen(index_path,"w"); - if( !fp ) { + 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); + init_plugin_index(mwindow, preferences, fp, plugin_path); fclose(fp); return 0; } @@ -796,6 +789,12 @@ void MWindow::init_preferences() BC_Signals::set_trap_hook(trap_hook, this); BC_Signals::set_catch_segv(preferences->trap_sigsegv); BC_Signals::set_catch_intr(preferences->trap_sigintr); + if( preferences->trap_sigsegv || preferences->trap_sigintr ) { + BC_Trace::enable_locks(); + } + else { + BC_Trace::disable_locks(); + } BC_WindowBase::get_resources()->popupmenu_btnup = preferences->popupmenu_btnup; } @@ -1064,21 +1063,21 @@ void MWindow::init_menus() interlace_asset_fixmethods.append(new InterlacefixmethodItem(string, x)); // Interlacing Modes - ILACEASSETMODELISTADD(BC_ILACE_MODE_UNDETECTED); // Not included in the list for the project options. + ILACEASSETMODELISTADD(ILACE_MODE_UNDETECTED); // Not included in the list for the project options. - ILACEASSETMODELISTADD(BC_ILACE_MODE_TOP_FIRST); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_TOP_FIRST); + ILACEASSETMODELISTADD(ILACE_MODE_TOP_FIRST); + ILACEPROJECTMODELISTADD(ILACE_MODE_TOP_FIRST); - ILACEASSETMODELISTADD(BC_ILACE_MODE_BOTTOM_FIRST); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_BOTTOM_FIRST); + ILACEASSETMODELISTADD(ILACE_MODE_BOTTOM_FIRST); + ILACEPROJECTMODELISTADD(ILACE_MODE_BOTTOM_FIRST); - ILACEASSETMODELISTADD(BC_ILACE_MODE_NOTINTERLACED); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_NOTINTERLACED); + ILACEASSETMODELISTADD(ILACE_MODE_NOTINTERLACED); + ILACEPROJECTMODELISTADD(ILACE_MODE_NOTINTERLACED); // Interlacing Fixing Methods - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_NONE); - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_UPONE); - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_DOWNONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_NONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_UPONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_DOWNONE); } void MWindow::init_indexes() @@ -1172,9 +1171,16 @@ int MWindow::brender_available(int position) return result; } -void MWindow::set_brender_start() +void MWindow::set_brender_range() { edl->session->brender_start = edl->local_session->get_selectionstart(1); + edl->session->brender_end = edl->local_session->get_selectionend(1); + + if(EQUIV(edl->session->brender_end, edl->session->brender_start)) + { + edl->session->brender_end = edl->tracks->total_video_length(); + } + restart_brender(); gui->draw_overlays(1); } @@ -1279,7 +1285,7 @@ int MWindow::put_commercial() void MWindow::stop_playback(int wait) { int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); + if( locked ) gui->unlock_window(); cwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, @@ -1293,7 +1299,7 @@ void MWindow::stop_playback(int wait) vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); vwindow->playback_engine->interrupt_playback(wait); } - if( locked ) gui->lock_window("MWindow::stop_playback"); + if( locked ) gui->lock_window("MWindow::stop_playback"); } int MWindow::load_filenames(ArrayList *filenames, @@ -2092,7 +2098,18 @@ ENABLE_BUFFER void MWindow::run() { + run_lock->lock("MWindow::run"); gui->run_window(); + stop_playback(1); + + brender_lock->lock("MWindow::run 1"); + delete brender; brender = 0; + brender_lock->unlock(); + + interrupt_indexes(); + clean_indexes(); + save_defaults(); + run_lock->unlock(); } void MWindow::show_vwindow() @@ -2159,6 +2176,14 @@ void MWindow::show_gwindow() gui->mainmenu->show_gwindow->set_checked(1); } +void MWindow::hide_gwindow() +{ + session->show_gwindow = 0; + + gwindow->gui->lock_window("MWindow::show_gwindow"); + gwindow->gui->hide_window(); + gwindow->gui->unlock_window(); +} void MWindow::show_lwindow() { @@ -3161,10 +3186,10 @@ void MWindow::dump_undo(FILE *fp) void MWindow::dump_exe(FILE *fp) { - char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; - sprintf(proc_path, "/proc/%d/exe", (int)getpid()); + char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; + sprintf(proc_path, "/proc/%d/exe", (int)getpid()); - int ret = -1, n = 100; + int ret = -1, n = 100; for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) { exe_path[len] = 0; strcpy(proc_path, exe_path); ret = 0; @@ -3476,6 +3501,8 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra EDLSession *session = edl->session; double old_framerate = session->frame_rate; double old_samplerate = session->sample_rate; + int old_auto_keyframes = session->auto_keyframes; + session->auto_keyframes = 0; int result = file->open_file(preferences, asset, 1, 0); if( !result && delete_tracks > 0 ) undo->update_undo_before(); @@ -3589,6 +3616,7 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra edl->resample(old_samplerate, session->sample_rate, TRACK_AUDIO); } delete file; + session->auto_keyframes = old_auto_keyframes; if( !result && delete_tracks > 0 ) { save_backup(); undo->update_undo_after(_("select asset"), LOAD_ALL); @@ -3617,3 +3645,34 @@ void MWindow::dump_plugindb(FILE *fp) plugindb->get(i)->dump(fp); } +FloatAuto* MWindow::get_float_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + FloatAutos *ptr = (FloatAutos*)patch->track->automation->autos[idx]; + return (FloatAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +IntAuto* MWindow::get_int_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + IntAutos *ptr = (IntAutos*)patch->track->automation->autos[idx]; + return (IntAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +PanAuto* MWindow::get_pan_auto(PatchGUI *patch) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + PanAutos *ptr = (PanAutos*)patch->track->automation->autos[AUTOMATION_PAN]; + return (PanAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +