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=c560f208d1e70c283a20d104a23e111478681771;hb=502b6f3b6fd04f6b01c6d70dcb81aa304dd0db1c;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index c560f208..1014baf5 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -1,9 +1,12 @@ #include "asset.h" +#include "bchash.h" +#include "clip.h" #include "dvdcreate.h" #include "edl.h" #include "edit.h" #include "edits.h" #include "edlsession.h" +#include "file.h" #include "filexml.h" #include "keyframe.h" #include "labels.h" @@ -13,6 +16,8 @@ #include "mwindowgui.h" #include "plugin.h" #include "pluginset.h" +#include "preferences.h" +#include "rescale.h" #include "track.h" #include "tracks.h" @@ -22,8 +27,44 @@ #include #include + +#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 dvd_norm { + const char *name; + int w, h; + double framerate; +} 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; const int CreateDVD_Thread::DVD_STREAMS = 1; @@ -44,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; } @@ -61,14 +102,24 @@ CreateDVD_Thread::CreateDVD_Thread(MWindow *mwindow) this->mwindow = mwindow; this->gui = 0; this->use_deinterlace = 0; - this->use_inverse_telecine = 0; this->use_scale = 0; - this->use_resize_tracks = 0; this->use_histogram = 0; + this->use_inverse_telecine = 0; this->use_wide_audio = 0; - this->use_wide_aspect = 0; - this->use_label_chapters = 0; this->use_ffmpeg = 0; + this->use_resize_tracks = 0; + this->use_label_chapters = 0; + + this->dvd_size = DVD_SIZE; + this->dvd_width = DVD_WIDTH; + this->dvd_height = DVD_HEIGHT; + this->dvd_aspect_width = DVD_ASPECT_WIDTH; + this->dvd_aspect_height = DVD_ASPECT_HEIGHT; + this->dvd_framerate = DVD_FRAMERATE; + this->dvd_samplerate = DVD_SAMPLERATE; + this->dvd_max_bitrate = DVD_MAX_BITRATE; + this->dvd_kaudio_rate = DVD_KAUDIO_RATE; + this->max_w = this->max_h = 0; } CreateDVD_Thread::~CreateDVD_Thread() @@ -76,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 ) { @@ -96,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)); @@ -112,12 +159,12 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, session->video_channels = DVD_STREAMS; session->video_tracks = DVD_STREAMS; - session->frame_rate = DVD_FRAMERATE; - session->output_w = DVD_WIDTH; - session->output_h = DVD_HEIGHT; - session->aspect_w = use_wide_aspect ? DVD_WIDE_ASPECT_WIDTH : DVD_ASPECT_WIDTH; - session->aspect_h = use_wide_aspect ? DVD_WIDE_ASPECT_HEIGHT : DVD_ASPECT_HEIGHT; - session->sample_rate = DVD_SAMPLERATE; + session->frame_rate = dvd_framerate; + session->output_w = dvd_width; + session->output_h = dvd_height; + session->aspect_w = dvd_aspect_width; + session->aspect_h = dvd_aspect_height; + session->sample_rate = dvd_samplerate; session->audio_channels = session->audio_tracks = use_wide_audio ? DVD_WIDE_CHANNELS : DVD_CHANNELS; @@ -135,16 +182,27 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp,"#!/bin/bash\n"); fprintf(fp,"echo \"running %s\" $# $*\n", script_filename); fprintf(fp,"\n"); - char exe_path[BCTEXTLEN]; - get_exe_path(exe_path); - fprintf(fp,"PATH=$PATH:%s\n",exe_path); - if( !use_ffmpeg ) { - fprintf(fp,"mplex -f 8 -o $1/dvd.mpg $1/dvd.m2v $1/dvd.ac3\n"); - fprintf(fp,"\n"); + const char *exec_path = File::get_cinlib_path(); + fprintf(fp,"PATH=$PATH:%s\n",exec_path); + 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 + 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"); @@ -152,8 +210,11 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp," \n"); fprintf(fp," \n"); fprintf(fp," \n"); - fprintf(fp,"