X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fdvdcreate.C;h=1014baf5e2368312a739e01b0d5bac51aedcbc76;hp=ed43a03b7f10ca2fc8429fd87bd8da8afcf5a1d6;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=089f2be86316b88f72a6c359ab10e2b95539005b diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index ed43a03b..1014baf5 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -1,4 +1,5 @@ #include "asset.h" +#include "bchash.h" #include "clip.h" #include "dvdcreate.h" #include "edl.h" @@ -15,6 +16,8 @@ #include "mwindowgui.h" #include "plugin.h" #include "pluginset.h" +#include "preferences.h" +#include "rescale.h" #include "track.h" #include "tracks.h" @@ -24,30 +27,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; @@ -69,7 +85,7 @@ const double CreateDVD_Thread::DVD_KAUDIO_RATE = 224; CreateDVD_MenuItem::CreateDVD_MenuItem(MWindow *mwindow) : BC_MenuItem(_("DVD Render..."), _("Shift-D"), 'D') { - set_shift(1); + set_shift(1); this->mwindow = mwindow; } @@ -90,7 +106,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; @@ -112,8 +127,7 @@ CreateDVD_Thread::~CreateDVD_Thread() close_window(); } -int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, - const char *tmp_path, const char *asset_title) +int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const char *asset_dir) { EDL *edl = mwindow->edl; if( !edl || !edl->session ) { @@ -132,9 +146,6 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, return 1; } - char asset_dir[BCTEXTLEN]; - sprintf(asset_dir, "%s/%s", tmp_path, asset_title); - if( mkdir(asset_dir, 0777) ) { char err[BCTEXTLEN], msg[BCTEXTLEN]; strerror_r(errno, err, sizeof(err)); @@ -173,16 +184,25 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp,"\n"); const char *exec_path = File::get_cinlib_path(); fprintf(fp,"PATH=$PATH:%s\n",exec_path); - if( !use_ffmpeg ) { - fprintf(fp,"mplex -f 8 -o $1/dvd.mpg $1/dvd.m2v $1/dvd.ac3\n"); - fprintf(fp,"\n"); + if( mwindow->preferences->use_renderfarm || + (use_label_chapters && edl->labels ) ) { + if( !use_ffmpeg ) { + fprintf(fp, "cat > $1/dvd.m2v $1/dvd.m2v0*\n"); + fprintf(fp, "mplex -M -f 8 -o $1/dvd.mpg $1/dvd.m2v $1/dvd.ac3\n"); + } + else + fprintf(fp, "ffmpeg -f concat -safe 0 -i <(for f in \"$1/dvd.mpg0\"*; do " + "echo \"file '$f'\"; done) -c copy -y $1/dvd.mpg\n"); } + else + fprintf(fp, "mplex -f 8 -o $1/dvd.mpg $1/dvd.m2v $1/dvd.ac3\n"); fprintf(fp,"rm -rf $1/iso\n"); 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 +210,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,"