Ejemplo n.º 1
0
Archivo: obs.c Proyecto: FTCr/Siemens
HObj CreateHObjFromImgFile(const char *path)
{
	HObj obj;
	unsigned int err = 0;
	unsigned int uid = GetExtUidByFileName(path);
	if (uid >= UID_BMX && uid <= UID_SVG)
	{
		#ifdef NEWSGOLD
			obj = Obs_CreateObject(uid, 0x2D, 0, 0x80A8, 1, 1, &err);
		#else
			obj = Obs_CreateObject(uid, 0x29, 2, 0x1C7, 1, 1, &err);
		#endif
		if (err) return -1;
		
		
		unsigned int len = strlen(path);
		WSHDR *ws = AllocWS(len);
		str_2ws (ws, path, len);
		Obs_SetInput_File(obj, 0, ws);
		FreeWS(ws);
		Obs_GetInfo(obj, 0);
		return obj;
	}
	return -1;
}
Ejemplo n.º 2
0
static void Send(GUI *data)
{
    unsigned int i = GetCurMenuItem(tab_tracks_gui);
    DIR_ENTRY_LIST *ptr = APlayer_GetPtr(i);

    WSHDR *fname, *dir;
    int len;

    len = strlen(ptr->fname);
    fname = AllocWS(len);
    str_2ws(fname, ptr->fname, len);

    len = strlen(ptr->dir);
    dir = AllocWS(len);
    str_2ws(dir, ptr->dir, len);

    MediaSendCSM_Open(fname, dir);

    FreeWS(fname);
    FreeWS(dir);

    GeneralFuncF1(2);
}
Ejemplo n.º 3
0
Archivo: obs.c Proyecto: FTCr/Siemens
HObj CreateHObjFromAudioFile(char *path)
{
	HObj obj;
	unsigned uid = GetExtUidByFileName(path); 
	unsigned int err = 0;
	obj = Obs_CreateObject(uid, 0x34, 2, 0, 1, 0, &err);
	if (!err)
	{
		int len = strlen(path);
		WSHDR *ws = AllocWS(len);
		str_2ws (ws, path, len);
		Obs_SetInput_File(obj, 0, ws);
		#ifdef ELKA  
			Obs_Mam_SetPurpose(obj, 0x016);
		#else
			Obs_Sound_SetPurpose(obj, 0x16);
		#endif
		Obs_Prepare(obj);
		return obj;
	}
	return 0;
};
Ejemplo n.º 4
0
int GetID3(ID3 *id3, const char *path)
{
	FSTATS fs;
	unsigned int err;
	
	if (GetFileStats(path, &fs, &err) == -1) return -1;
	
	int fp = _open(path, A_ReadOnly + A_BIN, P_READ, &err);
	if (fp == -1) return -1;
	
	char head[ID3_HEAD_LEN];
	if (_read(fp, head, ID3_HEAD_LEN, &err) < ID3_HEAD_LEN) //empty?
	{
		_close(fp, &err);
		return -1;
	}
	
	//get tag version
	enum id3_ver_enum {id3_v1, id3_v2};
	int id3_ver;
	if (strncmp(head, ID3_V1_HEAD, ID3_HEAD_LEN) != 0)
	{
		id3_ver = id3_v1;
		_close(fp, &err);
		return -1;
	}
	else if (strncmp(head, ID3_V2_HDR, ID3_HEAD_LEN) != 0)
	{
		id3_ver = id3_v2;
	}
	else
	{
		_close(fp, &err);
		return -1;
	}
	//read id3v2 header
	if (id3_ver == id3_v2)
	{
		ID3_V2_HEADER header;
		strncpy(header.head, head, ID3_HEAD_LEN);
		header.head[ID3_HEAD_LEN] = '\0';
		
		char *buffer = malloc(ID3_V2_HDR_SIZE);
		_read(fp, buffer, ID3_V2_HDR_SIZE - ID3_HEAD_LEN, &err);
		header.ver   = buffer[0];
		header.rev   = buffer[1];
		header.flags = buffer[2];
		header.size  = ID3_V2_4_BitCock(buffer + 3);
		//header.size = (buffer[6] & 0xFF) | ((buffer[5] & 0xFF) << 7 ) | ((buffer[4] & 0xFF) << 14 ) | ((buffer[3] & 0xFF) << 21 );
		
		//only v2.4
		unsigned int frame_lenght;
		if (header.ver != 0x04)
		{
			mfree(buffer);
			_close(fp, &err);
			return 0;
		}
		frame_lenght = 0x0A;
		
		mfree(buffer);
		buffer = malloc(header.size + 5);
		_read(fp, buffer, header.size + 4, &err);
		zeromem(id3, sizeof(ID3));
		
		unsigned int tag_lenght;
		unsigned int frame_id = 0;
		int helper;
		unsigned int i = 0;
		
		while (i < header.size && frame_id < ID3_V2_FRAME_COUNT)
		{
			if (buffer[i] >= 'A' && buffer[i] <= 'Z')
			{
				helper = ID3_V2_Helper(buffer + i);
				if (helper != -1)
				{
					if (helper == 5) //wtf?
					{
						tag_lenght = ID3_V2_4_BitCock(buffer + i + ID3_V2_4_FRAME_LEN) - 5;
						i += frame_lenght + 5;
					}
					else
					{
						tag_lenght = ID3_V2_4_BitCock(buffer + i + ID3_V2_4_FRAME_LEN) - 1;
						i += frame_lenght + 1;
					}
					id3->tag[helper] = AllocWS(tag_lenght + 1);
					utf8_2ws(id3->tag[helper], buffer + i, tag_lenght);
					frame_id++;
					i += tag_lenght - 1;
				}
			}
			i++;
		}
		mfree(buffer);
	}
	_close(fp, &err);
	return 1;
}
Ejemplo n.º 5
0
void DoConfig (){
    WSHDR *ws=AllocWS (256);
    str_2ws(ws,GetConfigName(), 256);
    ExecuteFile(ws, NULL, NULL);
    FreeWS(ws);
}
Ejemplo n.º 6
0
Archivo: main.c Proyecto: FTCr/Siemens
int maincsm_onmessage(CSM_RAM* data, GBS_MSG* msg)
{
	if (msg->msg == MSG_IPC)
	{
		IPC_REQ *ipc = (IPC_REQ*)msg->data0;
		if (ipc)
		{
			if (strcmp(ipc->name_to, IPC_MY_NAME) == 0)
			{
				if (msg->submess != data->id)
				{
					LockSched();
					CloseCSM(msg->submess);
					SUBPROC((void*)CreateClipperGUI);
					UnlockSched();
				}
			}
		}
	}
	if (msg->msg == MSG_RECONFIGURE_REQ)
	{
		if (strcmp_nocase(successed_config_filename, (char *)msg->data0) == 0)
			InitConfig();
	}
	if (total < cfg_max_history)
	{
		static WSHDR *clip;
		if (not_reading)
		{
			clip = GetClipBoard();
			not_reading = 0;
		}
		else
		{
			if (clip != GetClipBoard())
			{
				clip = GetClipBoard();
				if (total)
				{
					CLIPBOARD_LIST *p = top;
					while (1)
					{
						if (p->next) p = p->next;
						else break;
					}
					p->next = malloc(sizeof(CLIPBOARD_LIST));
					p = p->next;
					last->next = p;
					
					p->prev = last;
					p->next = NULL;
					
					p->ws = AllocWS(clip->wsbody[0] + 1);
					wstrcpy(p->ws, clip);
					last = p;
					
				}
				else
				{
					top = malloc(sizeof(CLIPBOARD_LIST));
					top->prev = NULL;
					top->next = NULL;
					last = top;
					top->ws = AllocWS(clip->wsbody[0] + 1);
					wstrcpy(top->ws, clip);
				}
				total++;
			}
		}
	}
	return 1;
}