Exemplo n.º 1
0
int FileMediaDb::close_file()
{
	reset_parameters();

	FileBase::close_file();
	return 0;
}
Exemplo n.º 2
0
CommonRender::CommonRender(RenderEngine *renderengine)
 : Thread(1, 0, 0)
{
	this->renderengine = renderengine;
	reset_parameters();
	start_lock = new Condition(0, "CommonRender::start_lock");
}
Exemplo n.º 3
0
VFrame::VFrame(int w, int h, int color_model, long bytes_per_line)
{
	reset_parameters(1);
	params = new BC_Hash;
	allocate_data(data, -1, 0, 0, 0, w, h,
		color_model, bytes_per_line);
}
Exemplo n.º 4
0
int FileAC3::close_file()
{
	if( mpg_file )
	{
		delete mpg_file;
		mpg_file = 0;
	}
	if(codec_context)
	{
		avcodec_close(((AVCodecContext*)codec_context));
		free(codec_context);
		codec_context = 0;
		codec = 0;
	}
	if(fd)
	{
		fclose(fd);
		fd = 0;
	}
	if(temp_raw)
	{
		delete [] temp_raw;
		temp_raw = 0;
	}
	if(temp_compressed)
	{
		delete [] temp_compressed;
		temp_compressed = 0;
	}
	reset_parameters();
	FileBase::close_file();
	return 0;
}
Exemplo n.º 5
0
FileVorbis::FileVorbis(Asset *asset, File *file)
 : FileBase(asset, file)
{
	reset_parameters();
	if(asset->format == FILE_UNKNOWN) asset->format = FILE_VORBIS;
	asset->byte_order = 0;
}
Exemplo n.º 6
0
VFrame::VFrame(unsigned char *data, int shmid, int w, int h,
	int color_model, long bytes_per_line)
{
	reset_parameters(1);
	params = new BC_Hash;
	allocate_data(data, shmid, 0, 0, 0, w, h,
		color_model, bytes_per_line);
}
Exemplo n.º 7
0
VFrame::VFrame(VFrame &frame)
{
	reset_parameters(1);
	params = new BC_Hash;
	allocate_data(0, 0, 0, 0, frame.w, frame.h, frame.color_model, frame.bytes_per_line);
	memcpy(data, frame.data, bytes_per_line * h);
	copy_stacks(&frame);
}
Exemplo n.º 8
0
int FileDB::close_file()
{
	reset_parameters();
	FileBase::close_file();
	mdb->closeDb();
	delete vframe;
	vframe = 0;
	return 0;
}
Exemplo n.º 9
0
RecordMonitorThread::RecordMonitorThread(MWindow *mwindow, 
	Record *record, 
	RecordMonitor *record_monitor)
 : Thread(1, 0, 0)
{
	this->mwindow = mwindow;
	this->record_monitor = record_monitor;
	this->record = record;
	this->ovly = 0;
	reset_parameters();
	output_lock = new Condition(1, "RecordMonitor::output_lock");
	input_lock = new Condition(1, "RecordMonitor::input_lock");
}
Exemplo n.º 10
0
FileMediaDb::FileMediaDb(Asset *asset, File *file)
 : FileBase(asset, file)
{
	reset_parameters();
	if(asset->format == FILE_UNKNOWN)
		asset->format = FILE_MEDIADB;
	clip_id = -1;
	swidth = (SWIDTH+1) & ~1;
	sheight = (SHEIGHT+1) & ~1;
	seq_no = frame_id = frames = -1;
	framerate = offset = -1;;
	title[0] = 0;
}
Exemplo n.º 11
0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Reset all session data buffers
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Session::reset(BufferParams& buffer_params, float mb_frame_time_sampling, float fps) {
	// Block for buffer acces and reset immediately. we can't do this
	// in the thread, because we need to allocate an OpenGL buffer, and
	// that only works in the main thread
	thread_scoped_lock display_lock(display_mutex);
	thread_scoped_lock render_buffer_lock(render_buffer_mutex);

	display_outdated    = true;
	reset_time          = time_dt();

	reset_parameters(buffer_params);
    server->reset(params.export_type, scene->kernel->uiGPUs, mb_frame_time_sampling, fps, params.deep_image);
	pause_cond.notify_all();
} //reset()
Exemplo n.º 12
0
int RecordVideo::arm_recording()
{
	reset_parameters();
// Resume next file in a series by incrementing existing counters
	if(record_thread->monitor)
		buffer_size = 1;
	else
		buffer_size = mwindow->edl->session->video_write_length;

	trigger_lock->lock("RecordVideo::arm_recording");
	Thread::start();

	return 0;
}
Exemplo n.º 13
0
RecordVideo::RecordVideo(MWindow *mwindow, Record *record)
 : Thread(1, 0, 0)
{
	this->mwindow = mwindow;
	this->record = record;
	this->gui = record->record_gui;
	trigger_lock = new Condition(0, "RecordVideo::trigger_lock");
        pause_record_lock = new Condition(0, "RecordVideo::pause_record_lock");
        record_paused_lock = new Condition(0, "RecordVideo::record_paused_lock");
	frame_ptr = 0;
	buffer_frame = 0;
	reset_parameters();
	done = -1;
}
Exemplo n.º 14
0
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Update render project on the render-server
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
void Session::update(BufferParams& buffer_params) {
	// Block for buffer acces and reset immediately. we can't do this
	// in the thread, because we need to allocate an OpenGL buffer, and
	// that only works in the main thread
	thread_scoped_lock display_lock(display_mutex);
	thread_scoped_lock render_buffer_lock(render_buffer_mutex);

	display_outdated    = true;
	reset_time          = time_dt();

	reset_parameters(buffer_params);
    //server->update();
	pause_cond.notify_all();
} //update()
Exemplo n.º 15
0
RecordVideo::RecordVideo(MWindow *mwindow,
	Record *record, 
	RecordThread *record_thread)
 : Thread(1, 0, 0)
{
	reset_parameters();
	this->mwindow = mwindow;
	this->record = record;
	this->record_thread = record_thread; 
	this->gui = record->record_gui;
	unhang_lock = new Mutex("RecordVideo::unhang_lock");
	trigger_lock = new Condition(1, "RecordVideo::trigger_lock");
	capture_frame = 0;
	frame_ptr = 0;
}
Exemplo n.º 16
0
VFrame::VFrame(int w, 
	int h, 
	int color_model)
 {
	reset_parameters(1);
	params = new BC_Hash;
	allocate_data(data, 
	      /* shmid = -1, */
		0, 
		0, 
		0, 
		w, 
		h, 
		color_model, 
		-1);
}
Exemplo n.º 17
0
FileDB::FileDB(Asset *asset, File *file)
 : FileBase(asset, file)
{
	reset_parameters();
	mdb = new MediaDb();
	if(asset->format == FILE_UNKNOWN)
		asset->format = FILE_DB;
	clip_id = -1;
	swidth = (SWIDTH+1) & ~1;
	sheight = (SHEIGHT+1) & ~1;
	frame_id = clip_size = -1;
	seq_no = 0;
	prefix_size = suffix_offset = -1;
	framerate = -1;
	vframe = 0;
}
Exemplo n.º 18
0
int FileList::close_file()
{
//	path_list.total, asset->format, list_type, wr);
	if(asset->format == list_type && path_list.total)
	{
		if(file->wr && asset->use_header) write_list_header();
		path_list.remove_all_objects();
	}
	if(data) delete data;
	if(writer) delete writer;
	if(temp) delete temp;
	reset_parameters();

	FileBase::close_file();
	return 0;
}
Exemplo n.º 19
0
RenderEngine::RenderEngine(PlaybackEngine *playback_engine,
 	Preferences *preferences, 
	TransportCommand *command,
	Canvas *output,
	ArrayList<PluginServer*> *plugindb,
	ChannelDB *channeldb)
 : Thread(1, 0, 0)
{
	this->playback_engine = playback_engine;
	this->output = output;
	this->plugindb = plugindb;
	this->channeldb = channeldb;
	audio = 0;
	video = 0;
	config = new PlaybackConfig;
	arender = 0;
	vrender = 0;
	do_audio = 0;
	do_video = 0;
	interrupted = 0;
	actual_frame_rate = 0;
 	this->preferences = new Preferences;
 	this->command = new TransportCommand;
 	this->preferences->copy_from(preferences);
 	this->command->copy_from(command);
	edl = new EDL;
	edl->create_objects();
// EDL only changed in construction.
// The EDL contained in later commands is ignored.
	edl->copy_all(command->get_edl());
	audio_cache = 0;
	video_cache = 0;
	if(playback_engine && playback_engine->mwindow)
		mwindow = playback_engine->mwindow;
	else
		mwindow = 0;
	show_tc = 0;


	input_lock = new Condition(1, "RenderEngine::input_lock");
	start_lock = new Condition(1, "RenderEngine::start_lock");
	output_lock = new Condition(1, "RenderEngine::output_lock");
	interrupt_lock = new Mutex("RenderEngine::interrupt_lock");
	first_frame_lock = new Condition(1, "RenderEngine::first_frame_lock");
	reset_parameters();
}
Exemplo n.º 20
0
VFrame::VFrame(BC_Bitmap *bitmap, int w, int h,
		 int color_model, long bytes_per_line)
{
	reset_parameters(1);
	params = new BC_Hash;
	int shmid = 0;
	unsigned char *data = 0;
	if( bitmap->is_shared() )
		shmid = bitmap->get_shmid();
	else
		data = bitmap->get_data();
	allocate_data(data, shmid,
		bitmap->get_y_offset(),
		bitmap->get_u_offset(),
		bitmap->get_v_offset(),
		w, h, color_model, bytes_per_line);
}
Exemplo n.º 21
0
FileList::FileList(Asset *asset, 
	File *file, 
	const char *list_prefix,
	const char *file_extension, 
	int frame_type,
	int list_type)
 : FileBase(asset, file)
{
	reset_parameters();
	path_list.set_array_delete();
	asset->video_data = 1;
	this->list_prefix = list_prefix;
	this->file_extension = file_extension;
	this->frame_type = frame_type;
	this->list_type = list_type;
	table_lock = new Mutex("FileList::table_lock");
}
Exemplo n.º 22
0
int bench(int argc, char **argv, bool main_bench) {
    for (int arg = 0; arg < argc; ++arg) {
        if (!strncmp("--batch=", argv[arg], 8))
            SAFE(batch(argv[arg] + 8, bench), CRIT);
        else if (!strncmp("--cfg=", argv[arg], 6))
            cfg = str2cfg(argv[arg] + 6);
        else if (!strncmp("--match=", argv[arg], 8))
            pattern = argv[arg] + 8;
        else if (!strncmp("--mb=", argv[arg], 5))
            mb = atoi(argv[arg] + 5);
        else if (!strncmp("--dir=", argv[arg], 6))
            dir = str2dir(argv[arg] + 6);
        else if (!strncmp("--alg=", argv[arg], 6))
            alg = str2alg(argv[arg] + 6);
        else if (!strncmp("--attr=", argv[arg], 7))
            SAFE(str2attr(&attr, argv[arg] + 7), CRIT);
        else if (!strncmp("--skip-impl=", argv[arg], 12))
            skip_impl = argv[arg] + 12;
        else if (!strncmp("--allow-unimpl=", argv[arg], 15))
            allow_unimpl = str2bool(argv[arg] + 15);
        else if (!strncmp("--perf-template=", argv[arg], 16))
            perf_template = argv[arg] + 16;
        else if (!strcmp("--reset", argv[arg]))
            reset_parameters();
        else if (!strncmp("--mode=", argv[arg], 7))
            bench_mode = str2bench_mode(argv[arg] + 7);
        else if (!strncmp("-v", argv[arg], 2))
            verbose = atoi(argv[arg] + 2);
        else if (!strncmp("--verbose=", argv[arg], 10))
            verbose = atoi(argv[arg] + 10);
        else {
            desc_t c;
            bool is_deconv = 0;
            if (str2desc(&c, argv[arg], is_deconv) == FAIL) {
                fprintf(stderr, "driver: unknown option: `%s`, exiting...\n",
                        argv[arg]);
                exit(2);
            }
            check_correctness(&c);
        }
    }

    return OK;
}
Exemplo n.º 23
0
int FileVorbis::close_file()
{
	if(fd)
	{
		if(wr)
		{
			vorbis_analysis_wrote(&vd, 0);
			FLUSH_VORBIS

			ogg_stream_clear(&os);
			vorbis_block_clear(&vb);
			vorbis_dsp_clear(&vd);
			vorbis_comment_clear(&vc);
			vorbis_info_clear(&vi);
			fclose(fd);
		}
		
		if(rd)
		{
// This also closes the file handle.
			ov_clear(&vf);
		}
		fd = 0;
	}

	if(pcm_history)
	{
		for(int i = 0; i < asset->channels; i++)
			delete [] pcm_history[i];
		delete [] pcm_history;
	}
	if(pcm_history_float)
	{
		for(int i = 0; i < asset->channels; i++)
			delete [] pcm_history_float[i];
		delete [] pcm_history_float;
	}

	reset_parameters();
	FileBase::close_file();
	return 0;
}
Exemplo n.º 24
0
VFrame::VFrame(unsigned char *data, 
		long y_offset,
		long u_offset,
		long v_offset, 
		int w, 
		int h, 
		int color_model, 
		long bytes_per_line)
{
	reset_parameters(1);
	params = new BC_Hash;
	allocate_data(data, 
		y_offset, 
		u_offset, 
		v_offset, 
		w, 
		h, 
		color_model, 
		bytes_per_line);
}
Exemplo n.º 25
0
static int open_aix(out123_handle *ao)
{
	audio_init ainit;
	int ret;
	const char *dev = ao->device;

	if(!dev) {
		if(getenv("AUDIODEV")) {
			dev = getenv("AUDIODEV");
			ao->fn = open(dev,O_WRONLY);
		} else {
			dev = "/dev/paud0/1";                   /* paud0 for PCI */
			ao->fn = open(dev,O_WRONLY);
			if ((ao->fn == -1) & (errno == ENOENT)) {
				dev = "/dev/baud0/1";                 /* baud0 for MCA */
				ao->fn = open(dev,O_WRONLY);
			}  
		}
	} else ao->fn = open(dev,O_WRONLY);
	
	if(ao->fn < 0) {
		error("Can't open audio device!");
		return ao->fn;
	}
	
	/* Init to default values */
	memset ( & ainit, '\0', sizeof (ainit));
	ainit.srate            = 44100;
	ainit.channels         = 2;
	ainit.mode             = PCM;
	ainit.bits_per_sample  = 16;
	ainit.flags            = BIG_ENDIAN | TWOS_COMPLEMENT;
	ainit.operation        = PLAY;
	ainit.bsize            = AUDIO_BSIZE;
	
	ret = ioctl (ao->fn, AUDIO_INIT, & ainit);
	if (ret < 0) return ret;
	
	reset_parameters(ao);
	return ao->fn;
}
Exemplo n.º 26
0
// Reallocate uncompressed buffer with or without alpha
int VFrame::reallocate(unsigned char *data, 
		long y_offset,
		long u_offset,
		long v_offset,
		int w, 
		int h, 
		int color_model, 
		long bytes_per_line)
{
	clear_objects(0);
	reset_parameters(0);
	allocate_data(data, 
		y_offset, 
		u_offset, 
		v_offset, 
		w, 
		h, 
		color_model, 
		bytes_per_line);
	return 0;
}
Exemplo n.º 27
0
int bench(int argc, char **argv, bool main_bench) {
    for (int arg = 0; arg < argc; ++arg) {
        if (!strncmp("--batch=", argv[arg], 8))
            SAFE(batch(argv[arg] + 8, bench), CRIT);
        else if (!strncmp("--dir=", argv[arg], 6))
            dir = str2dir(argv[arg] + 6);
        else if (!strncmp("--dt=", argv[arg], 5))
            dt = str2dt(argv[arg] + 5);
        else if (!strncmp("--tag=", argv[arg], 6))
            tag = str2tag(argv[arg] + 6);
        else if (!strncmp("--axis=", argv[arg], 7))
            axis = atoi(argv[arg] + 7);
        else if (!strncmp("--group=", argv[arg], 8))
            group = atoi(argv[arg] + 8);
        else if (!strncmp("--match=", argv[arg], 8))
            pattern = argv[arg] + 8;
        else if (!strncmp("--mode=", argv[0], 7))
            bench_mode = str2bench_mode(argv[0] + 7);
        else if (!strcmp("--reset", argv[arg]))
            reset_parameters();
        else if (!strncmp("-v", argv[arg], 2))
            verbose = atoi(argv[arg] + 2);
        else if (!strncmp("--verbose=", argv[arg], 10))
            verbose = atoi(argv[arg] + 10);
        else {
            if (!strncmp("--", argv[arg], 2)) {
                fprintf(stderr, "driver: unknown option: `%s`, exiting...\n",
                        argv[arg]);
                exit(2);
            }
            dims = str2dims(argv[arg]);
            check_correctness();
        }
    }

    return OK;
}
Exemplo n.º 28
0
int
main (int argc, char **argv)
{
  int ret = -1;

  reset_parameters ();
  genl_client_init ();

  if (argc < 2)
    {
      ret = usage ();
      goto end;
    }

  if (strcmp (argv[1], HELP) == 0)
    {
      ret = usage ();
      goto end;
    }

  if ((strcmp (argv[1], LOCALSID) != 0) && (strcmp (argv[1], SRDEV) != 0))
    {
      printf ("Unrecognized table. Please try \"srconf help\". \n");
      goto end;
    }

  params.table = argv[1];

  if (strcmp (argv[1], LOCALSID) == 0)
    {

      if (argc == 2)
	{
	  ret = usage_localsid ();
	  goto end;
	}

      params.command = argv[2];

      if (strcmp (argv[2], HELP) == 0)
	ret = do_help (argc, argv);

      else if (strcmp (argv[2], FLUSH) == 0)
	ret = do_flush (argc, argv);

      else if (strcmp (argv[2], CLEAR) == 0)
	ret = do_clear (argc, argv);

      else if (strcmp (argv[2], SHOW) == 0)
	ret = do_show (argc, argv);

      else if (strcmp (argv[2], DEL) == 0)
	ret = do_del (argc, argv);

      else if (strcmp (argv[2], ADD) == 0)
	ret = do_add (argc, argv);

      else
	printf
	  ("Unrecognized command. Please try \"srconf localsid help\".\n");
    }
  else
    {
      printf ("srconf srdev commands are not supported yet. \n");
      usage_srdev ();
    }

end:
  return ret;
}
Exemplo n.º 29
0
FileAC3::FileAC3(Asset *asset, File *file)
 : FileBase(asset, file)
{
	reset_parameters();
	mpg_file = 0;
}
Exemplo n.º 30
0
VFrame::VFrame(unsigned char *png_data, long image_size)
{
	reset_parameters(1);
	params = new BC_Hash;
	read_png(png_data, image_size);
}