X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;ds=inline;f=cinelerra-5.1%2Fcinelerra%2Fbatchrender.C;h=6f1129f0afcee60f51c86c9c45ae89d7327b0845;hb=6ca0a7892ec6459a54fcb3ba3a223d1ddc5ce402;hp=40ed1b0b68bb33581fc33815af8bd48a82f1fdb2;hpb=94fc059e6ed3f77f20531338cbb03bdb3b4d9eab;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/batchrender.C b/cinelerra-5.1/cinelerra/batchrender.C index 40ed1b0b..6f1129f0 100644 --- a/cinelerra-5.1/cinelerra/batchrender.C +++ b/cinelerra-5.1/cinelerra/batchrender.C @@ -39,6 +39,7 @@ #include "keys.h" #include "labels.h" #include "language.h" +#include "localsession.h" #include "mainerror.h" #include "mainundo.h" #include "mainsession.h" @@ -408,21 +409,45 @@ char* BatchRenderThread::get_current_edl() return get_current_job()->edl_path; } +int BatchRenderThread::test_errmsg(BatchRenderWarnJobs &err_jobs, const char *msg, int *warn) +{ + int count = err_jobs.size(); + if( !count ) return 0; + fprintf(stderr, msg, count); + char string[BCTEXTLEN], *sp = string, *ep = sp+sizeof(string)-1; + sp += snprintf(sp,ep-sp, msg,count); + for( int i=0; ishow_warning(warn, string); + if( mwindow->wait_warning() ) { + gui->button_enable(); + } + return 1; +} // Test EDL files for existence int BatchRenderThread::test_edl_files() { - int not_equiv = 0, ret = 0; + int ret = 0; const char *path = 0; + BatchRenderWarnJobs not_equiv; + BatchRenderWarnJobs empty_jobs; + BatchRenderWarnJobs no_labels; + BatchRenderWarnJobs no_rendering; for( int i=0; !ret && ienabled ) continue; - path = jobs.values[i]->edl_path; + path = jobs[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 ) { + if( mwindow && !is_script ) { char *bfr = 0; size_t sz = 0; struct stat st; if( !fstat(fileno(fp), &st) ) { @@ -440,7 +465,17 @@ int BatchRenderThread::test_edl_files() file.set_shared_input(&data); edl->load_xml(&file, LOAD_ALL); } double pos = edl->equivalent_output(mwindow->edl); - if( pos >= 0 ) ++not_equiv; + if( pos >= 0 ) + not_equiv.add(i+1, path); + double length = edl->tracks->total_playable_length(); + double start = edl->local_session->get_selectionstart(1); + if( start >= length ) + empty_jobs.add(i+1, path); + if( jobs[i]->labeled && !edl->labels->first) + no_labels.add(i+1,path); + Asset *asset = jobs[i]->asset; + if( !asset->audio_data && !asset->video_data ) + no_rendering.add(i+1,path); edl->remove_user(); } delete [] bfr; @@ -466,21 +501,21 @@ int BatchRenderThread::test_edl_files() 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); + ret = 1; } + if( !ret && warn && mwindow ) { + ret = test_errmsg(not_equiv, _("%d job EDLs do not match session edl\n"), &warn); + if( !warn ) gui->warning->update(0); + } + if( !ret && mwindow ) + ret = test_errmsg(empty_jobs, _("%d job EDLs begin position beyond end of media\n"), 0); + if( !ret && mwindow ) + ret = test_errmsg(no_rendering, _("%d job EDLs no audio or video in render asset format\n"), 0); + if( !ret && mwindow ) + ret = test_errmsg(no_labels, _("%d job EDLs render file per label and no labels\n"), 0); + if( ret ) + is_rendering = 0; return ret; } @@ -506,12 +541,13 @@ void BatchRenderThread::calculate_dest_paths(ArrayList *paths, command->playback_range_adjust_inout(); // Create test packages - packages->create_packages(mwindow, command->get_edl(), + int result = packages->create_packages(mwindow, command->get_edl(), preferences, job->get_strategy(), job->asset, command->start_position, command->end_position, 0); + if( !result ) + packages->get_package_paths(paths); // Append output paths allocated to total - packages->get_package_paths(paths); // Delete package harness delete packages;