Example #1
0
static void load_headers(struct obs_x264 *obsx264)
{
	x264_nal_t      *nals;
	int             nal_count;
	DARRAY(uint8_t) header;
	DARRAY(uint8_t) sei;

	da_init(header);
	da_init(sei);

	x264_encoder_headers(obsx264->context, &nals, &nal_count);

	for (int i = 0; i < nal_count; i++) {
		x264_nal_t *nal = nals+i;

		if (nal->i_type == NAL_SEI)
			da_push_back_array(sei, nal->p_payload, nal->i_payload);
		else
			da_push_back_array(header, nal->p_payload,
					nal->i_payload);
	}

	obsx264->extra_data      = header.array;
	obsx264->extra_data_size = header.num;
	obsx264->sei             = sei.array;
	obsx264->sei_size        = sei.num;
}
Example #2
0
static inline void reset_immediate_arrays(graphics_t graphics)
{
	da_init(graphics->verts);
	da_init(graphics->norms);
	da_init(graphics->colors);
	for (size_t i = 0; i < 16; i++)
		da_init(graphics->texverts[i]);
}
Example #3
0
void cf_preprocessor_init(struct cf_preprocessor *pp)
{
	da_init(pp->defines);
	da_init(pp->sys_include_dirs);
	da_init(pp->dependencies);
	da_init(pp->tokens);
	pp->lex = NULL;
	pp->ed = NULL;
	pp->ignore_state = false;
}
Example #4
0
bool obs_module_load(void)
{
	da_init(active_log_contexts);
	da_init(cached_log_contexts);

	//av_log_set_callback(ffmpeg_log_callback);

	obs_register_source(&ffmpeg_source);
	obs_register_output(&ffmpeg_output);
	obs_register_output(&ffmpeg_muxer);
	obs_register_encoder(&aac_encoder_info);
	return true;
}
Example #5
0
static void send_first_video_packet(struct obs_encoder *encoder,
		struct encoder_callback *cb, struct encoder_packet *packet)
{
	struct encoder_packet first_packet;
	DARRAY(uint8_t)       data;
	uint8_t               *sei;
	size_t                size;

	/* always wait for first keyframe */
	if (!packet->keyframe)
		return;

	da_init(data);

	if (!get_sei(encoder, &sei, &size)) {
		cb->new_packet(cb->param, packet);
		cb->sent_first_packet = true;
		return;
	}

	da_push_back_array(data, sei, size);
	da_push_back_array(data, packet->data, packet->size);

	first_packet      = *packet;
	first_packet.data = data.array;
	first_packet.size = data.num;

	cb->new_packet(cb->param, &first_packet);
	cb->sent_first_packet = true;

	da_free(data);
}
Example #6
0
static void remove_all_items(struct obs_scene *scene)
{
	struct obs_scene_item *item;
	DARRAY(struct obs_scene_item*) items;

	da_init(items);

	full_lock(scene);

	item = scene->first_item;

	while (item) {
		struct obs_scene_item *del_item = item;
		item = item->next;

		remove_without_release(del_item);
		da_push_back(items, &del_item);
	}

	full_unlock(scene);

	for (size_t i = 0; i < items.num; i++)
		obs_sceneitem_release(items.array[i]);
	da_free(items);
}
int main(void) {
	serieport_init();
	ad_init();
	da_init();
	timer_init();
	
	struct audio_settings settings;
	settings.equ_freqA = 200;
	settings.equ_freqB = 400;
	settings.equ_band1_vol = 100;
	settings.equ_band2_vol = 100;
	settings.equ_band3_vol = 100;
	settings.echo_delay = 48000 * 2;
	settings.echo_vol_decay = 50;
	
	serieport_print_settings(&settings);
		
	unsigned int value;
	
	while(1) {
		if (serieport_getsettings(&settings) == 1) {
			serieport_print_settings(&settings);
		}

	}
	return 0;
}
Example #8
0
void sound_init(void)
     /* 音を鳴らすための初期化               */
     /* D/A変換用の初期化とスピーカの切り替え */
{
  da_init();               /* DAの初期化 */
  speaker_switch(SPEAKER); /* スピーカとして使用 */
}
Example #9
0
int main(void)
{
	da_init();

	sound_sin(0,91);

	return 0;
}
Example #10
0
void cf_lexer_init(struct cf_lexer *lex)
{
	lexer_init(&lex->base_lexer);
	da_init(lex->tokens);

	lex->file           = NULL;
	lex->reformatted    = NULL;
	lex->write_offset   = NULL;
	lex->unexpected_eof = false;
}
Example #11
0
void netif_get_addrs(struct netif_saddr_data *ifaddrs)
{
	da_init(ifaddrs->addrs);

#ifdef _WIN32
	netif_get_addrs_win32(ifaddrs);
#else
	netif_get_addrs_nix(ifaddrs);
#endif
}
Example #12
0
/*
 * module init / deinit functions. Returns 0 if OK, or a combination of ERR_*.
 */
static int init_deviceatlas(void)
{
	int err_code = 0;

	if (global_deviceatlas.jsonpath != 0) {
		FILE *jsonp;
		da_property_decl_t extraprops[] = {{0, 0}};
		size_t atlasimglen;
		da_status_t status;

		jsonp = fopen(global_deviceatlas.jsonpath, "r");
		if (jsonp == 0) {
			ha_alert("deviceatlas : '%s' json file has invalid path or is not readable.\n",
				 global_deviceatlas.jsonpath);
			err_code |= ERR_ALERT | ERR_FATAL;
			goto out;
		}

		da_init();
		da_seterrorfunc(da_haproxy_log);
		status = da_atlas_compile(jsonp, da_haproxy_read, da_haproxy_seek,
			&global_deviceatlas.atlasimgptr, &atlasimglen);
		fclose(jsonp);
		if (status != DA_OK) {
			ha_alert("deviceatlas : '%s' json file is invalid.\n",
				 global_deviceatlas.jsonpath);
			err_code |= ERR_ALERT | ERR_FATAL;
			goto out;
		}

		status = da_atlas_open(&global_deviceatlas.atlas, extraprops,
			global_deviceatlas.atlasimgptr, atlasimglen);

		if (status != DA_OK) {
			ha_alert("deviceatlas : data could not be compiled.\n");
			err_code |= ERR_ALERT | ERR_FATAL;
			goto out;
		}

		if (global_deviceatlas.cookiename == 0) {
			global_deviceatlas.cookiename = strdup(DA_COOKIENAME_DEFAULT);
			global_deviceatlas.cookienamelen = strlen(global_deviceatlas.cookiename);
		}

		global_deviceatlas.useragentid = da_atlas_header_evidence_id(&global_deviceatlas.atlas,
			"user-agent");
		global_deviceatlas.daset = 1;

		fprintf(stdout, "Deviceatlas module loaded.\n");
	}

out:
	return err_code;
}
int _init_agent()
{
	int da_ret = 0;
	da_client_cb_t da_cb = {
		__notify_cb,
		__download_info_cb,
		__downloading_info_cb
	};
	da_ret = da_init(&da_cb, DA_DOWNLOAD_MANAGING_METHOD_AUTO);
	if (da_ret != DA_RESULT_OK) {
		return DOWNLOAD_ERROR_FAIL_INIT_AGENT;
	}
	return DOWNLOAD_ERROR_NONE;
}
Example #14
0
static bool load_cached_font_list(struct serializer *s)
{
	bool success = true;
	int count;

	success = read_var(s, count);
	if (!success) return false;

	da_init(font_list);
	da_resize(font_list, count);

#define do_read(var) \
	success = read_var(s, var); \
	if (!success) break

	for (int i = 0; i < count; i++) {
		struct font_path_info *info = &font_list.array[i];

		success = read_str(s, &info->face_and_style);
		if (!success) break;

		do_read(info->full_len);
		do_read(info->face_len);
		do_read(info->is_bitmap);
		do_read(info->num_sizes);

		info->sizes = bmalloc(sizeof(int) * info->num_sizes);
		success = read_data(s, info->sizes,
				sizeof(int) * info->num_sizes);
		if (!success) break;

		do_read(info->bold);

		success = read_str(s, &info->path);
		if (!success) break;

		do_read(info->italic);
		do_read(info->index);
	}

#undef do_read

	if (!success) {
		free_os_font_list();
		return false;
	}

	return true;
}
Example #15
0
static void scene_video_render(void *data, gs_effect_t *effect)
{
	DARRAY(struct obs_scene_item*) remove_items;
	struct obs_scene *scene = data;
	struct obs_scene_item *item;

	da_init(remove_items);

	video_lock(scene);
	item = scene->first_item;

	gs_blend_state_push();
	gs_reset_blend_state();

	while (item) {
		if (obs_source_removed(item->source)) {
			struct obs_scene_item *del_item = item;
			item = item->next;

			remove_without_release(del_item);
			da_push_back(remove_items, &del_item);
			continue;
		}

		if (source_size_changed(item))
			update_item_transform(item);

		if (item->user_visible) {
			gs_matrix_push();
			gs_matrix_mul(&item->draw_transform);
			obs_source_video_render(item->source);
			gs_matrix_pop();
		}

		item = item->next;
	}

	gs_blend_state_pop();

	video_unlock(scene);

	for (size_t i = 0; i < remove_items.num; i++)
		obs_sceneitem_release(remove_items.array[i]);
	da_free(remove_items);

	UNUSED_PARAMETER(effect);
}
Example #16
0
void server_start()
{
    da_init(rcon_data.plugin_handlers);
    //darray_init(&rcon_data.plugin_handlers);

    struct rcon_handler test_plugin_handler;
    test_plugin_handler.action = "test_plugin";
    test_plugin_handler.handle_func = &handle_version;
    rcon_add_handler(&test_plugin_handler);

    rcon_data.server = mg_create_server(NULL, ev_handler);
    mg_set_option(rcon_data.server, "listening_port", "8080");

    rcon_data.run_thread = true;

    pthread_create(&rcon_data.server_thread, NULL, thread_runner, NULL);
}
Example #17
0
void build_font_path_info(FT_Face face, FT_Long idx, const char *path)
{
	FT_UInt num_names = FT_Get_Sfnt_Name_Count(face);
	DARRAY(char*) family_names;

	da_init(family_names);
	da_push_back(family_names, &face->family_name);

	for (FT_UInt i = 0; i < num_names; i++) {
		FT_SfntName name;
		char        *family;
		FT_Error    ret = FT_Get_Sfnt_Name(face, i, &name);

		if (ret != 0 || name.name_id != TT_NAME_ID_FONT_FAMILY)
			continue;

		family = sfnt_name_to_utf8(&name);
		if (!family)
			continue;

		for (size_t i = 0; i < family_names.num; i++) {
			if (astrcmpi(family_names.array[i], family) == 0) {
				bfree(family);
				family = NULL;
				break;
			}
		}

		if (family)
			da_push_back(family_names, &family);
	}

	for (size_t i = 0; i < family_names.num; i++) {
		add_font_path(face, idx, family_names.array[i],
				face->style_name, path);

		/* first item isn't our allocation */
		if (i > 0)
			bfree(family_names.array[i]);
	}

	da_free(family_names);
}
Example #18
0
int main(void)
{
  /* キー入力情報を取得するための変数を宣言する */
  unsigned char key_data;

  lcd_init();    /* LCD の初期化            */
  ad_init();     /* A/D 変換器の初期化      */
  da_init();     /* D/A 変換器の初期化      */

  /* ◎ここにキー入力取得のためのポートの初期化を記述する */

	/* 追記	*/
	P6DDR &= ~0x07;  /* P60,1,2   入力 */
	PADDR |= 0x0f;   /* PA0,1,2,3 出力 */
	/* ここまで */

  while (1) {
    play_mode = NOSELECT;
    key_data = menu();                    /* メニューを選ぶ   */
    /* 録音キーが押されたらSAMPLE, 再生キーが押されたらPLAY   */
    /* をplay_modeに格納する処理を記述する                    */
		
		/*追記*/
		if(key_data == '*'){
			play_mode = SAMPLE;
		}
		if(key_data == '5'){
			play_mode = INVERSE;
		}	
		if(key_data == '#'){
			play_mode = PLAY;
		}
		/*ここまで*/
    
    
    /* ◎*キー入力されていれば録音/再生の関数を呼び出す処理を記述する  */
		sample_replay(play_mode);	
    
  }
  return 1;
}
Example #19
0
static void create_bitmap_sizes(struct font_path_info *info, FT_Face face)
{
	DARRAY(int) sizes;

	if (!info->is_bitmap) {
		info->num_sizes = 0;
		info->sizes     = NULL;
		return;
	}

	da_init(sizes);
	da_reserve(sizes, face->num_fixed_sizes);

	for (int i = 0; i < face->num_fixed_sizes; i++) {
		int val = face->available_sizes[i].size >> 6;
		da_push_back(sizes, &val);
	}

	info->sizes     = sizes.array;
	info->num_sizes = face->num_fixed_sizes;
}
Example #20
0
int os_glob(const char *pattern, int flags, os_glob_t *pglob)
{
	DARRAY(struct os_globent) files;
	HANDLE                    handle;
	WIN32_FIND_DATA           wfd;
	int                       ret = -1;
	os_glob_t                 out = NULL;
	wchar_t                   *w_path;

	da_init(files);

	if (os_utf8_to_wcs_ptr(pattern, 0, &w_path) > 0) {
		handle = FindFirstFileW(w_path, &wfd);
		if (handle != INVALID_HANDLE_VALUE) {
			do {
				struct os_globent ent = {0};
				make_globent(&ent, &wfd, pattern);
				if (ent.path)
					da_push_back(files, &ent);
			} while (FindNextFile(handle, &wfd));
			FindClose(handle);

			*pglob = bmalloc(sizeof(**pglob));
			(*pglob)->gl_pathc = files.num;
			(*pglob)->gl_pathv = files.array;

			ret = 0;
		}

		bfree(w_path);
	}

	if (ret != 0)
		*pglob = NULL;

	UNUSED_PARAMETER(flags);
	return ret;
}
Example #21
0
static void load_headers(struct obs_qsv *obsqsv)
{
	DARRAY(uint8_t) header;
	uint8_t sei = 0;

	// Not sure if SEI is needed.
	// Just filling in empty meaningless SEI message.
	// Seems to work fine.
	// DARRAY(uint8_t) sei;

	da_init(header);
	// da_init(sei);

	uint8_t *pSPS, *pPPS;
	uint16_t nSPS, nPPS;
	qsv_encoder_headers(obsqsv->context, &pSPS, &pPPS, &nSPS, &nPPS);
	da_push_back_array(header, pSPS, nSPS);
	da_push_back_array(header, pPPS, nPPS);

	obsqsv->extra_data = header.array;
	obsqsv->extra_data_size = header.num;
	obsqsv->sei = &sei;
	obsqsv->sei_size = 1;
}
Example #22
0
proc_handler_t *proc_handler_create(void)
{
	struct proc_handler *handler = bmalloc(sizeof(struct proc_handler));
	da_init(handler->procs);
	return handler;
}
Example #23
0
static inline void macro_params_init(struct macro_params *params)
{
	da_init(params->params);
}
Example #24
0
static inline void macro_param_init(struct macro_param *param)
{
	cf_token_clear(&param->name);
	da_init(param->tokens);
}
Example #25
0
int main(void)
{
  unsigned char cf,key_data;
  int vol = 127;

  ROMEMU();
  da_init();
  timer_init();

  P6DDR &= ~0x07;  /* P60,1,2   入力 */
  PADDR |= 0x0f;   /* PA0,1,2,3 出力 */

  tone_init();
  
  while (1)
  {
	key_data = 0;

    //key 1,2,3
    PADR = 0x07; // PA3 = L
    cf = P6DR;   // データ入力
    cf = ~cf;    // cfの反転
    cf &= 0x07;  // P60,1,2のみ見る
    switch(cf) {
    case 1 : key_data = '1'; break;
    case 2 : key_data = '2'; break;
    case 4 : key_data = '3'; break;
    }  
      
    //key 4,5,6
    PADR = 0x0b;
    cf = P6DR;
    cf = ~cf;
    cf &= 0x07;
    switch(cf) {
    case 1 : key_data = '4'; break;
    case 2 : key_data = '5'; break;
    case 4 : key_data = '6'; break;
    }  
      
    //key 7,8,9
    PADR = 0x0d; /* This is a mistake code. */
    cf = P6DR;
    cf = ~cf;
    cf &= 0x07;
    switch(cf) {
    case 1 : key_data = '7'; break;
    case 2 : key_data = '8'; break;
    case 4 : key_data = '9'; break;
    }  
      
    //key *,0,#
    PADR = 0x0e;
    cf = P6DR;
    cf = ~cf;
    cf &= 0x07;
    switch(cf) {
    case 1 : key_data = '*'; break;
    case 2 : key_data = '0'; break;
    case 4 : key_data = '#'; break;
    } 

	switch(key_data)
	{
    case '1':
      note_on(DO_L,vol);
      break;
    case '2':
      note_on(RE,vol);
      break;
    case '3':
      note_on(MI,vol);
      break;
    case '4':
      note_on(FA,vol);
      break;
    case '5':
      note_on(SO,vol);
      break;
    case '6':
      note_on(RA,vol);
      break;
    case '7':
      note_on(SI,vol);
      break;
    case '8':
      note_on(DO_H,vol);
      break;
    default:
	  note_off();
	  break;
	}
  }
  return 1;
}