void svg_pause_animation(GF_Node *n, Bool pause) { SVGlinkStack *st = gf_node_get_private(n); if (!st) return; if (pause) gf_mo_pause(st->resource); else gf_mo_resume(st->resource); }
void svg_pause_audio(GF_Node *n, Bool pause) { SVG_audio_stack *st = (SVG_audio_stack *)gf_node_get_private(n); if (!st) return; if (pause) gf_mo_pause(st->input.stream); else gf_mo_resume(st->input.stream); }
static void svg_animation_smil_update(GF_Node *node, SVGlinkStack *stack, Fixed normalized_scene_time) { if (stack->init_vis_state == 3) { stack->init_vis_state = 4; gf_mo_resume(stack->resource); } else if (stack->needs_play || (gf_node_dirty_get(node) & GF_SG_SVG_XLINK_HREF_DIRTY )) { SVGAllAttributes all_atts; Double clipBegin, clipEnd; GF_MediaObject *new_res; gf_svg_flatten_attributes((SVG_Element *)node, &all_atts); clipBegin = all_atts.clipBegin ? *all_atts.clipBegin : 0; clipEnd = all_atts.clipEnd ? *all_atts.clipEnd : -1; if (stack->needs_play) { gf_mo_play(stack->resource, clipBegin, clipEnd, 0); stack->needs_play = 0; } else { Bool primary = all_atts.gpac_useAsPrimary ? *all_atts.gpac_useAsPrimary : 1; new_res = gf_mo_load_xlink_resource(node, primary, clipBegin, clipEnd); if (new_res != stack->resource) { if (stack->resource) gf_mo_unload_xlink_resource(node, stack->resource); if (all_atts.xlink_href) all_atts.xlink_href->target = NULL; stack->resource = new_res; stack->fragment_id = NULL; stack->inline_sg = NULL; } gf_node_dirty_clear(node, 0); } } }
static void movietexture_activate(MovieTextureStack *stack, M_MovieTexture *mt, Double scene_time) { mt->isActive = 1; gf_node_event_out((GF_Node*)mt, 8/*"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); } else if (stack->first_frame_fetched) { gf_mo_resume(stack->txh.stream); } gf_mo_set_speed(stack->txh.stream, mt->speed); }
static void movietexture_update_time(GF_TimeNode *st) { Double time; M_MovieTexture *mt = (M_MovieTexture *)st->udta; MovieTextureStack *stack = (MovieTextureStack *)gf_node_get_private(st->udta); /*not active, store start time and speed*/ if ( ! mt->isActive) { stack->start_time = mt->startTime; } time = gf_node_get_scene_time(st->udta); if (time < stack->start_time || /*special case if we're getting active AFTER stoptime */ (!mt->isActive && (mt->stopTime > stack->start_time) && (time>=mt->stopTime)) // || (!stack->start_time && !stack->is_x3d && !mt->loop) ) { /*opens stream only at first access to fetch first frame*/ if (stack->fetch_first_frame) { stack->fetch_first_frame = 0; if (!stack->txh.is_open) gf_sc_texture_play(&stack->txh, &mt->url); else gf_mo_resume(stack->txh.stream); } return; } if (movietexture_get_speed(stack, mt) && mt->isActive) { /*if stoptime is reached (>startTime) deactivate*/ if ((mt->stopTime > stack->start_time) && (time >= mt->stopTime) ) { movietexture_deactivate(stack, mt); return; } } /*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 (! mt->isActive) movietexture_activate(stack, mt, time); stack->txh.stream_finished = GF_FALSE; }