Beispiel #1
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;
}
Beispiel #2
0
static void animationstream_update_time(GF_TimeNode *st)
{
    Double time;
    M_AnimationStream *as = (M_AnimationStream *)st->udta;
    AnimationStreamStack *stack = (AnimationStreamStack *)gf_node_get_private(st->udta);

    /*not active, store start time and speed*/
    if ( ! as->isActive) {
        stack->start_time = as->startTime;
    }
    time = gf_node_get_scene_time(st->udta);

    if ((time < stack->start_time) || (stack->start_time < 0)) return;

    if (animationstream_get_speed(stack, as) && as->isActive) {
        //if stoptime is reached (>startTime) deactivate
        if ((as->stopTime > stack->start_time) && (time >= as->stopTime) ) {
            animationstream_deactivate(stack, as);
            return;
        }
        if (gf_mo_is_done(stack->stream)) {
            if (animationstream_get_loop(stack, as)) {
                gf_mo_restart(stack->stream);
            } else if (gf_mo_should_deactivate(stack->stream)) {
                animationstream_deactivate(stack, as);
            }
        }
    }

    /*we're (about to be) active: VRML:
    "A time-dependent node is inactive until its startTime is reached. When time now becomes greater than or
    equal to startTime, an isActive TRUE event is generated and the time-dependent node becomes active 	*/
    if (!as->isActive && !st->needs_unregister) animationstream_activate(stack, as);
}
Beispiel #3
0
static void svg_updates_smil_evaluate(SMIL_Timing_RTI *rti, Fixed normalized_scene_time, u32 status)
{
	SVG_updates_stack *stack = (SVG_updates_stack *)gf_node_get_private(gf_smil_get_element(rti));

	switch (status) {
	case SMIL_TIMING_EVAL_UPDATE:
		if (!stack->is_open) { 
			if (stack->resource ) gf_mo_play(stack->resource, stack->clipBegin, stack->clipEnd, GF_FALSE);
			stack->is_open = GF_TRUE;
		}
		else if (gf_mo_is_done(stack->resource) && (gf_smil_get_media_duration(rti)<0) ) { 
			Double dur = gf_mo_get_duration(stack->resource);
			gf_smil_set_media_duration(rti, dur);
		}
		break;
	case SMIL_TIMING_EVAL_FREEZE:
	case SMIL_TIMING_EVAL_REMOVE:
		stack->is_open = GF_FALSE;
		gf_mo_set_flag(stack->resource, GF_MO_DISPLAY_REMOVE, GF_TRUE);
		gf_mo_stop(stack->resource);
		break;
	case SMIL_TIMING_EVAL_REPEAT:
		gf_mo_restart(stack->resource);
		break;
	}
}