#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
+#if !defined(__FreeBSD__)
#include <sys/stat.h>
#include <sys/statfs.h>
-
+#else
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
#define DVD_PAL_4x3 0
#define DVD_PAL_16x9 1
CreateDVD_MenuItem::CreateDVD_MenuItem(MWindow *mwindow)
- : BC_MenuItem(_("DVD Render..."), _("Shift-D"), 'D')
+ : BC_MenuItem(_("DVD Render..."), _("Alt-d"), 'd')
{
- set_shift(1);
+ set_alt(1);
this->mwindow = mwindow;
}
}
fprintf(fp,"#!/bin/bash\n");
- fprintf(fp,"dir=`dirname $0`\n");
+ fprintf(fp,"sdir=`dirname $0`\n");
+ fprintf(fp,"dir=`cd \"$sdir\"; pwd`\n");
fprintf(fp,"echo \"running %s\"\n", script);
fprintf(fp,"\n");
const char *exec_path = File::get_cinlib_path();
int file_seq = farmed || labeled ? 1 : 0;
if( !muxed ) {
if( file_seq ) {
- fprintf(fp, "cat > $dir/dvd.m2v $dir/dvd.m2v0*\n");
+ fprintf(fp, "cat > $dir/dvd.m2v $dir/dvd.m2v[0-9]*\n");
fprintf(fp, "mplex -M -f 8 -o $dir/dvd.mpg $dir/dvd.m2v $dir/dvd.ac3\n");
file_seq = 0;
}
bmin(video_length, audio_length) :
idxbl->have_video() ? video_length :
idxbl->have_audio() ? audio_length : 0;
- fprintf(fp," <vob file=\"%s", !file_seq ? "dvd.mpg" : idxbl->path);
+ fprintf(fp," <vob file=\"%s", !file_seq ? "$dir/dvd.mpg" : idxbl->path);
chapter = 0;
double vob_end = i+1>=total_idxbls ? total_length : vob_pos + length;
if( labeled ) {
}
BatchRenderJob *job = new DVD_BatchRenderJob(mwindow->preferences,
- use_labeled, use_farmed, use_standard, use_ffmpeg);
+ use_labeled, use_farmed, use_standard, 0);// use_ffmpeg);
jobs->append(job);
strcpy(&job->edl_path[0], xml_filename);
Asset *asset = job->asset;
sprintf(&asset->path[0],"%s/dvd.mpg", asset_dir);
asset->format = FILE_FFMPEG;
strcpy(asset->fformat, "dvd");
-
+// if there are many renderfarm jobs, then there are small audio fragments of
+// silence that are used at the end of a render to fill the last audio "block".
+// this extra data gradually skews the audio/video sync. Therefore, the audio
+// is not rendered muxed for ffmpeg, and is remuxed as with mjpeg rendering.
+// since this audio is in one file, the only fragment is at the end and is ok.
+#if 0
asset->audio_data = 1;
asset->channels = session->audio_channels;
asset->sample_rate = session->sample_rate;
asset->ff_video_bitrate = vid_bitrate;
asset->ff_video_quality = -1;
use_farmed = job->farmed;
+#else
+ asset->video_data = 1;
+ strcpy(asset->vcodec, "raw.dvd");
+ sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir);
+ FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
+ FFMPEG::load_options(option_path, asset->ff_video_options,
+ sizeof(asset->ff_video_options));
+ asset->ff_video_bitrate = vid_bitrate;
+ asset->ff_video_quality = -1;
+ use_farmed = job->farmed;
+
+ job = new BatchRenderJob(mwindow->preferences, 0, 0);
+ jobs->append(job);
+ strcpy(&job->edl_path[0], xml_filename);
+ asset = job->asset;
+ sprintf(&asset->path[0],"%s/dvd.ac3", asset_dir);
+ asset->format = FILE_AC3;
+ asset->audio_data = 1;
+ asset->channels = session->audio_channels;
+ asset->sample_rate = session->sample_rate;
+ asset->ac3_bitrate = dvd_kaudio_rate;
+#endif
}
else {
sprintf(&asset->path[0],"%s/dvd.m2v", asset_dir);
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;
+ if( !vtrk->is_armed() ) continue;
vtrk->expand_view = 1;
PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk);
vtrk->plugin_set.append(plugin_set);
int scr_x = mwindow->gui->get_screen_x(0, -1);
int scr_w = mwindow->gui->get_screen_w(0, -1);
int scr_h = mwindow->gui->get_screen_h(0, -1);
- int w = 520, h = 280;
+ int w = xS(560), h = yS(280);
int x = scr_x + scr_w/2 - w/2, y = scr_h/2 - h/2;
gui = new CreateDVD_GUI(this, x, y, w, h);
int CreateDVD_OK::keypress_event()
{
- return 0;
+ return context_help_check_and_show();
}
CreateDVD_GUI::CreateDVD_GUI(CreateDVD_Thread *thread, int x, int y, int w, int h)
- : BC_Window(_(PROGRAM_NAME ": Create DVD"), x, y, w, h, 50, 50, 1, 0, 1)
+ : BC_Window(_(PROGRAM_NAME ": Create DVD"), x, y, w, h, xS(50), yS(50), 1, 0, 1)
{
this->thread = thread;
at_x = at_y = tmp_x = tmp_y = 0;
need_farmed = 0;
ok = 0;
cancel = 0;
+// *** CONTEXT_HELP ***
+ context_help_set_keyword("DVD and Bluray Creation");
}
CreateDVD_GUI::~CreateDVD_GUI()
void CreateDVD_GUI::create_objects()
{
+ int xs10 = xS(10), xs35 = xS(35), xs170 = xS(170);
+ int ys5 = yS(5), ys10 = yS(10);
lock_window("CreateDVD_GUI::create_objects");
- int pady = BC_TextBox::calculate_h(this, MEDIUMFONT, 0, 1) + 5;
+ int pady = BC_TextBox::calculate_h(this, MEDIUMFONT, 0, 1) + ys5;
int padx = BC_Title::calculate_w(this, (char*)"X", MEDIUMFONT);
int x = padx/2, y = pady/2;
BC_Title *title = new BC_Title(x, y, _("Title:"), MEDIUMFONT, YELLOW);
add_subwindow(title);
at_x = x + title->get_w(); at_y = y;
- asset_title = new CreateDVD_AssetTitle(this, at_x, at_y, get_w()-at_x-10);
+ asset_title = new CreateDVD_AssetTitle(this, at_x, at_y, get_w()-at_x-xs10);
add_subwindow(asset_title);
y += title->get_h() + pady/2;
title = new BC_Title(x, y, _("Work path:"), MEDIUMFONT, YELLOW);
add_subwindow(title);
tmp_x = x + title->get_w(); tmp_y = y;
- tmp_path = new CreateDVD_TmpPath(this, tmp_x, tmp_y, get_w()-tmp_x-35);
+ tmp_path = new CreateDVD_TmpPath(this, tmp_x, tmp_y, get_w()-tmp_x-xs35);
add_subwindow(tmp_path);
btmp_path = new BrowseButton(thread->mwindow->theme, this, tmp_path,
tmp_x+tmp_path->get_w(), tmp_y, "/tmp",
y += title->get_h() + pady/2;
disk_space = new CreateDVD_DiskSpace(this, x, y);
add_subwindow(disk_space);
- int x0 = get_w() - 170;
+ int x0 = get_w() - xs170;
title = new BC_Title(x0, y, _("Media:"), MEDIUMFONT, YELLOW);
add_subwindow(title);
int x1 = x0+title->get_w()+padx;
standard = new CreateDVD_Format(this, title->get_w() + padx, y);
add_subwindow(standard);
standard->create_objects();
- x0 -= 30;
+ x0 -= xS(60);
title = new BC_Title(x0, y, _("Scale:"), MEDIUMFONT, YELLOW);
add_subwindow(title);
x1 = x0+title->get_w()+padx;
y += need_deinterlace->get_h() + pady/2;
need_histogram = new CreateDVD_Histogram(this, x, y);
add_subwindow(need_histogram);
- y = y1; x1 += 170;
+ y = y1; x1 += xs170;
need_inverse_telecine = new CreateDVD_InverseTelecine(this, x1, y);
add_subwindow(need_inverse_telecine);
y += need_inverse_telecine->get_h() + pady/2;
y += need_use_ffmpeg->get_h() + pady/2;
need_resize_tracks = new CreateDVD_ResizeTracks(this, x1, y);
add_subwindow(need_resize_tracks);
- y = y1; x1 += 170;
+ y = y1; x1 += xs170;
need_labeled = new CreateDVD_LabelChapters(this, x1, y);
add_subwindow(need_labeled);
y += need_labeled->get_h() + pady/2;
add_subwindow(need_farmed);
ok_w = BC_OKButton::calculate_w();
ok_h = BC_OKButton::calculate_h();
- ok_x = 10;
- ok_y = get_h() - ok_h - 10;
+ ok_x = xs10;
+ ok_y = get_h() - ok_h - ys10;
ok = new CreateDVD_OK(this, ok_x, ok_y);
add_subwindow(ok);
cancel_w = BC_CancelButton::calculate_w();
cancel_h = BC_CancelButton::calculate_h();
- cancel_x = get_w() - cancel_w - 10,
- cancel_y = get_h() - cancel_h - 10;
+ cancel_x = get_w() - cancel_w - xs10,
+ cancel_y = get_h() - cancel_h - ys10;
cancel = new CreateDVD_Cancel(this, cancel_x, cancel_y);
add_subwindow(cancel);
show_window();
int CreateDVD_GUI::resize_event(int w, int h)
{
- asset_title->reposition_window(at_x, at_y, get_w()-at_x-10);
- tmp_path->reposition_window(tmp_x, tmp_y, get_w()-tmp_x-35);
+ int xs10 = xS(10), xs35 = xS(35);
+ int ys10 = yS(10);
+ asset_title->reposition_window(at_x, at_y, get_w()-at_x-xs10);
+ tmp_path->reposition_window(tmp_x, tmp_y, get_w()-tmp_x-xs35);
btmp_path->reposition_window(tmp_x+tmp_path->get_w(), tmp_y);
- ok_y = h - ok_h - 10;
+ ok_y = h - ok_h - ys10;
ok->reposition_window(ok_x, ok_y);
- cancel_x = w - cancel_w - 10,
- cancel_y = h - cancel_h - 10;
+ cancel_x = w - cancel_w - xs10,
+ cancel_y = h - cancel_h - ys10;
cancel->reposition_window(cancel_x, cancel_y);
return 0;
}
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;
+ if( !vtrk->is_armed() ) continue;
vtrk->expand_view = 1;
PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk);
vtrk->plugin_set.append(plugin_set);
if( trk_h < dvd_height ) trk_h = dvd_height;
for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
if( vtrk->data_type != TRACK_VIDEO ) continue;
- if( !vtrk->record ) continue;
+ if( !vtrk->is_armed() ) continue;
vtrk->track_w = trk_w;
vtrk->track_h = trk_h;
}
max_w = 0; max_h = 0;
int has_deinterlace = 0, has_scale = 0;
for( Track *trk=tracks->first; trk; trk=trk->next ) {
- if( !trk->record ) continue;
+ if( !trk->is_armed() ) continue;
Edits *edits = trk->edits;
switch( trk->data_type ) {
case TRACK_VIDEO:
if( max_h != dvd_height ) use_resize_tracks = 1;
}
for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
- if( !trk->record ) continue;
+ if( !trk->is_armed() ) continue;
switch( trk->data_type ) {
case TRACK_VIDEO:
if( trk->track_w != max_w ) use_resize_tracks = 1;
CreateDVD_Format::CreateDVD_Format(CreateDVD_GUI *gui, int x, int y)
- : BC_PopupMenu(x, y, 180, "", 1)
+ : BC_PopupMenu(x, y, xS(180), "", 1)
{
this->gui = gui;
}
CreateDVD_Scale::CreateDVD_Scale(CreateDVD_GUI *gui, int x, int y)
- : BC_PopupMenu(x, y, 100, "", 1)
+ : BC_PopupMenu(x, y, xS(140), "", 1)
{
this->gui = gui;
}
CreateDVD_MediaSize::CreateDVD_MediaSize(CreateDVD_GUI *gui, int x, int y)
- : BC_PopupTextBox(gui, 0, 0, x, y, 70,50)
+ : BC_PopupTextBox(gui, 0, 0, x, y, xS(70), 50)
{
this->gui = gui;
}