308
308
/*reload term part*/
310
sOpt = gf_cfg_get_key(term->user->config, "Systems", "AlwaysDrawBIFS");
310
sOpt = gf_cfg_get_key(term->user->config, "Systems", "DrawLateFrames");
311
311
if (sOpt && !stricmp(sOpt, "yes"))
312
term->flags &= ~GF_TERM_SYSDEC_RESYNC;
312
term->flags &= ~GF_TERM_DROP_LATE_FRAMES;
314
term->flags |= GF_TERM_SYSDEC_RESYNC;
314
term->flags |= GF_TERM_DROP_LATE_FRAMES;
316
316
sOpt = gf_cfg_get_key(term->user->config, "Systems", "ForceSingleClock");
317
317
if (sOpt && !stricmp(sOpt, "yes"))
630
645
gf_list_add(tmp->unthreaded_extensions, ifce);
648
gf_term_lock_media_queue(tmp, 1);
633
649
if (!gf_list_count(tmp->unthreaded_extensions)) {
634
650
gf_list_del(tmp->unthreaded_extensions);
635
651
tmp->unthreaded_extensions = NULL;
653
gf_term_lock_media_queue(tmp, 0);
637
655
if (0 == gf_cfg_get_key_count(user->config, "MimeTypes")){
638
GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Initializing Mime Types..."));
639
/* No mime-types detected, probably the first launch */
640
for (i=0; i< gf_modules_get_count(user->modules); i++) {
641
GF_BaseInterface *ifce = gf_modules_load_interface(user->modules, i, GF_NET_CLIENT_INTERFACE);
643
GF_InputService * service = (GF_InputService*) ifce;
644
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Asking mime types supported for new module %s...\n", ifce->module_name));
645
if (service->RegisterMimeTypes){
646
u32 num = service->RegisterMimeTypes(service);
647
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] module %s has registered %u new mime-types.\n", ifce->module_name, num));
649
GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("[Core] Module %s has not declared any RegisterMimeTypes method, cannot guess its supported mime-types.\n", ifce->module_name));
651
gf_modules_close_interface(ifce);
656
GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Initializing Mime Types..."));
657
/* No mime-types detected, probably the first launch */
658
for (i=0; i< gf_modules_get_count(user->modules); i++) {
659
GF_BaseInterface *ifce = gf_modules_load_interface(user->modules, i, GF_NET_CLIENT_INTERFACE);
661
GF_InputService * service = (GF_InputService*) ifce;
662
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] Asking mime types supported for new module %s...\n", ifce->module_name));
663
if (service->RegisterMimeTypes){
664
u32 num = service->RegisterMimeTypes(service);
665
GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("[Core] module %s has registered %u new mime-types.\n", ifce->module_name, num));
667
GF_LOG(GF_LOG_WARNING, GF_LOG_CORE, ("[Core] Module %s has not declared any RegisterMimeTypes method, cannot guess its supported mime-types.\n", ifce->module_name));
669
gf_modules_close_interface(ifce);
654
GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Finished Initializing Mime Types."));
672
GF_LOG(GF_LOG_INFO, GF_LOG_MEDIA, ("[Terminal] Finished Initializing Mime Types."));
658
675
tmp->uri_relocators = gf_list_new();
973
999
else if (term->root_scene && term->root_scene->root_od->net_service->cache) return GF_MEDIA_CACHE_RUNNING;
974
1000
else return GF_MEDIA_CACHE_ENABLED;
975
1001
case GF_OPT_CAN_SELECT_STREAMS: return (term->root_scene && term->root_scene->is_dynamic_scene) ? 1 : 0;
1002
case GF_OPT_HTTP_MAX_RATE: return gf_dm_get_data_rate(term->downloader);
1003
case GF_OPT_VIDEO_BENCH: return term->bench_mode ? GF_TRUE : GF_FALSE;
976
1005
default: return gf_sc_get_option(term->compositor, type);
1270
1303
*min_buffer = 0;
1276
void gf_term_service_media_event_with_download(GF_ObjectManager *odm, u32 event_type, u64 loaded_size, u64 total_size, u32 bytes_per_sec)
1310
void gf_term_service_media_event_with_download(GF_ObjectManager *odm, GF_EventType event_type, u64 loaded_size, u64 total_size, u32 bytes_per_sec)
1278
1312
#ifndef GPAC_DISABLE_SVG
1279
1313
u32 i, count, min_buffer, min_time;
1325
1359
if (!locked) return;
1327
1361
for (i=0; i<count; i++) {
1328
GF_Node *node = gf_list_get(odm->mo->nodes, i);
1329
gf_dom_event_fire(node, &evt);
1362
GF_DOMEventTarget *target = (GF_DOMEventTarget *)gf_list_get(odm->mo->evt_targets, i);
1363
sg_fire_dom_event(target, &evt, scene->graph, NULL);
1332
1366
GF_Node *root = gf_sg_get_root_node(scene->graph);
1333
1367
if (root) gf_dom_event_fire(root, &evt);
1335
gf_sc_lock(odm->term->compositor, 0);
1369
gf_sc_lock(odm->term->compositor, GF_FALSE);
1339
void gf_term_service_media_event(GF_ObjectManager *odm, u32 event_type)
1373
void gf_term_service_media_event(GF_ObjectManager *odm, GF_EventType event_type)
1341
1375
gf_term_service_media_event_with_download(odm, event_type, 0, 0, 0);
1496
1530
gf_term_cleanup_pending_session(term, ns);
1533
GF_ClientService *gf_term_get_service_from_url(GF_Terminal *term, const char *url)
1536
GF_ClientService *ns;
1537
while ( (ns = (GF_ClientService*)gf_list_enum(term->net_services, &i)) ) {
1538
if (!strcmp(ns->url, url)) {
1499
1545
/*connects given channel to its URL if needed*/
1500
1546
GF_Err gf_term_connect_remote_channel(GF_Terminal *term, GF_Channel *ch, char *URL)
1595
1641
u32 gf_term_get_time_in_ms(GF_Terminal *term)
1597
1644
if (!term || !term->root_scene) return 0;
1598
if (term->root_scene->scene_codec && term->root_scene->scene_codec->ck) return gf_clock_ellapse_time(term->root_scene->scene_codec->ck);
1599
else if (term->root_scene->dyn_ck) return gf_clock_ellapse_time(term->root_scene->dyn_ck);
1646
if (term->root_scene->scene_codec && term->root_scene->scene_codec->ck) ck = term->root_scene->scene_codec->ck;
1647
else if (term->root_scene->dyn_ck) ck = term->root_scene->dyn_ck;
1650
if (!ck->has_seen_eos && ck->last_TS_rendered) return ck->last_TS_rendered;
1651
return gf_clock_elapse_time(ck);
1603
1654
GF_Node *gf_term_pick_node(GF_Terminal *term, s32 X, s32 Y)
1718
1770
GF_SceneLoader load;
1720
1772
if (!term) return GF_BAD_PARAM;
1774
if (type && (!stricmp(type, "application/ecmascript") || !stricmp(type, "js")) ) {
1775
return gf_scene_execute_script(term->root_scene->graph, com);
1722
1778
memset(&load, 0, sizeof(GF_SceneLoader));
1723
1779
load.localPath = gf_cfg_get_key(term->user->config, "General", "CacheDirectory");
1841
1897
return gf_sc_release_screen_buffer(term->compositor, framebuffer);
1845
static void gf_term_sample_scenetime(GF_Scene *scene)
1848
Bool locked = gf_mx_try_lock(scene->root_od->term->net_mx);
1849
/*we cannot grab the network mutex, therefore we are not sure if some resources are not being destroyed.
1850
TODO: add a dedicated mutex for this condition instead of using the global net mutex*/
1851
if (!locked) return;
1853
gf_scene_sample_time(scene);
1854
count = gf_list_count(scene->resources);
1855
for (i=0; i<count; i++) {
1856
GF_ObjectManager *odm = gf_list_get(scene->resources, i);
1857
if (odm->subscene) gf_term_sample_scenetime(odm->subscene);
1859
gf_mx_v(scene->root_od->term->net_mx);
1862
u32 gf_term_sample_clocks(GF_Terminal *term)
1864
if (term->root_scene) {
1865
gf_term_sample_scenetime(term->root_scene);
1866
return (u32) (1000*term->root_scene->simulation_time);
1871
1901
const char *gf_term_get_text_selection(GF_Terminal *term, Bool probe_only)
2266
2299
gf_scene_switch_quality(term->root_scene, up);
2303
GF_Err gf_term_get_visual_output_size(GF_Terminal *term, u32 *width, u32 *height)
2305
if (!term) return GF_BAD_PARAM;
2306
if (width) *width = term->compositor->vp_width;
2307
if (height) *height = term->compositor->vp_height;
b'\\ No newline at end of file'