+char *BD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls)
+{
+ char script[BCTEXTLEN];
+ strcpy(script, edl_path);
+ FILE *fp = 0;
+ char *bp = strrchr(script,'/');
+ int fd = -1;
+ if( bp ) {
+ strcpy(bp, "/bd.sh");
+ fd = open(script, O_WRONLY+O_CREAT+O_TRUNC, 0755);
+ }
+ if( fd >= 0 )
+ fp = fdopen(fd, "w");
+ if( !fp ) {
+ char err[BCTEXTLEN], msg[BCTEXTLEN];
+ strerror_r(errno, err, sizeof(err));
+ sprintf(msg, _("Unable to save: %s\n-- %s"), script, err);
+ MainError::show_error(msg);
+ return 0;
+ }
+ char udfs[BCTEXTLEN], mopts[BCTEXTLEN], mntpt[BCTEXTLEN];
+ int is_usr_mnt = get_udfs_mount(udfs, mopts, mntpt);
+ const char *exec_path = File::get_cinlib_path();
+ fprintf(fp,"#!/bin/bash -ex\n");
+ fprintf(fp,"sdir=`dirname $0`\n");
+ fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n");
+ fprintf(fp,"PATH=$PATH:%s\n",exec_path);
+ fprintf(fp,"mkdir -p $dir/udfs\n");
+ fprintf(fp,"sz=`du -cb $dir/bd.m2ts* | tail -1 | sed -e 's/[ ].*//'`\n");
+ fprintf(fp,"blks=$((sz/2048 + 4096))\n");
+ fprintf(fp,"rm -f %s\n", udfs);
+ fprintf(fp,"mkudffs -b 2048 %s $blks\n", udfs);
+ fprintf(fp,"mount %s%s\n", mopts, mntpt);
+ fprintf(fp,"bdwrite %s $dir/bd.m2ts*\n",mntpt);
+ fprintf(fp,"umount %s\n",mntpt);
+ if( is_usr_mnt )
+ fprintf(fp,"mv -f %s $dir/bd.udfs\n", udfs);
+ fprintf(fp,"echo To burn bluray, load writable media and run:\n");
+ fprintf(fp,"echo for WORM: growisofs -dvd-compat -Z /dev/bd=$dir/bd.udfs\n");
+ fprintf(fp,"echo for RW: dd if=$dir/bd.udfs of=/dev/bd bs=2048000\n");
+ fprintf(fp,"kill $$\n");
+ fprintf(fp,"\n");
+ fclose(fp);
+ return cstrdup(script);
+}
+
+
+CreateBD_Thread::CreateBD_Thread(MWindow *mwindow)
+ : BC_DialogThread()
+{
+ this->mwindow = mwindow;
+ this->gui = 0;
+ this->use_deinterlace = 0;
+ this->use_scale = Rescale::none;
+ this->use_histogram = 0;
+ this->use_inverse_telecine = 0;
+ this->use_wide_audio = 0;
+ this->use_resize_tracks = 0;
+ this->use_labeled = 0;
+ this->use_farmed = 0;
+
+ this->bd_size = BD_SIZE;
+ this->bd_width = BD_WIDTH;
+ this->bd_height = BD_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;
+ this->bd_kaudio_rate = BD_KAUDIO_RATE;
+ this->max_w = this->max_h = 0;
+}
+
+CreateBD_Thread::~CreateBD_Thread()
+{
+ close_window();
+}
+