X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.0%2Fcinelerra%2Fbdcreate.C;h=ce851d2521f7ed196d37696948d273605a4d7c0a;hp=86a2a690dabd4919cd2e03582054b17c17556724;hb=52fcc46226f9df46f9ce9d0566dc568455a7db0b;hpb=2d8ee7ae9c2f42d8c6f2d5dcc8949ef989ebd7af diff --git a/cinelerra-5.0/cinelerra/bdcreate.C b/cinelerra-5.0/cinelerra/bdcreate.C index 86a2a690..ce851d25 100644 --- a/cinelerra-5.0/cinelerra/bdcreate.C +++ b/cinelerra-5.0/cinelerra/bdcreate.C @@ -83,19 +83,19 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, EDL *edl = mwindow->edl; if( !edl || !edl->session ) { char msg[BCTEXTLEN]; - sprintf(msg, _("No EDL/Session")); - MainError::show_error(msg); - return 1; - } + sprintf(msg, _("No EDL/Session")); + MainError::show_error(msg); + return 1; + } EDLSession *session = edl->session; double total_length = edl->tracks->total_length(); - if( total_length <= 0 ) { + if( total_length <= 0 ) { char msg[BCTEXTLEN]; - sprintf(msg, _("No content: %s"), asset_title); - MainError::show_error(msg); - return 1; - } + sprintf(msg, _("No content: %s"), asset_title); + MainError::show_error(msg); + return 1; + } char asset_dir[BCTEXTLEN]; sprintf(asset_dir, "%s/%s", tmp_path, asset_title); @@ -111,16 +111,16 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, double old_samplerate = session->sample_rate; double old_framerate = session->frame_rate; - session->video_channels = BD_STREAMS; - session->video_tracks = BD_STREAMS; + session->video_channels = BD_STREAMS; + session->video_tracks = BD_STREAMS; // use session framerate -// session->frame_rate = BD_FRAMERATE; - session->output_w = BD_WIDTH; - session->output_h = BD_HEIGHT; - session->aspect_w = use_wide_aspect ? BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH; - session->aspect_h = use_wide_aspect ? BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT; - session->sample_rate = BD_SAMPLERATE; - session->audio_channels = session->audio_tracks = +// session->frame_rate = BD_FRAMERATE; + session->output_w = BD_WIDTH; + session->output_h = BD_HEIGHT; + session->aspect_w = use_wide_aspect ? BD_WIDE_ASPECT_WIDTH : BD_ASPECT_WIDTH; + session->aspect_h = use_wide_aspect ? BD_WIDE_ASPECT_HEIGHT : BD_ASPECT_HEIGHT; + session->sample_rate = BD_SAMPLERATE; + session->audio_channels = session->audio_tracks = use_wide_audio ? BD_WIDE_CHANNELS : BD_CHANNELS; char script_filename[BCTEXTLEN]; @@ -137,20 +137,21 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, char exe_path[BCTEXTLEN]; get_exe_path(exe_path); fprintf(fp,"#!/bin/bash -ex\n"); + fprintf(fp,"PATH=$PATH:%s\n",exe_path); fprintf(fp,"mkdir -p $1/udfs\n"); fprintf(fp,"sz=`du -sb $1/bd.m2ts | sed -e 's/[ \t].*//'`\n"); fprintf(fp,"blks=$((sz/2048 + 4096))\n"); fprintf(fp,"mkudffs $1/bd.udfs $blks\n"); fprintf(fp,"mount -o loop $1/bd.udfs $1/udfs\n"); - fprintf(fp,"%s/bdwrite $1/udfs $1/bd.m2ts\n",exe_path); + fprintf(fp,"bdwrite $1/udfs $1/bd.m2ts\n"); fprintf(fp,"umount $1/udfs\n"); - fprintf(fp,"echo To burn bluray, load blank media and run:\n"); - fprintf(fp,"echo dd if=$1/bd.udfs of=/dev/bd bs=2048000\n"); + fprintf(fp,"echo To burn bluray, load writable media and run:\n"); + fprintf(fp,"echo growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n"); fprintf(fp,"\n"); fclose(fp); if( use_wide_audio ) { - session->audio_channels = session->audio_tracks = BD_WIDE_CHANNELS; + session->audio_channels = session->audio_tracks = BD_WIDE_CHANNELS; session->achannel_positions[0] = 90; session->achannel_positions[1] = 150; session->achannel_positions[2] = 30; @@ -161,7 +162,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, mwindow->remap_audio(MWindow::AUDIO_1_TO_1); } else { - session->audio_channels = session->audio_tracks = BD_CHANNELS; + session->audio_channels = session->audio_tracks = BD_CHANNELS; session->achannel_positions[0] = 180; session->achannel_positions[1] = 0; if( edl->tracks->recordable_audio_tracks() == BD_WIDE_CHANNELS ) @@ -182,10 +183,10 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, char xml_filename[BCTEXTLEN]; sprintf(xml_filename, "%s/bd.xml", asset_dir); - FileXML xml_file; - edl->save_xml(&xml_file, xml_filename, 0, 0); - xml_file.terminate_string(); - if( xml_file.write_to_file(xml_filename) ) { + FileXML xml_file; + edl->save_xml(&xml_file, xml_filename, 0, 0); + xml_file.terminate_string(); + if( xml_file.write_to_file(xml_filename) ) { char msg[BCTEXTLEN]; sprintf(msg, _("Unable to save: %s"), xml_filename); MainError::show_error(msg); @@ -215,7 +216,7 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, sizeof(asset->ff_audio_options)); asset->ff_audio_bitrate = BD_KAUDIO_RATE * 1000; - asset->video_data = 1; + asset->video_data = 1; strcpy(asset->vcodec, "bluray.m2ts"); FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec); FFMPEG::load_options(option_path, asset->ff_video_options, @@ -223,11 +224,6 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, asset->ff_video_bitrate = vid_bitrate; asset->ff_video_quality = 0; - int len = strlen(asset->ff_video_options); - char *cp = asset->ff_video_options + len; - snprintf(cp, sizeof(asset->ff_video_options)-len-1, - "aspect %.5f\n", asset->aspect_ratio); - job = new BatchRenderJob(mwindow->preferences); jobs->append(job); job->edl_path[0] = '@'; @@ -241,7 +237,7 @@ void CreateBD_Thread::handle_close_event(int result) { if( result ) return; mwindow->batch_render->load_defaults(mwindow->defaults); - mwindow->undo->update_undo_before(); + mwindow->undo->update_undo_before(); KeyFrame keyframe; char data[BCTEXTLEN]; if( use_deinterlace ) { sprintf(data,""); @@ -310,10 +306,10 @@ BC_Window* CreateBD_Thread::new_gui() use_wide_aspect = 0; use_label_chapters = 0; option_presets(); - 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 = 500, h = 250; + 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 = 500, h = 250; int x = scr_x + scr_w/2 - w/2, y = scr_h/2 - h/2; gui = new CreateBD_GUI(this, x, y, w, h); @@ -325,8 +321,8 @@ BC_Window* CreateBD_Thread::new_gui() CreateBD_OK::CreateBD_OK(CreateBD_GUI *gui, int x, int y) : BC_OKButton(x, y) { - this->gui = gui; - set_tooltip(_("end setup, start batch render")); + this->gui = gui; + set_tooltip(_("end setup, start batch render")); } CreateBD_OK::~CreateBD_OK() @@ -335,23 +331,23 @@ CreateBD_OK::~CreateBD_OK() int CreateBD_OK::button_press_event() { - if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) { - gui->set_done(0); - return 1; - } - return 0; + if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) { + gui->set_done(0); + return 1; + } + return 0; } int CreateBD_OK::keypress_event() { - return 0; + return 0; } CreateBD_Cancel::CreateBD_Cancel(CreateBD_GUI *gui, int x, int y) : BC_CancelButton(x, y) { - this->gui = gui; + this->gui = gui; } CreateBD_Cancel::~CreateBD_Cancel() @@ -360,18 +356,18 @@ CreateBD_Cancel::~CreateBD_Cancel() int CreateBD_Cancel::button_press_event() { - if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) { - gui->set_done(1); - return 1; - } - return 0; + if(get_buttonpress() == 1 && is_event_win() && cursor_inside()) { + gui->set_done(1); + return 1; + } + return 0; } CreateBD_DiskSpace::CreateBD_DiskSpace(CreateBD_GUI *gui, int x, int y) : BC_Title(x, y, "", MEDIUMFONT, GREEN) { - this->gui = gui; + this->gui = gui; } CreateBD_DiskSpace::~CreateBD_DiskSpace() @@ -402,10 +398,10 @@ void CreateBD_DiskSpace::update() } CreateBD_TmpPath::CreateBD_TmpPath(CreateBD_GUI *gui, int x, int y, int w) - : BC_TextBox(x, y, w, 1, -sizeof(gui->thread->tmp_path), + : BC_TextBox(x, y, w, 1, -(int)sizeof(gui->thread->tmp_path), gui->thread->tmp_path, 1, MEDIUMFONT) { - this->gui = gui; + this->gui = gui; } CreateBD_TmpPath::~CreateBD_TmpPath() @@ -415,14 +411,14 @@ CreateBD_TmpPath::~CreateBD_TmpPath() int CreateBD_TmpPath::handle_event() { gui->disk_space->update(); - return 1; + return 1; } CreateBD_AssetTitle::CreateBD_AssetTitle(CreateBD_GUI *gui, int x, int y, int w) : BC_TextBox(x, y, w, 1, 0, gui->thread->asset_title, 1, MEDIUMFONT) { - this->gui = gui; + this->gui = gui; } CreateBD_AssetTitle::~CreateBD_AssetTitle() @@ -622,11 +618,11 @@ int CreateBD_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-10); - ok_y = h - ok_h - 10; - ok->reposition_window(ok_x, ok_y); + ok_y = h - ok_h - 10; + ok->reposition_window(ok_x, ok_y); cancel_x = w - cancel_w - 10, cancel_y = h - cancel_h - 10; - cancel->reposition_window(cancel_x, cancel_y); + cancel->reposition_window(cancel_x, cancel_y); return 0; } @@ -637,8 +633,8 @@ int CreateBD_GUI::translation_event() int CreateBD_GUI::close_event() { - set_done(1); - return 1; + set_done(1); + return 1; } int CreateBD_Thread:: @@ -659,16 +655,16 @@ insert_video_plugin(const char *title, KeyFrame *default_keyframe) } vtrk->optimize(); } - return 0; + return 0; } int CreateBD_Thread:: resize_tracks() { - Tracks *tracks = mwindow->edl->tracks; + Tracks *tracks = mwindow->edl->tracks; #if 0 int max_w = 0, max_h = 0; - for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) { + for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) { if( vtrk->data_type != TRACK_VIDEO ) continue; if( !vtrk->record ) continue; Edits *edits = vtrk->edits; @@ -679,25 +675,25 @@ resize_tracks() int h = indexable->get_h(); if( h > max_h ) max_h = h; } - } + } #endif - for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) { - if( vtrk->data_type != TRACK_VIDEO ) continue; - if( !vtrk->record ) continue; + for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) { + if( vtrk->data_type != TRACK_VIDEO ) continue; + if( !vtrk->record ) continue; vtrk->track_w = BD_WIDTH; // max_w; vtrk->track_h = BD_HEIGHT; // max_h; } - return 0; + return 0; } int CreateBD_Thread:: option_presets() { if( !mwindow->edl ) return 1; - Tracks *tracks = mwindow->edl->tracks; + Tracks *tracks = mwindow->edl->tracks; int max_w = 0, max_h = 0; int has_deinterlace = 0, has_scale = 0; - for( Track *trk=tracks->first; trk; trk=trk->next ) { + for( Track *trk=tracks->first; trk; trk=trk->next ) { if( !trk->record ) continue; Edits *edits = trk->edits; switch( trk->data_type ) { @@ -713,8 +709,8 @@ option_presets() } for( int i=0; iplugin_set.size(); ++i ) { for(Plugin *plugin = (Plugin*)trk->plugin_set[i]->first; - plugin; - plugin = (Plugin*)plugin->next) { + plugin; + plugin = (Plugin*)plugin->next) { if( !strcmp(plugin->title, "Deinterlace") ) has_deinterlace = 1; if( !strcmp(plugin->title, "Auto Scale") || @@ -724,14 +720,14 @@ option_presets() } break; } - } + } if( has_scale ) use_scale = 0; if( use_scale ) { if( max_w != BD_WIDTH ) use_resize_tracks = 1; if( max_h != BD_HEIGHT ) use_resize_tracks = 1; } - for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) { + for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) { if( !trk->record ) continue; switch( trk->data_type ) { case TRACK_VIDEO: @@ -739,7 +735,7 @@ option_presets() if( trk->track_h != max_h ) use_resize_tracks = 1; break; } - } + } if( !has_deinterlace && max_h > 2*BD_HEIGHT ) use_deinterlace = 1; // Labels *labels = mwindow->edl->labels; // use_label_chapters = labels && labels->first ? 1 : 0;