Пример #1
0
static void AS_CheckURL(AnimationStreamStack *stack, M_AnimationStream *as)
{
    if (!stack->stream) {
        gf_sg_vrml_mf_reset(&stack->current_url, GF_SG_VRML_MFURL);
        gf_sg_vrml_field_copy(&stack->current_url, &as->url, GF_SG_VRML_MFURL);
        stack->stream = gf_mo_find((GF_Node *)as, &as->url, 0);
        gf_sr_invalidate(stack->compositor, NULL);

        /*if changed while playing trigger*/
        if (as->isActive) {
            gf_mo_play(stack->stream, 0, -1, 0);
            gf_mo_set_speed(stack->stream, as->speed);
        }
        return;
    }
    /*check change*/
    if (gf_mo_url_changed(stack->stream, &as->url)) {
        gf_sg_vrml_mf_reset(&stack->current_url, GF_SG_VRML_MFURL);
        gf_sg_vrml_field_copy(&stack->current_url, &as->url, GF_SG_VRML_MFURL);
        /*if changed while playing stop old source*/
        if (as->isActive) {
            gf_mo_set_flag(stack->stream, GF_MO_DISPLAY_REMOVE, 1);
            gf_mo_stop(stack->stream);
        }
        stack->stream = gf_mo_find((GF_Node *)as, &as->url, 0);
        /*if changed while playing play new source*/
        if (as->isActive) {
            gf_mo_play(stack->stream, 0, -1, 0);
            gf_mo_set_speed(stack->stream, as->speed);
        }
        gf_sr_invalidate(stack->compositor, NULL);
    }
}
Пример #2
0
/*check only URL changes*/
void InputSensorModified(GF_Node *node)
{
#if GPAC_HTK_DEMO
	GF_ObjectManager *odm;
	ISPriv *is_dec;
#endif
	GF_MediaObject *mo;
	ISStack *st = (ISStack *)gf_node_get_private(node);

	mo = gf_mo_find(node, &st->is->url, 0);
	if ((mo!=st->mo) || !st->registered){
		if (mo!=st->mo) {
			if (st->mo) IS_Unregister(st);
			st->mo = mo;
		}
		if (st->is->enabled) 
			IS_Register(node);
		else
			return;
	} else if (!st->is->enabled) {
		IS_Unregister(st);
		st->mo = NULL;
		return;
	}

#if GPAC_HTK_DEMO
	/*turn audio analyse on/off*/
	if (!st->is_dec || !st->is_dec->od_man) return;
	odm = st->is_dec->od_man;
	assert(odm->codec && (odm->codec->type == GF_STREAM_INTERACT));
	/*get IS dec*/
	is_dec = odm->codec->decio->privateStack;
	StartHTK(is_dec);
#endif
}
Пример #3
0
static void RenderInputSensor(GF_Node *node, void *rs, Bool is_destroy)
{
	ISStack *st = (ISStack*)gf_node_get_private(node);
	M_InputSensor *is = (M_InputSensor *)node;

	if (is_destroy) {
		GF_InlineScene *is;
		if (st->registered) IS_Unregister(st);
		is = (GF_InlineScene*)gf_sg_get_private(gf_node_get_graph(node));
		gf_term_rem_render_node(is->root_od->term, node);
		free(st);
	} else {
		/*get decoder object */
		if (!st->mo) st->mo = gf_mo_find(node, &is->url, 0);
		/*register with decoder*/
		if (st->mo && !st->registered) IS_Register(node);
	}
}