示例#1
0
/*pause all objects*/
void MC_SetSpeed(GF_ObjectManager *odm, Fixed speed)
{
	u32 i;
	GF_ObjectManager *ctrl_od;
	GF_Scene *in_scene;
	GF_Clock *ck;

	if (odm->flags & GF_ODM_NO_TIME_CTRL) return;

	/*locate all objects sharing the clock*/
	ck = gf_odm_get_media_clock(odm);
	if (!ck) return;

	in_scene = odm->parentscene;
	if (odm->subscene) {
		assert(odm->subscene->root_od==odm);
//		assert( gf_odm_shares_clock(odm, ck) );
		gf_odm_set_speed(odm, speed, GF_TRUE);
		in_scene = odm->subscene;
	}

	i=0;
	while ((ctrl_od = (GF_ObjectManager*)gf_list_enum(in_scene->resources, &i))) {
		if (!gf_odm_shares_clock(ctrl_od, ck)) continue;
		gf_odm_set_speed(ctrl_od, speed, GF_TRUE);
	}
}
示例#2
0
/*pause all objects*/
void mediacontrol_set_speed(GF_ObjectManager *odm, Fixed speed)
{
    u32 i;
    GF_ObjectManager *ctrl_od;
    GF_Scene *in_scene;
    GF_Clock *ck;

    if (odm->flags & GF_ODM_NO_TIME_CTRL) return;

    /*locate all objects sharing the clock*/
    ck = gf_odm_get_media_clock(odm);
    if (!ck) return;

    in_scene = odm->parentscene;
    if (odm->subscene) {
        assert(odm->subscene->root_od==odm);
        in_scene = odm->subscene;

        //dynamic scene with speed direction, we need to re-start everything to issue new PLAY requests
        if (in_scene->is_dynamic_scene && (gf_mulfix(ck->speed, speed) < 0)) {
            u32 time = gf_clock_time(ck);
            gf_clock_set_speed(ck, speed);

            //enable main addon
            if (speed<0) {
                i=0;
                while ((ctrl_od = (GF_ObjectManager*)gf_list_enum(in_scene->resources, &i))) {
                    if (ctrl_od->addon && (ctrl_od->addon->addon_type==GF_ADDON_TYPE_MAIN)) {
                        gf_scene_select_main_addon(in_scene, ctrl_od, GF_TRUE, gf_clock_time(ck) );
                        break;
                    }
                }
            }
            gf_scene_restart_dynamic(in_scene, time, 0, 1);
            return;
        }
        gf_clock_set_speed(ck, speed);
        gf_odm_set_speed(odm, speed, GF_TRUE);
    }

    i=0;
    while ((ctrl_od = (GF_ObjectManager*)gf_list_enum(in_scene->resources, &i))) {
        if (!gf_odm_shares_clock(ctrl_od, ck)) continue;

        if (ctrl_od->subscene) {
            mediacontrol_set_speed(ctrl_od, speed);
        } else {
            gf_odm_set_speed(ctrl_od, speed, GF_TRUE);
        }
    }
}