int ChromaKey::process_buffer(VFrame *frame,
		int64_t start_position,
		double frame_rate)
{
SET_TRACE

	load_configuration();
	this->input = frame;
	this->output = frame;

	read_frame(frame, 
		0, 
		start_position, 
		frame_rate,
		get_use_opengl());

	if(EQUIV(config.threshold, 0))
	{
		return 1;
	}
	else
	{
		if(get_use_opengl()) return run_opengl();

		if(!engine) engine = new ChromaKeyServer(this);
		engine->process_packages();
	}
SET_TRACE

	return 1;
}
Example #2
0
void deal_all_label_value(query_conf *que, char *item_name)
{
	conf_item *item = NULL;
	char *res = NULL;
	if ((que == NULL) || (item_name == NULL))
		return;

	query_conf *mod_option_conf = NULL;
	query_conf *mod_items_conf = NULL;
	query_conf *mod_item_label_name = NULL;

	char *mod_items_path = "mod_items.conf";
	if ((mod_items_conf = load_configuration(mod_items_path)) == NULL)
	{
        return;
	}

	item = que->label_item;
	while (item != NULL)
	{
		if (strcmp(item->item_value, "yes") == 0)
		{
			if ((mod_item_label_name = find_label(mod_items_conf, item->item_name)) == NULL)
			{
				free_configuration(&mod_items_conf);
				return;
			}

			deal_all_item_value(mod_item_label_name, "null");
		}
		//printf("%s\n", item->item_value);	

		item = item->item_next;
	}
}
Example #3
0
int PitchEffect::process_buffer(int64_t size, 
		Samples *buffer,
		int64_t start_position,
		int sample_rate)
{
//printf("PitchEffect::process_buffer %d\n", __LINE__);
	load_configuration();

	if(fft && config.size != fft->window_size)
	{
		delete fft;
		fft = 0;
	}

	if(!fft)
	{
		fft = new PitchFFT(this);
		fft->initialize(config.size);
	}

	fft->process_buffer(start_position,
		size, 
		buffer,
		get_direction());

	return 0;
}
Example #4
0
void IVTCMain::update_gui()
{
	if(thread)
	{
		load_configuration();
		((IVTCWindow*)thread->window)->lock_window();
		if(config.pattern == IVTCConfig::AUTOMATIC)
		{
			((IVTCWindow*)thread->window)->frame_offset->disable();
			((IVTCWindow*)thread->window)->first_field->disable();
		}
		else
		{
			((IVTCWindow*)thread->window)->frame_offset->enable();
			((IVTCWindow*)thread->window)->first_field->enable();
		}
		((IVTCWindow*)thread->window)->frame_offset->update((int64_t)config.frame_offset);
		((IVTCWindow*)thread->window)->first_field->update(config.first_field);
//		((IVTCWindow*)thread->window)->automatic->update(config.automatic);
		for(int i = 0; i < TOTAL_PATTERNS; i++)
		{
			((IVTCWindow*)thread->window)->pattern[i]->update(config.pattern == i);
		}
		((IVTCWindow*)thread->window)->unlock_window();
	}
}
int BrightnessMain::process_buffer(VFrame *frame,
	int64_t start_position,
	double frame_rate)
{
	load_configuration();

	read_frame(frame, 
		0, 
		start_position, 
		frame_rate,
		get_use_opengl());


// Use hardware
	if(get_use_opengl())
	{
		run_opengl();
		return 0;
	}




	if(!engine) engine = new BrightnessEngine(this, PluginClient::smp + 1);

	this->input = frame;
	this->output = frame;

	if(!EQUIV(config.brightness, 0) || !EQUIV(config.contrast, 0))
	{
		engine->process_packages();
	}

	return 0;
}
Example #6
0
int HueEffect::process_buffer(VFrame *frame,
	int64_t start_position,
	double frame_rate)
{
	load_configuration();

	read_frame(frame, 
		0, 
		start_position, 
		frame_rate,
		get_use_opengl());
	

	this->input = frame;
	this->output = frame;
	if(EQUIV(config.hue, 0) && EQUIV(config.saturation, 0) && EQUIV(config.value, 0))
	{
		return 0;
	}
	else
	{
		if(get_use_opengl())
		{
			run_opengl();
			return 0;
		}

		if(!engine) engine = new HueEngine(this, PluginClient::smp + 1);
		
		engine->process_packages();
	}
	return 0;
}
void GraphicEQ::update_gui()
{
	if(thread)
	{
		if(load_configuration() && 
			((GraphicGUI*)thread->window)->canvas->state != GraphicCanvas::DRAG_POINT)
		{
			((GraphicGUI*)thread->window)->lock_window("GraphicEQ::update_gui");
			((GraphicGUI*)thread->window)->update_canvas();
			((GraphicGUI*)thread->window)->update_textboxes();
			((GraphicGUI*)thread->window)->unlock_window();
		}
		else
		{
			int total_frames = get_gui_update_frames();
//printf("ParametricEQ::update_gui %d %d\n", __LINE__, total_frames);
			if(total_frames)
			{
				((GraphicGUI*)thread->window)->lock_window("GraphicEQ::update_gui");
				((GraphicGUI*)thread->window)->update_canvas();
				((GraphicGUI*)thread->window)->unlock_window();
			}
		}
	}
}
Example #8
0
int Piano::process_realtime(int64_t size, double *input_ptr, double *output_ptr)
{


	need_reconfigure |= load_configuration();
	if(need_reconfigure) reconfigure();

	double wetness = DB::fromdb(config.wetness);
	if(EQUIV(config.wetness, INFINITYGAIN)) wetness = 0;

	for(int j = 0; j < size; j++)
		output_ptr[j] = input_ptr[j] * wetness;

	int64_t fragment_len;
	for(int64_t i = 0; i < size; i += fragment_len)
	{
		fragment_len = size;
		if(i + fragment_len > size) fragment_len = size - i;

//printf("Piano::process_realtime 1 %d %d %d\n", i, fragment_len, size);
		fragment_len = overlay_synth(i, fragment_len, input_ptr, output_ptr);
//printf("Piano::process_realtime 2\n");
	}
	
	
	return 0;
}
Example #9
0
int BlurZoomMain::show_gui()
{
	load_configuration();
	thread = new BlurZoomThread(this);
	thread->start();
	return 0;
}
Example #10
0
/**
 * @brief Creates a selection menu phase where the player sets the global options.
 * @param menu the selection menu this phase will belong to
 */
SelectionMenuOptions::SelectionMenuOptions(SelectionMenu *menu):
  SelectionMenuPhase(menu, "selection_menu.phase.options"),
  cursor_position(0), modifying(false) {

  // option texts and values
  for (int i = 0; i < nb_options; i++) {

    // labels
    this->label_texts[i] = new TextSurface(64, 86 + i * 16, TextSurface::ALIGN_LEFT, TextSurface::ALIGN_MIDDLE);
    this->label_texts[i]->set_font("fixed");
    this->label_texts[i]->set_text(StringResource::get_string(label_keys[i]));

    // values
    this->value_texts[i] = new TextSurface(266, 86 + i * 16, TextSurface::ALIGN_RIGHT, TextSurface::ALIGN_MIDDLE);
    this->value_texts[i]->set_font("fixed");

    this->current_indices[i] = -1;
  }
  load_configuration();

  this->left_arrow_sprite = new Sprite("menus/arrow");
  this->left_arrow_sprite->set_current_animation("blink");
  this->left_arrow_sprite->set_current_direction(2);

  this->right_arrow_sprite = new Sprite("menus/arrow");
  this->right_arrow_sprite->set_current_animation("blink");
  this->right_arrow_sprite->set_current_direction(0);

  menu->set_bottom_options("selection_menu.back", "");
  set_cursor_position(0);
}
Example #11
0
int BurnMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
	this->input_ptr = input_ptr;
	this->output_ptr = output_ptr;

	load_configuration();

	if(!burn_server)
	{
		effecttv = new EffectTV(input_ptr->get_w(), input_ptr->get_h());
		buffer = (unsigned char *)new unsigned char[input_ptr->get_w() * input_ptr->get_h()];
		make_palette(input_ptr->get_color_model());

		effecttv->image_set_threshold_y(config.threshold);
		total = 0;

		burn_server = new BurnServer(this, 1, 1);
	}

	if(total == 0)
	{
		bzero(buffer, input_ptr->get_w() * input_ptr->get_h());
		effecttv->image_bgset_y(input_ptr);
	}
	burn_server->process_packages();

	total++;
//	if(total >= config.recycle * project_frame_rate) total = 0;
	return 0;
}
Example #12
0
IronBeeThreadedConsumer::IronBeeThreadedConsumer(
    const string& config_path,
    size_t        num_workers
) :
    m_state(make_shared<State>(num_workers))
{
    load_configuration(m_state->engine, config_path);
}
Example #13
0
int Piano::show_gui()
{
	load_configuration();
	
	thread = new PianoThread(this);
	thread->start();
	return 0;
}
Example #14
0
int hw_init_from_config(char* configuration_filename)
{
    configuration* config = load_configuration(configuration_filename);
    if (config == NULL)
    {
        return 1;
    }
    return hw_init_with_config(config);
}
Example #15
0
int play()
{

    static pthread_t thPlayer1, thPlayer2, thReferee;
    struct sched_param param;
    pthread_attr_t attr;

    prtflu("\033[H\033[2J"); // clearScreen in Linux
    prtflu("****************************************************************\n");
    prtflu("* RPS game                                                     *\n");
    prtflu("* Multithreaded implementation of the game Rock Paper Scissors *\n");
    prtflu("* 2012                                                         *\n");
    prtflu("****************************************************************\n");
    prtflu("\n");

    if ((errno = load_configuration()) != EOK)
        handle_error("Error while loading configuration");

    initialize((int)(config.flags & FL_SEMAPHORE));

    if ((errno = pthread_attr_init(&attr)) != 0)
        handle_error("pthread_attr_init");
    if ((errno = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED)) >0)
        handle_error("pthread_attr_setinheritsched");
    if ((errno = pthread_attr_setschedpolicy(&attr, SCHED_RR)) != 0)
        handle_error("pthread_attr_setschedpolicy");

    param.sched_priority = sched_get_priority_min(SCHED_RR);
    if ((errno = pthread_attr_setschedparam(&attr, &param)) != 0)
        handle_error("pthread_attr_setschedparam");
    if ((errno = pthread_create(&thPlayer1, &attr, player, (void*)0)) != 0)
        handle_error("Error creating thread player1");

    if ((errno = pthread_create(&thPlayer2, &attr, player, (void*)1)) != 0)
        handle_error("Error creating thread player2");

    param.sched_priority = sched_get_priority_max(SCHED_RR);
    if ((errno = pthread_attr_setschedparam(&attr, &param)) != 0)
        handle_error("pthread_attr_setschedparam");
    if ((errno = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE)) >0)
        handle_error("pthread_attr_setdetachstate");
    if (pthread_create(&thReferee, &attr, referee, (void*)NULL) != 0)
        handle_error("Error creating thread referee");

    pthread_attr_destroy(&attr);

    pthread_join(thReferee, NULL);

    if (config.flags & FL_SEMAPHORE)
    {
        sem_destroy(&sem_play);
        sem_destroy(&sem_done);
    }

    return EOK;
}
Example #16
0
int OverlayAudio::process_buffer(int64_t size, 
	Samples **buffer,
	int64_t start_position,
	int sample_rate)
{
	load_configuration();


	int output_track = 0;
	if(config.output_track == OverlayAudioConfig::BOTTOM)
		output_track = get_total_buffers() - 1;

// Direct copy the output track
	read_samples(buffer[output_track],
		output_track,
		sample_rate,
		start_position,
		size);

// Add remaining tracks
	Samples *output_buffer = buffer[output_track];
	double *output_samples = output_buffer->get_data();
	for(int i = 0; i < get_total_buffers(); i++)
	{
		if(i != output_track)
		{
			Samples *input_buffer = buffer[i];
			read_samples(buffer[i],
				i,
				sample_rate,
				start_position,
				size);
			double *input_samples = input_buffer->get_data();
			
			switch(config.mode)
			{
				case OverlayAudioConfig::ADD:
					for(int j = 0; j < size; j++)
					{
						output_samples[j] += input_samples[j];
					}
					break;
					
					
				case OverlayAudioConfig::MULTIPLY:
					for(int j = 0; j < size; j++)
					{
						output_samples[j] *= input_samples[j];
					}
					break;
			}
		}
	}

	return 0;
}
void DelayAudio::update_gui()
{
	if(thread)
	{
		load_configuration();
		((DelayAudioWindow*)thread->window)->lock_window();
		((DelayAudioWindow*)thread->window)->update_gui();
		((DelayAudioWindow*)thread->window)->unlock_window();
	}
}
Example #18
0
void Piano::update_gui()
{
	if(thread)
	{
		load_configuration();
		thread->window->lock_window();
		thread->window->update_gui();
		thread->window->unlock_window();
	}
}
Example #19
0
void _1080to540Main::update_gui()
{
	if(thread) 
	{
		load_configuration();
		thread->window->lock_window();
		((_1080to540Window*)thread->window)->set_first_field(config.first_field, 0);
		thread->window->unlock_window();
	}
}
Example #20
0
/**
 * @brief Called by Geany to initialize the plugin.
 * @note data is the same as geany_data.
 */
void plugin_init(GeanyData *data)
{
	log_func();

	/* Load configuration */
	load_configuration();
	/* Initialize the features */
	switch_head_impl_init();
	goto_file_init();
}
SpectralMeterConfigWidget::SpectralMeterConfigWidget( QWidget * parent )
	: QDialog(parent)
{
	setupUi(this);
	groupBoxAdvanced->hide();
	
	load_configuration();
	
	connect(buttonAdvanced, SIGNAL(toggled(bool)), this, SLOT(advancedButton_toggled(bool)));
}
void Color3WayMain::update_gui()
{
	if(thread)
	{
		load_configuration();
		((Color3WayWindow*)thread->window)->lock_window("Color3WayMain::update_gui");
		((Color3WayWindow*)thread->window)->update();
		((Color3WayWindow*)thread->window)->unlock_window();
	}
}
Example #23
0
void ShiftInterlaceMain::update_gui()
{
	if(thread) 
	{
		load_configuration();
		thread->window->lock_window();
		thread->window->odd_offset->update(config.odd_offset);
		thread->window->even_offset->update(config.even_offset);
		thread->window->unlock_window();
	}
}
Example #24
0
void RGB601Main::update_gui()
{
	if(thread)
	{
		load_configuration();
		thread->window->lock_window();
		((RGB601Window*)thread->window)->forward->update(config.direction == 1);
		((RGB601Window*)thread->window)->reverse->update(config.direction == 2);
		thread->window->unlock_window();
	}
}
Example #25
0
int BlurZoomMain::process_realtime(VFrame *input_ptr, VFrame *output_ptr)
{
	load_configuration();
	this->input_ptr = input_ptr;
	this->output_ptr = output_ptr;


	blurzoom_server->process_packages();

	return 0;
}
void FreezeFrameMain::update_gui()
{
	if(thread)
	{
		load_configuration();
		((FreezeFrameWindow*)thread->window)->lock_window();
		((FreezeFrameWindow*)thread->window)->enabled->update(config.enabled);
//		thread->window->line_double->update(config.line_double);
		thread->window->unlock_window();
	}
}
Example #27
0
void Despike::update_gui()
{
	if(thread)
	{
		load_configuration();
		((DespikeWindow*)thread->window)->lock_window();
		((DespikeWindow*)thread->window)->level->update(config.level);
		((DespikeWindow*)thread->window)->slope->update(config.slope);
		((DespikeWindow*)thread->window)->unlock_window();
	}
}
Example #28
0
void FlipMain::update_gui()
{
	if(thread)
	{
		load_configuration();
		thread->window->lock_window();
		thread->window->flip_vertical->update((int)config.flip_vertical);
		thread->window->flip_horizontal->update((int)config.flip_horizontal);
		thread->window->unlock_window();
	}
}
Example #29
0
int FlipMain::process_buffer(VFrame *frame,
		int64_t start_position,
		double frame_rate)
{
	int i, j, k, l;
	int w = frame->get_w();
	int h = frame->get_h();
	int colormodel = frame->get_color_model();

	load_configuration();

	read_frame(frame,
		0,
		get_source_position(),
		get_framerate(),
		get_use_opengl());



	if(get_use_opengl()) 
	{
		if(config.flip_vertical || config.flip_horizontal)
			return run_opengl();
		else
			return 0;
	}

	switch(colormodel)
	{
		case BC_RGB888:
		case BC_YUV888:
			FLIP_MACRO(unsigned char, 3);
			break;
		case BC_RGB_FLOAT:
			FLIP_MACRO(float, 3);
			break;
		case BC_RGB161616:
		case BC_YUV161616:
			FLIP_MACRO(uint16_t, 3);
			break;
		case BC_RGBA8888:
		case BC_YUVA8888:
			FLIP_MACRO(unsigned char, 4);
			break;
		case BC_RGBA_FLOAT:
			FLIP_MACRO(float, 4);
			break;
		case BC_RGBA16161616:
		case BC_YUVA16161616:
			FLIP_MACRO(uint16_t, 4);
			break;
	}
	return 0;
}
void FindObjectMain::update_gui()
{
	if(thread)
	{
		if(load_configuration())
		{
			thread->window->lock_window("FindObjectMain::update_gui");
			
			char string[BCTEXTLEN];

			((FindObjectWindow*)thread->window)->global_range_w->update(config.global_range_w);
			((FindObjectWindow*)thread->window)->global_range_h->update(config.global_range_h);
			((FindObjectWindow*)thread->window)->global_block_w->update(config.global_block_w);
			((FindObjectWindow*)thread->window)->global_block_h->update(config.global_block_h);
			((FindObjectWindow*)thread->window)->block_x->update(config.block_x);
			((FindObjectWindow*)thread->window)->block_y->update(config.block_y);
			((FindObjectWindow*)thread->window)->block_x_text->update((float)config.block_x);
			((FindObjectWindow*)thread->window)->block_y_text->update((float)config.block_y);

			((FindObjectWindow*)thread->window)->draw_keypoints->update(config.draw_keypoints);
			((FindObjectWindow*)thread->window)->draw_border->update(config.draw_border);
			((FindObjectWindow*)thread->window)->replace_object->update(config.replace_object);
			((FindObjectWindow*)thread->window)->draw_object_border->update(config.draw_object_border);


			((FindObjectWindow*)thread->window)->object_layer->update(
				(int64_t)config.object_layer);
			((FindObjectWindow*)thread->window)->replace_layer->update(
				(int64_t)config.replace_layer);
			((FindObjectWindow*)thread->window)->scene_layer->update(
				(int64_t)config.scene_layer);
			((FindObjectWindow*)thread->window)->algorithm->set_text(
				FindObjectAlgorithm::to_text(config.algorithm));

			((FindObjectWindow*)thread->window)->vmin->update(
				(int64_t)config.vmin);
			((FindObjectWindow*)thread->window)->vmax->update(
				(int64_t)config.vmax);
			((FindObjectWindow*)thread->window)->smin->update(
				(int64_t)config.smin);
			((FindObjectWindow*)thread->window)->blend->update(
				(int64_t)config.blend);

			((FindObjectWindow*)thread->window)->flush();
			thread->window->unlock_window();
		}
// printf("FindObjectMain::update_gui %d %d %d %d\n", 
// __LINE__, 
// config.mode1,
// config.mode2,
// config.mode3);
	}
}