Ejemplo n.º 1
0
int YUVConfigVideo::create_objects()
{
	BC_Title *bt;
	int init_x = 10;
	int init_y = 10;
	
	int x = init_x;
	int y = init_y;

	add_subwindow(new BC_Title(init_x, y, _("Output Path:")));
	add_subwindow(path_textbox = new BC_TextBox(init_x + 100, y, 350, 1, asset->path));
	add_subwindow(path_recent = new BC_RecentList("PATH", defaults, path_textbox, 10, init_x + 450, y, path_textbox->get_w(), 100));
	path_recent->load_items(FILE_FORMAT_PREFIX(asset->format));

	x = init_x;
	y += 30;

	add_subwindow(bt = new BC_Title(init_x, y, _("Use Pipe:")));
	add_subwindow(pipe_checkbox = new PipeCheckBox(init_x + bt->get_w(), y, asset->use_pipe));
	add_subwindow(pipe_textbox = new BC_TextBox(init_x + 100, y, 350, 1, asset->pipe));
	add_subwindow(pipe_recent = new BC_RecentList("PIPE", defaults, pipe_textbox, 10, init_x + 450, y, pipe_textbox->get_w(), 100));
	pipe_recent->load_items(FILE_FORMAT_PREFIX(asset->format));

	pipe_checkbox->textbox = pipe_textbox;
	if (!asset->use_pipe) pipe_textbox->disable();

	x = init_x;
	y += 30;
	add_subwindow(new BC_Title(x, y, _("Stream Header:"), MEDIUMFONT, RED));

	x = init_x + 20;
	y += 30;
	add_subwindow(bt = new BC_Title(x, y, _("Interlacing:")));
	char string[BCTEXTLEN];
	ilacemode_to_text(string,asset->interlace_mode);
	add_subwindow(new BC_Title(x + bt->get_w() + 5, y, string, MEDIUMFONT, YELLOW));

	x = init_x;
	y += 30;
	add_subwindow(new BC_Title(x, y, _("Pipe Presets:")));

	x += 130;
	add_subwindow(mpeg2enc = new PipePreset(x, y, "mpeg2enc", pipe_textbox, pipe_checkbox));
	// NOTE: the '%' character will be replaced by the current path
	// NOTE: to insert a real '%' double it up: '%%' -> '%'
	// NOTE: preset items must have a '|' before the actual command
	mpeg2enc->add_item(new BC_MenuItem ("(DVD) | mpeg2enc -f 8 -o %"));
	mpeg2enc->add_item(new BC_MenuItem ("(VCD) | mpeg2enc -f 2 -o %"));

	x += 180;
	add_subwindow(ffmpeg = new PipePreset(x, y, "ffmpeg", pipe_textbox, pipe_checkbox));
	ffmpeg->add_item(new BC_MenuItem("(DVD) | ffmpeg -f yuv4mpegpipe -i - -y -target dvd -ilme -ildct -hq -f mpeg2video %"));
	ffmpeg->add_item(new BC_MenuItem("(VCD) | ffmpeg -f yuv4mpegpipe -i - -y -target vcd -hq -f mpeg2video %"));

	add_subwindow(new BC_OKButton(this));
	add_subwindow(new BC_CancelButton(this));
	show_window();
	return 0;
}
Ejemplo n.º 2
0
void FileYUV::get_parameters(BC_WindowBase *parent_window, 
			     Asset *asset, 
			     BC_WindowBase* &format_window,
			     int video_options,
			     FormatTools *format)
{
	if (! video_options) return;

	YUVConfigVideo *config = new YUVConfigVideo(parent_window, asset, format);
	format_window = config;
	config->create_objects();
	if (config->run_window() == 0) 
	{
		// save the new path and pipe to the asset
		strcpy(asset->path, config->path_textbox->get_text());
		strcpy(asset->pipe, config->pipe_textbox->get_text());
		// are we using the pipe (if there is one)
		asset->use_pipe = config->pipe_checkbox->get_value();
		// update the path textbox in the render window
		format->path_textbox->update(asset->path);
		// add the new path and pipe to the defaults list
		const char *prefix = FILE_FORMAT_PREFIX(asset->format);
		config->path_recent->add_item(prefix, asset->path);
		config->pipe_recent->add_item(prefix, asset->pipe);
	}
	delete config;
}
Ejemplo n.º 3
0
int FormatFormat::handle_event()
{
	if(get_selection(0, 0) >= 0)
	{
		int new_format = File::strtoformat(format->plugindb, get_selection(0, 0)->get_text());
		if(new_format != format->asset->format)
		{
			format->asset->format = new_format;
			format->format_text->update(get_selection(0, 0)->get_text());
			format->update_extension();
			format->close_format_windows();
			if (format->path_recent)
				format->path_recent->load_items
					(FILE_FORMAT_PREFIX(format->asset->format));
		}
	}
	return 1;
}
Ejemplo n.º 4
0
int FormatTools::create_objects(int &init_x, 
						int &init_y, 
						int do_audio,    // Include support for audio
						int do_video,   // Include support for video
						int prompt_audio,  // Include checkbox for audio
						int prompt_video,
						int prompt_audio_channels,
						int prompt_video_compression,
						const char *locked_compressor,
						int recording,
						int *strategy,
						int brender,
						int horizontal_layout)
{
	int x = init_x;
	int y = init_y;
	int ylev = init_y;

	this->locked_compressor = locked_compressor;
	this->recording = recording;
	this->use_brender = brender;
	this->do_audio = do_audio;
	this->do_video = do_video;
	this->prompt_audio = prompt_audio;
	this->prompt_audio_channels = prompt_audio_channels;
	this->prompt_video = prompt_video;
	this->prompt_video_compression = prompt_video_compression;
	this->strategy = strategy;

//printf("FormatTools::create_objects 1\n");

// Modify strategy depending on render farm
	if(strategy)
	{
		if(mwindow->preferences->use_renderfarm)
		{
			if(*strategy == FILE_PER_LABEL)
				*strategy = FILE_PER_LABEL_FARM;
			else
			if(*strategy == SINGLE_PASS)
				*strategy = SINGLE_PASS_FARM;
		}
		else
		{
			if(*strategy == FILE_PER_LABEL_FARM)
				*strategy = FILE_PER_LABEL;
			else
			if(*strategy == SINGLE_PASS_FARM)
				*strategy = SINGLE_PASS;
		}
	}

//printf("FormatTools::create_objects 1\n");
	if(!recording)
	{
		window->add_subwindow(path_textbox = new FormatPathText(x, y, this));
		x += 305;
		path_recent = new BC_RecentList("PATH", mwindow->defaults,
					path_textbox, 10, x, y, 300, 100);
		window->add_subwindow(path_recent);
		path_recent->load_items(FILE_FORMAT_PREFIX(asset->format));

		x += 18;
		window->add_subwindow(path_button = new BrowseButton(
			mwindow,
			window,
			path_textbox, 
			x, 
			y, 
			asset->path,
			_("Output to file"),
			_("Select a file to write to:"),
			0));

// Set w for user.
		w = x + path_button->get_w() + 5;

		y += path_textbox->get_h() + 10;
	}
	else
		w = x + 305;

	x = init_x;
	window->add_subwindow(format_title = new BC_Title(x, y, _("File Format:")));
	y += format_title->get_h() + 5;
	window->add_subwindow(format_text = new BC_TextBox(x, 
		y, 
		200, 
		1, 
		File::formattostr(asset->format)));
	x += format_text->get_w();
	window->add_subwindow(format_button = new FormatFormat(x, 
		y, 
		this));
	format_button->create_objects();

	x = init_x;
	y += format_button->get_h() + 10;
	if(do_audio)
	{
		window->add_subwindow(audio_title = new BC_Title(x, y, _("Audio:"), LARGEFONT,  BC_WindowBase::get_resources()->audiovideo_color));
		x += 80;
		window->add_subwindow(aparams_button = new FormatAParams(mwindow, this, x, y));
		x += aparams_button->get_w() + 10;
		if(prompt_audio) 
		{
			window->add_subwindow(audio_switch = new FormatAudio(x, y, this, asset->audio_data));
		}
		x = init_x;
		ylev = y;
		y += aparams_button->get_h() + 5;

// Audio channels only used for recording.
// 		if(prompt_audio_channels)
// 		{
// 			window->add_subwindow(channels_title = new BC_Title(x, y, _("Number of audio channels to record:")));
// 			x += 260;
// 			window->add_subwindow(channels_button = new FormatChannels(x, y, this));
// 			x += channels_button->get_w() + 5;
// 			window->add_subwindow(channels_tumbler = new BC_ITumbler(channels_button, 1, MAXCHANNELS, x, y));
// 			y += channels_button->get_h() + 20;
// 			x = init_x;
// 		}

//printf("FormatTools::create_objects 6\n");
		aparams_thread = new FormatAThread(this);
	}

//printf("FormatTools::create_objects 7\n");
	if(do_video)
	{
		if(horizontal_layout && do_audio){
			x += 370;
			y = ylev;
		}

//printf("FormatTools::create_objects 8\n");
		window->add_subwindow(video_title = new BC_Title(x, y, _("Video:"), LARGEFONT,  BC_WindowBase::get_resources()->audiovideo_color));
		x += 80;
		if(prompt_video_compression)
		{
			window->add_subwindow(vparams_button = new FormatVParams(mwindow, this, x, y));
			x += vparams_button->get_w() + 10;
		}

//printf("FormatTools::create_objects 9\n");
		if(prompt_video)
		{
			window->add_subwindow(video_switch = new FormatVideo(x, y, this, asset->video_data));
			y += video_switch->get_h();
		}
		else
		{
			y += vparams_button->get_h();
		}

//printf("FormatTools::create_objects 10\n");
		y += 10;
		vparams_thread = new FormatVThread(this);
	}

//printf("FormatTools::create_objects 11\n");

	x = init_x;
	if(strategy)
	{
		window->add_subwindow(multiple_files = new FormatMultiple(mwindow, x, y, strategy));
		y += multiple_files->get_h() + 10;
	}

//printf("FormatTools::create_objects 12\n");

	init_y = y;
	return 0;
}
Ejemplo n.º 5
0
void Render::run()
{
	int format_error;


	result = 0;

	if(mode == Render::INTERACTIVE)
	{
// Fix the asset for rendering
printf("Render::run 1\n");
		Asset *asset = new Asset;
		load_defaults(asset);
printf("Render::run 2\n");
		check_asset(mwindow->edl, *asset);
printf("Render::run 3\n");

// Get format from user
		if(!result)
		{
printf("Render::run 4\n");
			do
			{
				format_error = 0;
				result = 0;

				{
printf("Render::run 5\n");
					RenderWindow window(mwindow, this, asset);
printf("Render::run 6\n");
					window.create_objects();
printf("Render::run 7\n");
					result = window.run_window();
printf("Render::run 8\n");
					if (! result) {
						// add to recentlist only on OK
						window.format_tools->path_recent->add_item(FILE_FORMAT_PREFIX(asset->format), asset->path);
					}
				}

				if(!result)
				{
printf("Render::run 8.1\n");
// Check the asset format for errors.
					FormatCheck format_check(asset);
printf("Render::run 8.2\n");
					format_error = format_check.check_format();
printf("Render::run 8.3\n");
				}
			}while(format_error && !result);
		}
printf("Render::run 9\n");

		save_defaults(asset);
		mwindow->save_defaults();
printf("Render::run 10\n");

		if(!result) render(1, asset, mwindow->edl, strategy, range_type);
printf("Render::run 11\n");

		Garbage::delete_object(asset);
printf("Render::run 12\n");
	}
	else
	if(mode == Render::BATCH)
	{
		for(int i = 0; i < jobs->total && !result; i++)
		{
			BatchRenderJob *job = jobs->values[i];
			if(job->enabled)
			{
				if(mwindow)
				{
					mwindow->batch_render->update_active(i);
				}
				else
				{
					printf("Render::run: %s\n", job->edl_path);
				}


				FileXML *file = new FileXML;
				EDL *edl = new EDL;
				edl->create_objects();
				file->read_from_file(job->edl_path);
				if(!plugindb && mwindow)
					plugindb = mwindow->plugindb;
				edl->load_xml(plugindb, file, LOAD_ALL);

				check_asset(edl, *job->asset);
				render(0, job->asset, edl, job->strategy, RANGE_BACKCOMPAT);

				delete edl;
				delete file;
				if(!result)
				{
					if(mwindow)
						mwindow->batch_render->update_done(i, 1, elapsed_time);
					else
					{
						char string[BCTEXTLEN];
						elapsed_time = 
							(double)progress_timer->get_scaled_difference(1);
						Units::totext(string,
							elapsed_time,
							TIME_HMS2);
						printf("Render::run: done in %s\n", string);
					}
				}
				else
				{
					if(mwindow)
						mwindow->batch_render->update_active(-1);
					else
						printf("Render::run: failed\n");
				}
			}
		}

		if(mwindow)
		{
			mwindow->batch_render->update_active(-1);
			mwindow->batch_render->update_done(-1, 0, 0);
		}
	}
printf("Render::run 100\n");
}