static void audiosource_traverse(GF_Node *node, void *rs, Bool is_destroy) { GF_TraverseState*tr_state = (GF_TraverseState*)rs; M_AudioSource *as = (M_AudioSource *)node; AudioSourceStack *st = (AudioSourceStack *)gf_node_get_private(node); if (is_destroy) { gf_sc_audio_predestroy(&st->input); if (st->time_handle.is_registered) { gf_sc_unregister_time_node(st->input.compositor, &st->time_handle); } gf_free(st); return; } /*check end of stream*/ if (st->input.stream && st->input.stream_finished) { if (gf_mo_get_loop(st->input.stream, 0)) { gf_sc_audio_restart(&st->input); } else if (st->is_active && gf_mo_should_deactivate(st->input.stream)) { /*deactivate*/ audiosource_deactivate(st, as); } } if (st->is_active) { gf_sc_audio_register(&st->input, (GF_TraverseState*)rs); } /*store mute flag*/ st->input.is_muted = tr_state->switched_off; }
static void UpdateBackgroundTexture(GF_TextureHandler *txh) { gf_sc_texture_update_frame(txh, 0); /*restart texture if needed (movie background controled by MediaControl)*/ if (txh->stream_finished && gf_mo_get_loop(txh->stream, 0)) gf_sc_texture_restart(txh); }
static void movietexture_activate(MovieTextureStack *stack, M_MovieTexture *mt, Double scene_time) { mt->isActive = 1; gf_node_event_out_str((GF_Node*)mt, "isActive"); if (!stack->txh.is_open) { scene_time -= mt->startTime; gf_sc_texture_play_from_to(&stack->txh, &mt->url, scene_time, -1, gf_mo_get_loop(stack->txh.stream, mt->loop), 0); } gf_mo_set_speed(stack->txh.stream, mt->speed); }
static void audioclip_traverse(GF_Node *node, void *rs, Bool is_destroy) { GF_TraverseState *tr_state = (GF_TraverseState *)rs; M_AudioClip *ac = (M_AudioClip *)node; AudioClipStack *st = (AudioClipStack *)gf_node_get_private(node); if (is_destroy) { gf_sc_audio_predestroy(&st->input); if (st->time_handle.is_registered) { gf_sc_unregister_time_node(st->input.compositor, &st->time_handle); } gf_free(st); return; } if (st->failure) return; /*check end of stream*/ if (st->input.stream && st->input.stream_finished) { if (gf_mo_get_loop(st->input.stream, ac->loop)) { gf_sc_audio_restart(&st->input); } else if (ac->isActive && gf_mo_should_deactivate(st->input.stream)) { /*deactivate*/ audioclip_deactivate(st, ac); } } if (ac->isActive) { gf_sc_audio_register(&st->input, (GF_TraverseState*)rs); } if (st->set_duration && st->input.stream) { ac->duration_changed = gf_mo_get_duration(st->input.stream); gf_node_event_out_str(node, "duration_changed"); st->set_duration = 0; } /*store mute flag*/ st->input.is_muted = tr_state->switched_off; }
static Bool animationstream_get_loop(AnimationStreamStack *stack, M_AnimationStream *as) { return gf_mo_get_loop(stack->stream, as->loop); }
static Bool movietexture_get_loop(MovieTextureStack *stack, M_MovieTexture *mt) { return gf_mo_get_loop(stack->txh.stream, mt->loop); }