From: Good Guy Date: Fri, 17 Jun 2016 20:54:39 +0000 (-0600) Subject: bd/dvd create reworks, Makefile updates X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=29cc4023b50d6f7f9ab518978d8c9e839832b900;p=goodguy%2Fhistory.git bd/dvd create reworks, Makefile updates --- diff --git a/cinelerra-5.1/Makefile.am b/cinelerra-5.1/Makefile.am index a3d3aa64..b15546ca 100644 --- a/cinelerra-5.1/Makefile.am +++ b/cinelerra-5.1/Makefile.am @@ -1,8 +1,8 @@ -PKG_CFLAGS_ := $(CFLAGS) -PKG_CXXFLAGS_ := $(CXXFLAGS) -PKG_LDFLAGS_ := $(LDFLAGS) +CFLAGS_ := $(CFLAGS) +CXXFLAGS_ := $(CXXFLAGS) +LDFLAGS_ := $(LDFLAGS) -export PKG_CFLAGS_ PKG_CXXFLAGS_ PKG_LDFLAGS_ +export CFLAGS_ CXXFLAGS_ LDFLAGS_ unexport CFLAGS CXXFLAGS LDFLAGS AM_MAKEFLAGS := -j$(WANT_JOBS) diff --git a/cinelerra-5.1/Makefile.devel b/cinelerra-5.1/Makefile.devel index 7996f322..beb20ec0 100644 --- a/cinelerra-5.1/Makefile.devel +++ b/cinelerra-5.1/Makefile.devel @@ -2,7 +2,7 @@ TOPDIR := $(CURDIR) CFLAGS ?= -ggdb -export CFLAGS +export CFLAGS_ := $(CFLAGS) cpus:=$(shell grep -c "^proc" /proc/cpuinfo) jobs:=-j$(shell echo $$(($(cpus) + $(cpus)/2 +2))) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 9715e368..8abbcdc3 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -1,5 +1,4 @@ -TOPDIR ?= $(CURDIR)/.. -export TOPDIR +export TOPDIR ?= $(CURDIR)/.. include $(TOPDIR)/global_config OBJS = \ @@ -13,15 +12,15 @@ OBJS = \ $(OBJDIR)/amodule.o \ $(OBJDIR)/androidcontrol.o \ $(OBJDIR)/apatchgui.o \ - $(OBJDIR)/aplugin.o \ $(OBJDIR)/apluginarray.o \ + $(OBJDIR)/aplugin.o \ $(OBJDIR)/apluginset.o \ $(OBJDIR)/arender.o \ $(OBJDIR)/assetedit.o \ + $(OBJDIR)/asset.o \ $(OBJDIR)/assetpopup.o \ $(OBJDIR)/assetremove.o \ $(OBJDIR)/assets.o \ - $(OBJDIR)/asset.o \ $(OBJDIR)/atrack.o \ $(OBJDIR)/attachmentpoint.o \ $(OBJDIR)/audio1394.o \ @@ -30,56 +29,66 @@ OBJS = \ $(OBJDIR)/audiodvb.o \ $(OBJDIR)/audioesound.o \ $(OBJDIR)/audioidevice.o \ + $(OBJDIR)/audiompeg.o \ $(OBJDIR)/audioodevice.o \ $(OBJDIR)/audiooss.o \ - $(OBJDIR)/auto.o \ - $(OBJDIR)/autos.o \ + $(OBJDIR)/audiov4l2mpeg.o \ $(OBJDIR)/autoconf.o \ $(OBJDIR)/automation.o \ + $(OBJDIR)/auto.o \ + $(OBJDIR)/autos.o \ $(OBJDIR)/avc1394control.o \ $(OBJDIR)/avc1394transport.o \ - $(OBJDIR)/awindow.o \ $(OBJDIR)/awindowgui.o \ $(OBJDIR)/awindowmenu.o \ + $(OBJDIR)/awindow.o \ $(OBJDIR)/batch.o \ $(OBJDIR)/batchrender.o \ + $(OBJDIR)/bdcreate.o \ $(OBJDIR)/bitspopup.o \ $(OBJDIR)/brender.o \ $(OBJDIR)/browsebutton.o \ $(OBJDIR)/byteorderpopup.o \ - $(OBJDIR)/cache.o \ $(OBJDIR)/cachebase.o \ + $(OBJDIR)/cache.o \ $(OBJDIR)/canvas.o \ $(OBJDIR)/canvastools.o \ - $(OBJDIR)/channel.o \ $(OBJDIR)/channeldb.o \ $(OBJDIR)/channeledit.o \ + $(OBJDIR)/channelinfo.o \ + $(OBJDIR)/channel.o \ $(OBJDIR)/channelpicker.o \ $(OBJDIR)/chantables.o \ - $(OBJDIR)/clipedit.o \ $(OBJDIR)/cicolors.o \ + $(OBJDIR)/clipedit.o \ $(OBJDIR)/colorpicker.o \ + $(OBJDIR)/commercials.o \ $(OBJDIR)/commonrender.o \ - $(OBJDIR)/confirmsave.o \ $(OBJDIR)/confirmquit.o \ + $(OBJDIR)/confirmsave.o \ $(OBJDIR)/cpanel.o \ $(OBJDIR)/cplayback.o \ $(OBJDIR)/ctimebar.o \ $(OBJDIR)/ctracking.o \ $(OBJDIR)/cursor.o \ - $(OBJDIR)/cwindow.o \ $(OBJDIR)/cwindowgui.o \ + $(OBJDIR)/cwindow.o \ $(OBJDIR)/cwindowtool.o \ + $(OBJDIR)/dbwindow.o \ $(OBJDIR)/dcoffset.o \ + $(OBJDIR)/deleteallindexes.o \ $(OBJDIR)/device1394input.o \ - $(OBJDIR)/devicedvbinput.o \ $(OBJDIR)/device1394output.o \ - $(OBJDIR)/deleteallindexes.o \ - $(OBJDIR)/dvbtune.o \ + $(OBJDIR)/devicedvbinput.o \ + $(OBJDIR)/devicempeginput.o \ + $(OBJDIR)/devicev4l2base.o \ + $(OBJDIR)/devicev4l2input.o \ $(OBJDIR)/drivesync.o \ - $(OBJDIR)/edit.o \ + $(OBJDIR)/dvbtune.o \ + $(OBJDIR)/dvdcreate.o \ $(OBJDIR)/edithandles.o \ $(OBJDIR)/editlength.o \ + $(OBJDIR)/edit.o \ $(OBJDIR)/editpanel.o \ $(OBJDIR)/editpopup.o \ $(OBJDIR)/edits.o \ @@ -88,21 +97,22 @@ OBJS = \ $(OBJDIR)/exportedl.o \ $(OBJDIR)/fadeengine.o \ $(OBJDIR)/ffmpeg.o \ - $(OBJDIR)/file.o \ $(OBJDIR)/fileac3.o \ - $(OBJDIR)/filebase.o \ $(OBJDIR)/filebaseaudio.o \ + $(OBJDIR)/filebase.o \ $(OBJDIR)/filebaseulaw.o \ $(OBJDIR)/filecr2.o \ - $(OBJDIR)/fileffmpeg.o \ + $(OBJDIR)/filedb.o \ $(OBJDIR)/filedv.o \ $(OBJDIR)/fileexr.o \ + $(OBJDIR)/fileffmpeg.o \ $(OBJDIR)/fileflac.o \ $(OBJDIR)/fileformat.o \ $(OBJDIR)/filegif.o \ - $(OBJDIR)/filelist.o \ $(OBJDIR)/filejpeg.o \ + $(OBJDIR)/filelist.o \ $(OBJDIR)/filempeg.o \ + $(OBJDIR)/file.o \ $(OBJDIR)/fileogg.o \ $(OBJDIR)/filepng.o \ $(OBJDIR)/filescene.o \ @@ -115,14 +125,14 @@ OBJS = \ $(OBJDIR)/floatauto.o \ $(OBJDIR)/floatautos.o \ $(OBJDIR)/formatcheck.o \ - $(OBJDIR)/formatpresets.o \ $(OBJDIR)/formatpopup.o \ + $(OBJDIR)/formatpresets.o \ $(OBJDIR)/formattools.o \ $(OBJDIR)/fourier.o \ $(OBJDIR)/framecache.o \ $(OBJDIR)/garbage.o \ - $(OBJDIR)/gwindow.o \ $(OBJDIR)/gwindowgui.o \ + $(OBJDIR)/gwindow.o \ $(OBJDIR)/iec61883input.o \ $(OBJDIR)/iec61883output.o \ $(OBJDIR)/indexable.o \ @@ -133,28 +143,28 @@ OBJS = \ $(OBJDIR)/intautos.o \ $(OBJDIR)/interfaceprefs.o \ $(OBJDIR)/interlacemodes.o \ - $(OBJDIR)/keyframe.o \ $(OBJDIR)/keyframegui.o \ + $(OBJDIR)/keyframehandles.o \ + $(OBJDIR)/keyframe.o \ $(OBJDIR)/keyframepopup.o \ $(OBJDIR)/keyframes.o \ - $(OBJDIR)/keyframehandles.o \ $(OBJDIR)/labeledit.o \ $(OBJDIR)/labelnavigate.o \ $(OBJDIR)/labels.o \ - $(OBJDIR)/levelwindow.o \ $(OBJDIR)/levelwindowgui.o \ + $(OBJDIR)/levelwindow.o \ $(OBJDIR)/libdv.o \ $(OBJDIR)/libmjpeg.o \ $(OBJDIR)/loadbalance.o \ $(OBJDIR)/loadfile.o \ $(OBJDIR)/loadmode.o \ $(OBJDIR)/localsession.o \ - $(OBJDIR)/main.o \ $(OBJDIR)/mainclock.o \ $(OBJDIR)/maincursor.o \ $(OBJDIR)/mainerror.o \ $(OBJDIR)/mainindexes.o \ $(OBJDIR)/mainmenu.o \ + $(OBJDIR)/main.o \ $(OBJDIR)/mainprogress.o \ $(OBJDIR)/mainsession.o \ $(OBJDIR)/mainundo.o \ @@ -163,6 +173,7 @@ OBJS = \ $(OBJDIR)/maskautos.o \ $(OBJDIR)/maskengine.o \ $(OBJDIR)/mbuttons.o \ + $(OBJDIR)/mediadb.o \ $(OBJDIR)/menuaeffects.o \ $(OBJDIR)/menuattacheffect.o \ $(OBJDIR)/menuattachtransition.o \ @@ -173,13 +184,13 @@ OBJS = \ $(OBJDIR)/meterpanel.o \ $(OBJDIR)/module.o \ $(OBJDIR)/mtimebar.o \ - $(OBJDIR)/mwindow.o \ $(OBJDIR)/mwindowedit.o \ $(OBJDIR)/mwindowgui.o \ $(OBJDIR)/mwindowmove.o \ + $(OBJDIR)/mwindow.o \ $(OBJDIR)/nestededls.o \ - $(OBJDIR)/new.o \ $(OBJDIR)/newfolder.o \ + $(OBJDIR)/new.o \ $(OBJDIR)/overlayframe.o \ $(OBJDIR)/packagedispatcher.o \ $(OBJDIR)/packagerenderer.o \ @@ -197,75 +208,83 @@ OBJS = \ $(OBJDIR)/playbackengine.o \ $(OBJDIR)/playbackprefs.o \ $(OBJDIR)/playtransport.o \ - $(OBJDIR)/plugin.o \ - $(OBJDIR)/pluginaclient.o \ $(OBJDIR)/pluginaclientlad.o \ + $(OBJDIR)/pluginaclient.o \ $(OBJDIR)/pluginarray.o \ $(OBJDIR)/pluginclient.o \ $(OBJDIR)/plugindialog.o \ + $(OBJDIR)/pluginfclient.o \ + $(OBJDIR)/plugin.o \ $(OBJDIR)/pluginpopup.o \ - $(OBJDIR)/pluginset.o \ $(OBJDIR)/pluginserver.o \ + $(OBJDIR)/pluginset.o \ $(OBJDIR)/plugintclient.o \ $(OBJDIR)/plugintoggles.o \ $(OBJDIR)/pluginvclient.o \ $(OBJDIR)/preferences.o \ $(OBJDIR)/preferencesthread.o \ - $(OBJDIR)/presets.o \ $(OBJDIR)/presetsgui.o \ + $(OBJDIR)/presets.o \ $(OBJDIR)/question.o \ $(OBJDIR)/quit.o \ $(OBJDIR)/recconfirmdelete.o \ - $(OBJDIR)/record.o \ $(OBJDIR)/recordableatracks.o \ $(OBJDIR)/recordablevtracks.o \ $(OBJDIR)/recordaudio.o \ + $(OBJDIR)/recordbatches.o \ $(OBJDIR)/recordconfig.o \ $(OBJDIR)/recordgui.o \ $(OBJDIR)/recordlabel.o \ $(OBJDIR)/recordmonitor.o \ + $(OBJDIR)/record.o \ $(OBJDIR)/recordprefs.o \ $(OBJDIR)/recordscopes.o \ $(OBJDIR)/recordthread.o \ $(OBJDIR)/recordtransport.o \ $(OBJDIR)/recordvideo.o \ + $(OBJDIR)/remotecontrol.o \ $(OBJDIR)/removefile.o \ - $(OBJDIR)/render.o \ - $(OBJDIR)/renderfarm.o \ - $(OBJDIR)/renderfarmclient.o \ $(OBJDIR)/renderengine.o \ + $(OBJDIR)/renderfarmclient.o \ + $(OBJDIR)/renderfarm.o \ + $(OBJDIR)/render.o \ $(OBJDIR)/renderprofiles.o \ $(OBJDIR)/resample.o \ + $(OBJDIR)/rescale.o \ $(OBJDIR)/resizetrackthread.o \ $(OBJDIR)/resourcepixmap.o \ $(OBJDIR)/resourcethread.o \ - $(OBJDIR)/samples.o \ $(OBJDIR)/samplescroll.o \ + $(OBJDIR)/samples.o \ $(OBJDIR)/savefile.o \ $(OBJDIR)/scenegraph.o \ $(OBJDIR)/scopewindow.o \ $(OBJDIR)/setformat.o \ $(OBJDIR)/sha1.o \ $(OBJDIR)/sharedlocation.o \ + $(OBJDIR)/shbtnprefs.o \ $(OBJDIR)/shmemory.o \ $(OBJDIR)/sighandler.o \ + $(OBJDIR)/signalstatus.o \ $(OBJDIR)/splashgui.o \ $(OBJDIR)/statusbar.o \ + $(OBJDIR)/strack.o \ + $(OBJDIR)/swindow.o \ $(OBJDIR)/theme.o \ $(OBJDIR)/threadexec.o \ $(OBJDIR)/threadloader.o \ - $(OBJDIR)/timelinepane.o \ $(OBJDIR)/timebar.o \ $(OBJDIR)/timeentry.o \ + $(OBJDIR)/timelinepane.o \ $(OBJDIR)/tipwindow.o \ - $(OBJDIR)/track.o \ $(OBJDIR)/trackcanvas.o \ $(OBJDIR)/tracking.o \ - $(OBJDIR)/tracks.o \ + $(OBJDIR)/track.o \ $(OBJDIR)/trackscroll.o \ $(OBJDIR)/tracksedit.o \ - $(OBJDIR)/transition.o \ + $(OBJDIR)/tracks.o \ $(OBJDIR)/transitionhandles.o \ + $(OBJDIR)/transition.o \ $(OBJDIR)/transitionpopup.o \ $(OBJDIR)/transportque.o \ $(OBJDIR)/tunerserver.o \ @@ -276,59 +295,39 @@ OBJS = \ $(OBJDIR)/vdevicebase.o \ $(OBJDIR)/vdevicebuz.o \ $(OBJDIR)/vdevicedvb.o \ + $(OBJDIR)/vdevicempeg.o \ $(OBJDIR)/vdeviceprefs.o \ - $(OBJDIR)/vdevicev4l.o \ - $(OBJDIR)/vdevicev4l2.o \ $(OBJDIR)/vdevicev4l2jpeg.o \ + $(OBJDIR)/vdevicev4l2mpeg.o \ + $(OBJDIR)/vdevicev4l2.o \ + $(OBJDIR)/vdevicev4l.o \ $(OBJDIR)/vdevicex11.o \ $(OBJDIR)/vedit.o \ $(OBJDIR)/vedits.o \ $(OBJDIR)/videodevice.o \ $(OBJDIR)/viewmenu.o \ - $(OBJDIR)/virtualnode.o \ $(OBJDIR)/virtualaconsole.o \ $(OBJDIR)/virtualanode.o \ $(OBJDIR)/virtualconsole.o \ + $(OBJDIR)/virtualnode.o \ $(OBJDIR)/virtualvconsole.o \ $(OBJDIR)/virtualvnode.o \ $(OBJDIR)/vmodule.o \ $(OBJDIR)/vpatchgui.o \ $(OBJDIR)/vplayback.o \ - $(OBJDIR)/vplugin.o \ $(OBJDIR)/vpluginarray.o \ + $(OBJDIR)/vplugin.o \ $(OBJDIR)/vpluginset.o \ - $(OBJDIR)/vtimebar.o \ $(OBJDIR)/vrender.o \ - $(OBJDIR)/vtrack.o \ + $(OBJDIR)/vtimebar.o \ $(OBJDIR)/vtracking.o \ - $(OBJDIR)/vwindow.o \ + $(OBJDIR)/vtrack.o \ $(OBJDIR)/vwindowgui.o \ + $(OBJDIR)/vwindow.o \ $(OBJDIR)/wavecache.o \ + $(OBJDIR)/wwindow.o \ $(OBJDIR)/zoombar.o \ $(OBJDIR)/zoompanel.o \ -\ - $(OBJDIR)/audiompeg.o \ - $(OBJDIR)/audiov4l2mpeg.o \ - $(OBJDIR)/bdcreate.o \ - $(OBJDIR)/channelinfo.o \ - $(OBJDIR)/commercials.o \ - $(OBJDIR)/dbwindow.o \ - $(OBJDIR)/devicempeginput.o \ - $(OBJDIR)/devicev4l2base.o \ - $(OBJDIR)/devicev4l2input.o \ - $(OBJDIR)/dvdcreate.o \ - $(OBJDIR)/filedb.o \ - $(OBJDIR)/mediadb.o \ - $(OBJDIR)/recordbatches.o \ - $(OBJDIR)/remotecontrol.o \ - $(OBJDIR)/shbtnprefs.o \ - $(OBJDIR)/signalstatus.o \ - $(OBJDIR)/strack.o \ - $(OBJDIR)/swindow.o \ - $(OBJDIR)/vdevicempeg.o \ - $(OBJDIR)/vdevicev4l2mpeg.o \ - $(OBJDIR)/wwindow.o \ - $(OBJDIR)/pluginfclient.o \ # $(OBJDIR)/renderfarmfsclient.o \ # $(OBJDIR)/renderfarmfsserver.o \ diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C index 9d52cd59..3fa755bc 100644 --- a/cinelerra-5.1/cinelerra/batchrender.C +++ b/cinelerra-5.1/cinelerra/batchrender.C @@ -206,6 +206,7 @@ BatchRenderThread::BatchRenderThread(MWindow *mwindow) default_job = 0; boot_defaults = 0; preferences = 0; + warn = 1; render = 0; file_entries = 0; } @@ -220,6 +221,7 @@ BatchRenderThread::BatchRenderThread() default_job = 0; boot_defaults = 0; preferences = 0; + warn = 1; render = 0; file_entries = 0; } @@ -236,8 +238,9 @@ BatchRenderThread::~BatchRenderThread() } } -void BatchRenderThread::reset() +void BatchRenderThread::reset(int warn) { + if( warn ) this->warn = 1; current_job = 0; rendering_job = -1; delete default_job; default_job = 0; @@ -310,7 +313,11 @@ void BatchRenderThread::load_jobs(char *path, Preferences *preferences) { if(!(result = file.read_tag())) { - if(file.tag.title_is("JOB")) + if(file.tag.title_is("JOBS")) + { + warn = file.tag.get_property("WARN", 1); + } + else if(file.tag.title_is("JOB")) { BatchRenderJob *job; jobs.append(job = new BatchRenderJob(preferences)); @@ -323,6 +330,10 @@ void BatchRenderThread::load_jobs(char *path, Preferences *preferences) void BatchRenderThread::save_jobs(char *path) { FileXML file; + file.tag.set_title("JOBS"); + file.tag.set_property("WARN", warn); + file.append_tag(); + file.append_newline(); for(int i = 0; i < jobs.total; i++) { @@ -341,12 +352,7 @@ void BatchRenderThread::load_defaults(BC_Hash *defaults) if(default_job) { default_job->asset->load_defaults(defaults, - "BATCHRENDER_", - 1, - 1, - 1, - 1, - 1); + "BATCHRENDER_", 1, 1, 1, 1, 1); default_job->fix_strategy(); } @@ -363,12 +369,7 @@ void BatchRenderThread::save_defaults(BC_Hash *defaults) if(default_job) { default_job->asset->save_defaults(defaults, - "BATCHRENDER_", - 1, - 1, - 1, - 1, - 1); + "BATCHRENDER_", 1, 1, 1, 1, 1); defaults->update("BATCHRENDER_STRATEGY", default_job->strategy); } for(int i = 0; i < BATCHRENDER_COLUMNS; i++) @@ -469,43 +470,71 @@ char* BatchRenderThread::get_current_edl() // Test EDL files for existence int BatchRenderThread::test_edl_files() { - for(int i = 0; i < jobs.total; i++) - { - if(jobs.values[i]->enabled) - { - const char *path = jobs.values[i]->edl_path; - if( *path == '@' ) ++path; - FILE *fd = fopen(path, "r"); - if(!fd) - { - char string[BCTEXTLEN]; - sprintf(string, _("EDL %s not found.\n"), jobs.values[i]->edl_path); - if(mwindow) - { - ErrorBox error_box(_(PROGRAM_NAME ": Error"), - mwindow->gui->get_abs_cursor_x(1), - mwindow->gui->get_abs_cursor_y(1)); - error_box.create_objects(string); - error_box.run_window(); - gui->button_enable(); + int not_equiv = 0, ret = 0; + const char *path = 0; + + for( int i=0; !ret && ienabled ) continue; + const char *path = jobs.values[i]->edl_path; + int is_script = *path == '@' ? 1 : 0; + if( is_script ) ++path; + FILE *fp = fopen(path, "r"); + if( fp ) { + if( warn && mwindow && !is_script ) { + fseek(fp, 0, SEEK_END); + int64_t sz = ftell(fp); + fseek(fp, 0, SEEK_SET); + char *bfr = new char[sz+1]; + int64_t len = fread(bfr, 1, sz+1, fp); + if( len == sz ) { + FileXML file; file.set_shared_input(bfr, len); + EDL *edl = new EDL; edl->create_objects(); + edl->load_xml(&file, LOAD_ALL); + double pos = edl->equivalent_output(mwindow->edl); + if( pos >= 0 ) ++not_equiv; + edl->remove_user(); } else - { - fprintf(stderr, - "%s", - string); - } - - is_rendering = 0; - return 1; - } - else - { - fclose(fd); + ret = 1; + delete [] bfr; } + fclose(fp); } + else + ret = 1; } - return 0; + + if( ret ) { + char string[BCTEXTLEN]; + sprintf(string, _("EDL %s not found.\n"), path); + if( mwindow ) { + ErrorBox error_box(_(PROGRAM_NAME ": Error"), + mwindow->gui->get_abs_cursor_x(1), + mwindow->gui->get_abs_cursor_y(1)); + error_box.create_objects(string); + error_box.run_window(); + gui->button_enable(); + } + else { + fprintf(stderr, "%s", string); + } + is_rendering = 0; + } + else if( warn && mwindow && not_equiv > 0 ) { + fprintf(stderr, _("%d job EDLs do not match session edl\n"), not_equiv); + char string[BCTEXTLEN], *sp = string; + sp += sprintf(sp, _("%d job EDLs do not match session edl\n"),not_equiv); + sp += sprintf(sp, _("press cancel to abandon batch render")); + mwindow->show_warning(&warn, string); + if( mwindow->wait_warning() ) { + gui->button_enable(); + is_rendering = 0; + ret = 1; + } + gui->warning->update(warn); + } + + return ret; } void BatchRenderThread::calculate_dest_paths(ArrayList *paths, @@ -706,21 +735,9 @@ void BatchRenderThread::move_batch(int src, int dst) BatchRenderGUI::BatchRenderGUI(MWindow *mwindow, - BatchRenderThread *thread, - int x, - int y, - int w, - int h) + BatchRenderThread *thread, int x, int y, int w, int h) : BC_Window(_(PROGRAM_NAME ": Batch Render"), - x, - y, - w, - h, - 50, - 50, - 1, - 0, - 1) + x, y, w, h, 50, 50, 1, 0, 1) { this->mwindow = mwindow; this->thread = thread; @@ -780,7 +797,9 @@ void BatchRenderGUI::create_objects() add_subwindow(savelist_batch = new BatchRenderSaveList(thread, x, y)); x += savelist_batch->get_w() + mwindow->theme->widget_border; add_subwindow(loadlist_batch = new BatchRenderLoadList(thread, x, y)); - y2 = y + loadlist_batch->get_h() + mwindow->theme->widget_border; + y += loadlist_batch->get_h() + mwindow->theme->widget_border; + add_subwindow(warning = new BatchRenderWarning(thread, x2, y)); + y2 = y + warning->get_h() + mwindow->theme->widget_border; if( y2 > y1 ) y1 = y2; x = mwindow->theme->batchrender_x1, y = y1; @@ -1392,6 +1411,19 @@ int BatchRenderStop::handle_event() } +BatchRenderWarning::BatchRenderWarning(BatchRenderThread *thread, int x, int y) + : BC_CheckBox(x, y, thread->warn, _("warn if jobs/session mismatched")) +{ + this->thread = thread; +} + +int BatchRenderWarning::handle_event() +{ + thread->warn = get_value(); + return 1; +} + + BatchRenderCancel::BatchRenderCancel(BatchRenderThread *thread, int x, int y) diff --git a/cinelerra-5.1/cinelerra/batchrender.h b/cinelerra-5.1/cinelerra/batchrender.h index d848d989..2791d0e4 100644 --- a/cinelerra-5.1/cinelerra/batchrender.h +++ b/cinelerra-5.1/cinelerra/batchrender.h @@ -92,7 +92,7 @@ public: int test_edl_files(); void calculate_dest_paths(ArrayList *paths, Preferences *preferences); - void reset(); + void reset(int warn=0); // Load batch rendering jobs void load_jobs(char *path, Preferences *preferences); // Not applicable to western civilizations @@ -134,25 +134,16 @@ public: // job being rendered int rendering_job; int is_rendering; + int warn; ArrayList *file_entries; }; - - - - - - - class BatchRenderEDLPath : public BC_TextBox { public: - BatchRenderEDLPath(BatchRenderThread *thread, - int x, - int y, - int w, + BatchRenderEDLPath(BatchRenderThread *thread, int x, int y, int w, char *text); int handle_event(); BatchRenderThread *thread; @@ -162,9 +153,7 @@ public: class BatchRenderCurrentEDL : public BC_GenericButton { public: - BatchRenderCurrentEDL(BatchRenderThread *thread, - int x, - int y); + BatchRenderCurrentEDL(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -173,9 +162,7 @@ public: class BatchRenderUpdateEDL : public BC_GenericButton { public: - BatchRenderUpdateEDL(BatchRenderThread *thread, - int x, - int y); + BatchRenderUpdateEDL(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -184,9 +171,7 @@ public: class BatchRenderNew : public BC_GenericButton { public: - BatchRenderNew(BatchRenderThread *thread, - int x, - int y); + BatchRenderNew(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -194,9 +179,7 @@ public: class BatchRenderDelete : public BC_GenericButton { public: - BatchRenderDelete(BatchRenderThread *thread, - int x, - int y); + BatchRenderDelete(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -206,9 +189,7 @@ public: class BatchRenderSaveList : public BC_GenericButton, public Thread { public: - BatchRenderSaveList(BatchRenderThread *thread, - int x, - int y); + BatchRenderSaveList(BatchRenderThread *thread, int x, int y); ~BatchRenderSaveList(); int handle_event(); BatchRenderThread *thread; @@ -221,9 +202,7 @@ public: class BatchRenderLoadList : public BC_GenericButton, public Thread { public: - BatchRenderLoadList(BatchRenderThread *thread, - int x, - int y); + BatchRenderLoadList(BatchRenderThread *thread, int x, int y); ~BatchRenderLoadList(); int handle_event(); BatchRenderThread *thread; @@ -238,11 +217,7 @@ public: class BatchRenderList : public BC_ListBox { public: - BatchRenderList(BatchRenderThread *thread, - int x, - int y, - int w, - int h); + BatchRenderList(BatchRenderThread *thread, int x, int y, int w, int h); int handle_event(); int selection_changed(); int column_resize_event(); @@ -255,9 +230,7 @@ public: class BatchRenderStart : public BC_GenericButton { public: - BatchRenderStart(BatchRenderThread *thread, - int x, - int y); + BatchRenderStart(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -265,9 +238,15 @@ public: class BatchRenderStop : public BC_GenericButton { public: - BatchRenderStop(BatchRenderThread *thread, - int x, - int y); + BatchRenderStop(BatchRenderThread *thread, int x, int y); + int handle_event(); + BatchRenderThread *thread; +}; + +class BatchRenderWarning : public BC_CheckBox +{ +public: + BatchRenderWarning(BatchRenderThread *thread, int x, int y); int handle_event(); BatchRenderThread *thread; }; @@ -275,9 +254,7 @@ public: class BatchRenderCancel : public BC_GenericButton { public: - BatchRenderCancel(BatchRenderThread *thread, - int x, - int y); + BatchRenderCancel(BatchRenderThread *thread, int x, int y); int handle_event(); int keypress_event(); BatchRenderThread *thread; @@ -287,9 +264,7 @@ public: class BatchFormat : public FormatTools { public: - BatchFormat(MWindow *mwindow, - BatchRenderGUI *gui, - Asset *asset); + BatchFormat(MWindow *mwindow, BatchRenderGUI *gui, Asset *asset); ~BatchFormat(); int handle_event(); @@ -336,6 +311,7 @@ public: BatchRenderDelete *delete_batch; BatchRenderSaveList *savelist_batch; BatchRenderLoadList *loadlist_batch; + BatchRenderWarning *warning; BatchRenderList *batch_list; BatchRenderStart *start_button; BatchRenderStop *stop_button; diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index d9529c8d..dc10bbc0 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -15,6 +15,7 @@ #include "mwindowgui.h" #include "plugin.h" #include "pluginset.h" +#include "rescale.h" #include "track.h" #include "tracks.h" @@ -41,27 +42,28 @@ static struct bd_format { const char *name; int w, h; double framerate; + int interlaced, wide; } bd_formats[] = { - { "1920x1080 29.97i", 1920,1080, 29.97 }, - { "1920x1080 25i", 1920,1080, 25 }, - { "1920x1080 24p", 1920,1080, 24 }, - { "1920x1080 23.976p", 1920,1080, 23.976 }, - { "1280x720 59.94p", 1280,720, 59.94 }, - { "1280x720 50p", 1280,720, 50 }, - { "1280x720 23.976p", 1280,720, 23.976 }, - { "1280x720 24p", 1280,720, 24 }, - { "720x576 25i (PAL)", 720,576, 25 }, - { "720x480 29.97i (NTSC)", 720,480, 29.97 }, + { "1920x1080 29.97i", 1920,1080, 29.97, 1, 1 }, + { "1920x1080 25i", 1920,1080, 25., 1, 1 }, + { "1920x1080 24p", 1920,1080, 24., 0, 1 }, + { "1920x1080 23.976p", 1920,1080, 23.976, 0, 1 }, + { "1280x720 59.94p", 1280,720, 59.94, 0, 1 }, + { "1280x720 50p", 1280,720, 50., 0, 1 }, + { "1280x720 23.976p", 1280,720, 23.976, 0, 1 }, + { "1280x720 24p", 1280,720, 24., 0, 1 }, + { "720x576 25i", 720,576, 25., 1, 0 }, + { "720x480 29.97i", 720,480, 29.97, 1, 0 }, }; const int64_t CreateBD_Thread::BD_SIZE = 25000000000; const int CreateBD_Thread::BD_STREAMS = 1; const int CreateBD_Thread::BD_WIDTH = 1920; const int CreateBD_Thread::BD_HEIGHT = 1080; -const double CreateBD_Thread::BD_ASPECT_WIDTH = 4.; -const double CreateBD_Thread::BD_ASPECT_HEIGHT = 3.; const double CreateBD_Thread::BD_WIDE_ASPECT_WIDTH = 16.; const double CreateBD_Thread::BD_WIDE_ASPECT_HEIGHT = 9.; +const double CreateBD_Thread::BD_ASPECT_WIDTH = 4.; +const double CreateBD_Thread::BD_ASPECT_HEIGHT = 3.; const double CreateBD_Thread::BD_FRAMERATE = 24000. / 1001.; //const int CreateBD_Thread::BD_MAX_BITRATE = 40000000; const int CreateBD_Thread::BD_MAX_BITRATE = 8000000; @@ -70,7 +72,6 @@ const int CreateBD_Thread::BD_WIDE_CHANNELS = 6; const double CreateBD_Thread::BD_SAMPLERATE = 48000; const double CreateBD_Thread::BD_KAUDIO_RATE = 224; - CreateBD_MenuItem::CreateBD_MenuItem(MWindow *mwindow) : BC_MenuItem(_("BD Render..."), _("Ctrl-d"), 'd') { @@ -91,19 +92,18 @@ CreateBD_Thread::CreateBD_Thread(MWindow *mwindow) this->mwindow = mwindow; this->gui = 0; this->use_deinterlace = 0; - this->use_scale = 0; + this->use_scale = Rescale::none; this->use_histogram = 0; this->use_inverse_telecine = 0; this->use_wide_audio = 0; - this->use_wide_aspect = 0; this->use_resize_tracks = 0; this->use_label_chapters = 0; this->bd_size = BD_SIZE; this->bd_width = BD_WIDTH; this->bd_height = BD_HEIGHT; - this->bd_aspect_width = BD_ASPECT_WIDTH; - this->bd_aspect_height = BD_ASPECT_HEIGHT; + this->bd_aspect_width = BD_WIDE_ASPECT_WIDTH; + this->bd_aspect_height = BD_WIDE_ASPECT_HEIGHT; this->bd_framerate = BD_FRAMERATE; this->bd_samplerate = BD_SAMPLERATE; this->bd_max_bitrate = BD_MAX_BITRATE; @@ -288,15 +288,37 @@ void CreateBD_Thread::handle_close_event(int result) keyframe.set_data(data); insert_video_plugin("Inverse Telecine", &keyframe); } - if( use_scale ) { - sprintf(data,"", - max_w >= bd_width || max_h >= bd_height ? 1 : 0, - max_w > 0 ? (double)bd_width/max_w : 1, - max_h > 0 ? (double)bd_height/max_h : 1, - bd_width, bd_height); - keyframe.set_data(data); - insert_video_plugin("Scale", &keyframe); + if( use_scale != Rescale::none ) { + double bd_aspect = bd_aspect_height > 0 ? bd_aspect_width / bd_aspect_height : 1; + + Tracks *tracks = mwindow->edl->tracks; + for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) { + if( vtrk->data_type != TRACK_VIDEO ) continue; + if( !vtrk->record ) continue; + vtrk->expand_view = 1; + PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk); + vtrk->plugin_set.append(plugin_set); + Edits *edits = vtrk->edits; + for( Edit *edit=edits->first; edit; edit=edit->next ) { + Indexable *indexable = edit->get_source(); + if( !indexable ) continue; + Rescale in(indexable); + Rescale out(bd_width, bd_height, bd_aspect); + float src_w, src_h, dst_w, dst_h; + in.rescale(out,use_scale, src_w,src_h, dst_w,dst_h); + sprintf(data,"", use_scale, + in.w, in.h, in.aspect, out.w, out.h, out.aspect, + 0., 0., src_w, src_h, 0., 0., dst_w, dst_h); + keyframe.set_data(data); + plugin_set->insert_plugin(_("Scale Ratio"), + edit->startproject, edit->length, + PLUGIN_STANDALONE, 0, &keyframe, 0); + } + } } if( use_resize_tracks ) resize_tracks(); @@ -322,7 +344,7 @@ void CreateBD_Thread::handle_close_event(int result) keyframe.set_data(data); insert_video_plugin("Histogram", &keyframe); } - mwindow->batch_render->reset(); + mwindow->batch_render->reset(1); create_bd_jobs(&mwindow->batch_render->jobs, tmp_path, asset_title); mwindow->save_backup(); mwindow->undo->update_undo_after(_("create bd"), LOAD_ALL); @@ -336,17 +358,16 @@ BC_Window* CreateBD_Thread::new_gui() memset(tmp_path,0,sizeof(tmp_path)); strcpy(tmp_path,"/tmp"); memset(asset_title,0,sizeof(asset_title)); - time_t dt; time(&dt); - struct tm dtm; localtime_r(&dt, &dtm); + time_t dt; time(&dt); + struct tm dtm; localtime_r(&dt, &dtm); sprintf(asset_title, "bd_%02d%02d%02d-%02d%02d%02d", dtm.tm_year+1900, dtm.tm_mon+1, dtm.tm_mday, dtm.tm_hour, dtm.tm_min, dtm.tm_sec); use_deinterlace = 0; - use_scale = 0; + use_scale = Rescale::none; use_histogram = 0; use_inverse_telecine = 0; use_wide_audio = 0; - use_wide_aspect = 0; use_resize_tracks = 0; use_label_chapters = 0; use_standard = BD_1920x1080_2997i; @@ -354,8 +375,8 @@ BC_Window* CreateBD_Thread::new_gui() bd_size = BD_SIZE; bd_width = BD_WIDTH; bd_height = BD_HEIGHT; - bd_aspect_width = BD_ASPECT_WIDTH; - bd_aspect_height = BD_ASPECT_HEIGHT; + bd_aspect_width = BD_WIDE_ASPECT_WIDTH; + bd_aspect_height = BD_WIDE_ASPECT_HEIGHT; bd_framerate = BD_FRAMERATE; bd_samplerate = BD_SAMPLERATE; bd_max_bitrate = BD_MAX_BITRATE; @@ -373,7 +394,8 @@ BC_Window* CreateBD_Thread::new_gui() has_standard = i; break; } } - use_standard = has_standard >= 0 ? has_standard : BD_1920x1080_23976p; + if( has_standard >= 0 ) + use_standard = has_standard; option_presets(); int scr_x = mwindow->gui->get_screen_x(0, -1); @@ -543,17 +565,6 @@ int CreateBD_InverseTelecine::handle_event() } -CreateBD_Scale::CreateBD_Scale(CreateBD_GUI *gui, int x, int y) - : BC_CheckBox(x, y, &gui->thread->use_scale, _("Scale")) -{ - this->gui = gui; -} - -CreateBD_Scale::~CreateBD_Scale() -{ -} - - CreateBD_ResizeTracks::CreateBD_ResizeTracks(CreateBD_GUI *gui, int x, int y) : BC_CheckBox(x, y, &gui->thread->use_resize_tracks, _("Resize Tracks")) { @@ -595,17 +606,6 @@ CreateBD_WideAudio::~CreateBD_WideAudio() { } -CreateBD_WideAspect::CreateBD_WideAspect(CreateBD_GUI *gui, int x, int y) - : BC_CheckBox(x, y, &gui->thread->use_wide_aspect, _("Aspect 16x9")) -{ - this->gui = gui; -} - -CreateBD_WideAspect::~CreateBD_WideAspect() -{ -} - - CreateBD_GUI::CreateBD_GUI(CreateBD_Thread *thread, int x, int y, int w, int h) : BC_Window(_(PROGRAM_NAME ": Create BD"), x, y, w, h, 50, 50, 1, 0, 1) @@ -618,13 +618,13 @@ CreateBD_GUI::CreateBD_GUI(CreateBD_Thread *thread, int x, int y, int w, int h) tmp_path = 0; btmp_path = 0; disk_space = 0; + standard = 0; + scale = 0; need_deinterlace = 0; need_inverse_telecine = 0; - need_scale = 0; need_resize_tracks = 0; need_histogram = 0; need_wide_audio = 0; - need_wide_aspect = 0; need_label_chapters = 0; ok = 0; cancel = 0; @@ -661,40 +661,41 @@ void CreateBD_GUI::create_objects() int x0 = get_w() - 170; title = new BC_Title(x0, y, _("Media:"), MEDIUMFONT, YELLOW); add_subwindow(title); - x0 += title->get_w() + padx; - media_size = new CreateBD_MediaSize(this, x0, y); + int x1 = x0+title->get_w()+padx; + media_size = new CreateBD_MediaSize(this, x1, y); media_size->create_objects(); media_sizes.append(new BC_ListBoxItem("25GB")); media_sizes.append(new BC_ListBoxItem("50GB")); media_size->update_list(&media_sizes); media_size->update(media_sizes[0]->get_text()); disk_space->update(); - x0 = x; y += disk_space->get_h() + pady/2; - title = new BC_Title(x0, y, _("Format:"), MEDIUMFONT, YELLOW); + title = new BC_Title(x, y, _("Format:"), MEDIUMFONT, YELLOW); add_subwindow(title); - x0 += title->get_w() + padx; - standard = new CreateBD_Format(this, x0, y); + standard = new CreateBD_Format(this, title->get_w() + padx, y); add_subwindow(standard); standard->create_objects(); + x0 -= 30; + title = new BC_Title(x0, y, _("Scale:"), MEDIUMFONT, YELLOW); + add_subwindow(title); + x1 = x0+title->get_w()+padx; + scale = new CreateBD_Scale(this, x1, y); + add_subwindow(scale); + scale->create_objects(); y += standard->get_h() + pady/2; need_deinterlace = new CreateBD_Deinterlace(this, x, y); add_subwindow(need_deinterlace); - int x1 = x + 150, x2 = x1 + 150; + x1 = x + 170; //, x2 = x1 + 150; need_inverse_telecine = new CreateBD_InverseTelecine(this, x1, y); add_subwindow(need_inverse_telecine); y += need_deinterlace->get_h() + pady/2; - need_scale = new CreateBD_Scale(this, x, y); - add_subwindow(need_scale); + need_histogram = new CreateBD_Histogram(this, x, y); + add_subwindow(need_histogram); need_wide_audio = new CreateBD_WideAudio(this, x1, y); add_subwindow(need_wide_audio); - need_resize_tracks = new CreateBD_ResizeTracks(this, x2, y); + y += need_histogram->get_h() + pady/2; + need_resize_tracks = new CreateBD_ResizeTracks(this, x1, y); add_subwindow(need_resize_tracks); - y += need_scale->get_h() + pady/2; - need_histogram = new CreateBD_Histogram(this, x, y); - add_subwindow(need_histogram); - need_wide_aspect = new CreateBD_WideAspect(this, x1, y); - add_subwindow(need_wide_aspect); // need_label_chapters = new CreateBD_LabelChapters(this, x2, y); // add_subwindow(need_label_chapters); ok_w = BC_OKButton::calculate_w(); @@ -739,13 +740,12 @@ int CreateBD_GUI::close_event() void CreateBD_GUI::update() { + scale->set_value(thread->use_scale); need_deinterlace->set_value(thread->use_deinterlace); need_inverse_telecine->set_value(thread->use_inverse_telecine); - need_scale->set_value(thread->use_scale); need_resize_tracks->set_value(thread->use_resize_tracks); need_histogram->set_value(thread->use_histogram); need_wide_audio->set_value(thread->use_wide_audio); - need_wide_aspect->set_value(thread->use_wide_aspect); // need_label_chapters->set_value(thread->use_label_chapters); } @@ -765,7 +765,6 @@ insert_video_plugin(const char *title, KeyFrame *default_keyframe) edit->startproject, edit->length, PLUGIN_STANDALONE, 0, default_keyframe, 0); } - vtrk->optimize(); } return 0; } @@ -791,10 +790,9 @@ option_presets() { // reset only probed options use_deinterlace = 0; - use_scale = 0; + use_scale = Rescale::none; use_resize_tracks = 0; use_wide_audio = 0; - use_wide_aspect = 0; use_label_chapters = 0; if( !mwindow->edl ) return 1; @@ -802,6 +800,11 @@ option_presets() bd_width = bd_formats[use_standard].w; bd_height = bd_formats[use_standard].h; bd_framerate = bd_formats[use_standard].framerate; + bd_aspect_width = bd_formats[use_standard].wide ? + BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH; + bd_aspect_height = bd_formats[use_standard].wide ? + BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT; + double bd_aspect = bd_aspect_width / bd_aspect_height; Tracks *tracks = mwindow->edl->tracks; max_w = 0; max_h = 0; @@ -816,10 +819,14 @@ option_presets() Indexable *indexable = edit->get_source(); int w = indexable->get_w(); if( w > max_w ) max_w = w; - if( w != bd_width ) use_scale = 1; + if( w != bd_width ) use_scale = Rescale::scaled; int h = indexable->get_h(); if( h > max_h ) max_h = h; - if( h != bd_height ) use_scale = 1; + if( h != bd_height ) use_scale = Rescale::scaled; + float aw, ah; + MWindow::create_aspect_ratio(aw, ah, w, h); + double aspect = ah > 0 ? aw / ah : 1; + if( !EQUIV(aspect, bd_aspect) ) use_scale = Rescale::scaled; } for( int i=0; iplugin_set.size(); ++i ) { for(Plugin *plugin = (Plugin*)trk->plugin_set[i]->first; @@ -828,6 +835,7 @@ option_presets() if( !strcmp(plugin->title, _("Deinterlace")) ) has_deinterlace = 1; if( !strcmp(plugin->title, _("Auto Scale")) || + !strcmp(plugin->title, _("Scale Ratio")) || !strcmp(plugin->title, _("Scale")) ) has_scale = 1; } @@ -836,8 +844,8 @@ option_presets() } } if( has_scale ) - use_scale = 0; - if( use_scale ) { + use_scale = Rescale::none; + if( use_scale != Rescale::none ) { if( max_w != bd_width ) use_resize_tracks = 1; if( max_h != bd_height ) use_resize_tracks = 1; } @@ -853,12 +861,6 @@ option_presets() if( !has_deinterlace && max_h > 2*bd_height ) use_deinterlace = 1; // Labels *labels = mwindow->edl->labels; // use_label_chapters = labels && labels->first ? 1 : 0; - float aw, ah; - MWindow::create_aspect_ratio(aw, ah, max_w, max_h); - if( aw == BD_WIDE_ASPECT_WIDTH && ah == BD_WIDE_ASPECT_HEIGHT ) - use_wide_aspect = 1; - bd_aspect_width = use_wide_aspect ? BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH; - bd_aspect_height = use_wide_aspect ? BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT; if( tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS ) use_wide_audio = 1; @@ -902,6 +904,7 @@ void CreateBD_Format::create_objects() for( int i=0; i<(int)(sizeof(bd_formats)/sizeof(bd_formats[0])); ++i ) { add_item(new CreateBD_FormatItem(this, i, bd_formats[i].name)); } + set_value(gui->thread->use_standard); } int CreateBD_Format::handle_event() @@ -911,6 +914,53 @@ int CreateBD_Format::handle_event() return 1; } + +CreateBD_ScaleItem::CreateBD_ScaleItem(CreateBD_Scale *popup, + int scale, const char *text) + : BC_MenuItem(text) +{ + this->popup = popup; + this->scale = scale; +} + +CreateBD_ScaleItem::~CreateBD_ScaleItem() +{ +} + +int CreateBD_ScaleItem::handle_event() +{ + popup->gui->thread->use_scale = scale; + popup->set_value(scale); + return popup->handle_event(); +} + + +CreateBD_Scale::CreateBD_Scale(CreateBD_GUI *gui, int x, int y) + : BC_PopupMenu(x, y, 100, "", 1) +{ + this->gui = gui; +} + +CreateBD_Scale::~CreateBD_Scale() +{ +} + +void CreateBD_Scale::create_objects() +{ + + for( int i=0; i<(int)Rescale::n_scale_types; ++i ) { + add_item(new CreateBD_ScaleItem(this, i, Rescale::scale_types[i])); + } + set_value(gui->thread->use_scale); +} + +int CreateBD_Scale::handle_event() +{ + gui->update(); + return 1; +} + + CreateBD_MediaSize::CreateBD_MediaSize(CreateBD_GUI *gui, int x, int y) : BC_PopupTextBox(gui, 0, 0, x, y, 70,50) { diff --git a/cinelerra-5.1/cinelerra/bdcreate.h b/cinelerra-5.1/cinelerra/bdcreate.h index f13bee74..7efb2421 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.h +++ b/cinelerra-5.1/cinelerra/bdcreate.h @@ -11,6 +11,7 @@ #include "bctextbox.h" #include "browsebutton.h" #include "mwindow.h" +#include "rescale.h" #include "bdcreate.inc" @@ -49,7 +50,7 @@ public: char tmp_path[BCTEXTLEN]; int use_deinterlace, use_inverse_telecine; int use_scale, use_resize_tracks; - int use_wide_audio, use_wide_aspect; + int use_wide_audio; int use_histogram, use_label_chapters; int use_standard; @@ -138,15 +139,6 @@ public: CreateBD_GUI *gui; }; -class CreateBD_Scale : public BC_CheckBox -{ -public: - CreateBD_Scale(CreateBD_GUI *gui, int x, int y); - ~CreateBD_Scale(); - - CreateBD_GUI *gui; -}; - class CreateBD_ResizeTracks : public BC_CheckBox { public: @@ -183,15 +175,6 @@ public: CreateBD_GUI *gui; }; -class CreateBD_WideAspect : public BC_CheckBox -{ -public: - CreateBD_WideAspect(CreateBD_GUI *gui, int x, int y); - ~CreateBD_WideAspect(); - - CreateBD_GUI *gui; -}; - class CreateBD_GUI : public BC_Window { public: @@ -213,15 +196,14 @@ public: BrowseButton *btmp_path; CreateBD_DiskSpace *disk_space; CreateBD_Format *standard; + CreateBD_Scale *scale; ArrayList media_sizes; CreateBD_MediaSize *media_size; CreateBD_Deinterlace *need_deinterlace; CreateBD_InverseTelecine *need_inverse_telecine; - CreateBD_Scale *need_scale; CreateBD_ResizeTracks *need_resize_tracks; CreateBD_Histogram *need_histogram; CreateBD_WideAudio *need_wide_audio; - CreateBD_WideAspect *need_wide_aspect; CreateBD_LabelChapters *need_label_chapters; int ok_x, ok_y, ok_w, ok_h; CreateBD_OK *ok; @@ -247,8 +229,32 @@ public: int handle_event(); CreateBD_Format(CreateBD_GUI *gui, int x, int y); ~CreateBD_Format(); + void set_value(int v) { set_text(get_item(v)->get_text()); } + + CreateBD_GUI *gui; +}; + +class CreateBD_ScaleItem : public BC_MenuItem +{ +public: + int handle_event(); + CreateBD_ScaleItem(CreateBD_Scale *popup, int scale, const char *text); + ~CreateBD_ScaleItem(); + + CreateBD_Scale *popup; + int scale; +}; + +class CreateBD_Scale : public BC_PopupMenu +{ +public: + void create_objects(); + int handle_event(); + CreateBD_Scale(CreateBD_GUI *gui, int x, int y); + ~CreateBD_Scale(); CreateBD_GUI *gui; + void set_value(int v) { set_text(Rescale::scale_types[v]); } }; class CreateBD_MediaSize : public BC_PopupTextBox diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index ed43a03b..c752ba81 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -15,6 +15,7 @@ #include "mwindowgui.h" #include "plugin.h" #include "pluginset.h" +#include "rescale.h" #include "track.h" #include "tracks.h" @@ -24,30 +25,43 @@ #include #include -// DVD Creation -#define HD_1920x1080_2997 0 -#define HD_1920x1080_2500 1 -#define HD_1280x720_5994p 2 -#define HD_1280x720_5000p 3 -#define HD_720x576_5000p 4 -#define HD_720x576_2500 5 -#define HD_720x480_5994p 6 -#define HD_720x480_2997 7 +#define DVD_PAL_4x3 0 +#define DVD_PAL_16x9 1 +#define DVD_NTSC_4x3 2 +#define DVD_NTSC_16x9 3 + +#define DVD_NORM_PAL 0 +#define DVD_NORM_NTSC 1 + +#define DVD_ASPECT_4x3 0 +#define DVD_ASPECT_16x9 1 -static struct hd_format { +static struct dvd_norm { const char *name; int w, h; double framerate; -} hd_formats[] = { - { "1920x1080 29.97", 1920,1080, 29.97 }, - { "1920x1080 25", 1920,1080, 25 }, - { "1280x720 59.94p", 1280,720, 59.94 }, - { "1280x720 50p", 1280,720, 50 }, - { "720x576 50p(PAL)", 720,576, 50 }, - { "720x576 25 (PAL)", 720,576, 25 }, - { "720x480 59.94p(NTSC)", 720,480, 59.94 }, - { "720x480 29.97 (NTSC)", 720,480, 29.97 }, +} dvd_norms[] = { + { "PAL", 720,576, 25 }, + { "NTSC", 720,480, 29.97 }, +}; + +static struct dvd_aspect { + int w, h; +} dvd_aspects[] = { + { 4, 3, }, + { 16, 9, }, +}; + +// DVD Creation + +static struct dvd_format { + int norm, aspect; +} dvd_formats[] = { + { DVD_NORM_PAL, DVD_ASPECT_4x3, }, + { DVD_NORM_PAL, DVD_ASPECT_16x9, }, + { DVD_NORM_NTSC, DVD_ASPECT_4x3, }, + { DVD_NORM_NTSC, DVD_ASPECT_16x9, }, }; const int64_t CreateDVD_Thread::DVD_SIZE = 4700000000; @@ -90,7 +104,6 @@ CreateDVD_Thread::CreateDVD_Thread(MWindow *mwindow) this->use_histogram = 0; this->use_inverse_telecine = 0; this->use_wide_audio = 0; - this->use_wide_aspect = 0; this->use_ffmpeg = 0; this->use_resize_tracks = 0; this->use_label_chapters = 0; @@ -181,8 +194,9 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp,"mkdir -p $1/iso\n"); fprintf(fp,"\n"); // dvdauthor ver 0.7.0 requires this to work - fprintf(fp,"export VIDEO_FORMAT=%s\n", - use_standard == HD_720x576_2500 ? "PAL" : "NTSC"); + int norm = dvd_formats[use_standard].norm; + const char *name = dvd_norms[norm].name; + fprintf(fp,"export VIDEO_FORMAT=%s\n", name); fprintf(fp,"dvdauthor -x - <\n"); fprintf(fp," \n"); @@ -190,9 +204,11 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp," \n"); fprintf(fp," \n"); fprintf(fp," \n"); + char std[BCSTRLEN], *cp = std; + for( const char *np=name; *np!=0; ++cp,++np) *cp = *np + 'a'-'A'; + *cp = 0; fprintf(fp,"