Exemplo n.º 1
0
LASeRNode *LASERSG_NewNode(LPSCENEGRAPH inScene, u32 tag)
{
	SFNode *node;
	if (!inScene) return NULL;
	node = LASeR_CreateNode(tag);
	if (node) {
		node->sgprivate->scenegraph = inScene;
		Node_Init(node);
	}
	return (LASeRNode *)node;
}
Exemplo n.º 2
0
bool_t Context_Init(const tchar_t* Name,const tchar_t* Version,int Id,const tchar_t* CmdLine,void* Application)
{
	context* p = malloc(sizeof(context));
	if (!p) return 0;

#ifdef PREALLOC
	{ int i; for (i=0;i<PREALLOC;++i) q[i] = malloc(65536); }
#endif

	memset(p,0,sizeof(context));
	p->Version = CONTEXT_VERSION;
	p->ProgramId = Id;
	p->ProgramName = Name;
	p->ProgramVersion = Version;
	p->CmdLine = CmdLine;
	p->Lang = DefaultLang();
	p->StartUpMemory = AvailMemory();
	p->LowMemory = p->StartUpMemory < LOWMEMORY_LIMIT;
	p->Application = Application;

	SetContext(p);

	Mem_Init();
	DynCode_Init();
	String_Init();
	PCM_Init();
	Blit_Init();
	Node_Init();
	Platform_Init();
	Stream_Init();
	Advanced_Init();
	Flow_Init();
	Codec_Init();
	Audio_Init();
	Video_Init();
	Format_Init();
	Playlist_Init();
	FormatBase_Init();
	NullOutput_Init();
	RawAudio_Init();
	RawImage_Init();
	Timer_Init();
	IDCT_Init();
	Overlay_Init();
	M3U_Init();
	PLS_Init();
	ASX_Init();
	WaveOut_Init();
	SoftIDCT_Init();
#if defined(CONFIG_SUBS)
	SubTitle_Init();
#endif
#if defined(TARGET_PALMOS)
	OverlayHIRES_Init();
	//Win_Init();
	//About_Init();
	//BenchResult_Init();
	//MediaInfo_Init();
	//Settings_Init();
	ASF_Init();
	AVI_Init();
	WAV_Init();
	MP4_Init();
	MPG_Init();
	NSV_Init();
	Law_Init();
	ADPCM_Init();
#elif defined(TARGET_WIN32) || defined(TARGET_WINCE)
#if defined(TARGET_WINCE)
	if (QueryPlatform(PLATFORM_TYPENO) != TYPE_SMARTPHONE)
	{
		OverlayRAW_Init();
		OverlayGAPI_Init();
	}
	else
	{
		OverlayGAPI_Init(); // prefer GAPI with smartphones (Sagem MyS-7 crashes with Raw FrameBuffer?)
		OverlayRAW_Init();
	}
	OverlayDirect_Init();
	OverlayS1D13806_Init();
#else
	OverlayConsole_Init();
#endif
	OverlayXScale_Init();
	OverlayDDraw_Init(); // after GAPI and RAW and XScale
	OverlayFlyTV_Init();
	OverlayGDI_Init();
#elif defined(TARGET_SYMBIAN)
	OverlaySymbian_Init();
#endif
#ifdef NO_PLUGINS
	Static_Init();
#else
	Plugins_Init();
#endif
	Association_Init(); // after all formats are registered
	Color_Init(); 
	Equalizer_Init();
	Player_Init(); // after all output drivers are registered
	return 1;
}
Exemplo n.º 3
0
SFNode *SG_CloneNode(LPSCENEGRAPH inScene, SFNode *orig, SFNode *cloned_parent)
{
	u32 i, j, count;
	Bool is_script;
	SFNode *node, *child, *tmp;
	Chain *list, *list2;
	Route *r1, *r2;
	void BIFS_SetupConditionalClone(SFNode *node, SFNode *orig);
	ProtoInstance *proto;
	PrototypeNode *proto_node;
	FieldInfo field_orig, field;

	/*this is not a mistake*/
	if (!orig) return NULL;

	/*check for DEF/USE*/
	if (orig->sgprivate->NodeID) {
		node = SG_FindNode(inScene, orig->sgprivate->NodeID);
		/*node already created, USE*/
		if (node) {
			Node_Register(node, cloned_parent);
			return node;
		}
	}
	/*create a node*/
	if (orig->sgprivate->tag == TAG_ProtoNode) {
		proto_node = ((ProtoInstance *)orig)->proto_interface;
		/*create the instance but don't load the code -c we MUST wait for ISed routes to be cloned before*/
		node = Proto_CreateNode(inScene, proto_node, (ProtoInstance *) orig);
	} else {
		node = SG_NewNode(inScene, orig->sgprivate->tag);
	}

	count = Node_GetFieldCount(orig);

	is_script = 0;
	if ((orig->sgprivate->tag==TAG_MPEG4_Script) || (orig->sgprivate->tag==TAG_X3D_Script)) is_script = 1;
	if (is_script) Script_PrepareClone(node, orig);

	/*copy each field*/
	for (i=0; i<count; i++) {
		Node_GetField(orig, i, &field_orig);

		/*get target ptr*/
		Node_GetField(node, i, &field);

		assert(field.eventType==field_orig.eventType);
		assert(field.fieldType==field_orig.fieldType);

		/*duplicate it*/
		switch (field.fieldType) {
		case FT_SFNode:
			child = SG_CloneNode(inScene, (void *) (* ((SFNode **) field_orig.far_ptr)), node);
			*((SFNode **) field.far_ptr) = child;
			break;
		case FT_MFNode:
			list = *( (Chain **) field_orig.far_ptr);
			list2 = *( (Chain **) field.far_ptr);

			for (j=0; j<ChainGetCount(list); j++) {
				tmp = ChainGetEntry(list, j);
				child = SG_CloneNode(inScene, tmp, node);
				ChainAddEntry(list2, child);
			}
			break;
		case FT_SFTime:
			VRML_FieldCopy(field.far_ptr, field_orig.far_ptr, field.fieldType);
			if (!inScene->GetSceneTime) break;
			/*update SFTime that must be updated when cloning the node*/
			if (orig->sgprivate->tag == TAG_ProtoNode) {
				if (Proto_FieldIsSFTimeOffset(orig, &field_orig))
					*((SFTime *)field.far_ptr) += inScene->GetSceneTime(inScene->SceneCallback);
			} else if (!stricmp(field_orig.name, "startTime") || !stricmp(field_orig.name, "startTime") ) {
				*((SFTime *)field.far_ptr) += inScene->GetSceneTime(inScene->SceneCallback);
			}
			break;
		default:
			VRML_FieldCopy(field.far_ptr, field_orig.far_ptr, field.fieldType);
			break;
		}
	}
	/*register node*/
	if (orig->sgprivate->NodeID) {
		Node_SetDEF(node, orig->sgprivate->NodeID, orig->sgprivate->NodeName);
	}
	Node_Register(node, cloned_parent);

	/*init node before creating ISed routes so the eventIn handler are in place*/
	if (node->sgprivate->tag == TAG_MPEG4_Conditional) BIFS_SetupConditionalClone(node, orig);
	else 
		if (node->sgprivate->tag != TAG_ProtoNode) Node_Init(node);

	if (!inScene->pOwningProto) return node;
	proto = inScene->pOwningProto;
	
	/*create Routes for ISed fields*/
	for (i=0; i<ChainGetCount(proto->proto_interface->sub_graph->Routes); i++) {
		r1 = ChainGetEntry(proto->proto_interface->sub_graph->Routes, i);
		r2 = NULL;
		/*locate only ISed routes*/
		if (!r1->IS_route) continue;
		
		/*eventOut*/
		if (r1->FromNode == orig) {
			r2 = SG_NewRoute(inScene, node, r1->FromFieldIndex, (SFNode *) proto, r1->ToFieldIndex);
			r2->IS_route = 1;
		}
		/*eventIn or exposedField*/
		else if (r1->ToNode == orig) {
			r2 = SG_NewRoute(inScene, (SFNode *) proto, r1->FromFieldIndex, node, r1->ToFieldIndex);
			r2->IS_route = 1;
		}
		/*activate the route now so that proto instanciation works properly, otherwise
		we may load scripts with wrong field values*/		
		if (r2) ActivateRoute(r2);
	}
	
	/*remember scripts*/
	if (is_script) ChainAddEntry(proto->scripts_to_load, node);

	/*this is a proto node, init our internal stuff*/
	if (node->sgprivate->tag == TAG_ProtoNode) {
		node->sgprivate->PreDestroyNode = NULL;
		node->sgprivate->privateStack = NULL;
		node->sgprivate->RenderNode = RenderProtoInstance;
		/*load code*/
		proto_instanciate((ProtoInstance *)node);
	}
	return node;
}