Ejemplo n.º 1
0
GF_EXPORT
const char *gf_term_get_world_info(GF_Terminal *term, GF_ObjectManager *scene_od, GF_List *descriptions)
{
    GF_Node *info;
    if (!term) return NULL;
    info = NULL;
    if (!scene_od) {
        if (!term->root_scene) return NULL;
        info = (GF_Node*)term->root_scene->world_info;
    } else {
        if (!gf_term_check_odm(term, scene_od)) return NULL;
        info = (GF_Node*) (scene_od->subscene ? scene_od->subscene->world_info : scene_od->parentscene->world_info);
    }
    if (!info) return NULL;

    if (gf_node_get_tag(info) == TAG_SVG_title) {
        /*FIXME*/
        //return ((SVG_titleElement *) info)->textContent;
        return "TO FIX IN GPAC!!";
    } else {
#ifndef GPAC_DISABLE_VRML
        M_WorldInfo *wi = (M_WorldInfo *) info;
        if (descriptions) {
            u32 i;
            for (i=0; i<wi->info.count; i++) {
                gf_list_add(descriptions, wi->info.vals[i]);
            }
        }
        return wi->title.buffer;
#endif
    }
    return "GPAC";
}
Ejemplo n.º 2
0
static void RenderAnchor(GF_Node *node, void *rs, Bool is_destroy)
{
	AnchorStack *st = (AnchorStack *) gf_node_get_private(node);
	RenderEffect3D *eff = (RenderEffect3D *)rs;

	if (is_destroy) {
		R3D_SensorDeleted(st->compositor, &st->hdl);
		DeleteGroupingNode((GroupingNode *)st);
		free(st);
		return;
	}

	if (!st->compositor->user->EventProc) {
		st->enabled = 0;
		return;
	}

	/*note we don't clear dirty flag, this is done in traversing*/
	if (gf_node_dirty_get(node) & GF_SG_NODE_DIRTY) {
		MFURL *url;
		if (gf_node_get_tag(node)==TAG_MPEG4_Anchor) {
			url = & ((M_Anchor *)node)->url;
		} else {
			url = & ((X_Anchor *)node)->url;
		}
		st->enabled = 0;
		if (url->count && url->vals[0].url && strlen(url->vals[0].url) )
			st->enabled = 1;
	}

	grouping_traverse((GroupingNode*)st, eff, NULL);
}
Ejemplo n.º 3
0
static void svg_compute_text_width(GF_Node *node, SVGAllAttributes *atts, GF_TraverseState *tr_state )
{
	GF_ChildNodeItem *child;
	Bool is_switch = GF_FALSE;
	/*compute length of all text blocks*/
	switch  (gf_node_get_tag(node)) {
	case TAG_DOMText:
		get_domtext_width(node, atts, tr_state);
		break;
	case TAG_SVG_tspan:
		get_tspan_width(node, tr_state);
		break;
	case TAG_SVG_switch:
		is_switch = GF_TRUE;
	case TAG_SVG_a:
		child = ((GF_ParentNode *)node)->children;
		while (child) {
			if (is_switch) {
				SVGAllAttributes a_atts;
				gf_svg_flatten_attributes((SVG_Element*)child->node, &a_atts);
				if (compositor_svg_evaluate_conditional(tr_state->visual->compositor, &a_atts)) {
					svg_compute_text_width(child->node, atts, tr_state);
					break;
				}
			} else {
				svg_compute_text_width(child->node, atts, tr_state);
			}
			child = child->next;
		}
		break;
	default:
		break;
	}
}
Ejemplo n.º 4
0
GF_EXPORT
Bool gf_smil_timing_is_active(GF_Node *node) 
{
	SMILTimingAttributesPointers *timingp = NULL;
	u32 tag = gf_node_get_tag(node);

	if ((tag>=GF_NODE_RANGE_FIRST_SVG) && (tag<=GF_NODE_RANGE_LAST_SVG)) {
		timingp = ((SVGTimedAnimBaseElement *)node)->timingp;
	}
#ifdef GPAC_ENABLE_SVG_SA
	else if ((tag>=GF_NODE_RANGE_FIRST_SVG_SA) && (tag<=GF_NODE_RANGE_LAST_SVG_SA)) {
		timingp = ((SVG_SA_Element *)node)->timingp;
	}
#endif
#ifdef GPAC_ENABLE_SVG_SANI
	else if ((tag>=GF_NODE_RANGE_FIRST_SVG_SANI) && (tag<=GF_NODE_RANGE_LAST_SVG_SANI)) {
		timingp = ((SVG_SANI_Element *)node)->timingp;
	}
#endif
	else {
		return 0;
	}

	if (!timingp || !timingp->runtime) return 0;
	return (timingp->runtime->status == SMIL_STATUS_ACTIVE);
}
Ejemplo n.º 5
0
void compositor_imagetexture_modified(GF_Node *node)
{
	MFURL url;
	SFURL sfurl;
	GF_TextureHandler *txh = (GF_TextureHandler *) gf_node_get_private(node);
	if (!txh) return;

	if (gf_node_get_tag(node)!=TAG_MPEG4_CacheTexture) {
		url = ((M_ImageTexture *) node)->url;
	} else {
		url.count = 1;
		sfurl.OD_ID=GF_MEDIA_EXTERNAL_ID;
		sfurl.url = ((M_CacheTexture *) node)->image.buffer;
		url.vals = &sfurl;
	}

	/*if open and changed, stop and play*/
	if (txh->is_open) {
		if (! gf_sc_texture_check_url_change(txh, &url)) return;
		gf_sc_texture_stop(txh);
		gf_sc_texture_play(txh, &url);
		return;
	}
	/*if not open and changed play*/
	if (url.count)
		gf_sc_texture_play(txh, &url);
}
Ejemplo n.º 6
0
static GF_Err BM_ParseGlobalQuantizer(GF_BifsDecoder *codec, GF_BitStream *bs, GF_List *com_list)
{
	GF_Node *node;
	GF_Command *com;
	GF_CommandField *inf;
	node = gf_bifs_dec_node(codec, bs, NDT_SFWorldNode);

	/*reset global QP*/
	if (codec->scenegraph->global_qp) {
		gf_node_unregister(codec->scenegraph->global_qp, NULL);
	}
	codec->ActiveQP = NULL;
	codec->scenegraph->global_qp = NULL;

	if (node && (gf_node_get_tag(node) != TAG_MPEG4_QuantizationParameter)) {
		gf_node_unregister(node, NULL);
		return GF_NON_COMPLIANT_BITSTREAM;
	}

	/*register global QP*/
	codec->ActiveQP = (M_QuantizationParameter *) node;
	codec->ActiveQP->isLocal = 0;
	codec->scenegraph->global_qp = node;
	if (node) {
		/*register TWICE: once for the command, and for the scenegraph globalQP*/
		node->sgprivate->num_instances = 2;
	}
	com = gf_sg_command_new(codec->current_graph, GF_SG_GLOBAL_QUANTIZER);
	inf = gf_sg_command_field_new(com);
	inf->new_node = node;
	inf->field_ptr = &inf->new_node;
	inf->fieldType = GF_SG_VRML_SFNODE;
	gf_list_add(com_list, com);
	return GF_OK;
}
Ejemplo n.º 7
0
static void get_tspan_width(GF_Node *node, void *rs)
{
	SVGPropertiesPointers backup_props;
	u32 backup_flags;
	GF_TraverseState *tr_state = (GF_TraverseState *)rs;
	SVG_Element *tspan = (SVG_Element *)node;
	SVGAllAttributes atts;
	GF_ChildNodeItem *child;

	gf_svg_flatten_attributes(tspan, &atts);
	if (!compositor_svg_traverse_base(node, &atts, tr_state, &backup_props, &backup_flags))
		return;

	child = ((GF_ParentNode *) tspan)->children;
	while (child) {
		switch  (gf_node_get_tag(child->node)) {
		case TAG_DOMText:
			get_domtext_width(child->node, &atts, tr_state);
			break;
		case TAG_SVG_tspan:
			get_tspan_width(child->node, tr_state);
			break;
		default:
			break;
		}
		child=child->next;
	}

	memcpy(tr_state->svg_props, &backup_props, sizeof(SVGPropertiesPointers));
	tr_state->svg_flags = backup_flags;
}
Ejemplo n.º 8
0
GF_Err gf_sc_get_viewpoint(GF_Compositor *compositor, u32 viewpoint_idx, const char **outName, Bool *is_bound)
{
#ifndef GPAC_DISABLE_VRML
	u32 count;
	GF_Node *n;
	if (!compositor->visual) return GF_BAD_PARAM;
	count = gf_list_count(compositor->visual->view_stack);
	if (!viewpoint_idx) return GF_BAD_PARAM;
	if (viewpoint_idx>count) return GF_EOS;

	n = (GF_Node*)gf_list_get(compositor->visual->view_stack, viewpoint_idx-1);
	switch (gf_node_get_tag(n)) {
	case TAG_MPEG4_Viewport:
		*outName = ((M_Viewport*)n)->description.buffer;
		*is_bound = ((M_Viewport*)n)->isBound;
		return GF_OK;
	case TAG_MPEG4_Viewpoint:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Viewpoint:
#endif
		*outName = ((M_Viewpoint*)n)->description.buffer;
		*is_bound = ((M_Viewpoint*)n)->isBound;
		return GF_OK;
	default:
		*outName = NULL;
		return GF_OK;
	}
#else
	return GF_NOT_SUPPORTED;
#endif
}
Ejemplo n.º 9
0
Archivo: bindable.c Proyecto: zsuo/gpac
GF_List *Bindable_GetStack(GF_Node *bindable)
{
	void *st;
	if (!bindable) return 0;
	st = gf_node_get_private(bindable);
	switch (gf_node_get_tag(bindable)) {
	case TAG_MPEG4_Background2D:
		return ((Background2DStack*)st)->reg_stacks;
	case TAG_MPEG4_Viewport:
	case TAG_MPEG4_NavigationInfo:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_NavigationInfo:
#endif
		return ((ViewStack*)st)->reg_stacks;
#ifndef GPAC_DISABLE_3D
	case TAG_MPEG4_Background:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Background:
#endif
		return ((BackgroundStack*)st)->reg_stacks;
	case TAG_MPEG4_Viewpoint:
	case TAG_MPEG4_Fog:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Viewpoint:
	case TAG_X3D_Fog:
#endif
		return ((ViewStack*)st)->reg_stacks;
#endif
	default:
		return NULL;
	}
}
Ejemplo n.º 10
0
Archivo: bindable.c Proyecto: zsuo/gpac
Bool Bindable_GetIsBound(GF_Node *bindable)
{
	if (!bindable) return GF_FALSE;
	switch (gf_node_get_tag(bindable)) {
	case TAG_MPEG4_Background2D:
		return ((M_Background2D*)bindable)->isBound;
	case TAG_MPEG4_Viewport:
		return ((M_Viewport*)bindable)->isBound;
	case TAG_MPEG4_Background:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Background:
#endif
		return ((M_Background*)bindable)->isBound;
	case TAG_MPEG4_NavigationInfo:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_NavigationInfo:
#endif
		return ((M_NavigationInfo*)bindable)->isBound;
	case TAG_MPEG4_Viewpoint:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Viewpoint:
#endif
		return ((M_Viewpoint*)bindable)->isBound;
	case TAG_MPEG4_Fog:
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Fog:
#endif
		return ((M_Fog*)bindable)->isBound;
	default:
		return GF_FALSE;
	}
}
Ejemplo n.º 11
0
static Bool svg_font_uri_check(GF_Node *node, FontURIStack *st)
{
	GF_Font *font;
	GF_Node *font_elt;
	SVGAllAttributes atts;
	gf_svg_flatten_attributes((SVG_Element*)node, &atts);
	if (!atts.xlink_href) return 0;

	if (atts.xlink_href->type == XMLRI_ELEMENTID) {
		if (!atts.xlink_href->target) atts.xlink_href->target = gf_sg_find_node_by_name(gf_node_get_graph(node), atts.xlink_href->string+1);
	} else {
		GF_SceneGraph *ext_sg;
		char *font_name = strchr(atts.xlink_href->string, '#');
		if (!font_name) return 0;
		if (!st->mo) {
			st->mo = gf_mo_load_xlink_resource(node, 0, 0, -1);
			if (!st->mo) return 0;
		}
		ext_sg = gf_mo_get_scenegraph(st->mo);
		if (!ext_sg) return 0;
		atts.xlink_href->target = gf_sg_find_node_by_name(ext_sg, font_name+1);
		if (!atts.xlink_href->target) return 0;
	}
	font_elt = atts.xlink_href->target;
	if (gf_node_get_tag(font_elt) != TAG_SVG_font) return 0; 
	font = gf_node_get_private(font_elt);
	if (!font) return 0;
	st->alias = font;

	gf_mo_is_done(st->mo);
	font->not_loaded = 0;
	return 1;
}
Ejemplo n.º 12
0
static void imagetexture_destroy(GF_Node *node, void *rs, Bool is_destroy)
{
	if (is_destroy) {
		GF_TextureHandler *txh = (GF_TextureHandler *) gf_node_get_private(node);

		/*cleanup cache if needed*/
		if (gf_node_get_tag(node)==TAG_MPEG4_CacheTexture) {
			char section[64];
			const char *opt, *file;
			Bool delete_file = 1;
			M_CacheTexture *ct = (M_CacheTexture*)node;

			sprintf(section, "@cache=%p", ct);
			file = gf_cfg_get_key(txh->compositor->user->config, section, "cacheFile");
			opt = gf_cfg_get_key(txh->compositor->user->config, section, "expireAfterNTP");

			if (opt) {
				u32 sec, frac, exp;
				sscanf(opt, "%u", &exp);
				gf_net_get_ntp(&sec, &frac);
				if (!exp || (exp>sec)) delete_file=0;
			}
			if (delete_file) {
				gf_delete_file((char*)file);
				gf_cfg_del_section(txh->compositor->user->config, section);
			}

			if (txh->data) gf_free(txh->data);
			txh->data = NULL;
		}
		gf_sc_texture_destroy(txh);
		gf_free(txh);
	}
}
Ejemplo n.º 13
0
Bool gf_svg_is_property(GF_Node *node, GF_FieldInfo *target_attribute)
{
	u32 tag = gf_node_get_tag(node);

	if (tag > GF_NODE_RANGE_LAST_VRML) {
		SVG_Element *e = (SVG_Element *)node;
		SVGAttribute *att = e->attributes;
		while (att) {
			if (att->data == target_attribute->far_ptr) break;
			att = att->next;
		}
		if (!att) return 0;
		switch (att->tag) {
		case TAG_SVG_ATT_audio_level:
		case TAG_SVG_ATT_color:
		case TAG_SVG_ATT_color_rendering:
		case TAG_SVG_ATT_display:
		case TAG_SVG_ATT_display_align:
		case TAG_SVG_ATT_fill:
		case TAG_SVG_ATT_fill_opacity:
		case TAG_SVG_ATT_fill_rule:
		case TAG_SVG_ATT_font_family:
		case TAG_SVG_ATT_font_size:
		case TAG_SVG_ATT_font_style:
		case TAG_SVG_ATT_font_variant:
		case TAG_SVG_ATT_font_weight:
		case TAG_SVG_ATT_image_rendering:
		case TAG_SVG_ATT_line_increment:
		case TAG_SVG_ATT_opacity:
		case TAG_SVG_ATT_pointer_events:
		case TAG_SVG_ATT_shape_rendering:
		case TAG_SVG_ATT_solid_color:
		case TAG_SVG_ATT_solid_opacity:
		case TAG_SVG_ATT_stop_color:
		case TAG_SVG_ATT_stop_opacity:
		case TAG_SVG_ATT_stroke:
		case TAG_SVG_ATT_stroke_dasharray:
		case TAG_SVG_ATT_stroke_dashoffset:
		case TAG_SVG_ATT_stroke_linecap:
		case TAG_SVG_ATT_stroke_linejoin:
		case TAG_SVG_ATT_stroke_miterlimit:
		case TAG_SVG_ATT_stroke_opacity:
		case TAG_SVG_ATT_stroke_width:
		case TAG_SVG_ATT_text_align:
		case TAG_SVG_ATT_text_anchor:
		case TAG_SVG_ATT_text_rendering:
		case TAG_SVG_ATT_vector_effect:
		case TAG_SVG_ATT_viewport_fill:
		case TAG_SVG_ATT_viewport_fill_opacity:
		case TAG_SVG_ATT_visibility:
			return 1;
		default:
			return 0;
		}
	}
	else {
		return 0;
	}
}
Ejemplo n.º 14
0
GF_SensorHandler *compositor_mpeg4_get_sensor_handler(GF_Node *n)
{
	GF_SensorHandler *hs;

	switch (gf_node_get_tag(n)) {
	/*anchor is not considered as a child sensor node when picking sensors*/
	case TAG_MPEG4_Anchor:
		hs = gf_sc_anchor_get_handler(n);
		break;
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_Anchor:
		hs = gf_sc_anchor_get_handler(n);
		break;
#endif
	case TAG_MPEG4_DiscSensor:
		hs = disc_sensor_get_handler(n);
		break;
	case TAG_MPEG4_PlaneSensor2D:
		hs = plane_sensor2d_get_handler(n);
		break;
	case TAG_MPEG4_ProximitySensor2D:
		hs = proximity_sensor2d_get_handler(n);
		break;
	case TAG_MPEG4_TouchSensor:
		hs = touch_sensor_get_handler(n);
		break;
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_TouchSensor:
		hs = touch_sensor_get_handler(n);
		break;
#endif
#ifndef GPAC_DISABLE_3D
	case TAG_MPEG4_CylinderSensor:
		hs = cylinder_sensor_get_handler(n);
		break;
	case TAG_MPEG4_PlaneSensor:
		hs = plane_sensor_get_handler(n);
		break;
	case TAG_MPEG4_SphereSensor:
		hs = sphere_get_handler(n);
		break;
#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_CylinderSensor:
		hs = cylinder_sensor_get_handler(n);
		break;
	case TAG_X3D_PlaneSensor:
		hs = plane_sensor_get_handler(n);
		break;
	case TAG_X3D_SphereSensor:
		hs = sphere_get_handler(n);
		break;
#endif
#endif /*GPAC_DISABLE_3D*/
	default: return NULL;
	}
	if (hs && hs->IsEnabled(n)) return hs;
	return NULL;
}
Ejemplo n.º 15
0
static void RenderSwitch(GF_Node *node, void *rs, Bool is_destroy)
{
	GF_ChildNodeItem *l;
	u32 i, count;
	Bool prev_switch;
	GF_ChildNodeItem *children;
	s32 whichChoice;
	GF_Node *child;
	SwitchStack *st = (SwitchStack *)gf_node_get_private(node);
	RenderEffect2D *eff; 
	eff = (RenderEffect2D *)rs;

	if (is_destroy) {
		free(st);
		return;
	}
	

	if (gf_node_get_name(node)) {
		node = node;
	}
	/*WARNING: X3D/MPEG4 NOT COMPATIBLE*/
	if (gf_node_get_tag(node)==TAG_MPEG4_Switch) {
		children = ((M_Switch *)node)->choice;
		whichChoice = ((M_Switch *)node)->whichChoice;
	} else {
		children = ((X_Switch *)node)->children;
		whichChoice = ((X_Switch *)node)->whichChoice;
	}
	count = gf_node_list_get_count(children);

	prev_switch = eff->trav_flags;
	/*check changes in choice field*/
	if ((gf_node_dirty_get(node) & GF_SG_NODE_DIRTY) || (st->last_switch != whichChoice) ) {
		eff->trav_flags |= GF_SR_TRAV_SWITCHED_OFF;
		i=0;
		l = children;
		while (l) {
//			if ((s32) i!=whichChoice) gf_node_render(l->node, eff);
			if ((s32) i == st->last_switch) gf_node_render(l->node, eff);
			l = l->next;
			i++;
		}
		eff->trav_flags &= ~GF_SR_TRAV_SWITCHED_OFF;
		st->last_switch = whichChoice;
	}

	gf_node_dirty_clear(node, 0);

	/*no need to check for sensors since a sensor is active for the whole parent group, that is for switch itself
	CSQ: switch cannot be used to switch sensors, too bad...*/
	eff->trav_flags = prev_switch;

	if (whichChoice>=0) {
		child = (GF_Node*)gf_node_list_get_child(children, whichChoice);
		gf_node_render(child, eff);
	}
}
Ejemplo n.º 16
0
void BD_CheckSFTimeOffset(GF_BifsDecoder *codec, GF_Node *node, GF_FieldInfo *inf)
{
	if (gf_node_get_tag(node) != TAG_ProtoNode) {
		if (!stricmp(inf->name, "startTime") || !stricmp(inf->name, "stopTime"))
			BD_OffsetSFTime(codec,  (Double *)inf->far_ptr);
	} else if (gf_sg_proto_field_is_sftime_offset(node, inf)) {
		BD_OffsetSFTime(codec,  (Double *)inf->far_ptr);
	}
}
Ejemplo n.º 17
0
static Bool text_is_3d_material(GF_TraverseState *tr_state)
{
	GF_Node *__mat;
	if (!tr_state->appear) return 0;
	__mat = ((M_Appearance *)tr_state->appear)->material;
	if (!__mat) return 0;
	if (gf_node_get_tag(__mat)==TAG_MPEG4_Material2D) return 0;
	return 1;
}
Ejemplo n.º 18
0
void SFCommandBufferChanged(GF_BifsDecoder * codec, GF_Node *node)
{
	void Conditional_BufferReplaced(GF_BifsDecoder * codec, GF_Node *node);

	switch (gf_node_get_tag(node)) {
	case TAG_MPEG4_Conditional:
		Conditional_BufferReplaced(codec, node);
		break;
	}
}
Ejemplo n.º 19
0
GF_Err gf_bifs_dec_qp_set(GF_BifsDecoder *codec, GF_Node *qp)
{
	assert(gf_node_get_tag(qp) == TAG_MPEG4_QuantizationParameter);

	/*if we have an active QP, push it into the stack*/
	if (codec->ActiveQP && ((GF_Node*)codec->ActiveQP != codec->scenegraph->global_qp) )
		gf_list_insert(codec->QPs, codec->ActiveQP, 0);

	codec->ActiveQP = (M_QuantizationParameter *)qp;
	return GF_OK;
}
Ejemplo n.º 20
0
void CTXLoad_NodeCallback(void *cbk, u32 type, GF_Node *node, void *param)
{
	if ((type==GF_SG_CALLBACK_INIT) && (gf_node_get_tag(node) == TAG_MPEG4_Conditional) ) {
		M_Conditional*c = (M_Conditional*)node;
		c->on_activate = CTXLoad_OnActivate;
		c->on_reverseActivate = CTXLoad_OnReverseActivate;
		gf_node_set_private(node, cbk);
	} else {
		gf_term_node_callback(cbk, type, node, param);
	}
}
Ejemplo n.º 21
0
GF_TextureHandler *R2D_GetTextureHandler(GF_Node *n)
{
	if (!n) return NULL;
	switch (gf_node_get_tag(n)) {
	case TAG_MPEG4_CompositeTexture2D: return ct2D_get_texture(n);
	case TAG_MPEG4_MatteTexture: return r2d_matte_get_texture(n);
	case TAG_MPEG4_LinearGradient: return r2d_lg_get_texture(n);
	case TAG_MPEG4_RadialGradient: return r2d_rg_get_texture(n);
	default: return gf_sr_texture_get_handler(n);
	}
}
Ejemplo n.º 22
0
GF_EXPORT
GF_TextureHandler *gf_sc_texture_get_handler(GF_Node *n)
{
	if (!n) return NULL;
	switch (gf_node_get_tag(n)) {
#ifndef GPAC_DISABLE_VRML
	case TAG_MPEG4_ImageTexture:
	case TAG_MPEG4_CacheTexture:
		return it_get_texture(n);
	case TAG_MPEG4_MovieTexture:
		return mt_get_texture(n);
	case TAG_MPEG4_PixelTexture:
		return pt_get_texture(n);

	case TAG_MPEG4_CompositeTexture2D:
	case TAG_MPEG4_CompositeTexture3D:
		return compositor_get_composite_texture(n);
	case TAG_MPEG4_LinearGradient:
	case TAG_MPEG4_RadialGradient:
		return compositor_mpeg4_get_gradient_texture(n);

	case TAG_MPEG4_MatteTexture:
	{
		GF_TextureHandler *hdl = gf_sc_texture_get_handler( ((M_MatteTexture*)n)->surfaceB );
		if (hdl) hdl->matteTexture = n;
		return hdl;
	}
#endif /*GPAC_DISABLE_VRML*/

#ifndef GPAC_DISABLE_X3D
	case TAG_X3D_ImageTexture:
		return it_get_texture(n);
	case TAG_X3D_MovieTexture:
		return mt_get_texture(n);
	case TAG_X3D_PixelTexture:
		return pt_get_texture(n);
#endif


#ifndef GPAC_DISABLE_SVG
	case TAG_SVG_linearGradient:
	case TAG_SVG_radialGradient:
		return compositor_svg_get_gradient_texture(n);
	case TAG_SVG_image:
	case TAG_SVG_video:
		return compositor_svg_get_image_texture(n);
#endif

    case TAG_ProtoNode:
        return gf_sc_hardcoded_proto_get_texture_handler(n);
	default:
		return NULL;
	}
}
Ejemplo n.º 23
0
Bool compositor_svg_get_viewport(GF_Node *n, GF_Rect *rc) 
{
	SVGsvgStack *stack;
	if (gf_node_get_tag(n) != TAG_SVG_svg) return 0;
	stack = gf_node_get_private(n);
	rc->width = stack->parent_vp.x;
	rc->height = stack->parent_vp.y;
	/*not supported yet*/
	rc->x = rc->y = 0;
	return 1;
}
Ejemplo n.º 24
0
Bool compositor_is_composite_texture(GF_Node *appear)
{
	u32 tag;
	if (!appear) return 0;
	tag = gf_node_get_tag(appear);
	if ((tag==TAG_MPEG4_Appearance) 
#ifndef GPAC_DISABLE_X3D
		|| (tag==TAG_X3D_Appearance)
#endif
	) {
		M_Appearance *ap = (M_Appearance *)appear;
		if (!ap->texture) return 0;
		switch (gf_node_get_tag(((M_Appearance *)appear)->texture)) {
		case TAG_MPEG4_CompositeTexture2D:
		case TAG_MPEG4_CompositeTexture3D:
			return 1;
		}
	}
	return 0;
}
Ejemplo n.º 25
0
void compositor_init_afx_node(GF_Compositor *compositor, GF_Node *node, MFURL *url)
{
	GF_MediaObject *mo = gf_mo_register(node, url, 0, 0);
	if (!mo) {
		GF_LOG(GF_LOG_WARNING, GF_LOG_COMPOSE, ("[Compositor] AFX Decoder not found for node %s - node may not be completely/correctly rendered\n", gf_node_get_class_name(node)));
	}
#ifndef GPAC_DISABLE_VRML
	if (gf_node_get_tag(node)==TAG_MPEG4_BitWrapper) {
		compositor_init_bitwrapper(compositor, node);
	}
#endif
}
Ejemplo n.º 26
0
Archivo: main.c Proyecto: Bevara/GPAC
void node_init(void *cbk, GF_Node *node)
{
	BIFSVID *b2v = cbk;
	switch (gf_node_get_tag(node)) {
	case TAG_MPEG4_Conditional:
	case TAG_MPEG4_QuantizationParameter:
		break;
	default:
		if (b2v->sr) gf_sc_on_node_init(b2v->sr, node);
		break;
	}
}
Ejemplo n.º 27
0
void svg_filter_apply(GF_Node *node, GF_TextureHandler *source, GF_Rect *region)
{
	GF_ChildNodeItem *l = ((GF_ParentNode*)node)->children;

	while (l) {
		switch (gf_node_get_tag(l->node)) {
		case TAG_SVG_feComponentTransfer:
			apply_feComponentTransfer(l->node, source, region);
			break;
		}
		l = l->next;
	}
}
Ejemplo n.º 28
0
Bool compositor_background_transparent(GF_Node *node)
{
	if (node && (gf_node_get_tag(node) == TAG_MPEG4_Background2D)) {
		Background2DStack *st;
		if (!((M_Background2D *)node)->isBound) return 1;
			
		st = (Background2DStack *) gf_node_get_private(node);
		if (st->txh.transparent) return 1;
		return 0;
	}
	/*consider all other background nodes transparent*/
	return 1;
}
Ejemplo n.º 29
0
void InitTimeSensor(GF_Renderer *sr, GF_Node *node)
{
    TimeSensorStack *st;
    GF_SAFEALLOC(st, TimeSensorStack);
    st->time_handle.UpdateTimeNode = UpdateTimeSensor;
    st->time_handle.obj = node;
    st->store_info = 1;
    st->compositor = sr;
    st->is_x3d = (gf_node_get_tag(node)==TAG_X3D_TimeSensor) ? 1 : 0;
    gf_node_set_private(node, st);
    gf_node_set_callback_function(node, DestroyTimeSensor);
    /*time sensor needs to be run only if def'ed, otherwise it doesn't impact scene*/
    if (gf_node_get_id(node)) gf_sr_register_time_node(sr, &st->time_handle);
}
Ejemplo n.º 30
0
static void SG_CheckFieldChange(GF_Node *node, GF_FieldInfo *field)
{
	/*and propagate eventIn if any*/
	if (field->on_event_in) {
		field->on_event_in(node);
	} else if ((field->eventType==GF_SG_EVENT_IN) && (gf_node_get_tag(node) == TAG_MPEG4_Script)) {
		gf_sg_script_event_in(node, field);
	} else {
		/*Notify eventOut in all cases to handle protos*/
		gf_node_event_out(node, field->fieldIndex);
	}
	/*signal node modif*/
	gf_node_changed(node, field);
}