Example #1
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);
}
Example #2
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;
	}
}
Example #3
0
static void svg_animation_smil_evaluate(SMIL_Timing_RTI *rti, Fixed normalized_scene_time, u32 status)
{
	GF_Node *node = gf_smil_get_element(rti);
	SVGlinkStack *stack = gf_node_get_private(node);
	switch (status) {
	case SMIL_TIMING_EVAL_UPDATE:
		svg_animation_smil_update(node, stack, normalized_scene_time);
		break;
	case SMIL_TIMING_EVAL_FREEZE:
		if (stack->resource) {
			gf_mo_stop(stack->resource);
			stack->needs_play = 1;
		}
		break;
	case SMIL_TIMING_EVAL_REMOVE:
		if (stack->resource) {
			svg_reset_xlink_target(node);
			gf_mo_unload_xlink_resource(node, stack->resource);
			stack->resource = NULL;
			stack->fragment_id = NULL;
			stack->inline_sg = NULL;
			gf_node_dirty_set(node, GF_SG_SVG_XLINK_HREF_DIRTY, 0);
		}
		break;
	case SMIL_TIMING_EVAL_REPEAT:
		if (stack->resource) {
			svg_reset_xlink_target(node);
			stack->fragment_id = NULL;
			stack->inline_sg = NULL;
			gf_mo_restart(stack->resource);
		}
		break;
	}
}
Example #4
0
GF_EXPORT
void gf_sc_texture_restart(GF_TextureHandler *txh)
{
	if (!txh->is_open) return;
	gf_sc_texture_release_stream(txh);
	txh->stream_finished = 0;
	gf_mo_restart(txh->stream);
}
Example #5
0
GF_EXPORT
void gf_sc_audio_restart(GF_AudioInput *ai)
{
	if (!ai->is_open) return;
	if (ai->need_release) gf_mo_release_data(ai->stream, 0xFFFFFFFF, 2);
	ai->need_release = 0;
	ai->stream_finished = 0;
	if (ai->filter) gf_af_reset(ai->filter);
	gf_mo_restart(ai->stream);
}