void live_session_shutdown(LiveSession *livesess) { gf_seng_terminate(livesess->seng); if (livesess->streams) { while (gf_list_count(livesess->streams)) { RTPChannel *rtpch = gf_list_get(livesess->streams, 0); gf_list_rem(livesess->streams, 0); gf_rtp_streamer_del(rtpch->rtp); if (rtpch->carousel_data) gf_free(rtpch->carousel_data); gf_free(rtpch); } gf_list_del(livesess->streams); } }
GF_EXPORT GF_SceneEngine *gf_seng_init(void *calling_object, char * inputContext, u32 load_type, char *dump_path, Bool embed_resources) { GF_SceneEngine *seng; GF_Err e = GF_OK; if (!inputContext) return NULL; GF_SAFEALLOC(seng, GF_SceneEngine) if (!seng) return NULL; seng->calling_object = calling_object; /*Step 1: create context and load input*/ seng->sg = gf_sg_new(); gf_sg_set_node_callback(seng->sg, gf_seng_on_node_modified); gf_sg_set_private(seng->sg, seng); seng->dump_path = dump_path; seng->ctx = gf_sm_new(seng->sg); seng->owns_context = 1; memset(&(seng->loader), 0, sizeof(GF_SceneLoader)); seng->loader.ctx = seng->ctx; seng->loader.type = load_type; /*since we're encoding in BIFS we must get MPEG-4 nodes only*/ seng->loader.flags = GF_SM_LOAD_MPEG4_STRICT; if (embed_resources) seng->loader.flags |= GF_SM_LOAD_EMBEDS_RES; seng->loader.fileName = inputContext; e = gf_sm_load_init(&(seng->loader)); if (!e) e = gf_sm_load_run(&(seng->loader)); if (e<0) { GF_LOG(GF_LOG_ERROR, GF_LOG_SCENE, ("[SceneEngine] Cannot load context from %s (error %s)\n", inputContext, gf_error_to_string(e))); goto exit; } e = gf_sm_live_setup(seng); if (e!=GF_OK) { GF_LOG(GF_LOG_ERROR, GF_LOG_SCENE, ("[SceneEngine] cannot init scene encoder for context (error %s)\n", gf_error_to_string(e))); goto exit; } return seng; exit: gf_seng_terminate(seng); return NULL; }