コード例 #1
0
ファイル: pack-bitmap-write.c プロジェクト: jah2488/dotfiles
void bitmap_writer_select_commits(struct commit **indexed_commits,
                                  unsigned int indexed_commits_nr,
                                  int max_bitmaps)
{
    unsigned int i = 0, j, next;

    qsort(indexed_commits, indexed_commits_nr, sizeof(indexed_commits[0]),
          date_compare);

    if (writer.show_progress)
        writer.progress = start_progress("Selecting bitmap commits", 0);

    if (indexed_commits_nr < 100) {
        for (i = 0; i < indexed_commits_nr; ++i)
            push_bitmapped_commit(indexed_commits[i], NULL);
        return;
    }

    for (;;) {
        struct ewah_bitmap *reused_bitmap = NULL;
        struct commit *chosen = NULL;

        next = next_commit_index(i);

        if (i + next >= indexed_commits_nr)
            break;

        if (max_bitmaps > 0 && writer.selected_nr >= max_bitmaps) {
            writer.selected_nr = max_bitmaps;
            break;
        }

        if (next == 0) {
            chosen = indexed_commits[i];
            reused_bitmap = find_reused_bitmap(chosen->object.sha1);
        } else {
            chosen = indexed_commits[i + next];

            for (j = 0; j <= next; ++j) {
                struct commit *cm = indexed_commits[i + j];

                reused_bitmap = find_reused_bitmap(cm->object.sha1);
                if (reused_bitmap || (cm->object.flags & NEEDS_BITMAP) != 0) {
                    chosen = cm;
                    break;
                }

                if (cm->parents && cm->parents->next)
                    chosen = cm;
            }
        }

        push_bitmapped_commit(chosen, reused_bitmap);

        i += next + 1;
        display_progress(writer.progress, i);
    }

    stop_progress(&writer.progress);
}
コード例 #2
0
int InterpolateAllEffect::start_loop()
{
	state = READING;
	char string[BCTEXTLEN];
	sprintf(string, "%s...", plugin_title());
	progress = start_progress(string, (PluginClient::end - PluginClient::start));
	current_position = PluginClient::start;
	return 0;
}
コード例 #3
0
ファイル: mpmapwidget.cpp プロジェクト: daffodil/ffs-desktop
MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) :
        QWidget(parent)
{

	mainObject = mOb;
	setProperty("settings_namespace", QVariant("mp_map_window"));
	mainObject->settings->restoreWindow(this);

    setWindowTitle(tr("Multi Player Map"));
    setWindowIcon(QIcon(":/icons/mpmap"));

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);


    //** Toolbar
    QToolBar *toolbar = new QToolBar();
    mainLayout->addWidget(toolbar, 1);

    //** Select server
    QLabel *lblSelectServer = new QLabel("Select Server:");
    toolbar->addWidget(lblSelectServer);

    comboServer = new QComboBox();
    toolbar->addWidget(comboServer);
    comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org"));
    comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org"));
    connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server(int)));



    //** Browser
    browser = new QWebView(this);
    mainLayout->addWidget(browser, 100);
    connect(browser, SIGNAL(loadStarted()), this, SLOT(start_progress()));
    connect(browser, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int)));
    connect(browser, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool)));

    //*** Status Bar
    statusBar = new QStatusBar(this);
    mainLayout->addWidget(statusBar);
    statusBar->showMessage("Idle");

    //** Progress Bar
    progressBar = new QProgressBar();
    progressBar->setVisible(false);
    statusBar->addPermanentWidget(progressBar);

    //*** Initialise
    on_combo_server(0);
}
コード例 #4
0
ファイル: reframe.C プロジェクト: Cuchulain/cinelerra
int ReFrame::start_loop()
{
	if(PluginClient::interactive)
	{
		char string[BCTEXTLEN];
		sprintf(string, "%s...", plugin_title());
		progress = start_progress(string, 
			(PluginClient::end - PluginClient::start));
	}

	current_position = 0;
	return 0;
}
コード例 #5
0
int _720to480Main::start_loop()
{
	if(PluginClient::interactive)
	{
		char string[BCTEXTLEN];
		sprintf(string, "%s...", plugin_title());
		progress = start_progress(string, 
			PluginClient::end - PluginClient::start);
	}

	input_position = PluginClient::start;
	return 0;
}
コード例 #6
0
ファイル: normalize.C プロジェクト: beequ7et/cinelerra-cv
int NormalizeMain::start_loop()
{
	char string[BCTEXTLEN];
	sprintf(string, "%s...", plugin_title());
	progress = start_progress(string, (PluginClient::end - PluginClient::start) * 2);

	writing = 0;
	current_position = PluginClient::start;
	peak = new double[PluginClient::total_in_buffers];
	scale = new double[PluginClient::total_in_buffers];
	bzero(peak, sizeof(double) * PluginClient::total_in_buffers);
	return 0;
}
コード例 #7
0
ファイル: fsck.c プロジェクト: DoWonJin/git
static void fsck_object_dir(const char *path)
{
	struct progress *progress = NULL;

	if (verbose)
		fprintf(stderr, "Checking object directory\n");

	if (show_progress)
		progress = start_progress(_("Checking object directories"), 256);

	for_each_loose_file_in_objdir(path, fsck_loose, fsck_cruft, fsck_subdir,
				      progress);
	display_progress(progress, 256);
	stop_progress(&progress);
}
コード例 #8
0
ファイル: resample.C プロジェクト: knutj/cinelerra
int ResampleEffect::start_loop()
{
	if(PluginClient::interactive)
	{
		char string[BCTEXTLEN];
		sprintf(string, "%s...", plugin_title());
		progress = start_progress(string, 
			(int64_t)((double)(PluginClient::end - PluginClient::start) / scale));
	}

	current_position = PluginClient::start;
	total_written = 0;

	resample = new ResampleResample(this);
	return 0;
}
コード例 #9
0
ファイル: cdripper.C プロジェクト: beequ7et/cinelerra-cv
int CDRipMain::start_loop()
{
// get CD parameters
	int result = 0;

//printf("CDRipMain::start_loop 1\n");
	result = get_toc();
	FRAME = 4;    // 2 bytes 2 channels
	previewing = 3;     // defeat bug in hardware
	fragment_length = PluginClient::in_buffer_size * FRAME;
	fragment_length /= NFRAMES * FRAMESIZE;
	fragment_length *= NFRAMES * FRAMESIZE;
	total_length = (endlba - startlba) * FRAMESIZE / fragment_length + previewing + 1;
	result = open_drive();
//printf("CDRipMain::start_loop 1 %d\n", interactive);

// thread out progress
	if(interactive)
	{
		char string[BCTEXTLEN];
		sprintf(string, "%s...", plugin_title());
		progress = start_progress(string, total_length);
	}
//printf("CDRipMain::start_loop 1\n");

// get still more CD parameters
	endofselection = 0;
	currentlength = 0;
	startlba_fragment = startlba - fragment_length * previewing / FRAMESIZE;
	buffer = new char[fragment_length];
	arg.addr.lba = startlba_fragment;
	arg.addr_format = CDROM_LBA;
	arg.nframes = NFRAMES;
//printf("CDRipMain::start_loop 2\n");

	return result;
}
コード例 #10
0
ファイル: timestretch.C プロジェクト: Cuchulain/cinelerra
int TimeStretch::start_loop()
{
	scaled_size = (int64_t)(get_total_len() * scale);
	if(PluginClient::interactive)
	{
		char string[BCTEXTLEN];
		sprintf(string, "%s...", plugin_title());
		progress = start_progress(string, scaled_size);
	}

	current_position = get_source_start();
	total_written = 0;
	total_read = 0;



// The FFT case
	if(use_fft)
	{
		pitch = new PitchEngine(this);
		pitch->initialize(WINDOW_SIZE);
		resample = new TimeStretchResample(this);
	}
	else
// The windowing case
	{
// Must be short enough to mask beating but long enough to mask humming.
		stretch = new TimeStretchEngine(scale, 
			PluginAClient::project_sample_rate,
			WINDOW_TIME);
	}



	
	return 0;
}
コード例 #11
0
ファイル: delta-islands.c プロジェクト: fcharlie/git
void resolve_tree_islands(struct repository *r,
			  int progress,
			  struct packing_data *to_pack)
{
	struct progress *progress_state = NULL;
	struct tree_islands_todo *todo;
	int nr = 0;
	int i;

	if (!island_marks)
		return;

	/*
	 * We process only trees, as commits and tags have already been handled
	 * (and passed their marks on to root trees, as well. We must make sure
	 * to process them in descending tree-depth order so that marks
	 * propagate down the tree properly, even if a sub-tree is found in
	 * multiple parent trees.
	 */
	ALLOC_ARRAY(todo, to_pack->nr_objects);
	for (i = 0; i < to_pack->nr_objects; i++) {
		if (oe_type(&to_pack->objects[i]) == OBJ_TREE) {
			todo[nr].entry = &to_pack->objects[i];
			todo[nr].depth = oe_tree_depth(to_pack, &to_pack->objects[i]);
			nr++;
		}
	}
	QSORT(todo, nr, tree_depth_compare);

	if (progress)
		progress_state = start_progress(_("Propagating island marks"), nr);

	for (i = 0; i < nr; i++) {
		struct object_entry *ent = todo[i].entry;
		struct island_bitmap *root_marks;
		struct tree *tree;
		struct tree_desc desc;
		struct name_entry entry;
		khiter_t pos;

		pos = kh_get_sha1(island_marks, ent->idx.oid.hash);
		if (pos >= kh_end(island_marks))
			continue;

		root_marks = kh_value(island_marks, pos);

		tree = lookup_tree(r, &ent->idx.oid);
		if (!tree || parse_tree(tree) < 0)
			die(_("bad tree object %s"), oid_to_hex(&ent->idx.oid));

		init_tree_desc(&desc, tree->buffer, tree->size);
		while (tree_entry(&desc, &entry)) {
			struct object *obj;

			if (S_ISGITLINK(entry.mode))
				continue;

			obj = lookup_object(r, entry.oid->hash);
			if (!obj)
				continue;

			set_island_marks(obj, root_marks);
		}

		free_tree_buffer(tree);

		display_progress(progress_state, i+1);
	}

	stop_progress(&progress_state);
	free(todo);
}
コード例 #12
0
ファイル: mpmapwidget.cpp プロジェクト: fgx-bot/fgx
MpMapWidget::MpMapWidget(MainObject *mOb, QWidget *parent) :
        QWidget(parent)
{

	mainObject = mOb;
	setProperty("settings_namespace", QVariant("mp_map_window"));
	mainObject->settings->restoreWindow(this);

    setWindowTitle(tr("Multi Player Map"));
	setWindowIcon(QIcon(":/icon/mpmap"));

    QVBoxLayout *mainLayout = new QVBoxLayout(this);
    mainLayout->setContentsMargins(0,0,0,0);
    mainLayout->setSpacing(0);


    //** Toolbar
    QToolBar *toolbar = new QToolBar();
    mainLayout->addWidget(toolbar, 1);

    //** Select server
	QLabel *lblSelectServer = new QLabel(tr("Select Server:"));
    toolbar->addWidget(lblSelectServer);

    comboServer = new QComboBox();
    toolbar->addWidget(comboServer);
	
	//**get callsign

	//**add callsign to url
	comboServer->addItem("MpMap-01", QVariant("http://mpmap01.flightgear.org/"));
	comboServer->addItem("MpMap-02", QVariant("http://mpmap02.flightgear.org/"));
	comboServer->setCurrentIndex(0);
	connect(comboServer, SIGNAL(currentIndexChanged(int)), this, SLOT(on_combo_server()) );

	//=============================================================
	//== Cache
	//qDebug() << QDesktopServices::storageLocation(QDesktopServices::CacheLocation);

	networkDiskCache = new QNetworkDiskCache(this);
	networkDiskCache->setCacheDirectory(QDesktopServices::storageLocation(QDesktopServices::CacheLocation));

	networkCookieJar = new QNetworkCookieJar(this);

	//== Browser
	webView = new QWebView(this);
	mainLayout->addWidget(webView, 100);
	webView->page()->networkAccessManager()->setCache(networkDiskCache);
	webView->page()->networkAccessManager()->setCookieJar(networkCookieJar);
	connect(webView, SIGNAL(loadStarted()), this, SLOT(start_progress()));
	connect(webView, SIGNAL(loadProgress(int)), this, SLOT(update_progress(int)));
	connect(webView, SIGNAL(loadFinished(bool)), this, SLOT(end_progress(bool)));

    //*** Status Bar
    statusBar = new QStatusBar(this);
    mainLayout->addWidget(statusBar);
    statusBar->showMessage("Idle");

    //** Progress Bar
    progressBar = new QProgressBar();
    progressBar->setVisible(false);
    statusBar->addPermanentWidget(progressBar);

    //*** Initialise
	on_combo_server();
}
コード例 #13
0
ファイル: fontsel.c プロジェクト: GNOME/gimp-freetype
void
fontsel_configure (GtkWidget *fontsel,
		   gboolean   init)
{
  gchar        *path;
  GList        *list;
  GList        *dirs;
  GtkWidget    *parent;
  GtkWidget    *clist;
  ProgressData *pdata;

  g_return_if_fail (fontsel != NULL);

  parent = gtk_widget_get_toplevel (fontsel);
  path   = gimp_gimprc_query (FONTPATH_TOKEN);

  if (init)
    {
      if (path == NULL || !*path)
	{
	  path = g_strdup (DEFAULT_FONTPATH);

	  fontsel_directories_dialog
            (parent, _("You seem to be running the FreeType plug-in for the "
                       "first time. You need to specify a list of folders "
                       "where font files can be found on your system."),
             &path);
	}
    }
  else
    {
      init = fontsel_directories_dialog (parent, NULL, &path);
    }

  if (init)
    {
      pdata = g_object_get_data (G_OBJECT (fontsel), "progress_data");
      start_progress (pdata);

      if (families)
	{
	  g_tree_foreach (families,
                          (GTraverseFunc) fontsel_remove_family,
                          NULL);
	  g_tree_destroy (families);
	}

      families = g_tree_new ((GCompareFunc)strcmp);

      dirs = gimp_path_parse (path, 128, TRUE, NULL);

      for (list = dirs; list; list = g_list_next (list))
        fontsel_scan_directory (list->data);

      clist = g_object_get_data (G_OBJECT (fontsel), "family_list");
      gtk_clist_freeze (GTK_CLIST (clist));
      gtk_clist_clear (GTK_CLIST (clist));
      g_tree_foreach (families,
                      (GTraverseFunc) fontsel_family_list_insert,
                      clist);
      gtk_clist_thaw (GTK_CLIST (clist));

      stop_progress (pdata);
    }
}
コード例 #14
0
ファイル: fsck.c プロジェクト: DoWonJin/git
int cmd_fsck(int argc, const char **argv, const char *prefix)
{
	int i;
	struct alternate_object_database *alt;

	/* fsck knows how to handle missing promisor objects */
	fetch_if_missing = 0;

	errors_found = 0;
	check_replace_refs = 0;

	argc = parse_options(argc, argv, prefix, fsck_opts, fsck_usage, 0);

	fsck_walk_options.walk = mark_object;
	fsck_obj_options.walk = mark_used;
	fsck_obj_options.error_func = fsck_error_func;
	if (check_strict)
		fsck_obj_options.strict = 1;

	if (show_progress == -1)
		show_progress = isatty(2);
	if (verbose)
		show_progress = 0;

	if (write_lost_and_found) {
		check_full = 1;
		include_reflogs = 0;
	}

	if (name_objects)
		fsck_walk_options.object_names =
			xcalloc(1, sizeof(struct decoration));

	git_config(fsck_config, NULL);

	fsck_head_link();
	if (connectivity_only) {
		for_each_loose_object(mark_loose_for_connectivity, NULL, 0);
		for_each_packed_object(mark_packed_for_connectivity, NULL, 0);
	} else {
		struct alternate_object_database *alt_odb_list;

		fsck_object_dir(get_object_directory());

		prepare_alt_odb(the_repository);
		alt_odb_list = the_repository->objects->alt_odb_list;
		for (alt = alt_odb_list; alt; alt = alt->next)
			fsck_object_dir(alt->path);

		if (check_full) {
			struct packed_git *p;
			uint32_t total = 0, count = 0;
			struct progress *progress = NULL;

			if (show_progress) {
				for (p = get_packed_git(the_repository); p;
				     p = p->next) {
					if (open_pack_index(p))
						continue;
					total += p->num_objects;
				}

				progress = start_progress(_("Checking objects"), total);
			}
			for (p = get_packed_git(the_repository); p;
			     p = p->next) {
				/* verify gives error messages itself */
				if (verify_pack(p, fsck_obj_buffer,
						progress, count))
					errors_found |= ERROR_PACK;
				count += p->num_objects;
			}
			stop_progress(&progress);
		}
	}

	for (i = 0; i < argc; i++) {
		const char *arg = argv[i];
		struct object_id oid;
		if (!get_oid(arg, &oid)) {
			struct object *obj = lookup_object(oid.hash);

			if (!obj || !(obj->flags & HAS_OBJ)) {
				if (is_promisor_object(&oid))
					continue;
				error("%s: object missing", oid_to_hex(&oid));
				errors_found |= ERROR_OBJECT;
				continue;
			}

			obj->flags |= USED;
			if (name_objects)
				add_decoration(fsck_walk_options.object_names,
					obj, xstrdup(arg));
			mark_object_reachable(obj);
			continue;
		}
		error("invalid parameter: expected sha1, got '%s'", arg);
		errors_found |= ERROR_OBJECT;
	}

	/*
	 * If we've not been given any explicit head information, do the
	 * default ones from .git/refs. We also consider the index file
	 * in this case (ie this implies --cache).
	 */
	if (!argc) {
		get_default_heads();
		keep_cache_objects = 1;
	}

	if (keep_cache_objects) {
		verify_index_checksum = 1;
		verify_ce_order = 1;
		read_cache();
		for (i = 0; i < active_nr; i++) {
			unsigned int mode;
			struct blob *blob;
			struct object *obj;

			mode = active_cache[i]->ce_mode;
			if (S_ISGITLINK(mode))
				continue;
			blob = lookup_blob(&active_cache[i]->oid);
			if (!blob)
				continue;
			obj = &blob->object;
			obj->flags |= USED;
			if (name_objects)
				add_decoration(fsck_walk_options.object_names,
					obj,
					xstrfmt(":%s", active_cache[i]->name));
			mark_object_reachable(obj);
		}
		if (active_cache_tree)
			fsck_cache_tree(active_cache_tree);
	}

	check_connectivity();
	return errors_found;
}
コード例 #15
0
ファイル: pack-bitmap-write.c プロジェクト: jah2488/dotfiles
void bitmap_writer_build(struct packing_data *to_pack)
{
    static const double REUSE_BITMAP_THRESHOLD = 0.2;

    int i, reuse_after, need_reset;
    struct bitmap *base = bitmap_new();
    struct rev_info revs;

    writer.bitmaps = kh_init_sha1();
    writer.to_pack = to_pack;

    if (writer.show_progress)
        writer.progress = start_progress("Building bitmaps", writer.selected_nr);

    init_revisions(&revs, NULL);
    revs.tag_objects = 1;
    revs.tree_objects = 1;
    revs.blob_objects = 1;
    revs.no_walk = 0;

    revs.include_check = should_include;
    reset_revision_walk();

    reuse_after = writer.selected_nr * REUSE_BITMAP_THRESHOLD;
    need_reset = 0;

    for (i = writer.selected_nr - 1; i >= 0; --i) {
        struct bitmapped_commit *stored;
        struct object *object;

        khiter_t hash_pos;
        int hash_ret;

        stored = &writer.selected[i];
        object = (struct object *)stored->commit;

        if (stored->bitmap == NULL) {
            if (i < writer.selected_nr - 1 &&
                    (need_reset ||
                     !in_merge_bases(writer.selected[i + 1].commit,
                                     stored->commit))) {
                bitmap_reset(base);
                reset_all_seen();
            }

            add_pending_object(&revs, object, "");
            revs.include_check_data = base;

            if (prepare_revision_walk(&revs))
                die("revision walk setup failed");

            traverse_commit_list(&revs, show_commit, show_object, base);

            revs.pending.nr = 0;
            revs.pending.alloc = 0;
            revs.pending.objects = NULL;

            stored->bitmap = bitmap_to_ewah(base);
            need_reset = 0;
        } else
            need_reset = 1;

        if (i >= reuse_after)
            stored->flags |= BITMAP_FLAG_REUSE;

        hash_pos = kh_put_sha1(writer.bitmaps, object->sha1, &hash_ret);
        if (hash_ret == 0)
            die("Duplicate entry when writing index: %s",
                sha1_to_hex(object->sha1));

        kh_value(writer.bitmaps, hash_pos) = stored;
        display_progress(writer.progress, writer.selected_nr - i);
    }

    bitmap_free(base);
    stop_progress(&writer.progress);

    compute_xor_offsets();
}
コード例 #16
0
ファイル: render.C プロジェクト: beequ7et/cinelerra-cv
int Render::render(int test_overwrite, 
	Asset *asset,
	EDL *edl,
	int strategy,
	int range_type)
{
	char string[BCTEXTLEN];
// Total length in seconds
	double total_length;
	int last_audio_buffer;
	RenderFarmServer *farm_server = 0;
	FileSystem fs;
	int total_digits;      // Total number of digits including padding the user specified.
	int number_start;      // Character in the filename path at which the number begins
	int current_number;    // The number the being injected into the filename.
// Pointer from file
// (VFrame*)(VFrame array [])(Channel [])
	VFrame ***video_output;
// Pointer to output buffers
	VFrame *video_output_ptr[MAX_CHANNELS];
	double *audio_output_ptr[MAX_CHANNELS];
	int done = 0;
	in_progress = 1;


	this->default_asset = asset;
	progress = 0;
	result = 0;

	if(mwindow)
	{
		if(!preferences)
			preferences = new Preferences;

		preferences->copy_from(mwindow->preferences);
	}


// Create rendering command
	command = new TransportCommand;
	command->command = NORMAL_FWD;
	command->get_edl()->copy_all(edl);
	command->change_type = CHANGE_ALL;
	if (range_type == RANGE_BACKCOMPAT)
	{
// Get highlighted playback range
		command->set_playback_range();
// Adjust playback range with in/out points
		command->playback_range_adjust_inout();
	} else
	if (range_type == RANGE_PROJECT)
	{
		command->playback_range_project();
	} else
	if (range_type == RANGE_SELECTION)
	{
		command->set_playback_range();
	} else
	if (range_type == RANGE_INOUT)
	{
		command->playback_range_inout();
	}
	packages = new PackageDispatcher;


// Configure preview monitor
	VideoOutConfig vconfig;
	PlaybackConfig *playback_config = new PlaybackConfig;

// Create caches
	audio_cache = new CICache(preferences, plugindb);
	video_cache = new CICache(preferences, plugindb);

	default_asset->frame_rate = command->get_edl()->session->frame_rate;
	default_asset->sample_rate = command->get_edl()->session->sample_rate;

// Conform asset to EDL.  Find out if any tracks are playable.
	result = check_asset(command->get_edl(), *default_asset);

	if(!result)
	{
// Get total range to render
		total_start = command->start_position;
		total_end = command->end_position;
		total_length = total_end - total_start;

// Nothing to render
		if(EQUIV(total_length, 0))
		{
			result = 1;
		}
	}







// Generate packages
	if(!result)
	{
// Stop background rendering
		if(mwindow) mwindow->stop_brender();

		fs.complete_path(default_asset->path);
		strategy = Render::fix_strategy(strategy, preferences->use_renderfarm);

		result = packages->create_packages(mwindow,
			command->get_edl(),
			preferences,
			strategy, 
			default_asset, 
			total_start, 
			total_end,
			test_overwrite);
	}










	done = 0;
	total_rendered = 0;
	frames_per_second = 0;

	if(!result)
	{
// Start dispatching external jobs
		if(mwindow)
		{
			mwindow->gui->lock_window("Render::render 1");
			mwindow->gui->show_message(_("Starting render farm"));
			mwindow->gui->start_hourglass();
			mwindow->gui->unlock_window();
		}
		else
		{
			printf("Render::render: starting render farm\n");
		}

		if(strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM)
		{
			farm_server = new RenderFarmServer(plugindb, 
				packages,
				preferences, 
				1,
				&result,
				&total_rendered,
				counter_lock,
				default_asset,
				command->get_edl(),
				0);
			result = farm_server->start_clients();

			if(result)
			{
				if(mwindow)
				{
					mwindow->gui->lock_window("Render::render 2");
					mwindow->gui->show_message(_("Failed to start render farm"),
						mwindow->theme->message_error);
					mwindow->gui->stop_hourglass();
					mwindow->gui->unlock_window();
				}
				else
				{
					printf("Render::render: Failed to start render farm\n");
				}
			}
		}
	}




// Perform local rendering


	if(!result)
	{
		start_progress();
	



		MainPackageRenderer package_renderer(this);
		result = package_renderer.initialize(mwindow,
				command->get_edl(),   // Copy of master EDL
				preferences, 
				default_asset,
				plugindb);







		while(!result)
		{
// Get unfinished job
			RenderPackage *package;

			if(strategy == SINGLE_PASS_FARM)
			{
				package = packages->get_package(frames_per_second, -1, 1);
			}
			else
			{
				package = packages->get_package(0, -1, 1);
			}

// Exit point
			if(!package) 
			{
				done = 1;
				break;
			}



			Timer timer;
			timer.update();

			if(package_renderer.render_package(package))
				result = 1;

// Result is also set directly by the RenderFarm.

			frames_per_second = (double)(package->video_end - package->video_start) / 
				(double)(timer.get_difference() / 1000);


		} // file_number



printf("Render::run: Session finished.\n");





		if(strategy == SINGLE_PASS_FARM || strategy == FILE_PER_LABEL_FARM)
		{
			farm_server->wait_clients();
			result |= packages->packages_are_done();
		}

printf("Render::render 90\n");

// Notify of error
		if(result && 
			(!progress || !progress->is_cancelled()) &&
			!batch_cancelled)
		{
			if(mwindow)
			{
				ErrorBox error_box(PROGRAM_NAME ": Error",
					mwindow->gui->get_abs_cursor_x(1),
					mwindow->gui->get_abs_cursor_y(1));
				error_box.create_objects(_("Error rendering data."));
				error_box.raise_window();
				error_box.run_window();
			}
			else
			{
				printf("Render::render: Error rendering data\n");
			}
		}

// Delete the progress box
		stop_progress();

//printf("Render::render 100\n");




	}


// Paste all packages into timeline if desired

	if(!result && 
		load_mode != LOAD_NOTHING && 
		mwindow &&
		mode != Render::BATCH)
	{
		mwindow->gui->lock_window("Render::render 3");




		ArrayList<Asset*> *assets = packages->get_asset_list();
		if(load_mode == LOAD_PASTE)
			mwindow->clear(0);
		mwindow->load_assets(assets, 
			-1, 
			load_mode,
			0,
			0,
			mwindow->edl->session->labels_follow_edits,
			mwindow->edl->session->plugins_follow_edits,
			0); // overwrite
		delete assets;


		mwindow->save_backup();
		mwindow->undo->update_undo(_("render"), LOAD_ALL);
		mwindow->update_plugin_guis();
		mwindow->gui->update(1, 
			2,
			1,
			1,
			1,
			1,
			0);
		mwindow->sync_parameters(CHANGE_ALL);
		mwindow->gui->unlock_window();
	}


// Disable hourglass
	if(mwindow)
	{
		mwindow->gui->lock_window("Render::render 3");
		mwindow->gui->stop_hourglass();
		mwindow->gui->unlock_window();
	}

//printf("Render::render 110\n");
// Need to restart because brender always stops before render.
	if(mwindow)
		mwindow->restart_brender();
	if(farm_server) delete farm_server;
	delete command;
	delete playback_config;
	delete audio_cache;
	delete video_cache;
// Must delete packages after server
	delete packages;
	in_progress = 0;
	completion->unlock();
//printf("Render::render 120\n");

	return result;
}