Imported Upstream version 0.4.5+svn4002~dfsg0
authorAlessio Treglia <alessio@debian.org>
Fri, 6 Apr 2012 08:31:40 +0000 (10:31 +0200)
committerAlessio Treglia <alessio@debian.org>
Fri, 6 Apr 2012 08:31:40 +0000 (10:31 +0200)
111 files changed:
applications/Makefile
applications/mp42ts/main.c
applications/mp4box/fileimport.c
applications/mp4box/live.c
applications/mp4box/main.c
applications/mp4client/extract.c
applications/mp4client/main.c
configure
gui/iphone_wm_gui.js
gui/iphone_wm_gui.svg
include/gpac/internal/compositor_dev.h
include/gpac/internal/isomedia_dev.h
include/gpac/setup.h
include/gpac/tools.h
modules/aac_in/aac_in.c
modules/alsa/alsa.c
modules/amr_dec/amr_dec.c
modules/amr_float_dec/amr_float_dec.c
modules/audio_filter/audio_filter.c
modules/directfb_out/directfb_out.c
modules/droid_audio/droidaudio.c
modules/droid_mpegv/droid_mpegv.c
modules/droid_out/droid_vout-bitmap.c
modules/droid_out/droid_vout.c
modules/dx_hw/dx_video.c
modules/epoc_hw/epoc_vout.cpp
modules/ffmpeg_in/Makefile
modules/ffmpeg_in/ffmpeg_demux.c
modules/gapi/gapi.cpp
modules/gdip_raster/gdip_font.cpp
modules/gpac_js/gpac_js.c
modules/jack/Makefile
modules/jack/jack.c
modules/mpegts_in/mpegts_in.c
modules/ogg/ogg_load.c
modules/opensvc_dec/opensvc_dec.c
modules/oss_audio/oss.c
modules/platinum/GPACMediaRenderer.cpp
modules/platinum/GPACPlatinum.cpp
modules/pulseaudio/pulseaudio.c
modules/raw_out/raw_video.c
modules/rvc_dec/rvc_dec.c
modules/sdl_out/sdl_out.c
modules/wav_out/wav_out.c
modules/widgetman/unzip.c
modules/x11_out/Makefile
modules/x11_out/x11_out.c
modules/xvid_dec/xvid_dec.c
regression_tests/bifs/bifs-3D-positioning-layer3D.bt
src/compositor/audio_render.c
src/compositor/compositor.c
src/compositor/events.c
src/compositor/mpeg4_grouping_3d.c
src/compositor/svg_grouping.c
src/ietf/rtp_streamer.c
src/isomedia/avc_ext.c
src/isomedia/box_dump.c
src/isomedia/box_funcs.c
src/isomedia/hint_track.c
src/isomedia/isma_sample.c
src/isomedia/isom_read.c
src/isomedia/isom_write.c
src/isomedia/media.c
src/isomedia/meta.c
src/isomedia/movie_fragments.c
src/isomedia/sample_descs.c
src/mcrypt/sha1.c
src/media_tools/ait.c
src/media_tools/av_parsers.c
src/media_tools/dsmcc.c
src/media_tools/dvb_mpe.c
src/media_tools/filestreamer.c
src/media_tools/img.c
src/media_tools/isom_tools.c
src/media_tools/m2ts_mux.c
src/media_tools/media_import.c
src/media_tools/mpd.c
src/media_tools/mpegts.c
src/scene_manager/encode_isom.c
src/scene_manager/loader_bt.c
src/scenegraph/base_scenegraph.c
src/scenegraph/commands.c
src/scenegraph/dom_events.c
src/scenegraph/dom_smjs.c
src/scenegraph/mpeg4_nodes.c
src/scenegraph/svg_attributes.c
src/scenegraph/svg_smjs.c
src/scenegraph/vrml_route.c
src/scenegraph/vrml_script.c
src/scenegraph/vrml_smjs.c
src/scenegraph/vrml_tools.c
src/scenegraph/x3d_nodes.c
src/scenegraph/xml_ns.c
src/terminal/decoder.c
src/terminal/network_service.c
src/terminal/object_browser.c
src/terminal/object_manager.c
src/terminal/scene.c
src/terminal/terminal.c
src/utils/alloc.c
src/utils/base_encoding.c
src/utils/color.c
src/utils/downloader.c
src/utils/os_config_init.c
src/utils/os_divers.c
src/utils/os_module.c
src/utils/os_net.c
src/utils/os_thread.c
src/utils/ringbuffer.c
src/utils/unicode.c
src/utils/url.c

index e93a736a449f7826aff09f733645cade09a8d355..4683ad535beb2d59e2060bb91689e0b37f71f3be 100644 (file)
@@ -5,9 +5,11 @@ APPDIRS=mp4client
 ifeq ($(DISABLE_ISOFF), no)
 APPDIRS+=mp4box
 ifeq ($(DISABLE_M2TS), no)
+ifeq ($(DISABLE_SENG), no)
 APPDIRS+=mp42ts
 endif
 endif
+endif
 
 V4STUDIODIR=
 INSTDIRS=mp4client
index 80b22455007485ea5e72e883dfe1d2b4afed8ad5..57e1c480aa55233b65f643cbbe7d2140656bf944 100644 (file)
 
 #error "Cannot compile MP42TS if GPAC is not built with ISO File Format support"
 
-#else
+#endif
+
+#ifdef GPAC_DISABLE_MPEG2TS_MUX
+
+#error "Cannot compile MP42TS if GPAC is not built with MPEG2-TS Muxing support"
+
+#endif
 
 
 #define DEFAULT_PCR_OFFSET     18000
@@ -440,6 +446,7 @@ static GF_Err seng_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
        return GF_OK;
 }
 
+#ifndef GPAC_DISABLE_STREAMING
 typedef struct
 {
        /*RTP channel*/
@@ -497,6 +504,7 @@ static GF_Err rtp_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
        }
        return GF_OK;
 }
+#endif
 
 static GF_Err void_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param)
 {
@@ -732,7 +740,6 @@ static Bool seng_output(void *param)
 {
        GF_Err e;
        u64 last_src_modif, mod_time;
-       Bool has_carousel=0;
        M2TSProgram *prog = (M2TSProgram *)param;
        GF_SceneEngine *seng = prog->seng;
        GF_SimpleDataDescriptor *audio_desc;
@@ -741,9 +748,6 @@ static Bool seng_output(void *param)
        u32 period, ts_delta;
        u16 es_id, aggregate_on_stream;
        e = GF_OK;
-       if (prog->rate){
-               has_carousel = 1;
-       }
        gf_sleep(2000); /*TODO: events instead? What are we waiting for?*/
        gf_seng_encode_context(seng, SampleCallBack);
        
@@ -911,7 +915,7 @@ static Bool seng_output(void *param)
        return e ? 1 : 0;
 }
 
-
+#ifndef GPAC_DISABLE_STREAMING
 static void rtp_sl_packet_cbk(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e)
 {
        GF_ESIRTP *rtp = (GF_ESIRTP*)udta;
@@ -1027,6 +1031,7 @@ static void fill_rtp_es_ifce(GF_ESInterface *ifce, GF_SDPMedia *media, GF_SDPInf
        }
        fprintf(stderr, "RTP interface initialized\n");
 }
+#endif /*GPAC_DISABLE_STREAMING*/
 
 void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 period)
 {
@@ -1060,7 +1065,9 @@ void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 pe
 
 static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mpeg4_signaling, char *update, char *audio_input_ip, u16 audio_input_port, char *video_buffer, Bool force_real_time, u32 bifs_use_pes)
 {
+#ifndef GPAC_DISABLE_STREAMING
        GF_SDPInfo *sdp;
+#endif
        u32 i;
        GF_Err e;
        
@@ -1212,6 +1219,7 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp
                return 1;
        }
 
+#ifndef GPAC_DISABLE_STREAMING
        /*open SDP file*/
        if (strstr(src, ".sdp")) {
                GF_X_Attribute *att;
@@ -1280,8 +1288,9 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp
                gf_sdp_info_del(sdp);
 
                return 2;
-       } 
-       else if (strstr(src, ".bt")) //open .bt file
+       } else 
+#endif /*GPAC_DISABLE_STREAMING*/
+       if (strstr(src, ".bt")) //open .bt file
        {
                u32 load_type=0;
                prog->seng = gf_seng_init(prog, src, load_type, NULL, (load_type == GF_SM_LOAD_DIMS) ? 1 : 0);
@@ -1789,9 +1798,11 @@ int main(int argc, char **argv)
        char *ts_out = NULL, *udp_out = NULL, *rtp_out = NULL, *audio_input_ip = NULL;
        FILE *ts_output_file = NULL;
        GF_Socket *ts_output_udp_sk = NULL, *audio_input_udp_sk = NULL;
+#ifndef GPAC_DISABLE_STREAMING
        GF_RTPChannel *ts_output_rtp = NULL;
        GF_RTSPTransport tr;
        GF_RTPHeader hdr;
+#endif
        char *video_buffer;
        u32 video_buffer_size;
        u16 output_port = 0, audio_input_port = 0;
@@ -1823,11 +1834,13 @@ int main(int argc, char **argv)
        last_video_time = 0;
        audio_input_type = 0;
        ts_output_udp_sk = NULL;
-       ts_output_rtp = NULL;
-       src_name = NULL;
-       ts_out = NULL;
        udp_out = NULL;
+#ifndef GPAC_DISABLE_STREAMING
+       ts_output_rtp = NULL;
        rtp_out = NULL;
+#endif
+       ts_out = NULL;
+       src_name = NULL;
        nb_progs = 0;
        mux_rate = 0;
        run_time = 0;
@@ -1913,6 +1926,7 @@ int main(int argc, char **argv)
                        goto exit;
                }
        }
+#ifndef GPAC_DISABLE_STREAMING
        if (rtp_out != NULL) {
                ts_output_rtp = gf_rtp_new();
                gf_rtp_set_ports(ts_output_rtp, output_port);
@@ -1948,6 +1962,7 @@ int main(int argc, char **argv)
                hdr.SSRC = tr.SSRC;
                hdr.Marker = 0;
        }
+#endif /*GPAC_DISABLE_STREAMING*/
 
        /************************************/
        /*   create streaming audio input   */
@@ -2108,6 +2123,7 @@ int main(int argc, char **argv)
                                        fprintf(stderr, "Error %s sending UDP packet\n", gf_error_to_string(e));
                                }
                        }
+#ifndef GPAC_DISABLE_STREAMING
                        if (ts_output_rtp != NULL) {
                                hdr.SequenceNumber++;
                                /*muxer clock at 90k*/
@@ -2120,6 +2136,7 @@ int main(int argc, char **argv)
                                        fprintf(stderr, "Error %s sending RTP packet\n", gf_error_to_string(e));
                                }
                        }
+#endif
                        if (status>=GF_M2TS_STATE_PADDING) {
                                break;
                        }
@@ -2173,13 +2190,17 @@ exit:
        }
        if (ts_output_file) fclose(ts_output_file);
        if (ts_output_udp_sk) gf_sk_del(ts_output_udp_sk);
+#ifndef GPAC_DISABLE_STREAMING
        if (ts_output_rtp) gf_rtp_del(ts_output_rtp);
+#endif
        if (ts_out) gf_free(ts_out);
        if (audio_input_udp_sk) gf_sk_del(audio_input_udp_sk);
        if (audio_input_buffer) gf_free (audio_input_buffer);
        if (video_buffer) gf_free(video_buffer);
        if (udp_out) gf_free(udp_out);
+#ifndef GPAC_DISABLE_STREAMING
        if (rtp_out) gf_free(rtp_out);
+#endif
        if (aac_reader) AAC_Reader_del(aac_reader);
        if (muxer) gf_m2ts_mux_del(muxer);
        
@@ -2208,4 +2229,3 @@ exit:
        return 1;
 }
 
-#endif /*GPAC_DISABLE_ISOM*/
index 7b180e5c3d8f437b899064ff17ccc8cba20442d7..4d2b77b419b2989155c1560f818b6dbb237221a4 100644 (file)
@@ -932,6 +932,9 @@ GF_Err split_isomedia_file(GF_ISOFile *mp4, Double split_dur, u32 split_size_kb,
                        /*track done*/
                        if ((tki->stop_state==2) || (!is_last && (tki->sample_count == tki->last_sample)) ) {
                                if (tki->has_non_raps) last_rap_sample_time = 0;
+                               time = (Double) (s64) ( gf_isom_get_sample_dts(mp4, tki->tk, tki->last_sample+1) - tki->firstDTS);
+                               time /= tki->time_scale;
+                               if (file_split_dur==(Double)GF_MAX_FLOAT || file_split_dur<time) file_split_dur = time;
                                continue;
                        }
 
index efca9d6caf31b39612b8593ce317658fe1667f9d..e0ddba561406a962b728cf03e9634f5d21ccf108 100644 (file)
@@ -37,7 +37,7 @@
 
 #else
 
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
 
 void PrintStreamerUsage()
 {
@@ -805,6 +805,6 @@ exit:
 }
 
 
-#endif /*GPAC_DISABLE_STREAMING*/
+#endif /*!defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)*/
 
 #endif /*defined(GPAC_DISABLE_ISOM) || defined(GPAC_DISABLE_ISOM_WRITE)*/
index bc2b0c70a8e5ffe01dba428f4a0ff6574823e8d7..270fbc29223c11678efd027432d8b8db5f9b1038 100644 (file)
@@ -107,7 +107,7 @@ void dump_mpeg2_ts(char *mpeg2ts_file, char *pes_out_name, Bool prog_num,
 #endif 
 
 
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
 void PrintStreamerUsage();
 int stream_file_rtp(int argc, char **argv);
 int live_session(int argc, char **argv);
@@ -823,7 +823,7 @@ GF_Err HintFile(GF_ISOFile *file, u32 MTUSize, u32 max_ptime, u32 rtp_rate, u32
 
 #endif /*GPAC_DISABLE_ISOM_HINTING*/
 
-#ifndef GPAC_DISABLE_ISOM_WRITE
+#if !defined(GPAC_DISABLE_ISOM_WRITE) && !defined(GPAC_DISABLE_AV_PARSERS)
 
 static void check_media_profile(GF_ISOFile *file, u32 track)
 {
@@ -913,7 +913,7 @@ void remove_systems_tracks(GF_ISOFile *file)
        gf_isom_set_pl_indication(file, GF_ISOM_PL_INLINE, 0);
 }
 
-#endif
+#endif /*!defined(GPAC_DISABLE_ISOM_WRITE) && !defined(GPAC_DISABLE_AV_PARSERS)*/
 
 /*return value:
        0: not supported 
@@ -1204,7 +1204,7 @@ int mp4boxMain(int argc, char **argv)
 #ifndef GPAC_DISABLE_SCENE_ENCODER
        GF_SMEncodeOptions opts;
 #endif
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
        SDPLine sdp_lines[MAX_CUMUL_OPS];
 #endif
        Double InterleavingTime, split_duration, split_start, import_fps, dash_duration;
@@ -1386,15 +1386,14 @@ int mp4boxMain(int argc, char **argv)
                        i++;
                }
 #endif /*GPAC_DISABLE_MEDIA_EXPORT*/
-
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
                else if (!stricmp(arg, "-rtp")) {
                        stream_rtp = 1;
                }
-#endif
                else if (!stricmp(arg, "-live")) {
                        live_scene = 1;
                }
+#endif
                else if (!stricmp(arg, "-diod")) {
                        dump_iod = 1;
                }
@@ -1590,6 +1589,7 @@ int mp4boxMain(int argc, char **argv)
                else if (!stricmp(arg, "-mtu")) { CHECK_NEXT_ARG MTUSize = atoi(argv[i+1]); i++; }
                else if (!stricmp(arg, "-cardur")) { CHECK_NEXT_ARG car_dur = atoi(argv[i+1]); i++; }
                else if (!stricmp(arg, "-rate")) { CHECK_NEXT_ARG rtp_rate = atoi(argv[i+1]); i++; }
+#ifndef GPAC_DISABLE_SENG
                else if (!stricmp(arg, "-add-sdp") || !stricmp(arg, "-sdp_ex")) {
                        char *id;
                        CHECK_NEXT_ARG
@@ -1616,6 +1616,7 @@ int mp4boxMain(int argc, char **argv)
                        nb_sdp_ex++;
                        i++;
                }
+#endif /*GPAC_DISABLE_SENG*/
 #endif /*GPAC_DISABLE_ISOM_HINTING*/
 
                else if (!stricmp(arg, "-single")) {
@@ -2100,7 +2101,7 @@ int mp4boxMain(int argc, char **argv)
                        else if (!strcmp(argv[i+1], "crypt")) PrintEncryptUsage();
                        else if (!strcmp(argv[i+1], "meta")) PrintMetaUsage();
                        else if (!strcmp(argv[i+1], "swf")) PrintSWFUsage();
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
                        else if (!strcmp(argv[i+1], "rtp")) PrintStreamerUsage();
                        else if (!strcmp(argv[i+1], "live")) PrintLiveUsage     ();
 #endif
@@ -2115,7 +2116,7 @@ int mp4boxMain(int argc, char **argv)
                                PrintEncryptUsage();
                                PrintMetaUsage();
                                PrintSWFUsage();
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
                                PrintStreamerUsage();
                                PrintLiveUsage  ();
 #endif
@@ -2140,14 +2141,14 @@ int mp4boxMain(int argc, char **argv)
                return 1;
        }
 
-#ifndef GPAC_DISABLE_STREAMING
+#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG)
        if (live_scene) {
                return live_session(argc, argv);
        }
        if (stream_rtp) {
                return stream_file_rtp(argc, argv);
        }
-#endif /*GPAC_DISABLE_STREAMING*/
+#endif
 
        if (raw_cat) {
                char chunk[4096];
@@ -2786,7 +2787,9 @@ int mp4boxMain(int argc, char **argv)
        }
 
        if (remove_sys_tracks) {
+#ifndef GPAC_DISABLE_AV_PARSERS
                remove_systems_tracks(file);
+#endif
                needSave = 1;
                if (conv_type < GF_ISOM_CONV_TYPE_ISMA_EX) conv_type = 0;
        }
@@ -3215,6 +3218,7 @@ int mp4boxMain(int argc, char **argv)
                                                        u32 k, l, sps_id1, sps_id2;
                                                        GF_AVCConfig *avccfg1 = gf_isom_avc_config_get(in, j+1, 1);
                                                        GF_AVCConfig *avccfg2 = gf_isom_avc_config_get(init_seg, track, 1);
+#ifndef GPAC_DISABLE_AV_PARSERS
                                                        for (k=0; k<gf_list_count(avccfg2->sequenceParameterSets); k++) {
                                                                GF_AVCConfigSlot *slc = gf_list_get(avccfg2->sequenceParameterSets, k);
                                                                gf_avc_get_sps_info(slc->data, slc->size, &sps_id1, NULL, NULL, NULL, NULL);
@@ -3227,6 +3231,7 @@ int mp4boxMain(int argc, char **argv)
                                                                        }
                                                                }
                                                        }
+#endif
                                                        /*no conflicts in SPS ids, merge all SPS in a single sample desc*/
                                                        if (do_merge) {
                                                                while (gf_list_count(avccfg1->sequenceParameterSets)) {
@@ -3363,7 +3368,7 @@ int mp4boxMain(int argc, char **argv)
        }
        if (e) goto err_exit;
 
-#ifndef GPAC_DISABLE_ISOM_HINTING
+#if !defined(GPAC_DISABLE_ISOM_HINTING) && !defined(GPAC_DISABLE_SENG)
        for (i=0; i<nb_sdp_ex; i++) {
                if (sdp_lines[i].trackID) {
                        u32 track = gf_isom_get_track_by_id(file, sdp_lines[i].trackID);
@@ -3392,7 +3397,7 @@ int mp4boxMain(int argc, char **argv)
                        needSave = 1;
                }
        }
-#endif /*GPAC_DISABLE_ISOM_HINTING*/
+#endif /*!defined(GPAC_DISABLE_ISOM_HINTING) && !defined(GPAC_DISABLE_SENG)*/
 
        if (cprt) {
                e = gf_isom_set_copyright(file, "und", cprt);
index 2ce04e3fa0037f4a990c8ab4335d09b11f801cdb..9ff100944f11bcd5342202fa16f61cb7798cf37a 100644 (file)
@@ -157,10 +157,7 @@ void write_bmp(GF_VideoSurface *fb, char *rad_name, u32 img_num)
        BITMAPINFOHEADER fi;
        FILE *fout;
        u32 j, i;
-       char *ptr, *prev;
-
-       prev = strrchr(rad_name, '.');
-       //if (prev) prev[0] = '\0'; 
+       char *ptr;
 
        if (fb->pixel_format==GF_PIXEL_GREYSCALE) sprintf(str, "%s_%d_depth.bmp", rad_name, img_num);
        else sprintf(str, "%s_%d.bmp", rad_name, img_num);
@@ -259,7 +256,6 @@ void write_depthfile(GF_VideoSurface *fb, char *rad_name, u32 img_num)
 {
        FILE *fout;
        u32 i, j;
-       char val;
        unsigned char *depth;
 
        depth = (unsigned char *) fb->video_buffer;
@@ -270,10 +266,10 @@ void write_depthfile(GF_VideoSurface *fb, char *rad_name, u32 img_num)
                for (i=0;i<fb->width; i++) {
 
 #ifdef GPAC_USE_TINYGL
-                       val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short)], fout);
-                       val = fputc(depth[2*i+j*fb->width*sizeof(unsigned short) + 1], fout);
+                       fputc(depth[2*i+j*fb->width*sizeof(unsigned short)], fout);
+                       fputc(depth[2*i+j*fb->width*sizeof(unsigned short) + 1], fout);
 #else
-                       val = fputc(depth[i+j*fb->width], fout);
+                       fputc(depth[i+j*fb->width], fout);
 #endif
                }
        }
@@ -285,7 +281,6 @@ void write_texture_file(GF_VideoSurface *fb, char *rad_name, u32 img_num, u32 du
 
        FILE *fout;
        u32 i, j;
-       char val;
        unsigned char *buf;
 
        buf = (unsigned char *) fb->video_buffer;
@@ -297,7 +292,7 @@ void write_texture_file(GF_VideoSurface *fb, char *rad_name, u32 img_num, u32 du
        if (!fout) return;
        for (j=0; j<fb->height;  j++) {
                for (i=0;i<fb->width*4; i++) {
-                       val = fputc(buf[i+j*fb->pitch_y], fout);
+                       fputc(buf[i+j*fb->pitch_y], fout);
                }
        }
        fclose(fout);
index f43d16bb414cbdb43b0259a796c5c619c325317b..a2d0ec08c7a9320ac985c6ec398d3742a23c1c20 100644 (file)
@@ -1186,7 +1186,7 @@ int main (int argc, char **argv)
                if (!strcmp(str, "Raw Video Output")) fprintf(stdout, "WARNING: using raw output video (memory only) - no display used\n");
                /*check audio output*/
                str = gf_cfg_get_key(cfg_file, "Audio", "DriverName");
-               if (!str || !strcmp(str, "No Audio Output Available")) fprintf(stdout, "WARNING: no audio output availble - make sure no other program is locking the sound card\n");
+               if (!str || !strcmp(str, "No Audio Output Available")) fprintf(stdout, "WARNING: no audio output available - make sure no other program is locking the sound card\n");
 
                str = gf_cfg_get_key(cfg_file, "General", "NoMIMETypeFetch");
                no_mime_check = (str && !stricmp(str, "yes")) ? 1 : 0;
index d08a25d0c0a1597e33795910acb6e016827651f3..22c9fa6dcc2383bfce52e2e2c60e7b32f9f33305 100755 (executable)
--- a/configure
+++ b/configure
@@ -665,7 +665,7 @@ fi
 #spidermonkey test for new API
 if test "$has_js" = "no" ; then
 
-    cat > $TMPCPP << EOF
+cat > $TMPCPP << EOF
 #include <jsapi.h>
 int main( void ) { JSContext *cx; jsval *rp; return JS_AddValueRoot(cx, rp); }
 EOF
@@ -692,9 +692,13 @@ EOF
                 if test "$has_js" = "no" ; then
                     js_inc="/usr/include/$i"
                     js_flags="-DXP_UNIX -I$js_inc"
-                    js_lib="-L/usr/lib/$i/ -lxul -lmozsqlite3 -lmozalloc -lnss3"
+                    js_lib="-L/usr/lib/$i/ -lxul -lmozsqlite3 -lmozalloc -lnssutil3 -lnss3"
                     if $cpp -o $TMPO $TMPCPP $js_flags $js_lib 2> /dev/null  ; then
                         has_js="$i"
+                    elif $cpp -o $TMPO $TMPCPP $js_flags -lnssutil3 $js_lib -lssl3 2> /dev/null  ; then
+                        #firefox 11 compatibility
+                        has_js="$i"
+                        js_lib="-lnssutil3 $js_lib -lssl3"
                     fi
                 fi
             done
@@ -816,18 +820,21 @@ if test "$has_js" != "no" ; then
             #if the lib has been compiled with or without the macro. We currently just decide that if the macro is present
             #in the header, it was enabled in the build
             if test "$new_js_api" = "no" ; then
-              if grep MOZILLA_1_8_BRANCH $js_inc/jsapi.h > /dev/null 2>&1 ; then
-                  js_flags="-DMOZILLA_1_8_BRANCH $js_flags"
-                  echo "WARNING: Turning on MOZILLA_1_8_BRANCH SpiderMonkey macro"
-                  echo "If you have troubles with scripts in GPAC, disable this macro and recompile"
-              fi
+                if grep MOZILLA_1_8_BRANCH $js_inc/jsapi.h > /dev/null 2>&1 ; then
+                    js_flags="-DMOZILLA_1_8_BRANCH $js_flags"
+                    echo "WARNING: Turning on MOZILLA_1_8_BRANCH SpiderMonkey macro"
+                    echo "If you have troubles with scripts in GPAC, disable this macro and recompile"
+                fi
             else
-              #check presence of ***RuntimeThread
-              if grep RuntimeThread $js_inc/jsapi.h > /dev/null 2>&1 ; then
-                js_flags="$js_flags"
-              else
-                  js_flags="-DNO_JS_RUNTIMETHREAD $js_flags"
-              fi
+cat > $TMPC << EOF
+#include <jsapi.h>
+int main( void ) { JSContext *cx; JS_SetRuntimeThread(cx); }
+EOF
+                if $cc -o $TMPO $TMPC $js_flags $LDFLAGS $js_lib 2> /dev/null  ; then
+                    js_flags="$js_flags"
+                else
+                    js_flags="-DNO_JS_RUNTIMETHREAD $js_flags"
+                fi
             fi
         fi
     fi
@@ -1422,7 +1429,7 @@ IN6_IS_ADDR_MULTICAST( (struct in6_addr *) 0);
 }
 EOF
 
-if $cc -o $TMPE $TMPC $LDFLAGS > /dev/null 2>&1  ; then
+if $cc -o $TMPE $TMPC $LDFLAGS $extralibs > /dev/null 2>&1  ; then
     has_ipv6="yes"
 fi
 
@@ -1888,16 +1895,27 @@ EOF
 if $cc -o $TMPO $TMPCPP -I$xulsdk_path $LDFLAGS 2> /dev/null  ; then
     has_xul="system"
     xul_flags="-I$xulsdk_path $xul_flags"
-else
+fi
+
+if test "$has_xul" = "no" ; then
+    if $pkg_config --exists libxul 2> /dev/null ; then
+        if $cpp -o $TMPO $TMPCPP `$pkg_config --cflags libxul` `$pkg_config --libs libxul` ; then
+            has_xul="system"
+            xul_flags="`$pkg_config --cflags libxul` `$pkg_config --libs libxul`" 
+        fi
+    fi
+fi
+
+if test "$has_xul" = "no" ; then
     if $cc -o $TMPO $TMPCPP $xul_flags -I$local_inc/gecko-sdk/include $LDFLAGS 2> /dev/null  ; then
         has_xul="local"
         xul_flags="-I$local_inc/gecko-sdk/include $xul_flags"
     else
-        #xulrunner directories are sometimes included through js packages
-        if test "$has_js" = "system"  ;then
-            if $cpp -o $TMPO $TMPCPP $js_flags $js_lib_pkg $LDFLAGS 2> /dev/null  ; then
+        #xulrunner directories are sometimes included through js/xul/ff packages
+        if test ! "$has_js" = "no" -a ! "$has_js" = "local" ; then
+            if $cc -o $TMPO $TMPCPP $js_flags $js_lib_pkg $LDFLAGS 2> /dev/null  ; then
                 xul_flags=`$pkg_config --cflags mozilla-js`
-                has_xul="system"
+                has_xul="$has_js"
             fi
         fi
     fi
@@ -2335,8 +2353,8 @@ if test "$darwin" = "yes" ; then
 fi
 
 ldir=`pwd`
-CFLAGS="$CFLAGS -DGPAC_HAVE_CONFIG_H -I\"$ldir\""
-CPPFLAGS="$CPPFLAGS -DGPAC_HAVE_CONFIG_H -I\"$ldir\""
+CFLAGS="$CFLAGS -fvisibility=\"hidden\" -DGPAC_HAVE_CONFIG_H -I\"$ldir\""
+CPPFLAGS="$CPPFLAGS"
 
 
 echo "Creating config.mak"
@@ -2502,11 +2520,17 @@ if test "$has_libxml2" = "yes"; then
     echo "XML2_CFLAGS=$libxml2_cflags" >> config.mak
     echo "XML2_LIBS=$libxml2_lib_flags" >> config.mak
 fi
+if test "$disable_parsers" = "yes" ; then
+    disable_m2ts_mux="yes"
+fi
 if test "$disable_m2ts_mux" = "yes" -o "$disable_m2ts" = "yes" ; then
     echo "DISABLE_M2TS=yes" >> config.mak
 else
     echo "DISABLE_M2TS=no" >> config.mak
 fi
+if test "$disable_beng" = "no"; then
+    echo "DISABLE_SENG=no" >> config.mak
+fi
 
 echo "GPAC_USE_TINYGL=$has_tinygl" >> config.mak
 echo "OGL_INCLS=$INCL3D" >> config.mak
index d9cb1a9acbf8a7c7405455b4d7f8e6a50db291ab..1e0d22d6a9e9c504a32258f1e778a78761f63a77 100644 (file)
 // 01122011 AMD1 startWidget listWidgets getWidget implemented
-
-var iphone_wm_gui = (function () {
-
-    // to make sure the initialization is done only once
-    var init = true;
-
-    // constant
-    var xlinkns = 'http://www.w3.org/1999/xlink';
-    //var evns = 'http://www.w3.org/2001/xml-events';
-
-    // state of the widget manager: displays homepage (value=home) or executes widget (value="exec")
-    var state = 'home';
-
-    // convenience variables for SVG elements
-    var homepage = null, arrows = null, icons = null, widgetContainer = null, homebar = null, execbar = null;
-
-    // where is the index into pages of icons on the home page
-    var where = 0,maxwhere = 0,whereW = 0;
-
-    // array of activated widgets
-    var activatedWidgets = new Array();
-    var numActivatedWidgets = 0;
-
-    // variables for flexible layout
-    // variables for flexible layout
-    var totalWidth = 0,totalHeight = 0,iconNbHoriz = 0,iconNbVert = 0,iconsPerPage = 0;
-
-    //previous size
-    var previousWidth = 0,previousHeight = 0;
-
-    // to differentiate between install icon and scan dir for icons
-    var isThisAScan = null;
-
-    // preferred icon type
-    var preferredIconType = '.svg';
-
-    // adapt layout to the size of the screen
-    function adaptLayoutToSize() {
-        if (l_deb < log_level) {
-            alert("[UI] adaptLayoutToSize");
-        }
-        var tmpObject, tmpObj2;
-        // get size to adapt to
-        totalWidth = document.documentElement.viewport.width;
-        totalHeight = document.documentElement.viewport.height;
-        if (totalWidth == 0) {
-            totalWidth = 160;
-        }
-        if (totalHeight == 0) {
-            totalHeight = 280;
-        }
-        while (totalWidth < 160 || totalHeight < 280) {
-            totalWidth *= 4;
-            totalHeight *= 4;
-        }
-        // min size is 160 by 280
-        if (totalWidth < 160) {
-            totalWidth = 160;
-        }
-        if (totalHeight < 280) {
-            totalHeight = 280;
-        }
-        // round to lower multiple of 80
-        totalWidth -= totalWidth % 80;
-        var iconHeight = totalHeight - 120;
-        iconHeight -= iconHeight % 80;
-        // how many lines and columns of icons
-        iconNbHoriz = totalWidth / 80;
-        iconNbVert = iconHeight / 80;
-        totalHeight = iconHeight + 120;
-        // 120 is upper bar (60) + lower bar (60)
-        iconsPerPage = iconNbHoriz * iconNbVert;
-        // fix svg viewbox
-        document.getElementById("svg").setAttribute("viewBox", "0 0 " + totalWidth + " " + totalHeight);
-        // fix odd line
-        tmpObj2 = document.getElementById("odd");
-        var i, already = tmpObj2.getElementsByTagName("use").length;
-        //alert("odd line "+already+" "+iconNbHoriz);
-        for (i = already; i < iconNbHoriz; i++) {
-            tmpObject = document.createElement("use");
-            tmpObject.setAttribute("x", i * 80);
-            tmpObject.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#lightRect" : "#darkRect" ));
-            tmpObj2.appendChild(tmpObject);
-        }
-        // fix even line
-        tmpObj2 = document.getElementById("even");
-        already = tmpObj2.getElementsByTagName("use").length;
-        //alert("even line "+already+" "+iconNbHoriz);
-        for (i = already; i < iconNbHoriz; i++) {
-            tmpObject = document.createElement("use");
-            tmpObject.setAttribute("x", i * 80);
-            tmpObject.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#darkRect" : "#lightRect" ));
-            tmpObj2.appendChild(tmpObject);
-        }
-        // fix frame (black with rounded corners)
-        tmpObject = document.getElementById("frame");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight);
-        tmpObject = document.getElementById("frame2");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight);
-        // fix screen (white)
-        tmpObject = document.getElementById("screen");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight - 120);
-        // fix grid back (gray)
-        tmpObject = document.getElementById("gridback");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight - 120);
-        // fix icon background grid
-        tmpObject = document.getElementById("grid");
-        already = tmpObject.getElementsByTagName("use").length;
-        for (i = already; i < iconNbVert; i++) {
-            tmpObj2 = document.createElement("use");
-            tmpObj2.setAttribute("y", i * 80);
-            tmpObj2.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#odd" : "#even" ));
-            tmpObject.appendChild(tmpObj2);
-        }
-        // if there are already too many lines, remove the extra ones otherwise they are rendered on top of the lower
-        // part of the decoration
-        if (already > iconNbVert) {
-            while (already-- > iconNbVert) {
-                tmpObject.removeChild(tmpObject.lastChild);
-            }
-        }
-        // fix commands (lower bar)
-        document.getElementById("commands").setAttribute("transform", "translate(0, " + (totalHeight - 60) + ")");
-        document.getElementById("homeButton").setAttribute("transform", "translate(" + (totalWidth / 2) + ", 30)");
-        document.getElementById("right").setAttribute("transform", "translate(" + (totalWidth - 50) + ", 10)");
-        document.getElementById("rightW").setAttribute("transform", "translate(" + (totalWidth - 50) + ", 10)");
-        // fix the cuts (white rects left and right because we have no clipping)
-        tmpObject = document.getElementById("leftCut");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight);
-        tmpObject.setAttribute("x", -1 - totalWidth);
-        tmpObject = document.getElementById("rightCut");
-        tmpObject.setAttribute("width", totalWidth);
-        tmpObject.setAttribute("height", totalHeight);
-        tmpObject.setAttribute("x", 1 + totalWidth);
-        // respace executing widgets if any
-        tmpObject = widgetContainer.getElementsByTagName("g");
-        for (i = 0; i < tmpObject.length; i++) {
-            var gg = tmpObject.item(i);
-            gg.setAttribute("transform", "translate(" + (totalWidth * (i - 1)) + ", 0)");
-            if (gg.firstElementChild != null) {
-                gg.firstElementChild.setAttribute("width", totalWidth);
-                gg.firstElementChild.setAttribute("height", totalHeight - 120);
-            }
+/* wrapper as a module
+ var iphone_wm_gui = (function () {
+ */
+// to make sure the initialization is done only once
+var init = true;
+
+// constant
+var xlinkns = 'http://www.w3.org/1999/xlink';
+//var evns = 'http://www.w3.org/2001/xml-events';
+
+// state of the widget manager: displays homepage (value=home) or executes widget (value="exec")
+var state = 'home';
+
+// convenience variables for SVG elements
+var homepage = null, arrows = null, icons = null, widgetContainer = null, homebar = null, execbar = null;
+
+// where is the index into pages of icons on the home page
+var where = 0,maxwhere = 0,whereW = 0;
+
+// array of activated widgets
+var activatedWidgets = new Array();
+var numActivatedWidgets = 0;
+
+// variables for flexible layout
+// variables for flexible layout
+var totalWidth = 0,totalHeight = 0,iconNbHoriz = 0,iconNbVert = 0,iconsPerPage = 0;
+
+//previous size
+var previousWidth = 0,previousHeight = 0;
+
+// to differentiate between install icon and scan dir for icons
+var isThisAScan = null;
+
+// preferred icon type
+var preferredIconType = '.svg';
+
+// adapt layout to the size of the screen
+function adaptLayoutToSize() {
+    if (l_deb < log_level) {
+        alert("[UI] adaptLayoutToSize");
+    }
+    display_width = parseInt( gpac.getOption('General', 'LastWidth') );
+    display_height = parseInt( gpac.getOption('General', 'LastHeight') );
+    alert("display "+display_width+" "+display_height);
+    if (!gpac.fullscreen && display_width && display_height) {
+     gpac.set_size(display_width, display_height);
+    }
+    var tmpObject, tmpObj2;
+    // get size to adapt to
+    totalWidth = document.documentElement.viewport.width;
+    totalHeight = document.documentElement.viewport.height;
+    if (totalWidth == 0) {
+        totalWidth = 160;
+    }
+    if (totalHeight == 0) {
+        totalHeight = 280;
+    }
+    while (totalWidth < 160 || totalHeight < 280) {
+        totalWidth *= 4;
+        totalHeight *= 4;
+    }
+    // min size is 160 by 280
+    if (totalWidth < 160) {
+        totalWidth = 160;
+    }
+    if (totalHeight < 280) {
+        totalHeight = 280;
+    }
+    // round to lower multiple of 80
+    totalWidth -= totalWidth % 80;
+    var iconHeight = totalHeight - 120;
+    iconHeight -= iconHeight % 80;
+    // how many lines and columns of icons
+    iconNbHoriz = totalWidth / 80;
+    iconNbVert = iconHeight / 80;
+    totalHeight = iconHeight + 120;
+    // 120 is upper bar (60) + lower bar (60)
+    iconsPerPage = iconNbHoriz * iconNbVert;
+    // fix svg viewbox
+    document.getElementById("svg").setAttribute("viewBox", "0 0 " + totalWidth + " " + totalHeight);
+    // fix odd line
+    tmpObj2 = document.getElementById("odd");
+    var i, already = tmpObj2.getElementsByTagName("use").length;
+    //alert("odd line "+already+" "+iconNbHoriz);
+    for (i = already; i < iconNbHoriz; i++) {
+        tmpObject = document.createElement("use");
+        tmpObject.setAttribute("x", i * 80);
+        tmpObject.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#lightRect" : "#darkRect" ));
+        tmpObj2.appendChild(tmpObject);
+    }
+    // fix even line
+    tmpObj2 = document.getElementById("even");
+    already = tmpObj2.getElementsByTagName("use").length;
+    //alert("even line "+already+" "+iconNbHoriz);
+    for (i = already; i < iconNbHoriz; i++) {
+        tmpObject = document.createElement("use");
+        tmpObject.setAttribute("x", i * 80);
+        tmpObject.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#darkRect" : "#lightRect" ));
+        tmpObj2.appendChild(tmpObject);
+    }
+    // fix frame (black with rounded corners)
+    tmpObject = document.getElementById("frame");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight);
+    tmpObject = document.getElementById("frame2");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight);
+    // fix screen (white)
+    tmpObject = document.getElementById("screen");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight - 120);
+    // fix grid back (gray)
+    tmpObject = document.getElementById("gridback");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight - 120);
+    // fix icon background grid
+    tmpObject = document.getElementById("grid");
+    already = tmpObject.getElementsByTagName("use").length;
+    for (i = already; i < iconNbVert; i++) {
+        tmpObj2 = document.createElement("use");
+        tmpObj2.setAttribute("y", i * 80);
+        tmpObj2.setAttributeNS(xlinkns, "href", (((i % 2) == 0) ? "#odd" : "#even" ));
+        tmpObject.appendChild(tmpObj2);
+    }
+    // if there are already too many lines, remove the extra ones otherwise they are rendered on top of the lower
+    // part of the decoration
+    if (already > iconNbVert) {
+        while (already-- > iconNbVert) {
+            tmpObject.removeChild(tmpObject.lastChild);
+        }
+    }
+    // fix commands (lower bar)
+    document.getElementById("commands").setAttribute("transform", "translate(0, " + (totalHeight - 60) + ")");
+    document.getElementById("homeButton").setAttribute("transform", "translate(" + (totalWidth / 2) + ", 30)");
+    document.getElementById("right").setAttribute("transform", "translate(" + (totalWidth - 50) + ", 10)");
+    document.getElementById("rightW").setAttribute("transform", "translate(" + (totalWidth - 50) + ", 10)");
+    // fix the cuts (white rects left and right because we have no clipping)
+    tmpObject = document.getElementById("leftCut");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight);
+    tmpObject.setAttribute("x", -1 - totalWidth);
+    tmpObject = document.getElementById("rightCut");
+    tmpObject.setAttribute("width", totalWidth);
+    tmpObject.setAttribute("height", totalHeight);
+    tmpObject.setAttribute("x", 1 + totalWidth);
+    // respace executing widgets if any
+    tmpObject = widgetContainer.getElementsByTagName("g");
+    for (i = 0; i < tmpObject.length; i++) {
+        var gg = tmpObject.item(i);
+        gg.setAttribute("transform", "translate(" + (totalWidth * (i - 1)) + ", 0)");
+        if (gg.firstElementChild != null) {
+            gg.firstElementChild.setAttribute("width", totalWidth);
+            gg.firstElementChild.setAttribute("height", totalHeight - 120);
         }
     }
+}
 
-    //
-    // widget close on click at "Kill" button
-    //
-    function on_kill_widget() {
-        if (state == 'exec') {
-            widget_close(activatedWidgets[whereW]);
-        }
+//
+// widget close on click at "Kill" button
+//
+function on_kill_widget() {
+    if (state == 'exec') {
+        widget_close(activatedWidgets[whereW]);
     }
+}
 
-    //
-    // widget get on click at "GetW" button
-    //
-    function on_get_widget() {
-        alert("on_get_widget "+WidgetManager.MPEGUStandardServiceProviders.length);
-        if (WidgetManager.MPEGUStandardServiceProviders.length != 0) {
-            upnp_renders = selector_window1();
-            upnp_renders.on_select = function(item) {
-                upnp_renders.unregister(root);
-                upnp_renders = null;
-                if (item == -1) {
-                    return;
-                }
-                alert("upnp_renders.on_select(" + item + ")");
-                var device = WidgetManager.MPEGUStandardServiceProviders[item];
-                device.standardService.SetActionListener("listWidgets", get_widget_callback(device), true);
-                device.standardService.CallAction("listWidgets", new Array());
+//
+// widget get on click at "GetW" button
+//
+function on_get_widget() {
+    alert("on_get_widget " + WidgetManager.MPEGUStandardServiceProviders.length);
+    if (WidgetManager.MPEGUStandardServiceProviders.length != 0) {
+        upnp_renders = selector_window1();
+        upnp_renders.on_select = function(item) {
+            upnp_renders.unregister(root);
+            upnp_renders = null;
+            if (item == -1) {
+                return;
             }
-            upnp_renders.register(root);
+            alert("upnp_renders.on_select(" + item + ")");
+            var device = WidgetManager.MPEGUStandardServiceProviders[item];
+            device.standardService.SetActionListener("listWidgets", get_widget_callback(device), true);
+            device.standardService.CallAction("listWidgets", new Array());
         }
+        upnp_renders.register(root);
     }
+}
 
-    function get_widget_callback(device) {
-        return function() {
-            //alert("get_widget_callback");
-            // msgHandler is the first argument, the next arguments are from the reply to listWidgets
-            var act = arguments[0];
-            var act1 = act.GetArgumentValue("widgetCodes");
-            var act2 = act.GetArgumentValue("widgetNames");
-            //alert(act1+" "+act2);
-            target_widgets = selector_window2(act1.split(" "), act2.split(" "));
-            target_widgets.on_select = function(item) {
-                alert("target_widgets.on_select");
-                target_widgets.unregister(root);
-                target_widgets = null;
-                if (item == -1) {
-                    return;
-                }
-                alert("target_widgets.on_select(" + item + ")");
-                var args = new Array();
-                args[0] = "widgetCode";
-                args[1] = item;
-                device.standardService.CallAction("getWidget", args);
+function get_widget_callback(device) {
+    return function() {
+        //alert("get_widget_callback");
+        // msgHandler is the first argument, the next arguments are from the reply to listWidgets
+        var act = arguments[0];
+        var act1 = act.GetArgumentValue("widgetCodes");
+        var act2 = act.GetArgumentValue("widgetNames");
+        //alert(act1+" "+act2);
+        target_widgets = selector_window2(act1.split(" "), act2.split(" "));
+        target_widgets.on_select = function(item) {
+            alert("target_widgets.on_select");
+            target_widgets.unregister(root);
+            target_widgets = null;
+            if (item == -1) {
+                return;
             }
-            target_widgets.register(root);
+            alert("target_widgets.on_select(" + item + ")");
+            var args = new Array();
+            args[0] = "widgetCode";
+            args[1] = item;
+            device.standardService.SetActionListener("getWidget", get_widget_callback2, true);
+            device.standardService.CallAction("getWidget", args);
         }
+        target_widgets.register(root);
     }
+}
 
-    //
-    // creates the menu of available targets for pushing a widget elsewhere
-    //
-    function selector_window1() {
-        var i, count, render;
-        var selector = document.createElement('g'), obj, child;
-        selector.setAttribute('transform', 'translate(10,10)');
-        count = WidgetManager.MPEGUStandardServiceProviders.length;
-        selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black'));
-        for (i = 0; i < count; i++) {
-            render = WidgetManager.MPEGUStandardServiceProviders[i];
-            obj = createtext(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
-            obj.setAttribute('id', "select" + i);
-            selector.appendChild(obj);
-            obj.addEventListener('mouseover', sw1("select" + i), false);
-            obj.addEventListener('mouseout', sw2("select" + i), false);
-            obj.addEventListener('click', sw4(i), false);
-        }
-        obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
-        obj.setAttribute('id', "canc");
+function get_widget_callback2() {
+    // msgHandler is the first argument, the next arguments are from the reply to listWidgets
+    alert("callback2-1");
+    var act = arguments[0];
+    var act1 = act.GetArgumentValue("widgetUrl");
+    var act2 = act.GetArgumentValue("widgetContext");
+    alert("callback2-2 " + act1 + " " + act2);
+    var wid = WidgetManager.load(act1, null, act2);
+    WidgetManager.on_widget_add(wid);
+}
+
+//
+// creates the menu of available targets for pushing a widget elsewhere
+//
+function selector_window1() {
+    var i, count, render;
+    var selector = document.createElement('g'), obj, child;
+    selector.setAttribute('transform', 'translate(10,10)');
+    count = WidgetManager.MPEGUStandardServiceProviders.length;
+    selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black', null));
+    for (i = 0; i < count; i++) {
+        render = WidgetManager.MPEGUStandardServiceProviders[i];
+        obj = createtext(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
+        obj.setAttribute('id', "select" + i);
         selector.appendChild(obj);
-        obj.addEventListener('mouseover', function(evt) { document.getElementById("canc").setAttribute("fill", "red"); }, false);
-        obj.addEventListener('mouseout', function(evt) { document.getElementById("canc").setAttribute("fill", "black"); }, false);
-        obj.addEventListener('click', function(evt) { upnp_renders.on_select(-1); }, false);
-        selector.register = function(disp) {
-            disp.appendChild(this);
-        };
-        selector.unregister = function(disp) {
-            disp.removeChild(this);
-        };
-        return selector;
-    }
+        obj.addEventListener('mouseover', sw1("select" + i), false);
+        obj.addEventListener('mouseout', sw2("select" + i), false);
+        obj.addEventListener('click', sw4(i), false);
+    }
+    obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
+    obj.setAttribute('id', "canc");
+    selector.appendChild(obj);
+    obj.addEventListener('mouseover', function() { document.getElementById("canc").setAttribute("fill", "red"); }, false);
+    obj.addEventListener('mouseout', function() { document.getElementById("canc").setAttribute("fill", "black"); }, false);
+    obj.addEventListener('click', function() { upnp_renders.on_select(-1); }, false);
+    selector.register = function(disp) {
+        disp.appendChild(this);
+    };
+    selector.unregister = function(disp) {
+        disp.removeChild(this);
+    };
+    return selector;
+}
 
-    //
-    // creates the menu of available targets for pushing a widget elsewhere
-    //
-    function selector_window2(codes, names) {
-        alert("selector_window2");
-        var i, count, render;
-        var selector = document.createElement('g'), obj, child;
-        selector.setAttribute('transform', 'translate(10,10)');
-        count = codes.length;
-        selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black'));
-        for (i = 0; i < count; i++) {
-            render = names[i];
-            obj = createtext(render, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
-            obj.setAttribute('id', "selecto" + i);
-            selector.appendChild(obj);
-            obj.addEventListener('mouseover', sw1("selecto" + i), false);
-            obj.addEventListener('mouseout', sw2("selecto" + i), false);
-            obj.addEventListener('click', sw5(i), false);
-        }
-        obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
-        obj.setAttribute('id', "cance");
+//
+// creates the menu of available targets for pushing a widget elsewhere
+//
+function selector_window2(codes, names) {
+    alert("selector_window2");
+    var i, count, render;
+    var selector = document.createElement('g'), obj, child;
+    selector.setAttribute('transform', 'translate(10,10)');
+    count = codes.length;
+    selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black', null));
+    for (i = 0; i < count; i++) {
+        render = names[i];
+        obj = createtext(render, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
+        obj.setAttribute('id', "selecto" + i);
         selector.appendChild(obj);
-        obj.addEventListener('mouseover', function(evt) { document.getElementById("cance").setAttribute("fill", "red"); }, false);
-        obj.addEventListener('mouseout', function(evt) { document.getElementById("cance").setAttribute("fill", "black"); }, false);
-        obj.addEventListener('click', function(evt) { target_widgets.on_select(-1); }, false);
-        selector.register = function(disp) {
-            disp.appendChild(this);
-        };
-        selector.unregister = function(disp) {
-            disp.removeChild(this);
-        };
-        return selector;
-    }
+        obj.addEventListener('mouseover', sw1("selecto" + i), false);
+        obj.addEventListener('mouseout', sw2("selecto" + i), false);
+        obj.addEventListener('click', sw5(i), false);
+    }
+    obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
+    obj.setAttribute('id', "cance");
+    selector.appendChild(obj);
+    obj.addEventListener('mouseover', function() { document.getElementById("cance").setAttribute("fill", "red"); }, false);
+    obj.addEventListener('mouseout', function() { document.getElementById("cance").setAttribute("fill", "black"); }, false);
+    obj.addEventListener('click', function() { target_widgets.on_select(-1); }, false);
+    selector.register = function(disp) {
+        disp.appendChild(this);
+    };
+    selector.unregister = function(disp) {
+        disp.removeChild(this);
+    };
+    return selector;
+}
 
-    function sw4(si) {
-        return function(evt) { upnp_renders.on_select(si); };
-    }
+function sw4(si) {
+    return function() { upnp_renders.on_select(si); };
+}
 
-    function sw5(si) {
-        return function(evt) { target_widgets.on_select(si); };
-    }
+function sw5(si) {
+    return function() { target_widgets.on_select(si); };
+}
 
-    //
-    // when deleting an executing widgets, all executing widgets to its right are moved to the left
-    //
-    function recurseMoveAfterDelete(target) {
-        if (target != null && target.nextElementSibling != null) {
-            var v = target.nextElementSibling;
-            recurseMoveAfterDelete(v);
-            v.setAttribute("transform", target.getAttribute("transform"));
-        }
+//
+// when deleting an executing widgets, all executing widgets to its right are moved to the left
+//
+function recurseMoveAfterDelete(target) {
+    if (target != null && target.nextElementSibling != null) {
+        var v = target.nextElementSibling;
+        recurseMoveAfterDelete(v);
+        v.setAttribute("transform", target.getAttribute("transform"));
     }
+}
 
-    //
-    // click on home button to switch from icons to executing widgets
-    //
-    function home_button(evt) {
-        if (l_deb < log_level) {
-            alert("[UI] home_button");
-        }
-        if (state != 'home') {
-            state = 'home';
-            widgetContainer.setAttribute('display', 'none');
-            homepage.setAttribute('display', 'inline');
-            homebar.setAttribute('display', 'inline');
-            execbar.setAttribute('display', 'none');
-            arrows.setAttribute('display', 'inline');
-            arrowsW.setAttribute('display', 'none');
-            widgetAddList.setAttribute('display', 'none');
-        } else {
-            state = 'exec';
-            widgetContainer.setAttribute('display', 'inline');
-            homepage.setAttribute('display', 'none');
-            homebar.setAttribute('display', 'none');
-            execbar.setAttribute('display', 'inline');
-            arrows.setAttribute('display', 'none');
-            arrowsW.setAttribute('display', 'inline');
-            widgetAddList.setAttribute('display', 'none');
-        }
+//
+// click on home button to switch from icons to executing widgets
+//
+function home_button(evt) {
+    if (l_deb < log_level) {
+        alert("[UI] home_button");
     }
+    if (state != 'home') {
+        state = 'home';
+        widgetContainer.setAttribute('display', 'none');
+        homepage.setAttribute('display', 'inline');
+        homebar.setAttribute('display', 'inline');
+        execbar.setAttribute('display', 'none');
+        arrows.setAttribute('display', 'inline');
+        arrowsW.setAttribute('display', 'none');
+        widgetAddList.setAttribute('display', 'none');
+    } else {
+        state = 'exec';
+        widgetContainer.setAttribute('display', 'inline');
+        homepage.setAttribute('display', 'none');
+        homebar.setAttribute('display', 'none');
+        execbar.setAttribute('display', 'inline');
+        arrows.setAttribute('display', 'none');
+        arrowsW.setAttribute('display', 'inline');
+        widgetAddList.setAttribute('display', 'none');
+    }
+}
 
-    // constants
-    var adjustFrom = "0,0";
-    var animDue = true;
+// constants
+var adjustFrom = "0,0";
+var animDue = true;
+
+//
+// after each change of icon page, this function adjusts the visibility of arrows in the lower bar
+//
+function adjustwhere(animDue) {
+    if (l_deb < log_level) {
+        alert("[UI] adjust " + where + " 0 " + maxwhere);
+    }
+    document.getElementById("left").setAttribute("display", ((where > 0) ? "inline" : "none"));
+    document.getElementById("right").setAttribute("display", ((where < maxwhere) ? "inline" : "none"));
+    if (!animDue) {
+        icons.setAttribute("transform", 'translate(' + (-80 * iconNbHoriz * where) + ',0)');
+    } else {
+        var aw = document.createElement("animateTransform");
+        aw.setAttribute("attributeName", "transform");
+        aw.setAttribute("type", "translate");
+        //alert('time '+document.documentElement.getCurrentTime());
+        aw.setAttribute("begin", document.documentElement.getCurrentTime());
+        aw.setAttribute("dur", "1s");
+        aw.setAttribute("fill", "freeze");
+        aw.setAttributeNS(xlinkns, "href", "#icons");
+        aw.setAttribute("from", adjustFrom);
+        aw.setAttribute("to", (-80 * iconNbHoriz * where) + ",0");
+        document.documentElement.appendChild(aw);
+    }
+    adjustFrom = (-80 * iconNbHoriz * where) + ",0";
+}
 
-    //
-    // after each change of icon page, this function adjusts the visibility of arrows in the lower bar
-    //
-    function adjustwhere(animDue) {
-        if (l_deb < log_level) {
-            alert("[UI] adjust " + where + " 0 " + maxwhere);
-        }
-        document.getElementById("left").setAttribute("display", ((where > 0) ? "inline" : "none"));
-        document.getElementById("right").setAttribute("display", ((where < maxwhere) ? "inline" : "none"));
-        if (!animDue) {
-            icons.setAttribute("transform", 'translate(' + (-80 * iconNbHoriz * where) + ',0)');
-        } else {
-            var aw = document.createElement("animateTransform");
-            aw.setAttribute("attributeName", "transform");
-            aw.setAttribute("type", "translate");
-            //alert('time '+document.documentElement.getCurrentTime());
-            aw.setAttribute("begin", document.documentElement.getCurrentTime());
-            aw.setAttribute("dur", "1s");
-            aw.setAttribute("fill", "freeze");
-            aw.setAttributeNS(xlinkns, "href", "#icons");
-            aw.setAttribute("from", adjustFrom);
-            aw.setAttribute("to", (-80 * iconNbHoriz * where) + ",0");
-            document.documentElement.appendChild(aw);
-        }
-        adjustFrom = (-80 * iconNbHoriz * where) + ",0";
+//
+// action of the left button on the lower bar
+//
+function left_button() {
+    if (l_deb < log_level) {
+        alert("[UI] left button " + where + " 0");
     }
-
-    //
-    // action of the left button on the lower bar
-    //
-    function left_button() {
-        if (l_deb < log_level) {
-            alert("[UI] left button " + where + " 0");
-        }
-        if (where > 0) {
-            where--;
-            adjustwhere(true);
-        }
+    if (where > 0) {
+        where--;
+        adjustwhere(true);
     }
+}
 
-    //
-    // action of the right button of the lower bar
-    //
-    function right_button() {
-        if (l_deb < log_level) {
-            alert("[UI] right button " + where + " " + maxwhere);
-        }
-        if (where < maxwhere) {
-            where++;
-            adjustwhere(true);
-        }
+//
+// action of the right button of the lower bar
+//
+function right_button() {
+    if (l_deb < log_level) {
+        alert("[UI] right button " + where + " " + maxwhere);
     }
-
-    var adjustFromW = "0,0";
-    var oldwhereW = -1;
-
-    //
-    // after each change of icon page, this function adjusts the visibility of arrows in the lower bar
-    //
-    function adjustWhereWidgets(animDue) {
-        if (oldwhereW != whereW) {
-            // hide oldwhereW
-            if (oldwhereW >= 0 && activatedWidgets[oldwhereW] != null) {
-                WidgetManager.corein_message(activatedWidgets[oldwhereW], "hide");
-            }
-        }
-        if (l_deb < log_level) {
-            alert("[UI] adjustW " + whereW + " 0 " + (numActivatedWidgets - 1));
-        }
-        document.getElementById("leftW").setAttribute("display", ((whereW > 0) ? "inline" : "none"));
-        document.getElementById("rightW").setAttribute("display", ((whereW < (numActivatedWidgets - 1)) ? "inline" : "none"));
-        if (!animDue) {
-            widgetContainer.setAttribute("transform", "translate(" + (-totalWidth * whereW) + ",0)");
-        } else {
-            var aw = document.createElement("animateTransform");
-            aw.setAttribute("attributeName", "transform");
-            aw.setAttribute("type", "translate");
-            aw.setAttribute("begin", document.documentElement.getCurrentTime());
-            aw.setAttribute("dur", "1s");
-            aw.setAttribute("fill", "freeze");
-            aw.setAttributeNS(xlinkns, "href", "#widget");
-            aw.setAttribute("from", adjustFromW);
-            aw.setAttribute("to", (-totalWidth * whereW) + ",0");
-            document.documentElement.appendChild(aw);
-        }
-        adjustFromW = (-totalWidth * whereW) + ",0";
-        document.getElementById("widgetName").textContent =
-                (whereW >= 0 && activatedWidgets[whereW] != null ? activatedWidgets[whereW].shortName : '-');
-        if (oldwhereW != whereW) {
-            // show whereW
-            if (whereW >= 0 && activatedWidgets[whereW] != null) {
-                WidgetManager.corein_message(activatedWidgets[whereW], "show");
-            }
-            oldwhereW = whereW;
-        }
+    if (where < maxwhere) {
+        where++;
+        adjustwhere(true);
     }
+}
 
-    //
-    // action of the left button on the lower bar
-    //
-    function left_buttonW() {
-        if (l_deb < log_level) {
-            alert("[UI] left button " + whereW);
-        }
-        if (whereW > 0) {
-            whereW--;
-            adjustWhereWidgets(animDue);
-        }
+var adjustFromW = "0,0";
+var oldwhereW = -1;
+
+//
+// after each change of icon page, this function adjusts the visibility of arrows in the lower bar
+//
+function adjustWhereWidgets(animDue) {
+    if (oldwhereW != whereW) {
+        // hide oldwhereW
+        if (oldwhereW >= 0 && activatedWidgets[oldwhereW] != null) {
+            WidgetManager.corein_message(activatedWidgets[oldwhereW], "hide");
+        }
+    }
+    if (l_deb < log_level) {
+        alert("[UI] adjustW " + whereW + " 0 " + (numActivatedWidgets - 1));
+    }
+    document.getElementById("leftW").setAttribute("display", ((whereW > 0) ? "inline" : "none"));
+    document.getElementById("rightW").setAttribute("display", ((whereW < (numActivatedWidgets - 1)) ? "inline" : "none"));
+    if (!animDue) {
+        widgetContainer.setAttribute("transform", "translate(" + (-totalWidth * whereW) + ",0)");
+    } else {
+        var aw = document.createElement("animateTransform");
+        aw.setAttribute("attributeName", "transform");
+        aw.setAttribute("type", "translate");
+        aw.setAttribute("begin", document.documentElement.getCurrentTime());
+        aw.setAttribute("dur", "1s");
+        aw.setAttribute("fill", "freeze");
+        aw.setAttributeNS(xlinkns, "href", "#widget");
+        aw.setAttribute("from", adjustFromW);
+        aw.setAttribute("to", (-totalWidth * whereW) + ",0");
+        document.documentElement.appendChild(aw);
+    }
+    adjustFromW = (-totalWidth * whereW) + ",0";
+    document.getElementById("widgetName").textContent =
+            (whereW >= 0 && activatedWidgets[whereW] != null ? activatedWidgets[whereW].shortName : '-');
+    if (oldwhereW != whereW) {
+        // show whereW
+        if (whereW >= 0 && activatedWidgets[whereW] != null) {
+            WidgetManager.corein_message(activatedWidgets[whereW], "show");
+        }
+        oldwhereW = whereW;
     }
+}
 
-    //
-    // action of the right button of the lower bar
-    //
-    function right_buttonW() {
-        if (l_deb < log_level) {
-            alert("[UI] right button " + whereW + " " + (numActivatedWidgets - 1));
-        }
-        if (whereW < (numActivatedWidgets - 1)) {
-            whereW++;
-            adjustWhereWidgets(animDue);
-        }
+//
+// action of the left button on the lower bar
+//
+function left_buttonW() {
+    if (l_deb < log_level) {
+        alert("[UI] left button " + whereW);
     }
-
-    //
-    // action of each icon, starting the matching widget
-    //
-    function activating_widget(w) {
-        if (l_deb < log_level) {
-            alert("[UI] activating widget: " + w.name);
-        }
-        widget_add(w);
+    if (whereW > 0) {
+        whereW--;
+        adjustWhereWidgets(animDue);
     }
+}
 
-    //
-    // main initialization function
-    // init variables, then init the widget manager C code, then inits UPnP
-    //
-    function initialize() {
-        if (l_deb < log_level) {
-            alert("[UI] initialize");
-        }
-        init = false;
-        var display_width = parseInt(gpac.getOption('Widgets', 'LastWMWidth'));
-        var display_height = parseInt(gpac.getOption('Widgets', 'LastWMHeight'));
-        if (display_width && display_height) {
-            gpac.set_size(display_width, display_height);
-        }
-        root = document.documentElement;
-        homepage = document.getElementById('homepage');
-        homebar = document.getElementById('homebar');
-        execbar = document.getElementById('execbar');
-        arrows = document.getElementById('arrows');
-        arrowsW = document.getElementById('arrowsW');
-        icons = document.getElementById('icons');
-        widgetContainer = document.getElementById('widget');
-        widgetAddList = document.getElementById('widgetAddList');
-        /* Setup the GPAC Widget Manager - this will also scan the available widgets */
-        log_level = l_inf;
-        widget_manager_init();
-        WidgetManager.on_widget_remove = widget_remove;
-        WidgetManager.on_widget_add = widget_add;
-        /* register the callback to be notified of incoming widgets */
-        has_upnp = (typeof UPnP != 'undefined');
-        if (has_upnp) {
-            /* setting the callback to allow other devices to push their widgets */
-            UPnP.onMediaConnect = onMediaConnect;
-            /* Tell GPAC that the calls to the main Renderer (like open, ...) must be forwared to this scene */
-            UPnP.BindRenderer();
-        }
-        WidgetManager.coreOutShow = coreOutShowImplementation;
-        WidgetManager.coreOutGetAttention = coreOutGetAttentionImplementation;
-        WidgetManager.coreOutHide = coreOutHideImplementation;
-        WidgetManager.coreOutRequestDeactivate = coreOutRequestDeactivateImplementation;
-        WidgetManager.coreOutInstallWidget = coreOutInstallWidgetImplementation;
-        WidgetManager.coreOutActivateTemporaryWidget = coreOutActivateTemporaryWidgetImplementation;
-        WidgetManager.coreOutMigrateComponent = coreOutMigrateComponentImplementation;
-        WidgetManager.coreOutRequestMigrationTargets = coreOutRequestMigrationTargetsImplementation;
+//
+// action of the right button of the lower bar
+//
+function right_buttonW() {
+    if (l_deb < log_level) {
+        alert("[UI] right button " + whereW + " " + (numActivatedWidgets - 1));
     }
-
-    //
-    // implementation of core:out install widget
-    //
-    function coreOutInstallWidgetImplementation(wid, args) {
-        var w = widgetInstall(args[0], true, false, wid);
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.installWidgetMessage, ifce.get_message("installWidget"),
-                    wid, (w != null ? 1 : 0)); // send return code 1 = success
-        }
+    if (whereW < (numActivatedWidgets - 1)) {
+        whereW++;
+        adjustWhereWidgets(animDue);
     }
+}
 
-    //
-    // implementation of core:out activate temporary widget
-    //
-    function coreOutActivateTemporaryWidgetImplementation(wid, args) {
-        var w = widgetInstall(args[0], true, true, null);
-        if (w != null) {
-            activating_widget(w);
-        }
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.activateTemporaryWidgetMessage, ifce.get_message("activateTemporaryWidget"),
-                    wid, (w != null ? 1 : 0)); // send return code 1 = success
-        }
+//
+// action of each icon, starting the matching widget
+//
+function activating_widget(w) {
+    if (l_deb < log_level) {
+        alert("[UI] activating widget: " + w.name);
     }
+    widget_add(w);
+}
 
-    //
-    // implementation of core:out migrate component
-    //
-    function coreOutMigrateComponentImplementation(wid, args) {
-        //alert("coreOutMigrateComponent "+wid.name+" "+args.length);
-        var comp = wid.get_component(args[0], true);
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (comp == null) {
-            log(l_err, 'Component ' + args[0] + ' cannot be found in widget ' + wid.name);
-            if (ifce != null) {
-                wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 0);
-            }
-            return;
-        }
-        if (args.length > 1 && args[1] != null) {
-            //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(parseInt(args[1])), comp);
-            WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(parseInt(args[1])), comp);
-            widget_close(comp);
-        } else {
-            upnp_renders = selector_window(comp);
-            upnp_renders.on_select = function(item, wid) {
-                upnp_renders.unregister(root);
-                upnp_renders = null;
-                if (item == -1) {
-                    return;
-                }
-                if (comp != null) {
-                    alert("upnp_renders.on_select(" + item + "," + comp.name + ")");
-                    //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(item), comp);
-                    WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(item), comp);
-                    widget_close(comp);
-                }
-            };
-            upnp_renders.register(root);
-        }
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 1); // send return code 1 = success
-        }
-    }
+//
+// main initialization function
+// init variables, then init the widget manager C code, then inits UPnP
+//
+function initialize() {
+    if (l_deb < log_level) {
+        alert("[UI] initialize");
+    }
+    init = false;
+    var display_width = parseInt(gpac.getOption('Widgets', 'LastWMWidth'));
+    var display_height = parseInt(gpac.getOption('Widgets', 'LastWMHeight'));
+    if (display_width && display_height) {
+        gpac.set_size(display_width, display_height);
+    }
+    root = document.documentElement;
+    homepage = document.getElementById('homepage');
+    homebar = document.getElementById('homebar');
+    execbar = document.getElementById('execbar');
+    arrows = document.getElementById('arrows');
+    arrowsW = document.getElementById('arrowsW');
+    icons = document.getElementById('icons');
+    widgetContainer = document.getElementById('widget');
+    widgetAddList = document.getElementById('widgetAddList');
+    /* Setup the GPAC Widget Manager - this will also scan the available widgets */
+    log_level = l_inf;
+    widget_manager_init();
+    WidgetManager.on_widget_remove = widget_remove;
+    WidgetManager.on_widget_add = widget_add;
+    /* register the callback to be notified of incoming widgets */
+    has_upnp = (typeof UPnP != 'undefined');
+    if (has_upnp) {
+        /* setting the callback to allow other devices to push their widgets */
+        UPnP.onMediaConnect = onMediaConnect;
+        /* Tell GPAC that the calls to the main Renderer (like open, ...) must be forwared to this scene */
+        UPnP.BindRenderer();
+    }
+    WidgetManager.coreOutShow = coreOutShowImplementation;
+    WidgetManager.coreOutGetAttention = coreOutGetAttentionImplementation;
+    WidgetManager.coreOutHide = coreOutHideImplementation;
+    WidgetManager.coreOutRequestDeactivate = coreOutRequestDeactivateImplementation;
+    WidgetManager.coreOutInstallWidget = coreOutInstallWidgetImplementation;
+    WidgetManager.coreOutActivateTemporaryWidget = coreOutActivateTemporaryWidgetImplementation;
+    WidgetManager.coreOutMigrateComponent = coreOutMigrateComponentImplementation;
+    WidgetManager.coreOutRequestMigrationTargets = coreOutRequestMigrationTargetsImplementation;
+}
 
-    //
-    // implementation of core:out request migration targets
-    //
-    function coreOutRequestMigrationTargetsImplementation(wid, args) {
-        var count = UPnP.MediaRenderersCount, codes = new Array(), names = new Array(), descriptions = new Array(), i;
-        for (i = 0; i < count; i++) {
-            var render = UPnP.GetMediaRenderer(i);
-            codes.push("" + i);
-            names.push(render.Name);
-            descriptions.push(render.HostName + " " + render.UUID);
-        }
-        i = null;
-        var ifce_count = wid.num_interfaces, j;
-        for (j = 0; j < ifce_count; j++) {
-            var ifce = wid.get_interface(j);
-            if (ifce.type == "urn:mpeg:mpegu:schema:widgets:core:out:2010") {
-                i = ifce;
-                break;
-            }
-        }
-        if (i != null) {
-            wmjs_core_out_invoke_reply(coreOut.requestMigrationTargetsMessage, i.get_message("requestMigrationTargets"),
-                    wid, codes, names, descriptions);
-        }
+//
+// implementation of core:out install widget
+//
+function coreOutInstallWidgetImplementation(wid, args) {
+    var w = widgetInstall(args[0], true, false, wid);
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.installWidgetMessage, ifce.get_message("installWidget"),
+                wid, (w != null ? 1 : 0)); // send return code 1 = success
     }
+}
 
-    //
-    // implementation of core:out Show message
-    // this is a request by the widget to be shown
-    //
-    function coreOutShowImplementation(wid, args) {
-        //alert("core:out show "+wid.name);
-        var target = widgetContainer.firstElementChild;
-        var i;
-        for (i = 0; i < numActivatedWidgets; i++) {
-            //alert("is it "+activatedWidgets[i].name);
-            if (activatedWidgets[i] == wid) {
-                break;
-            }
-            target = target.nextElementSibling;
-        }
-        // here, i is the index of the current widget
-        //alert(" "+i+" "+numActivatedWidgets);
-        if (i < numActivatedWidgets) {
-            whereW = i;
-            adjustWhereWidgets(false);
-        }
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.showMessage, ifce.get_message("show"), wid, 1); // send return code 1 = success
-        }
+//
+// implementation of core:out activate temporary widget
+//
+function coreOutActivateTemporaryWidgetImplementation(wid, args) {
+    var w = widgetInstall(args[0], true, true, null);
+    if (w != null) {
+        activating_widget(w);
     }
-
-    //
-    // implementation of core:out GetAttention message
-    // this is a request by the widget to be shown and some special signal is given
-    //
-    function coreOutGetAttentionImplementation(wid, args) {
-        //alert("core:out getAttention "+wid.name);
-        var target = widgetContainer.firstElementChild;
-        var i;
-        for (i = 0; i < numActivatedWidgets; i++) {
-            //alert("is it "+activatedWidgets[i].name);
-            if (activatedWidgets[i] == wid) {
-                break;
-            }
-            target = target.nextElementSibling;
-        }
-        // here, i is the index of the current widget
-        //alert(" "+i+" "+numActivatedWidgets);
-        if (i < numActivatedWidgets) {
-            whereW = i;
-            adjustWhereWidgets(false);
-        }
-        document.getElementById("getAttention").beginElement();
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.getAttentionMessage, ifce.get_message("getAttention"), wid, 1); // send return code 1 = success
-        }
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.activateTemporaryWidgetMessage, ifce.get_message("activateTemporaryWidget"),
+                wid, (w != null ? 1 : 0)); // send return code 1 = success
     }
+}
 
-    //
-    // implementation of core:out hide message
-    // this is a request by the widget to be hidden (some other widget (if any) is shown)
-    //
-    function coreOutHideImplementation(wid, args) {
-        //alert("core:out hide "+wid.name);
-        var target = widgetContainer.firstElementChild;
-        var i;
-        for (i = 0; i < numActivatedWidgets; i++) {
-            //alert("is it "+activatedWidgets[i].name);
-            if (activatedWidgets[i] == wid) {
-                break;
-            }
-            target = target.nextElementSibling;
-        }
-        // here, i is the index of the current widget
-        //alert("hide "+i+" "+numActivatedWidgets);
-        if (i < numActivatedWidgets) {
-            if (whereW > 0) {
-                whereW--;
-            }
-            else if (whereW < numActivatedWidgets - 1) {
-                whereW++;
-            }
-            else {
-                return;
-            }
-            adjustWhereWidgets(false);
-        }
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+//
+// implementation of core:out migrate component
+//
+function coreOutMigrateComponentImplementation(wid, args) {
+    //alert("coreOutMigrateComponent "+wid.name+" "+args.length);
+    var comp = wid.get_component(args[0], true);
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (comp == null) {
+        log(l_err, 'Component ' + args[0] + ' cannot be found in widget ' + wid.name);
         if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.hideMessage, ifce.get_message("hide"), wid, 1); // send return code 1 = success
-        }
-    }
-
-    //
-    // implementation of core:out requestDeactivate message
-    // this is a request by the widget to be stopped
-    //
-    function coreOutRequestDeactivateImplementation(wid, args) {
-        //alert("core:out hide "+wid.name);
-        var target = widgetContainer.firstElementChild;
-        var i;
-        for (i = 0; i < numActivatedWidgets; i++) {
-            //alert("is it "+activatedWidgets[i].name);
-            if (activatedWidgets[i] == wid) {
-                break;
+            wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 0);
+        }
+        return;
+    }
+    if (args.length > 1 && args[1] != null) {
+        //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(parseInt(args[1])), comp);
+        WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(parseInt(args[1])), comp);
+        widget_close(comp);
+    } else {
+        upnp_renders = selector_window(comp);
+        upnp_renders.on_select = function(item, wid) {
+            upnp_renders.unregister(root);
+            upnp_renders = null;
+            if (item == -1) {
+                return;
             }
-            target = target.nextElementSibling;
-        }
-        // here, i is the index of the current widget
-        //alert("hide "+i+" "+numActivatedWidgets);
-        if (i < numActivatedWidgets) {
-            widget_close(activatedWidgets[i]);
-        }
-        var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
-        if (ifce != null) {
-            wmjs_core_out_invoke_reply(coreOut.requestDeactivateMessage, ifce.get_message("requestDeactivate"), wid, 1); // send return code 1 = success
-        }
-    }
-
-    //
-    // WM callback for when a component is activated by its parent
-    //
-    function widget_add(w) {
-        log(l_inf, "widget add " + w.name);
-        if (!w.activated) {
-            if (sameFileIgnoringSVGView(w.icon, w.main)) {
-                // same file in icon and main
-            } else {
-                widget_launch(w, document.createElement("animation"));
+            if (comp != null) {
+                alert("upnp_renders.on_select(" + item + "," + comp.name + ")");
+                //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(item), comp);
+                WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(item), comp);
+                widget_close(comp);
             }
-        } else if (w.multipleInstances) {
-            var newwid = WidgetManager.open(w.manifest, null);
-            widget_launch(newwid, document.createElement("animation"));
-        } else return false;
-        state = 'exec';
-        widgetContainer.setAttribute('display', 'inline');
-        homepage.setAttribute('display', 'none');
-        homebar.setAttribute('display', 'none');
-        execbar.setAttribute('display', 'inline');
-        arrows.setAttribute('display', 'none');
-        arrowsW.setAttribute('display', 'inline');
-        widgetAddList.setAttribute('display', 'none');
-        return true;
+        };
+        upnp_renders.register(root);
     }
-
-    function sameFileIgnoringSVGView(name1, name2) {
-        if (name1 == name2) {
-            return true;
-        }
-        if (name1 == null) {
-            return false;
-        }
-        var i1 = name1.indexOf("#");
-        var i2 = name2.indexOf("#");
-        if (i1 < 0) {
-            i1 = name1.length;
-        }
-        else {
-            i1--;
-        }
-        if (i2 < 0) {
-            i2 = name2.length;
-        }
-        else {
-            i2--;
-        }
-        return name1.substring(0, i1) == name2.substring(0, i2);
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.migrateComponentMessage, ifce.get_message("migrateComponent"), wid, 1); // send return code 1 = success
     }
+}
 
-    //
-    // recompute the number of widgets loaded currently
-    //
-    function getNbWidgets() {
-        var i, nbWidgets = 0;
-        for (i = 0; i < WidgetManager.num_widgets; i++) {
-            var w = WidgetManager.get(i);
-            if (w != null && w.loaded) {
-                nbWidgets++;
-            }
-        }
-        return nbWidgets;
+//
+// implementation of core:out request migration targets
+//
+function coreOutRequestMigrationTargetsImplementation(wid, args) {
+    var count = UPnP.MediaRenderersCount, codes = new Array(), names = new Array(), descriptions = new Array(), i;
+    for (i = 0; i < count; i++) {
+        var render = UPnP.GetMediaRenderer(i);
+        codes.push("" + i);
+        names.push(render.Name);
+        descriptions.push(render.HostName + " " + render.UUID);
+    }
+    i = null;
+    var ifce_count = wid.num_interfaces, j;
+    for (j = 0; j < ifce_count; j++) {
+        var ifce = wid.get_interface(j);
+        if (ifce.type == "urn:mpeg:mpegu:schema:widgets:core:out:2010") {
+            i = ifce;
+            break;
+        }
+    }
+    if (i != null) {
+        wmjs_core_out_invoke_reply(coreOut.requestMigrationTargetsMessage, i.get_message("requestMigrationTargets"),
+                wid, codes, names, descriptions);
     }
+}
 
-    //
-    // just resize the window and viewport, and initialize the first time this is called
-    //
-    function resize() {
-        if (init) {
-            initialize();
-        }
-        if (document.documentElement.viewport.width == previousWidth && document.documentElement.viewport.height == previousHeight) {
-            return;
-        }
-        if (l_deb < log_level) {
-            alert("[UI] start initialize() w:" + document.documentElement.viewport.width + " h:" + document.documentElement.viewport.height);
-        }
-        adaptLayoutToSize();
-        // start by filling the "home page" with known icons
-        where = 0;
-        var nbWidgets = getNbWidgets();
-        maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
-        var wid;
-        var iconIterator = document.getElementById("icons").firstElementChild;
-        var position = 0;
-        for (i = 1; i <= WidgetManager.num_widgets; i++) {
-            wid = WidgetManager.get(i - 1);
-            // alert("build:"+wid.main+" "+wid.loaded);
-            if (wid.loaded) {
-                insert_icon(wid, position, i - 1, iconIterator);
-                WidgetManager.corein_message(wid, 'setSize', 'width', totalWidth, 'height', totalHeight - 120, 'dpi', 96);
-                position++;
-                if (iconIterator != null) {
-                    iconIterator = iconIterator.nextElementSibling;
-                }
-            }
-        }
-        adjustwhere(false);
+//
+// implementation of core:out Show message
+// this is a request by the widget to be shown
+//
+function coreOutShowImplementation(wid, args) {
+    //alert("core:out show "+wid.name);
+    var target = widgetContainer.firstElementChild;
+    var i;
+    for (i = 0; i < numActivatedWidgets; i++) {
+        //alert("is it "+activatedWidgets[i].name);
+        if (activatedWidgets[i] == wid) {
+            break;
+        }
+        target = target.nextElementSibling;
+    }
+    // here, i is the index of the current widget
+    //alert(" "+i+" "+numActivatedWidgets);
+    if (i < numActivatedWidgets) {
+        whereW = i;
         adjustWhereWidgets(false);
-        previousWidth = document.documentElement.viewport.width;
-        previousHeight = document.documentElement.viewport.height;
-        gpac.setOption("Widgets", "LastWMWidth", '' + previousWidth);
-        gpac.setOption("Widgets", "LastWMHeight", '' + previousHeight);
-    }
-
-    //
-    // function inserting an icon on the home page
-    //
-    function insert_icon(widget, position, widgetIndex, previousIcon) {
-        if (l_deb < log_level) {
-            alert("[UI] insert_icon: " + widget.shortName + " " + position + " " + widgetIndex + " WMnw:" + WidgetManager.num_widgets);
-        }
-        widget.loaded = true;
-        if (l_deb < log_level) {
-            alert("[UI] widget name: " + widget.name);
-        }
-        var icon = null, original = null;
-        for (var i = 0; i < widget.icons.length; i++) {
-            // default to the first icon even if not of the preferred type
-            if (i == 0) {
-                icon = widget.icons[0].relocated_src;
-                //original = widget.icons[0].original;
-                // alert("choosing default icon " + icon);
-            }
-            // check for preferred type
-            if (widget.icons[i].relocated_src.indexOf(preferredIconType) > 0) {
-                icon = widget.icons[i].relocated_src;
-                //original = widget.icons[i].original;
-                break;
-            }
-        }
-        var shortName = widget.shortName;
-        if (typeof shortName == 'undefined') {
-            shortName = widget.name.substring(0, 9);
-        }
-        createIconSVGdecoration(previousIcon, widget, (((position % iconNbHoriz) * 80) + ((80 * (position - (position % iconsPerPage))) / iconNbVert)),
-                ((((position % iconsPerPage) - (position % iconNbHoriz)) / iconNbHoriz) * 80), "icons", icon,
-                shortName, widgetIndex);
     }
-
-    /*function restoreFragmentOnURL(iconUrl, original) {
-        var l = original.indexOf('#');
-        if (l >= 0) {
-            return iconUrl + original.substring(l);
-        }
-        return iconUrl;
-    }*/
-
-    // constant
-    // const corein = "urn:mpeg:mpegu:schema:widgets:core:in:2010";
-
-    //
-    // commodity method to empty a list of children
-    //
-    function removeAllChildren(o) {
-        if (o != null && o.hasChildNodes()) {
-            while (o.childNodes.length >= 1) {
-                o.removeChild(o.firstChild);
-            }
-        }
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.showMessage, ifce.get_message("show"), wid, 1); // send return code 1 = success
     }
+}
 
-    //
-    // create the home page icon with all its behaviours
-    //
-    function createIconSVGdecoration(previousIcon, widget, x, y, fatherId, iconUrl, name, widIndex) {
-        var g, g2;
-        if (l_inf < log_level) {
-            alert("[UI] createIconSVGdecoration " + iconUrl + " " + x + " " + y);
-        }
-        if (previousIcon != null) {
-            g = previousIcon;
-        } else {
-            g = document.createElement("g");
-            document.getElementById(fatherId).appendChild(g);
-        }
-        g.setAttribute("transform", 'translate(' + x + ',' + y + ')');
-        if (previousIcon != null) {
-            g2 = g.firstElementChild;
-        } else {
-            g2 = document.createElement("g");
-            g2.setAttribute("transform", 'translate(15,10)');
-            g.appendChild(g2);
-        }
-        if (iconUrl == null || iconUrl == "") {
-            iconUrl = "icons/face-surprise.svg";
-        }
-        //
-        // process differently cases where widget.icon == widget.main
-        //
-        var container;
-        if (sameFileIgnoringSVGView(iconUrl, widget.main) && widget.main.indexOf('.svg') >= 0) {
-            // see if the animation already exists
-            container = document.getElementById(name);
-            if (container == null) {
-                // if the animation does not exist yet, create it
-                container = media('animation', iconUrl, 50, 50);
-                // store the animation in the main defs
-                document.getElementById("mainDefs").appendChild(container);
-                container.setAttribute('id', name);
-            }
-            if (previousIcon == null) {
-                // put the container in a use
-                var use = document.createElement("use");
-                use.setAttribute('id', 'iconContainer' + name);
-                use.setAttributeNS(xlinkns, 'href', '#' + name);
-                g2.appendChild(use);
-            }
-        } else {
-            if (previousIcon == null) {
-                container = appropriateElementForMedia(iconUrl, 50, 50);
-                container.setAttribute('id', name);
-                g2.appendChild(container);
-            }
-        }
-        if (previousIcon == null) {
-            g2 = document.createElement("g");
-            g2.setAttribute("transform", 'translate(40,70)');
-            g.appendChild(g2);
-            var anim = createtext(name, 'white', 0, 0, 14, 'Arial Unicode MS');
-            anim.setAttribute("text-anchor", "middle");
-            anim.setAttribute("display-align", "center");
-            g2.appendChild(anim);
-            var rect = invisible_rect(80, 80);
-            g.appendChild(rect);
-            rect.addEventListener("click", csi(widget), false);
-        }
+//
+// implementation of core:out GetAttention message
+// this is a request by the widget to be shown and some special signal is given
+//
+function coreOutGetAttentionImplementation(wid, args) {
+    //alert("core:out getAttention "+wid.name);
+    var target = widgetContainer.firstElementChild;
+    var i;
+    for (i = 0; i < numActivatedWidgets; i++) {
+        //alert("is it "+activatedWidgets[i].name);
+        if (activatedWidgets[i] == wid) {
+            break;
+        }
+        target = target.nextElementSibling;
+    }
+    // here, i is the index of the current widget
+    //alert(" "+i+" "+numActivatedWidgets);
+    if (i < numActivatedWidgets) {
+        whereW = i;
+        adjustWhereWidgets(false);
     }
-
-    function csi(widget) {
-        return function(evt) { activating_widget(widget);};
+    document.getElementById("getAttention").beginElement();
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.getAttentionMessage, ifce.get_message("getAttention"), wid, 1); // send return code 1 = success
     }
+}
 
-    //
-    // widget closing action (WM callback)
-    //
-    function widget_close(wid) {
-        if (wid == null) {
-            return;
-        }
-        if (l_inf <= log_level) {
-            alert('[UI] widget_close:' + wid.name);
+//
+// implementation of core:out hide message
+// this is a request by the widget to be hidden (some other widget (if any) is shown)
+//
+function coreOutHideImplementation(wid, args) {
+    //alert("core:out hide "+wid.name);
+    var target = widgetContainer.firstElementChild;
+    var i;
+    for (i = 0; i < numActivatedWidgets; i++) {
+        //alert("is it "+activatedWidgets[i].name);
+        if (activatedWidgets[i] == wid) {
+            break;
+        }
+        target = target.nextElementSibling;
+    }
+    // here, i is the index of the current widget
+    //alert("hide "+i+" "+numActivatedWidgets);
+    if (i < numActivatedWidgets) {
+        if (whereW > 0) {
+            whereW--;
         }
-        // maybe inform the widget that it is going to be deactivated
-        WidgetManager.corein_message(wid, "deactivate");
-        var target = widgetContainer.firstElementChild;
-        var i;
-        for (i = 0; i < numActivatedWidgets; i++) {
-            if (activatedWidgets[i] == wid) {
-                break;
-            }
-            target = target.nextElementSibling;
+        else if (whereW < numActivatedWidgets - 1) {
+            whereW++;
         }
-        if (target != null) {
-            // move next widgets back one slot
-            recurseMoveAfterDelete(target);
-            // stop the subscene
-            if (target.firstElementChild != null) {
-                target.firstElementChild.setAttributeNS(xlinkns, "href", "");
-            }
-            // end trying
-            widgetContainer.removeChild(target);
+        else {
+            return;
         }
-        wid.deactivate();
-        wid.activated = false;
-        activatedWidgets.splice(i, 1);
-        numActivatedWidgets--;
-        whereW = (whereW >= i ? (whereW > 0 ? whereW - 1 : 0) : whereW);
         adjustWhereWidgets(false);
-        // if no more widgets, go back to the icons
-        if (numActivatedWidgets == 0) {
-            state = 'home';
-            widgetContainer.setAttribute('display', 'none');
-            homepage.setAttribute('display', 'inline');
-            homebar.setAttribute('display', 'inline');
-            execbar.setAttribute('display', 'none');
-            arrows.setAttribute('display', 'inline');
-            arrowsW.setAttribute('display', 'none');
-            widgetAddList.setAttribute('display', 'none');
-        }
-        if (!wid.permanent) {
-            WidgetManager.unload(wid, false);
-        }
     }
-
-    //
-    // widget unloading action (WM callback)
-    //
-    function widget_remove(wid) {
-        if (l_deb <= log_level) {
-            alert('[UI] widget_remove:' + wid.name);
-        }
-        widget_close(wid);
-        WidgetManager.unload(wid, false);
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.hideMessage, ifce.get_message("hide"), wid, 1); // send return code 1 = success
     }
+}
 
-    //
-    // widget launcher action
-    //
-    function widget_launch(wid, scene_container) {
-        if (l_inf <= log_level) {
-            alert('[UI] widget_launch:' + wid.name);
-        }
-        var tmp = document.createElement("g");
-        tmp.setAttribute("transform", "translate(" + (totalWidth * numActivatedWidgets) + ", 0)");
-        widgetContainer.appendChild(tmp);
-        var icon = null;
-        alert("wid: " + wid.name + "|" + wid.shortName);
-        if (typeof wid.shortName != 'undefined') {
-            var container = document.getElementById(wid.shortName);
-            if (container != null) {
-                icon = container.getAttributeNS(xlinkns, 'href');
-            }
-        }
-        if (icon != null &&
-                sameFileIgnoringSVGView(icon, wid.main) &&
-                endsWith(wid.main, '.svg')) {
-            // get the animation with id=shortName stored in mainDefs
-            scene_container = document.getElementById(wid.shortName);
-            // get the original use on it, used in the icon
-            var iconContainer = document.getElementById('iconContainer' + wid.shortName);
-            // create a new use
-            var use = document.createElement('use');
-            // point to the animation
-            use.setAttributeNS(xlinkns, 'href', '#' + wid.shortName);
-            // resize the animation
-            scene_container.setAttribute("width", totalWidth);
-            scene_container.setAttribute("height", totalHeight - 120);
-            // resize the original use //TODO fix the aspect ratio conservation
-            var m, t = Math.abs(totalHeight - 120 - totalWidth) / 2;
-            if (totalWidth > totalHeight - 120) {
-                m = 50 / (totalHeight - 120);
-                iconContainer.setAttribute('transform', 'scale(' + m + ',' + m + ') translate(' + (-t) + ',0)');
-            } else {
-                m = 50 / totalWidth;
-                iconContainer.setAttribute('transform', 'scale(' + m + ',' + m + ') translate(0,' + (-t) + ') ');
-            }
-            // add the new use as widget execution container
-            tmp.appendChild(use);
-            wid.activate(scene_container);
-        } else {
-            scene_container.setAttribute("width", totalWidth);
-            scene_container.setAttribute("height", totalHeight - 120);
-            tmp.appendChild(scene_container);
-            scene_container.setAttributeNS(xlinkns, 'href', wid.main);
-            wid.activate(scene_container);
-        }
-        wid.activated = true;
-        activatedWidgets.splice(numActivatedWidgets, 0, wid);
-        whereW = numActivatedWidgets;
-        numActivatedWidgets++;
-        adjustWhereWidgets(false);
-        wid.load_component = widget_load_component;
-        wid.permanent = true;
-        wid.on_load = function () {
-            WidgetManager.corein_message(this, 'setSize', 'width', totalWidth, 'height', totalHeight - 120, 'dpi', 96);
-        };
-        //
-        if (log_level > l_inf) {
-            var i = 0;
-            alert(">>>>>>>>>>>>> " + wid.name + " interfaces:");
-            for (; i < wid.num_interfaces; i++) {
-                alert("" + wid.get_interface(i).type);
-            }
-        }
-        //
+//
+// implementation of core:out requestDeactivate message
+// this is a request by the widget to be stopped
+//
+function coreOutRequestDeactivateImplementation(wid, args) {
+    //alert("core:out hide "+wid.name);
+    var target = widgetContainer.firstElementChild;
+    var i;
+    for (i = 0; i < numActivatedWidgets; i++) {
+        //alert("is it "+activatedWidgets[i].name);
+        if (activatedWidgets[i] == wid) {
+            break;
+        }
+        target = target.nextElementSibling;
+    }
+    // here, i is the index of the current widget
+    //alert("hide "+i+" "+numActivatedWidgets);
+    if (i < numActivatedWidgets) {
+        widget_close(activatedWidgets[i]);
+    }
+    var ifce = getInterfaceByType(wid, "urn:mpeg:mpegu:schema:widgets:core:out:2010");
+    if (ifce != null) {
+        wmjs_core_out_invoke_reply(coreOut.requestDeactivateMessage, ifce.get_message("requestDeactivate"), wid, 1); // send return code 1 = success
     }
+}
 
-    //
-    // widget load component (WM callback)
-    //
-    function widget_load_component(comp, is_unload) {
-        if (l_deb <= log_level) {
-            alert('[UI] widget_load_component:' + comp.name);
-        }
-        if (is_unload) {
-            widget_close(comp);
-            comp.parent = null;
+//
+// WM callback for when a component is activated by its parent
+//
+function widget_add(w) {
+    log(l_inf, "widget add " + w.name);
+    if (!w.activated) {
+        if (sameFileIgnoringSVGView(w.icon, w.main)) {
+            // same file in icon and main
         } else {
-            widget_add(comp);
-            comp.permanent = false;
-            comp.parent = this;
+            widget_launch(w, document.createElement("animation"));
         }
+    } else if (w.multipleInstances) {
+        var newwid = WidgetManager.open(w.manifest, null);
+        widget_launch(newwid, document.createElement("animation"));
+    } else {
+        return false;
     }
+    state = 'exec';
+    widgetContainer.setAttribute('display', 'inline');
+    homepage.setAttribute('display', 'none');
+    homebar.setAttribute('display', 'none');
+    execbar.setAttribute('display', 'inline');
+    arrows.setAttribute('display', 'none');
+    arrowsW.setAttribute('display', 'inline');
+    widgetAddList.setAttribute('display', 'none');
+    return true;
+}
 
-    var upnp_renders = null, target_widgets = null;
+function sameFileIgnoringSVGView(name1, name2) {
+    if (name1 == name2) {
+        return true;
+    }
+    if (name1 == null) {
+        return false;
+    }
+    var i1 = name1.indexOf("#");
+    var i2 = name2.indexOf("#");
+    if (i1 < 0) {
+        i1 = name1.length;
+    }
+    else {
+        i1--;
+    }
+    if (i2 < 0) {
+        i2 = name2.length;
+    }
+    else {
+        i2--;
+    }
+    return name1.substring(0, i1) == name2.substring(0, i2);
+}
 
-    //
-    // widget remoting function
-    //
-    function on_widget_remote() {
-        if (WidgetManager.MPEGUStandardServiceProviders.length != 0 && numActivatedWidgets > 0) {
-            upnp_renders = selector_window(activatedWidgets[whereW]);
-            upnp_renders.on_select = function(item, wid) {
-                upnp_renders.unregister(root);
-                upnp_renders = null;
-                if (item == -1) {
-                    return;
-                }
-                if (wid != null) {
-                    alert("upnp_renders.on_select(" + item + "," + wid.name + ")");
-                    //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(item), wid);
-                    WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(item), wid);
-                    widget_close(wid);
-                }
-            };
-            upnp_renders.register(root);
+//
+// recompute the number of widgets loaded currently
+//
+function getNbWidgets() {
+    var i, nbWidgets = 0;
+    for (i = 0; i < WidgetManager.num_widgets; i++) {
+        var w = WidgetManager.get(i);
+        if (w != null && w.loaded) {
+            nbWidgets++;
         }
     }
+    return nbWidgets;
+}
 
-    //
-    // creates the menu of available targets for pushing a widget elsewhere
-    //
-    function selector_window(widget) {
-        var i, count, render;
-        var selector = document.createElement('g'), obj, child;
-        selector.setAttribute('transform', 'translate(10,10)');
-        count = WidgetManager.MPEGUStandardServiceProviders.length;
-        selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black'));
-        for (i = 0; i < count; i++) {
-            render = WidgetManager.MPEGUStandardServiceProviders[i];
-            obj = createtext(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
-            obj.setAttribute('id', "selector" + i);
-            selector.appendChild(obj);
-            obj.addEventListener('mouseover', sw1("selector" + i), false);
-            obj.addEventListener('mouseout', sw2("selector" + i), false);
-            obj.addEventListener('click', sw3(i, widget), false);
+//
+// just resize the window and viewport, and initialize the first time this is called
+//
+function resize() {
+    if (init) {
+        initialize();
+    }
+    if (document.documentElement.viewport.width == previousWidth && document.documentElement.viewport.height == previousHeight) {
+        return;
+    }
+    if (l_deb < log_level) {
+        alert("[UI] start initialize() w:" + document.documentElement.viewport.width + " h:" + document.documentElement.viewport.height);
+    }
+    adaptLayoutToSize();
+    // start by filling the "home page" with known icons
+    where = 0;
+    var nbWidgets = getNbWidgets();
+    maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
+    var wid;
+    var iconIterator = document.getElementById("icons").firstElementChild;
+    var position = 0;
+    for (i = 1; i <= WidgetManager.num_widgets; i++) {
+        wid = WidgetManager.get(i - 1);
+        // alert("build:"+wid.main+" "+wid.loaded);
+        if (wid.loaded) {
+            insert_icon(wid, position, i - 1, iconIterator);
+            WidgetManager.corein_message(wid, 'setSize', 'width', totalWidth, 'height', totalHeight - 120, 'dpi', 96);
+            position++;
+            if (iconIterator != null) {
+                iconIterator = iconIterator.nextElementSibling;
+            }
         }
-        obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
-        obj.setAttribute('id', "cancel");
-        selector.appendChild(obj);
-        obj.addEventListener('mouseover', function(evt) { document.getElementById("cancel").setAttribute("fill", "red"); }, false);
-        obj.addEventListener('mouseout', function(evt) { document.getElementById("cancel").setAttribute("fill", "black"); }, false);
-        obj.addEventListener('click', function(evt) { upnp_renders.on_select(-1, null); }, false);
-        selector.register = function(disp) {
-            disp.appendChild(this);
-        };
-        selector.unregister = function(disp) {
-            disp.removeChild(this);
-        };
-        return selector;
     }
+    adjustwhere(false);
+    adjustWhereWidgets(false);
+    previousWidth = document.documentElement.viewport.width;
+    previousHeight = document.documentElement.viewport.height;
+    gpac.setOption("Widgets", "LastWMWidth", '' + previousWidth);
+    gpac.setOption("Widgets", "LastWMHeight", '' + previousHeight);
+}
 
-    function sw1(s) {
-        return function(evt) { document.getElementById(s).setAttribute("fill", "blue"); };
-    }
+//
+// function inserting an icon on the home page
+//
+function insert_icon(widget, position, widgetIndex, previousIcon) {
+    if (l_deb < log_level) {
+        alert("[UI] insert_icon: " + widget.shortName + " " + position + " " + widgetIndex + " WMnw:" + WidgetManager.num_widgets);
+    }
+    widget.loaded = true;
+    if (l_deb < log_level) {
+        alert("[UI] widget name: " + widget.name);
+    }
+    var icon = null, original = null;
+    for (var i = 0; i < widget.icons.length; i++) {
+        // default to the first icon even if not of the preferred type
+        if (i == 0) {
+            icon = widget.icons[0].relocated_src;
+            //original = widget.icons[0].original;
+            // alert("choosing default icon " + icon);
+        }
+        // check for preferred type
+        if (widget.icons[i].relocated_src.indexOf(preferredIconType) > 0) {
+            icon = widget.icons[i].relocated_src;
+            //original = widget.icons[i].original;
+            break;
+        }
+    }
+    var shortName = widget.shortName;
+    if (typeof shortName == 'undefined') {
+        shortName = widget.name.substring(0, 9);
+    }
+    createIconSVGdecoration(previousIcon, widget, (((position % iconNbHoriz) * 80) + ((80 * (position - (position % iconsPerPage))) / iconNbVert)),
+            ((((position % iconsPerPage) - (position % iconNbHoriz)) / iconNbHoriz) * 80), "icons", icon,
+            shortName, widgetIndex);
+}
 
-    function sw2(s) {
-        return function(evt) { document.getElementById(s).setAttribute("fill", "black"); };
-    }
+// constant
+// const corein = "urn:mpeg:mpegu:schema:widgets:core:in:2010";
 
-    function sw3(si, widget) {
-        return function(evt) { upnp_renders.on_select(si, widget); };
+//
+// commodity method to empty a list of children
+//
+function removeAllChildren(o) {
+    if (o != null && o.hasChildNodes()) {
+        while (o.childNodes.length >= 1) {
+            o.removeChild(o.firstChild);
+        }
     }
+}
 
-    //
-    // when a widget is pushed to here, install the widget and execute it
-    //
-    function onMediaConnect(url, src_ip) {
-        if (l_inf <= log_level) {
-            alert('[UI] onMediaConnect :\"' + url + '\"');
+//
+// create the home page icon with all its behaviours
+//
+function createIconSVGdecoration(previousIcon, widget, x, y, fatherId, iconUrl, name, widIndex) {
+    var g, g2;
+    if (l_inf < log_level) {
+        alert("[UI] createIconSVGdecoration " + iconUrl + " " + x + " " + y);
+    }
+    if (previousIcon != null) {
+        g = previousIcon;
+    } else {
+        g = document.createElement("g");
+        document.getElementById(fatherId).appendChild(g);
+    }
+    g.setAttribute("transform", 'translate(' + x + ',' + y + ')');
+    if (previousIcon != null) {
+        g2 = g.firstElementChild;
+    } else {
+        g2 = document.createElement("g");
+        g2.setAttribute("transform", 'translate(15,10)');
+        g.appendChild(g2);
+    }
+    if (iconUrl == null || iconUrl == "") {
+        iconUrl = "icons/face-surprise.svg";
+    }
+    //
+    // process differently cases where widget.icon == widget.main
+    //
+    var container;
+    if (sameFileIgnoringSVGView(iconUrl, widget.main) && widget.main.indexOf('.svg') >= 0) {
+        // see if the animation already exists
+        container = document.getElementById(name);
+        if (container == null) {
+            // if the animation does not exist yet, create it
+            container = media('animation', iconUrl, 50, 50);
+            // store the animation in the main defs
+            document.getElementById("mainDefs").appendChild(container);
+            container.setAttribute('id', name);
         }
-        if (WidgetManager.probe(url)) {
-            var w = WidgetManager.open(url, src_ip);
-            if (w == null) {
-                return;
-            }
-            widget_add(w);
-            adjustWhereWidgets(false);
-            w.permanent = false;
+        if (previousIcon == null) {
+            // put the container in a use
+            var use = document.createElement("use");
+            use.setAttribute('id', 'iconContainer' + name);
+            use.setAttributeNS(xlinkns, 'href', '#' + name);
+            g2.appendChild(use);
         }
+    } else {
+        if (previousIcon == null) {
+            container = appropriateElementForMedia(iconUrl, 50, 50);
+            container.setAttribute('id', name);
+            g2.appendChild(container);
+        }
+    }
+    if (previousIcon == null) {
+        g2 = document.createElement("g");
+        g2.setAttribute("transform", 'translate(40,70)');
+        g.appendChild(g2);
+        var anim = createtext(name, 'white', 0, 0, 14, 'Arial Unicode MS');
+        anim.setAttribute("text-anchor", "middle");
+        anim.setAttribute("display-align", "center");
+        g2.appendChild(anim);
+        var rect = invisible_rect(80, 80);
+        g.appendChild(rect);
+        rect.addEventListener("click", csi(widget), false);
     }
+}
 
-    //
-    // file list vars
-    //
-    var flstart = 0,fllist = null,maxFileNames = 14;
+function csi(widget) {
+    return function(evt) { activating_widget(widget);};
+}
 
-    //
-    // create a file menu in the main screen, allowing to navigate directories and choose widget config files
-    //
-    function on_widget_add_menu() {
-        state = 'list';
+//
+// widget closing action (WM callback)
+//
+function widget_close(wid) {
+    if (wid == null) {
+        return;
+    }
+    if (l_inf <= log_level) {
+        alert('[UI] widget_close:' + wid.name);
+    }
+    // maybe inform the widget that it is going to be deactivated
+    WidgetManager.corein_message(wid, "deactivate");
+    var target = widgetContainer.firstElementChild;
+    var i;
+    for (i = 0; i < numActivatedWidgets; i++) {
+        if (activatedWidgets[i] == wid) {
+            break;
+        }
+        target = target.nextElementSibling;
+    }
+    if (target != null) {
+        // move next widgets back one slot
+        recurseMoveAfterDelete(target);
+        // stop the subscene
+        if (target.firstElementChild != null) {
+            target.firstElementChild.setAttributeNS(xlinkns, "href", "");
+        }
+        // end trying
+        widgetContainer.removeChild(target);
+    }
+    wid.deactivate();
+    wid.activated = false;
+    activatedWidgets.splice(i, 1);
+    numActivatedWidgets--;
+    whereW = (whereW >= i ? (whereW > 0 ? whereW - 1 : 0) : whereW);
+    adjustWhereWidgets(false);
+    // if no more widgets, go back to the icons
+    if (numActivatedWidgets == 0) {
+        state = 'home';
         widgetContainer.setAttribute('display', 'none');
-        homepage.setAttribute('display', 'none');
-        homebar.setAttribute('display', 'none');
-        execbar.setAttribute('display', 'inline');
-        arrows.setAttribute('display', 'none');
+        homepage.setAttribute('display', 'inline');
+        homebar.setAttribute('display', 'inline');
+        execbar.setAttribute('display', 'none');
+        arrows.setAttribute('display', 'inline');
         arrowsW.setAttribute('display', 'none');
-        widgetAddList.setAttribute('display', 'inline');
-        maxFileNames = Math.round(((iconNbVert * 80) / 25) - 1.4);
-        isThisAScan = false;
-        refillWidgetAddList(false);
+        widgetAddList.setAttribute('display', 'none');
+    }
+    if (!wid.permanent) {
+        WidgetManager.unload(wid, false);
     }
+}
 
-    //
-    // create a file menu in the main screen, allowing to navigate directories and choose a directory to scan for widgets
-    // and load all their icons
-    //
-    function on_dir_scan() {
-        state = 'list';
-        widgetContainer.setAttribute('display', 'none');
-        homepage.setAttribute('display', 'none');
-        homebar.setAttribute('display', 'none');
-        execbar.setAttribute('display', 'inline');
-        arrows.setAttribute('display', 'none');
-        arrowsW.setAttribute('display', 'none');
-        widgetAddList.setAttribute('display', 'inline');
-        maxFileNames = Math.round(((iconNbVert * 80) / 25) - 1.4);
-        isThisAScan = true;
-        refillWidgetAddList(true);
+//
+// widget unloading action (WM callback)
+//
+function widget_remove(wid) {
+    if (l_deb <= log_level) {
+        alert('[UI] widget_remove:' + wid.name);
     }
+    widget_close(wid);
+    WidgetManager.unload(wid, false);
+}
 
+//
+// widget launcher action
+//
+function widget_launch(wid, scene_container) {
+    if (l_inf <= log_level) {
+        alert('[UI] widget_launch:' + wid.name);
+    }
+    var tmp = document.createElement("g");
+    tmp.setAttribute("transform", "translate(" + (totalWidth * numActivatedWidgets) + ", 0)");
+    widgetContainer.appendChild(tmp);
+    var icon = null;
+    alert("wid: " + wid.name + "|" + wid.shortName);
+    if (typeof wid.shortName != 'undefined') {
+        var container = document.getElementById(wid.shortName);
+        if (container != null) {
+            icon = container.getAttributeNS(xlinkns, 'href');
+        }
+    }
+    if (icon != null &&
+            sameFileIgnoringSVGView(icon, wid.main) &&
+            endsWith(wid.main, '.svg')) {
+        // get the animation with id=shortName stored in mainDefs
+        scene_container = document.getElementById(wid.shortName);
+        // get the original use on it, used in the icon
+        var iconContainer = document.getElementById('iconContainer' + wid.shortName);
+        // create a new use
+        var use = document.createElement('use');
+        // point to the animation
+        use.setAttributeNS(xlinkns, 'href', '#' + wid.shortName);
+        // resize the animation
+        scene_container.setAttribute("width", totalWidth);
+        scene_container.setAttribute("height", totalHeight - 120);
+        // resize the original use
+        //should do: fix the aspect ratio conservation
+        var m, t = Math.abs(totalHeight - 120 - totalWidth) / 2;
+        if (totalWidth > totalHeight - 120) {
+            m = 50 / (totalHeight - 120);
+            iconContainer.setAttribute('transform', 'scale(' + m + ',' + m + ') translate(' + (-t) + ',0)');
+        } else {
+            m = 50 / totalWidth;
+            iconContainer.setAttribute('transform', 'scale(' + m + ',' + m + ') translate(0,' + (-t) + ') ');
+        }
+        // add the new use as widget execution container
+        tmp.appendChild(use);
+        wid.activate(scene_container);
+    } else {
+        scene_container.setAttribute("width", totalWidth);
+        scene_container.setAttribute("height", totalHeight - 120);
+        tmp.appendChild(scene_container);
+        scene_container.setAttributeNS(xlinkns, 'href', wid.main);
+        wid.activate(scene_container);
+    }
+    wid.activated = true;
+    activatedWidgets.splice(numActivatedWidgets, 0, wid);
+    whereW = numActivatedWidgets;
+    numActivatedWidgets++;
+    adjustWhereWidgets(false);
+    wid.load_component = widget_load_component;
+    wid.permanent = true;
+    wid.on_load = function () {
+        WidgetManager.corein_message(this, 'setSize', 'width', totalWidth, 'height', totalHeight - 120, 'dpi', 96);
+    };
+    //
+    if (log_level > l_inf) {
+        var i = 0;
+        alert(">>>>>>>>>>>>> " + wid.name + " interfaces:");
+        for (; i < wid.num_interfaces; i++) {
+            alert("" + wid.get_interface(i).type);
+        }
+    }
     //
-    // remove all installed icons
-    //
-    function on_clean_up() {
-        var i;
-        //if (l_inf <= log_level) alert('[UI] unloading ' + WidgetManager.num_widgets + ' widgets');
-        for (i = WidgetManager.num_widgets - 1; i >= 0; i--) {
-            var w = WidgetManager.get(i);
-            if (w.loaded) {
-                alert("unloading " + w.name);
-                w.loaded = false;
-                WidgetManager.unload(w, false);
+}
+
+//
+// widget load component (WM callback)
+//
+function widget_load_component(comp, is_unload) {
+    if (l_deb <= log_level) {
+        alert('[UI] widget_load_component:' + comp.name);
+    }
+    if (is_unload) {
+        widget_close(comp);
+        comp.parent = null;
+    } else {
+        widget_add(comp);
+        comp.permanent = false;
+        comp.parent = this;
+    }
+}
+
+var upnp_renders = null, target_widgets = null;
+
+//
+// widget remoting function
+//
+function on_widget_remote() {
+    if (WidgetManager.MPEGUStandardServiceProviders.length != 0 && numActivatedWidgets > 0) {
+        upnp_renders = selector_window(activatedWidgets[whereW]);
+        upnp_renders.on_select = function(item, wid) {
+            upnp_renders.unregister(root);
+            upnp_renders = null;
+            if (item == -1) {
+                return;
+            }
+            if (wid != null) {
+                alert("upnp_renders.on_select(" + item + "," + wid.name + ")");
+                //WidgetManager.migrate_widget(UPnP.GetMediaRenderer(item), wid);
+                WidgetManager.migrate_widget(WidgetManager.get_mpegu_service_providers(item), wid);
+                widget_close(wid);
             }
+        };
+        upnp_renders.register(root);
+    }
+}
+
+//
+// creates the menu of available targets for pushing a widget elsewhere
+//
+function selector_window(widget) {
+    var i, count, render;
+    var selector = document.createElement('g'), obj, child;
+    selector.setAttribute('transform', 'translate(10,10)');
+    count = WidgetManager.MPEGUStandardServiceProviders.length;
+    selector.appendChild(rect(0, 0, 300, 20 * (count + 1), 'white', 'black'));
+    for (i = 0; i < count; i++) {
+        render = WidgetManager.MPEGUStandardServiceProviders[i];
+        obj = createtext(render.Name, 'black', 5, 17 + (20 * i), 15, 'sans-serif');
+        obj.setAttribute('id', "selector" + i);
+        selector.appendChild(obj);
+        obj.addEventListener('mouseover', sw1("selector" + i), false);
+        obj.addEventListener('mouseout', sw2("selector" + i), false);
+        obj.addEventListener('click', sw3(i, widget), false);
+    }
+    obj = createtext('Cancel', 'rgb(0,0,120)', 55, 17 + (20 * i), 15, 'sans-serif');
+    obj.setAttribute('id', "cancel");
+    selector.appendChild(obj);
+    obj.addEventListener('mouseover', function(evt) { document.getElementById("cancel").setAttribute("fill", "red"); }, false);
+    obj.addEventListener('mouseout', function(evt) { document.getElementById("cancel").setAttribute("fill", "black"); }, false);
+    obj.addEventListener('click', function(evt) { upnp_renders.on_select(-1, null); }, false);
+    selector.register = function(disp) {
+        disp.appendChild(this);
+    };
+    selector.unregister = function(disp) {
+        disp.removeChild(this);
+    };
+    return selector;
+}
+
+function sw1(s) {
+    return function(evt) { document.getElementById(s).setAttribute("fill", "blue"); };
+}
+
+function sw2(s) {
+    return function(evt) { document.getElementById(s).setAttribute("fill", "black"); };
+}
+
+function sw3(si, widget) {
+    return function(evt) { upnp_renders.on_select(si, widget); };
+}
+
+//
+// when a widget is pushed to here, install the widget and execute it
+//
+function onMediaConnect(url, src_ip) {
+    if (l_inf <= log_level) {
+        alert('[UI] onMediaConnect :\"' + url + '\"');
+    }
+    if (WidgetManager.probe(url)) {
+        var w = WidgetManager.open(url, src_ip);
+        if (w == null) {
+            return;
         }
-        where = 0;
-        maxwhere = 0;
-        removeAllChildren(document.getElementById("icons"));
-        adjustwhere(false);
+        widget_add(w);
+        adjustWhereWidgets(false);
+        w.permanent = false;
     }
+}
 
-    //
-    // install, but do not launch, the widget whose config.xml has been chosen, and return to the home page
-    //
-    function widgetInstall(uri, manual, temporary, parent_wid) {
-        var wid, j, count = WidgetManager.num_widgets, nbWidgets = getNbWidgets();
-        for (j = 0; j < count; j++) {
-            wid = WidgetManager.get(j);
-            if (wid.url == uri) {
-                if (wid.loaded) {
-                    break;
-                }
-                if (temporary) {
-                    wid.permanent = false;
-                }
-                else {
-                    insert_icon(wid, nbWidgets, nbWidgets);
-                }
+//
+// file list vars
+//
+var flstart = 0,fllist = null,maxFileNames = 14;
+
+//
+// create a file menu in the main screen, allowing to navigate directories and choose widget config files
+//
+function on_widget_add_menu() {
+    state = 'list';
+    widgetContainer.setAttribute('display', 'none');
+    homepage.setAttribute('display', 'none');
+    homebar.setAttribute('display', 'none');
+    execbar.setAttribute('display', 'inline');
+    arrows.setAttribute('display', 'none');
+    arrowsW.setAttribute('display', 'none');
+    widgetAddList.setAttribute('display', 'inline');
+    maxFileNames = Math.round(((iconNbVert * 80) / 25) - 1.4);
+    isThisAScan = false;
+    refillWidgetAddList(false);
+}
+
+//
+// create a file menu in the main screen, allowing to navigate directories and choose a directory to scan for widgets
+// and load all their icons
+//
+function on_dir_scan() {
+    state = 'list';
+    widgetContainer.setAttribute('display', 'none');
+    homepage.setAttribute('display', 'none');
+    homebar.setAttribute('display', 'none');
+    execbar.setAttribute('display', 'inline');
+    arrows.setAttribute('display', 'none');
+    arrowsW.setAttribute('display', 'none');
+    widgetAddList.setAttribute('display', 'inline');
+    maxFileNames = Math.round(((iconNbVert * 80) / 25) - 1.4);
+    isThisAScan = true;
+    refillWidgetAddList(true);
+}
+
+//
+// remove all installed icons
+//
+function on_clean_up() {
+    var i;
+    //if (l_inf <= log_level) alert('[UI] unloading ' + WidgetManager.num_widgets + ' widgets');
+    for (i = WidgetManager.num_widgets - 1; i >= 0; i--) {
+        var w = WidgetManager.get(i);
+        if (w.loaded) {
+            alert("unloading " + w.name);
+            w.loaded = false;
+            WidgetManager.unload(w, false);
+        }
+    }
+    where = 0;
+    maxwhere = 0;
+    removeAllChildren(document.getElementById("icons"));
+    adjustwhere(false);
+}
+
+//
+// install, but do not launch, the widget whose config.xml has been chosen, and return to the home page
+//
+function widgetInstall(uri, manual, temporary, parent_wid) {
+    var wid, j, count = WidgetManager.num_widgets, nbWidgets = getNbWidgets();
+    for (j = 0; j < count; j++) {
+        wid = WidgetManager.get(j);
+        if (wid.url == uri) {
+            if (wid.loaded) {
+                break;
             }
-        }
-        if (j == count) {
-            wid = WidgetManager.open(uri, null, parent_wid);
-            if (wid != null) {
-                if (temporary) {
-                    wid.permanent = false;
-                }
-                else {
-                    insert_icon(wid, nbWidgets, nbWidgets);
-                }
+            if (temporary) {
+                wid.permanent = false;
+            }
+            else {
+                insert_icon(wid, nbWidgets, nbWidgets);
             }
         }
-        if (manual) {
-            return wid;
+    }
+    if (j == count) {
+        wid = WidgetManager.open(uri, null, parent_wid);
+        if (wid != null) {
+            if (temporary) {
+                wid.permanent = false;
+            }
+            else {
+                insert_icon(wid, nbWidgets, nbWidgets);
+            }
         }
-        state = 'home';
-        widgetContainer.setAttribute('display', 'none');
-        homepage.setAttribute('display', 'inline');
-        homebar.setAttribute('display', 'inline');
-        execbar.setAttribute('display', 'none');
-        arrows.setAttribute('display', 'inline');
-        arrowsW.setAttribute('display', 'none');
-        removeAllChildren(widgetAddList);
-        maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
-        where = maxwhere;
-        adjustwhere(false);
+    }
+    if (manual) {
         return wid;
     }
+    state = 'home';
+    widgetContainer.setAttribute('display', 'none');
+    homepage.setAttribute('display', 'inline');
+    homebar.setAttribute('display', 'inline');
+    execbar.setAttribute('display', 'none');
+    arrows.setAttribute('display', 'inline');
+    arrowsW.setAttribute('display', 'none');
+    removeAllChildren(widgetAddList);
+    maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
+    where = maxwhere;
+    adjustwhere(false);
+    return wid;
+}
 
-    //
-    // clean up file list space and refill it
-    //
-    function refillWidgetAddList(flag) {
-        removeAllChildren(widgetAddList);
-        fllist = null;
-        flstart = 0;
-        fllist = gpac.enum_directory(gpac.last_working_directory, "", false);
-        fillWidgetAddList(flag);
-    }
+//
+// clean up file list space and refill it
+//
+function refillWidgetAddList(flag) {
+    removeAllChildren(widgetAddList);
+    fllist = null;
+    flstart = 0;
+    fllist = gpac.enum_directory(gpac.last_working_directory, "", false);
+    fillWidgetAddList(flag);
+}
 
-    //
-    // go to parent directory
-    //
-    function flUpDir(evt) {
-        var s = gpac.last_working_directory;
-        if (l_inf <= log_level) {
-            alert("[UI] lwd:" + gpac.last_working_directory);
-        }
-        var index = s.lastIndexOf("\\");
+//
+// go to parent directory
+//
+function flUpDir(evt) {
+    var s = gpac.last_working_directory;
+    if (l_inf <= log_level) {
+        alert("[UI] lwd:" + gpac.last_working_directory);
+    }
+    var index = s.lastIndexOf("\\");
+    if (index != -1) {
+        gpac.last_working_directory = s.substring(0, index);
+        refillWidgetAddList(isThisAScan);
+    } else {
+        index = s.lastIndexOf("/");
         if (index != -1) {
             gpac.last_working_directory = s.substring(0, index);
             refillWidgetAddList(isThisAScan);
         } else {
-            index = s.lastIndexOf("/");
-            if (index != -1) {
-                gpac.last_working_directory = s.substring(0, index);
-                refillWidgetAddList(isThisAScan);
-            } else {
-                gpac.last_working_directory = "/";
-                refillWidgetAddList(isThisAScan);
-            }
+            gpac.last_working_directory = "/";
+            refillWidgetAddList(isThisAScan);
         }
     }
+}
 
-    //
-    // go to a named directory
-    //
-    function flGoTo(newDir) {
-        //alert("goto "+newDir);
-        var s = gpac.last_working_directory;
-        if (s == "/") {
-            gpac.last_working_directory = newDir;
-        } else {
-            var c = s.charAt(s.length - 1);
-            if (c != '\\' && c != '/') {
-                s += "/";
-            }
-            gpac.last_working_directory = s + newDir;
-        }
-        //alert(gpac.last_working_directory);
-        refillWidgetAddList(isThisAScan);
-    }
+//
+// go to a named directory
+//
+function flGoTo(newDir) {
+    //alert("goto "+newDir);
+    var s = gpac.last_working_directory;
+    if (s == "/") {
+        gpac.last_working_directory = newDir;
+    } else {
+        var c = s.charAt(s.length - 1);
+        if (c != '\\' && c != '/') {
+            s += "/";
+        }
+        gpac.last_working_directory = s + newDir;
+    }
+    //alert(gpac.last_working_directory);
+    refillWidgetAddList(isThisAScan);
+}
 
-    //
-    // if the directory contains more files that can be shown, show previous page of file names
-    //
-    function flPrevFiles(evt) {
-        if (flstart == 0) {
-            return;
-        }
-        flstart -= maxFileNames;
-        if (flstart < 0) {
-            flstart = 0;
-        }
-        removeAllChildren(widgetAddList);
-        fillWidgetAddList(isThisAScan);
+//
+// if the directory contains more files that can be shown, show previous page of file names
+//
+function flPrevFiles(evt) {
+    if (flstart == 0) {
+        return;
     }
-
-    //
-    // if the directory contains more files that can be shown, show next page of file names
-    //
-    function flNextFiles(evt) {
-        if (flstart + maxFileNames < fllist.length) {
-            flstart += maxFileNames;
-            removeAllChildren(widgetAddList);
-            fillWidgetAddList(isThisAScan);
-        }
+    flstart -= maxFileNames;
+    if (flstart < 0) {
+        flstart = 0;
     }
+    removeAllChildren(widgetAddList);
+    fillWidgetAddList(isThisAScan);
+}
 
-    //
-    // scan the current directory recursively for widgets, clean up and return to home page
-    //
-    function flScanDir(evt) {
-        scan_directory(gpac.last_working_directory);
-        state = 'home';
-        var nbWidgets = getNbWidgets();
-        widgetContainer.setAttribute('display', 'none');
-        homepage.setAttribute('display', 'inline');
-        homebar.setAttribute('display', 'inline');
-        execbar.setAttribute('display', 'none');
-        arrows.setAttribute('display', 'inline');
-        arrowsW.setAttribute('display', 'none');
+//
+// if the directory contains more files that can be shown, show next page of file names
+//
+function flNextFiles(evt) {
+    if (flstart + maxFileNames < fllist.length) {
+        flstart += maxFileNames;
         removeAllChildren(widgetAddList);
-        maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
-        where = maxwhere;
-        adjustwhere(false);
+        fillWidgetAddList(isThisAScan);
     }
+}
 
-    //
-    // scanning
-    //
-    function scan_directory(dir) {
-        var ii, j, count, list, w, uri, loadedWidgets = 0;
-        list = gpac.enum_directory(dir, '.xml;.wgt', 0);
-        for (ii = 0; ii < list.length; ii++) {
-            uri = list[ii].path + list[ii].name;
-            if (list[ii].directory) {
-                scan_directory(uri);
-            } else {
-                count = WidgetManager.num_widgets;
-                for (j = 0; j < count; j++) {
-                    var wid = WidgetManager.get(j);
+//
+// scan the current directory recursively for widgets, clean up and return to home page
+//
+function flScanDir(evt) {
+    scan_directory(gpac.last_working_directory);
+    state = 'home';
+    var nbWidgets = getNbWidgets();
+    widgetContainer.setAttribute('display', 'none');
+    homepage.setAttribute('display', 'inline');
+    homebar.setAttribute('display', 'inline');
+    execbar.setAttribute('display', 'none');
+    arrows.setAttribute('display', 'inline');
+    arrowsW.setAttribute('display', 'none');
+    removeAllChildren(widgetAddList);
+    maxwhere = ((nbWidgets - 1) - ((nbWidgets - 1) % iconsPerPage)) / iconsPerPage;
+    where = maxwhere;
+    adjustwhere(false);
+}
+
+//
+// scanning
+//
+function scan_directory(dir) {
+    var ii, j, count, list, w, uri, loadedWidgets = 0;
+    list = gpac.enum_directory(dir, '.xml;.wgt', 0);
+    for (ii = 0; ii < list.length; ii++) {
+        uri = list[ii].path + list[ii].name;
+        if (list[ii].directory) {
+            scan_directory(uri);
+        } else {
+            count = WidgetManager.num_widgets;
+            for (j = 0; j < count; j++) {
+                var wid = WidgetManager.get(j);
+                if (wid.loaded) {
+                    loadedWidgets++;
+                }
+                if (wid.url == uri) {
                     if (wid.loaded) {
-                        loadedWidgets++;
-                    }
-                    if (wid.url == uri) {
-                        if (wid.loaded) {
-                            break;
-                        }
-                        insert_icon(wid, getNbWidgets(), j);
                         break;
                     }
+                    insert_icon(wid, getNbWidgets(), j);
+                    break;
                 }
-                if (j == count) {
-                    w = WidgetManager.open(uri, null);
-                    if (w != null) {
-                        insert_icon(w, loadedWidgets, WidgetManager.num_widgets - 1);
-                    }
+            }
+            if (j == count) {
+                w = WidgetManager.open(uri, null);
+                if (w != null) {
+                    insert_icon(w, loadedWidgets, WidgetManager.num_widgets - 1);
                 }
             }
         }
     }
+}
 
-    //
-    // create the up, prev, next button, show current directory and as many file names as possible
-    // the file names are active: clicking on a directory name goes to that directory
-    // clicking on a file tries to load that file as a widget
-    //
-    function fillWidgetAddList(flag) {
-        if (flag) {
-            widgetAddList.appendChild(use("cartoucheflag"));
-            document.getElementById("dirflag").textContent = gpac.last_working_directory;
-        } else {
-            widgetAddList.appendChild(use("cartouche"));
-            document.getElementById("dir").textContent = gpac.last_working_directory;
-        }
-        // next lines are file names
-        var obj;
-        for (i = 0; i < (fllist.length - flstart) && i < maxFileNames; i++) {
-            obj = use("fileMenuElement" + i);
-            obj.setAttribute('transform', 'translate(0,' + (25 * (i + 1)) + ')');
-            widgetAddList.appendChild(obj);
-            document.getElementById("fileMenuElement" + i + "u").setAttributeNS(xlinkns, 'href', "#" + (fllist[i + flstart].directory ? 'folder' : 'new'));
-            document.getElementById("fileMenuElement" + i + "t").textContent = fllist[i + flstart].name;
-            if (obj.listener != null) {
-                obj.removeEventListener("click", obj.listener);
-            }
-            if (fllist[i + flstart].directory) {
-                obj.listener = createGoto(escaping(fllist[i + flstart].name));
-                obj.addEventListener("click", obj.listener, false);
-            } else if (isWidgetFileName(fllist[i + flstart].name)) {
-                obj.listener = createWidgetInstall(escaping(gpac.last_working_directory + '/' + fllist[i + flstart].name));
-                obj.addEventListener("click", obj.listener, false);
-            }
+//
+// create the up, prev, next button, show current directory and as many file names as possible
+// the file names are active: clicking on a directory name goes to that directory
+// clicking on a file tries to load that file as a widget
+//
+function fillWidgetAddList(flag) {
+    if (flag) {
+        widgetAddList.appendChild(use("cartoucheflag"));
+        document.getElementById("dirflag").textContent = gpac.last_working_directory;
+    } else {
+        widgetAddList.appendChild(use("cartouche"));
+        document.getElementById("dir").textContent = gpac.last_working_directory;
+    }
+    // next lines are file names
+    var obj;
+    for (i = 0; i < (fllist.length - flstart) && i < maxFileNames; i++) {
+        obj = use("fileMenuElement" + i);
+        obj.setAttribute('transform', 'translate(0,' + (25 * (i + 1)) + ')');
+        widgetAddList.appendChild(obj);
+        document.getElementById("fileMenuElement" + i + "u").setAttributeNS(xlinkns, 'href', "#" + (fllist[i + flstart].directory ? 'folder' : 'new'));
+        document.getElementById("fileMenuElement" + i + "t").textContent = fllist[i + flstart].name;
+        if (obj.listener != null) {
+            obj.removeEventListener("click", obj.listener);
+        }
+        if (fllist[i + flstart].directory) {
+            obj.listener = createGoto(escaping(fllist[i + flstart].name));
+            obj.addEventListener("click", obj.listener, false);
+        } else if (isWidgetFileName(fllist[i + flstart].name)) {
+            obj.listener = createWidgetInstall(escaping(gpac.last_working_directory + '/' + fllist[i + flstart].name));
+            obj.addEventListener("click", obj.listener, false);
         }
     }
+}
 
-    function createGoto(s) {
-        return function () {
-            flGoTo(s);
-        };
-    }
+function createGoto(s) {
+    return function () {
+        flGoTo(s);
+    };
+}
 
-    function createWidgetInstall(s) {
-        return function () {
-            widgetInstall(s, false, false, null);
-        };
-    }
+function createWidgetInstall(s) {
+    return function () {
+        widgetInstall(s, false, false, null);
+    };
+}
 
-    // // // // // // // // // // // // // // //
-    // function library
-    // // // // // // // // // // // // // // //
+// // // // // // // // // // // // // // //
+// function library
+// // // // // // // // // // // // // // //
 
-    function isWidgetFileName(s) {
-        if (endsWith(s, 'config.xml')) {
-            return true;
-        }
-        if (endsWith(s, '.wgt')) {
-            return true;
-        }
-        return false;
+function isWidgetFileName(s) {
+    if (endsWith(s, 'config.xml')) {
+        return true;
     }
-
-    //
-    // replace globally \ with / in a string
-    //
-    function escaping(s) {
-        s = s.replace(/\\/g, '/');
-        return s;
+    if (endsWith(s, '.wgt')) {
+        return true;
     }
+    return false;
+}
 
-    //
-    // create rect
-    //
-    function rect(x, y, w, h, fill, stroke, id) {
-        var child = document.createElement('rect');
-        if (id != null) {
-            child.setAttribute('id', id);
-        }
-        child.setAttribute('x', x);
-        child.setAttribute('y', y);
-        child.setAttribute('width', w);
-        child.setAttribute('height', h);
-        child.setAttribute('fill', fill);
-        child.setAttribute('stroke', stroke);
-        return child;
-    }
+//
+// replace globally \ with / in a string
+//
+function escaping(s) {
+    s = s.replace(/\\/g, '/');
+    return s;
+}
 
-    //
-    // create text
-    //
-    function createtext(content, fill, x, y, size, family) {
-        var child = document.createElement('text');
-        child.setAttribute('fill', fill);
-        child.textContent = content;
-        child.setAttribute('x', x);
-        child.setAttribute('y', y);
-        child.setAttribute('font-size', size);
-        child.setAttribute('font-family', family);
-        return child;
-    }
+//
+// create rect
+//
+function rect(x, y, w, h, fill, stroke, id) {
+    var child = document.createElement('rect');
+    if (id != null) {
+        child.setAttribute('id', id);
+    }
+    child.setAttribute('x', x);
+    child.setAttribute('y', y);
+    child.setAttribute('width', w);
+    child.setAttribute('height', h);
+    child.setAttribute('fill', fill);
+    child.setAttribute('stroke', stroke);
+    return child;
+}
 
-    //
-    // create invisible rect getting all events
-    //
-    function invisible_rect(w, h) {
-        var child = document.createElement('rect');
-        child.setAttribute('width', w);
-        child.setAttribute('height', h);
-        child.setAttribute('fill', 'none');
-        child.setAttribute('stroke', 'none');
-        child.setAttribute('pointer-events', 'all');
-        return child;
-    }
+//
+// create text
+//
+function createtext(content, fill, x, y, size, family) {
+    var child = document.createElement('text');
+    child.setAttribute('fill', fill);
+    child.textContent = content;
+    child.setAttribute('x', x);
+    child.setAttribute('y', y);
+    child.setAttribute('font-size', size);
+    child.setAttribute('font-family', family);
+    return child;
+}
 
-    //
-    // create animation
-    //
-    function media(etype, uri, w, h) {
-        var child = document.createElement(etype);
-        child.setAttributeNS(xlinkns, 'href', uri);
-        child.setAttribute('width', w);
-        child.setAttribute('height', h);
-        if (etype == 'animation') {
-            child.setAttributeNS('http://gpac.sourceforge.net/svg-extensions', 'use-as-primary', 'false');
-        }
-        return child;
-    }
+//
+// create invisible rect getting all events
+//
+function invisible_rect(w, h) {
+    var child = document.createElement('rect');
+    child.setAttribute('width', w);
+    child.setAttribute('height', h);
+    child.setAttribute('fill', 'none');
+    child.setAttribute('stroke', 'none');
+    child.setAttribute('pointer-events', 'all');
+    return child;
+}
 
-    //
-    // create use
-    //
-    function use(uri) {
-        var child = document.createElement('use');
-        child.setAttributeNS(xlinkns, 'href', '#' + uri);
-        return child;
-    }
+//
+// create animation
+//
+function media(etype, uri, w, h) {
+    var child = document.createElement(etype);
+    child.setAttributeNS(xlinkns, 'href', uri);
+    child.setAttribute('width', w);
+    child.setAttribute('height', h);
+    if (etype == 'animation') {
+        child.setAttributeNS('http://gpac.sourceforge.net/svg-extensions', 'use-as-primary', 'false');
+    }
+    return child;
+}
 
-    //
-    // create appropriate element for media reference by the given uri
-    //
-    function appropriateElementForMedia(uri, w, h) {
-        if (uri.indexOf('#') != -1) {
-            return media('animation', uri, w, h);
-        }
-        if (endsWith(uri, '.svg')) {
-            return media('animation', uri, w, h);
-        }
-        if (endsWith(uri, '.bt')) {
-            return media('animation', uri, w, h);
-        }
-        if (endsWith(uri, '.png')) {
-            return media('image', uri, w, h);
-        }
-        if (endsWith(uri, '.jpg')) {
-            return media('image', uri, w, h);
-        }
-        if (endsWith(uri, '.gif')) {
-            return media('image', uri, w, h);
-        }
-        if (l_war <= log_level) {
-            alert("[UI] WARNING: bad suffix for an icon URI: " + uri);
-        }
+//
+// create use
+//
+function use(uri) {
+    var child = document.createElement('use');
+    child.setAttributeNS(xlinkns, 'href', '#' + uri);
+    return child;
+}
+
+//
+// create appropriate element for media reference by the given uri
+//
+function appropriateElementForMedia(uri, w, h) {
+    if (uri.indexOf('#') != -1) {
+        return media('animation', uri, w, h);
+    }
+    if (endsWith(uri, '.svg')) {
+        return media('animation', uri, w, h);
+    }
+    if (endsWith(uri, '.bt')) {
+        return media('animation', uri, w, h);
+    }
+    if (endsWith(uri, '.png')) {
+        return media('image', uri, w, h);
+    }
+    if (endsWith(uri, '.jpg')) {
+        return media('image', uri, w, h);
+    }
+    if (endsWith(uri, '.gif')) {
         return media('image', uri, w, h);
     }
+    if (l_war <= log_level) {
+        alert("[UI] WARNING: bad suffix for an icon URI: " + uri);
+    }
+    return media('image', uri, w, h);
+}
 
-    //
-    // substitute for the useful predefined function endsWith
-    //
-    function endsWith(s1, s2) {
-        return s1.toLowerCase().substring(s1.length - s2.length) == s2;
-    }
-
-    // export the resize function as the resize member of iphone_wm_gui, as well as other functions
-    return {
-        resize: resize,
-        left_button: left_button,
-        right_button: right_button,
-        left_buttonW: left_buttonW,
-        right_buttonW: right_buttonW,
-        home_button: home_button,
-        on_dir_scan: on_dir_scan,
-        on_clean_up: on_clean_up,
-        on_widget_add_menu: on_widget_add_menu,
-        on_kill_widget: on_kill_widget,
-        on_get_widget: on_get_widget,
-        on_widget_remote: on_widget_remote,
-        flUpDir: flUpDir,
-        flPrevFiles: flPrevFiles,
-        flNextFiles: flNextFiles,
-        flScanDir: flScanDir
-    }
-
-}());
+//
+// substitute for the useful predefined function endsWith
+//
+function endsWith(s1, s2) {
+    return s1.toLowerCase().substring(s1.length - s2.length) == s2;
+}
+
+/* wrapper as a module
+ // export the resize function as the resize member of iphone_wm_gui, as well as other functions
+ return {
+ resize: resize,
+ left_button: left_button,
+ right_button: right_button,
+ left_buttonW: left_buttonW,
+ right_buttonW: right_buttonW,
+ home_button: home_button,
+ on_dir_scan: on_dir_scan,
+ on_clean_up: on_clean_up,
+ on_widget_add_menu: on_widget_add_menu,
+ on_kill_widget: on_kill_widget,
+ on_get_widget: on_get_widget,
+ on_widget_remote: on_widget_remote,
+ flUpDir: flUpDir,
+ flPrevFiles: flPrevFiles,
+ flNextFiles: flNextFiles,
+ flScanDir: flScanDir,
+ get_widget_callback2: get_widget_callback2
+ }
+
+ }());*/
 
 function widget_activated_and_bound(wid) {
     WidgetManager.corein_message(wid, "activate");
 }
 
 function printAllFieldsOf(obj, printableName) {
-    var details = "fields of "+printableName+":\n";
+    var details = "fields of " + printableName + ":\n";
     for (var field in obj) {
-      fieldContents = obj[field];
-      if (typeof(fieldContents) == "function") {
-        fieldContents = "(function)";
-      }
-      details += "  " + field + ": " + fieldContents + "\n";
+        fieldContents = obj[field];
+        if (typeof(fieldContents) == "function") {
+            fieldContents = "(function)";
+        }
+        details += "  " + field + ": " + fieldContents + "\n";
     }
     alert(details);
 }
index 80df4a522ea81289027ab0ccf400cf99bf2abe12..63551daa044335507756dc1525077333add19c9f 100644 (file)
             <text fill="black" font-family="Comic Sans MS" font-size="12" x="2" y="12">Scan</text>
             <handler ev:event="click">on_dir_scan();</handler>
         </g>
+        <g id="get" transform="translate(130, 22)">
+            <rect rx="8" ry="8" fill="rgb(140,140,50)" width="36" height="16"/>
+            <text fill="black" font-family="Comic Sans MS" font-size="12" x="2" y="12">GetW</text>
+            <handler ev:event="click">on_get_widget();</handler>
+        </g>
     </g>
     <rect id="screen" width="320" height="480" fill="white" stroke="black" x="0" y="60"/>
 
index c1b6a6e0e8ef823d49cbd5bc635e2ea7da180d35..ef3cea0dbcdcb0756cfcd64d5ccf4f25dbf30335 100644 (file)
@@ -1335,6 +1335,7 @@ typedef struct
        void (*on_audio_reconfig)(void *udta, u32 samplerate, u32 bits_per_sample, u32 nb_channel, u32 channel_cfg);
 } GF_AudioListener;
 
+/*adds a new audio listener - the on_audio_reconfig callback will be called before this function returns*/
 GF_Err gf_sc_add_audio_listener(GF_Compositor *compositor, GF_AudioListener *al);
 GF_Err gf_sc_remove_audio_listener(GF_Compositor *compositor, GF_AudioListener *al);
 
index fa6e92e80e3f75a7eb4e9155d05af314749ad764..4050327e22412a3d00706736912c563cc96faf98 100644 (file)
@@ -2039,6 +2039,9 @@ GF_Err gf_isom_datamap_add_data(GF_DataMap *ptr, char *data, u32 dataSize);
 #define GF_ISOM_GET_FRAG_SYNC(flag) ( ! ( ( (flag) >> 16) & 0x1))
 #define GF_ISOM_GET_FRAG_DEG(flag)     (flag) & 0x7FFF
 
+#define GF_ISOM_GET_FRAG_DEPEND_FLAGS(lead, depends, depended, redundant) ( (lead<<26) | (depends<<24) | (depended<<22) | (redundant<<20) )
+#define GF_ISOM_RESET_FRAG_DEPEND_FLAGS(flags) flags = flags & 0xFFFFF
+
 GF_TrackExtendsBox *GetTrex(GF_MovieBox *moov, u32 TrackID);
 #endif
 
index 7c7c0a49f43ea7b87da289bfff043939f7d0c4bf..59dd39f279ccaf62fd83663b917b1932e839155b 100644 (file)
@@ -411,9 +411,13 @@ void gf_memory_print(void); /*prints the state of current allocations*/
 
 
 #ifndef GF_EXPORT
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define GF_EXPORT __attribute__((visibility("default")))
+#else
 /*use def files for windows or let compiler decide*/
 #define GF_EXPORT
 #endif
+#endif
 
 
 
index 11af4052dc8b01534d784f548a221380e49a376b..7f742234869c593146c8a261c297420262de46a3 100644 (file)
@@ -62,8 +62,8 @@ extern "C" {
  * SONAME versions must be digits (not strings)
  */
 #define GPAC_VERSION          "0.4.6-DEV"
-#define GPAC_VERSION_MAJOR    1
-#define GPAC_VERSION_MINOR    1
+#define GPAC_VERSION_MAJOR    2
+#define GPAC_VERSION_MINOR    0
 #define GPAC_VERSION_MICRO    0
 
 #include <gpac/version.h>
index dcd70a466f7fe71504656bdabeeae923f481e132..3a74968ef2b7d4ac1104bab3f89b80d7f37ad4f9 100644 (file)
@@ -928,6 +928,7 @@ void AAC_Delete(void *ifce)
        gf_free(plug);
 }
 
+#endif
 #endif
 
 #ifndef DONT_USE_TERMINAL_MODULE_API
@@ -982,4 +983,3 @@ void ShutdownInterface(GF_BaseInterface *ifce)
        }
 }
 #endif
-#endif
index b7ba4be6a0e0752500bdaaf10a3c428074ab29ff..2f5f809715bd782e5d4618e901c57cde94da5eea 100644 (file)
@@ -350,6 +350,7 @@ void DeleteALSAOutput(void *ifce)
  * ********************************************************************
  * interface
  */
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -359,6 +360,7 @@ const u32 *QueryInterfaces()
        return si; 
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) 
@@ -366,6 +368,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        if (ifce->InterfaceType==GF_AUDIO_OUTPUT_INTERFACE)
index 6c1a755f1f8f091685cd96997458689bc87069c6..15f1146d254af0124ae817ece85fef5be790adf3 100644 (file)
@@ -304,6 +304,7 @@ const u32 *QueryInterfaces()
 GF_InputService *NewAESReader();
 void DeleteAESReader(void *ifce);
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        switch (InterfaceType) {
@@ -313,6 +314,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        }
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 67a8dfd347aa3d0227cce355a2b9e2dcc0126825..682d2054ea3f8bd13b0a5edb2f654e19f50d5e33 100644 (file)
@@ -323,6 +323,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        switch (InterfaceType) {
@@ -332,6 +333,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        }
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index b68034ad7eb65ed5a6660cc5455ac446a764c924..b1830cc3e0ee278c40a17fb6f6844b7b271cc307 100644 (file)
@@ -260,6 +260,7 @@ void DeleteAudioFilter(void *ifce)
  * ********************************************************************
  * interface
  */
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -269,6 +270,7 @@ const u32 *QueryInterfaces()
        return si; 
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_AUDIO_FILTER_INTERFACE) 
@@ -276,6 +278,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        if (ifce->InterfaceType==GF_AUDIO_FILTER_INTERFACE)
index a194bdf38ef076c1419062b26ad6d2423a19dc71..174f9347e7383ed9c9369569cbbcdf292c867698 100755 (executable)
@@ -364,6 +364,7 @@ void DirectFBDeleteVideo(void *ifce)
 
 
 /*interface query*/
+GF_EXPORT
 const u32 *QueryInterfaces()
 {
        static u32 si [] = {
@@ -375,6 +376,7 @@ const u32 *QueryInterfaces()
 
 
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return DirectFBNewVideo();
@@ -383,6 +385,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
 
 
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index b0b6c4f79557eaa6e7b47dc6dc54b9c979fe27bc..1b9def076f2fd5b9995248c605a7f711d1b87c65 100644 (file)
@@ -427,6 +427,7 @@ void DeleteWAVRender(void *ifce)
        gf_free(dr);
 }
 //----------------------------------------------------------------------
+GF_EXPORT
 const u32 *QueryInterfaces()
 {
        static u32 si [] = {
@@ -436,12 +437,14 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) return NewWAVRender();
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index e0bf3661c42a2034625c678b85dc0e8f1fa95f50..b4d6797cab3996eebc9d904c39fc031e876678bb 100644 (file)
@@ -369,13 +369,17 @@ const u32 *QueryInterfaces()
        };
        return si; 
 }
+
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_INPUT_DEVICE_INTERFACE) return (GF_BaseInterface *) NewMPEGVSInputSesor();
        return NULL;
 }
+
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 09933c1972eec8a4ab15886e1a7be0e8611368d9..c177145789a2525b53177e8a8401c0c61f4b5558 100644 (file)
@@ -200,12 +200,14 @@ const u32 *QueryInterfaces()
        return si; 
 }
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewRawVideoOutput();
        return NULL;
 }
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index ac199e911789c2a5435926a6d3020fa27119fdc0..f63e9aba5ff1c713d051b6fed433d492aba26f8b 100644 (file)
@@ -648,12 +648,14 @@ const u32 *QueryInterfaces()
        return si;
 }
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewRawVideoOutput();
        return NULL;
 }
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 2ccce39dbd0369f1f53e48e1ecf386c01fe51e03..ee119d61d6a3e5e2a89d0301ae262bc3f22bb3c7 100644 (file)
@@ -721,6 +721,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return NewDXVideoOutput();
@@ -728,6 +729,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index eac6f0927a6593e6438e194f9d0f6591fc9f8cef..5e748a8723233fe7d31bc4de0ec44e91283b212a 100644 (file)
@@ -495,6 +495,7 @@ const u32 *QueryInterfaces()
        };
        return si;
 }
+
 /*interface create*/
 GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
@@ -504,6 +505,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        if (InterfaceType == GF_MEDIA_DECODER_INTERFACE) return (GF_BaseInterface *) EPOC_codec_new();
        return NULL;
 }
+
 /*interface destroy*/
 GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
index c561bd65b5ac7436114194478c7e0a19315dff35..bcff76633bff165851487e2cb2ff44ef84e12f1f 100644 (file)
@@ -2,7 +2,7 @@ include ../../config.mak
 
 vpath %.c $(SRC_PATH)/modules/ffmpeg_in
 
-CFLAGS=$(OPTFLAGS) -I"$(SRC_PATH)/include" $(ffmpeg_cflags)
+CFLAGS=$(OPTFLAGS) -Wno-deprecated-declarations -I"$(SRC_PATH)/include" $(ffmpeg_cflags)
 
 ifeq ($(DEBUGBUILD), yes)
 CFLAGS+=-g
index 9e801f950e420579186510f1a32d2b95ec548001..0f8ee5078c0a7a1d2ca258ed6403b8564d330524 100644 (file)
@@ -478,6 +478,7 @@ static void FFD_SetupObjects(FFDemux *ffd)
        }
 }
 
+#ifdef USE_PRE_0_7
 static int ff_url_read(void *h, unsigned char *buf, int size)
 {
        u32 retry = 10;
@@ -528,6 +529,7 @@ static int ff_url_read(void *h, unsigned char *buf, int size)
 #endif
        return full_size ? (int) full_size : -1;
 }
+#endif /*USE_PRE_0_7*/
 
 
 static GF_Err FFD_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
index 32e8d47f94297c9dd32a3e59c697d77f8a3126ce..37231fdcea548633fd588e9d4829cd889f98c26d 100644 (file)
@@ -1482,6 +1482,7 @@ extern "C" {
 
 
 /*interface query*/
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -1490,13 +1491,17 @@ const u32 *QueryInterfaces()
        };
        return si;
 }
+
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewGAPIVideoOutput();
        return NULL;
 }
+
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        GF_VideoOutput *dd = (GF_VideoOutput *)ifce;
index 66902cba6c37378b1a73db012504237c8c788ae1..343a74871f3d4cdf1da68ef5ac0e5a462990c9d5 100644 (file)
@@ -364,6 +364,7 @@ void gdip_delete_font_driver(GF_FontReader *dr)
 extern "C" {
 #endif
 
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -374,6 +375,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType==GF_FONT_READER_INTERFACE) return (GF_BaseInterface *)gdip_new_font_driver();
@@ -381,6 +383,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 10937c15a630737a4f6ae8edec9050a9eeb19c79..6f9074203fa226057491276ca2c3695f40e3d8e0 100644 (file)
@@ -762,7 +762,8 @@ static JSBool SMJS_FUNCTION(gpac_set_event_filter)
        SMJS_ARGS
        GF_GPACJSExt *gjs = (GF_GPACJSExt *)JS_GetPrivate(c, obj);
        if (!argc || !JSVAL_IS_OBJECT(argv[0])) return JS_FALSE;
-       if (JSVAL_IS_NULL(gjs->evt_fun) ) return JS_TRUE;
+
+       if (! JSVAL_IS_NULL(gjs->evt_fun) ) return JS_TRUE;
 
        gjs->evt_fun = argv[0];
        gjs->evt_filter_obj = obj;
@@ -893,8 +894,10 @@ static void gjs_load(GF_JSUserExtension *jsext, GF_SceneGraph *scene, JSContext
        /*nothing to do on unload*/
        if (unload) {
                gjs->nb_loaded--;
-               if (!gjs->nb_loaded && gjs->evt_filter.udta) {
+               /*if we destroy the script context holding the gpac event filter (only one for the time being), remove the filter*/
+               if ((gjs->c==c) && gjs->evt_filter.udta) {
                        gf_term_remove_event_filter(gjs->term, &gjs->evt_filter);
+                       gjs->evt_filter.udta = NULL;
                }
                return;
        }
@@ -957,6 +960,8 @@ static void gjs_load(GF_JSUserExtension *jsext, GF_SceneGraph *scene, JSContext
                
                JS_SETUP_CLASS(gjs->anyClass, "GPACOBJECT", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub);
                JS_InitClass(c, global, 0, &gjs->anyClass, 0, 0, 0, 0, 0, 0);
+
+               gjs->evt_fun = JSVAL_NULL;
                }
 }
 
index 05ae8fe2bb137fe70f253316a66d49eb0ed30338..0037f679d92c1ce0e17c3442035f82b83b4fb6b4 100644 (file)
@@ -2,7 +2,7 @@ include ../../config.mak
 
 vpath %.c $(SRC_PATH)/modules/jack
 
-CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(OSS_CFLAGS)
+CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" $(OSS_CFLAGS) -Wno-deprecated-declarations
 
 ifeq ($(DEBUGBUILD), yes)
 CFLAGS+=-g
index 0d92b7b1ad8c1b7dadf29eed7300c84f7bad6214..3eb5891dcd5f9efb6a539d24c944cc81c7eb6907 100644 (file)
@@ -545,6 +545,7 @@ DeleteJackOutput (void *ifce)
  * interface
  */
 
+GF_EXPORT
 const u32 *QueryInterfaces()
 {
        static u32 si [] = {
@@ -554,8 +555,8 @@ const u32 *QueryInterfaces()
        return si;
 }
 
-GF_BaseInterface *
-LoadInterface (u32 InterfaceType)
+GF_EXPORT
+GF_BaseInterface *LoadInterface (u32 InterfaceType)
 {
   if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
     {
@@ -564,8 +565,8 @@ LoadInterface (u32 InterfaceType)
   return NULL;
 }
 
-void
-ShutdownInterface (GF_BaseInterface * ifce)
+GF_EXPORT
+void ShutdownInterface (GF_BaseInterface * ifce)
 {
   if (ifce->InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
     DeleteJackOutput ((GF_AudioOutput *) ifce);
index bb512c6214be45164d1ca9e2a0fbe398e6ebf155..b8b777746910dc23125d4da7dd6696176bee35af 100644 (file)
@@ -1195,6 +1195,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        switch (InterfaceType) {
@@ -1205,6 +1206,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        }
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index fa7783a0b91c100186d68d37011c3ff308047495..c32c916e27534c85ca19b31199f90f3ec667f565 100644 (file)
@@ -107,6 +107,7 @@ void DeleteOGGDecoder(GF_BaseDecoder *ifcd)
 }
 
 
+GF_EXPORT
 const u32 *QueryInterfaces()
 {
        static u32 si [] = {
@@ -119,6 +120,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
 #if !defined(GPAC_DISABLE_AV_PARSERS) && !defined(GPAC_DISABLE_OGG)
@@ -128,6 +130,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 02a12e75482aebb97262283e934740cfd398a2c2..041bb06362e88c7f2383b10816665955c5c747b6 100644 (file)
@@ -81,10 +81,12 @@ static GF_Err OSVC_AttachStream(GF_BaseDecoder *ifcg, GF_ESD *esd)
                count = gf_list_count(cfg->sequenceParameterSets);
         SetCommandLayer(Layer, 255, 0, &i, 0);//bufindex can be reset without pb
                for (i=0; i<count; i++) {
-                       u32 w, h, par_n, par_d;
+                       u32 w=0, h=0, par_n=0, par_d=0;
                        GF_AVCConfigSlot *slc = gf_list_get(cfg->sequenceParameterSets, i);
 
+#ifndef GPAC_DISABLE_AV_PARSERS
                        gf_avc_get_sps_info(slc->data, slc->size, &slc->id, &w, &h, &par_n, &par_d);
+#endif
                        /*by default use the base layer*/
                        if (!i) {
                                if ((ctx->width<w) || (ctx->height<h)) {
@@ -340,6 +342,7 @@ void DeleteOSVCDec(GF_BaseDecoder *ifcg)
        gf_free(ifcg);
 }
 
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -351,6 +354,7 @@ const u32 *QueryInterfaces()
        return si; 
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType) 
 {
 #ifndef GPAC_DISABLE_AV_PARSERS
@@ -359,6 +363,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index f1f338f4e29c82d19ca327acab3bc858118af6ec..ff6a5b6ff1af38b5e9253662a353239ca7aeceb6 100644 (file)
@@ -257,6 +257,7 @@ void DeleteOSSRender(void *ifce)
  * ********************************************************************
  * interface
  */
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -266,6 +267,7 @@ const u32 *QueryInterfaces()
        return si;
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) 
@@ -273,6 +275,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        if (ifce->InterfaceType==GF_AUDIO_OUTPUT_INTERFACE)
index 21caa1cef639025af0e1abbd5838587b9deadcc0..6feb58e884f77530d18c6ca040fc2af7ba955863 100644 (file)
@@ -120,14 +120,18 @@ GPAC_MediaRenderer::SetupServices(PLT_DeviceData& data)
         m_pAVService->SetStateVariable("AbsoluteCounterPosition", "2147483647"); // means NOT_IMPLEMENTED
 
         // disable indirect eventing for certain state variables
-        PLT_StateVariable* var;
-        var = m_pAVService->FindStateVariable("RelativeTimePosition");
+        //PLT_StateVariable* var;
+        //var = 
+                       m_pAVService->FindStateVariable("RelativeTimePosition");
         //if (var) var->DisableIndirectEventing();
-        var = m_pAVService->FindStateVariable("AbsoluteTimePosition");
+        //var = 
+                       m_pAVService->FindStateVariable("AbsoluteTimePosition");
         //if (var) var->DisableIndirectEventing();
-        var = m_pAVService->FindStateVariable("RelativeCounterPosition");
+        //var = 
+                       m_pAVService->FindStateVariable("RelativeCounterPosition");
         //if (var) var->DisableIndirectEventing();
-        var = m_pAVService->FindStateVariable("AbsoluteCounterPosition");
+        //var = 
+                       m_pAVService->FindStateVariable("AbsoluteCounterPosition");
         //if (var) var->DisableIndirectEventing();
 
         // GetTransportInfo
index e1286a21b48eaa1def0701810c83081e7d361d15..667d00e4e983919d33899fdd54fed7f3cf595085 100644 (file)
@@ -262,7 +262,6 @@ Bool GF_UPnP::ProcessEvent(GF_Event *evt)
        case GF_EVENT_METADATA:
                if (m_pTerm->root_scene) {
                        char szName[1024];
-                       const char *artist;
                        NetInfoCommand com;
                        memset(&com, 0, sizeof(NetInfoCommand));
 
@@ -272,12 +271,12 @@ Bool GF_UPnP::ProcessEvent(GF_Event *evt)
                                if (com.name) { strcat(szName, com.name); strcat(szName, " "); }
                                if (com.album) { strcat(szName, "("); strcat(szName, com.album); strcat(szName, ")"); }
 
-                               artist = "Unknown";
+                               /*const char *artist = "Unknown";
                                if (com.artist) artist = com.artist;
                                else if (com.writer) artist = com.writer;
                                else if (com.composer) artist = com.composer;
 
-                               //MRSetMediaInfo(0, szName, com.artist ? com.artist : "Unknown");
+                               MRSetMediaInfo(0, szName, com.artist ? com.artist : "Unknown");*/
                        }
                }
                break;
index 517a12e703c839b76d6ad5b2da4a29bd0a8d62f4..073fcc47b6147a39ef441918047042d45050b06d 100644 (file)
@@ -320,6 +320,7 @@ DeletePulseAudioOutput (void *ifce)
  * ********************************************************************
  * interface
  */
+GF_EXPORT
 const u32 *QueryInterfaces(u32 InterfaceType)
 {
     static u32 si [] = {
@@ -329,16 +330,16 @@ const u32 *QueryInterfaces(u32 InterfaceType)
     return si;
 }
 
-GF_BaseInterface *
-LoadInterface (u32 InterfaceType)
+GF_EXPORT
+GF_BaseInterface *LoadInterface (u32 InterfaceType)
 {
     if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
         return NewPulseAudioOutput ();
     return NULL;
 }
 
-void
-ShutdownInterface (GF_BaseInterface * ifce)
+GF_EXPORT
+void ShutdownInterface (GF_BaseInterface * ifce)
 {
     if (ifce->InterfaceType == GF_AUDIO_OUTPUT_INTERFACE)
         DeletePulseAudioOutput ((GF_AudioOutput *) ifce);
index 1f274367deb60b8b6d7436804a966e2d61a39f2b..ad73a88da58b446fb338f43e87eb8181a93a4ba2 100644 (file)
@@ -152,13 +152,17 @@ const u32 *QueryInterfaces()
        };
        return si; 
 }
+
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return (GF_BaseInterface *) NewRawVideoOutput();
        return NULL;
 }
+
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 3649c02dee992e0e195e685a7926381cca85466b..a4ec5c83941bbc5f81279af3f6d5c5a7c0e6c47a 100644 (file)
@@ -416,6 +416,7 @@ void DeleteRVCDec(GF_BaseDecoder *ifcg)
        gf_free(ifcg);\r
 }\r
 \r
+GF_EXPORT\r
 const u32 *QueryInterfaces() \r
 {\r
        static u32 si [] = {\r
@@ -427,6 +428,7 @@ const u32 *QueryInterfaces()
        return si; \r
 }\r
 \r
+GF_EXPORT\r
 GF_BaseInterface *LoadInterface(u32 InterfaceType) \r
 {\r
 #ifndef GPAC_DISABLE_AV_PARSERS\r
@@ -435,6 +437,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;\r
 }\r
 \r
+GF_EXPORT\r
 void ShutdownInterface(GF_BaseInterface *ifce)\r
 {\r
        switch (ifce->InterfaceType) {\r
index 56fb7bb26a4899f83da41d5e8f30205f28556ed9..1be2a125d2d6b6dd0d28733c2398c0fcd9745c87 100644 (file)
@@ -50,6 +50,7 @@ void SDLOUT_CloseSDL()
 
 
 /*interface query*/
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -59,14 +60,18 @@ const u32 *QueryInterfaces()
        };
        return si; 
 }
+
 /*interface create*/
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE) return SDL_NewVideo();
        if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) return SDL_NewAudio();
        return NULL;
 }
+
 /*interface destroy*/
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index 321fef5e21e3e4aa6ba7d2a974c7b1fda3cbbc18..3e243f1237815a07e231ed7d368a3f8de0693bc0 100644 (file)
@@ -464,6 +464,7 @@ void DeleteWAVRender(void *ifce)
        gf_free(dr);
 }
 
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -473,12 +474,14 @@ const u32 *QueryInterfaces()
        return si; 
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType)
 {
        if (InterfaceType == GF_AUDIO_OUTPUT_INTERFACE) return NewWAVRender();
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index c3feb088560a4f1ce0877b9ff195da20aabde3e4..71f0e6991e761f6bfbd16d4808e13eff76953320 100644 (file)
@@ -5,7 +5,6 @@
    Copyright (C) 1998-2005 Gilles Vollant
 */
 
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -26,6 +25,9 @@
 
 #endif
 
+//hack: prevent mozilla to redifine z functions
+#define MOZZCONF_H
+
 #include "unzip.h"
 #include <gpac/tools.h>
 
index cf47d9dcd3e92d129d4fbcc2c4caf518aa111d5a..ab00d89d23bc499f5155421b84b685ea6b89e130 100644 (file)
@@ -2,7 +2,7 @@ include ../../config.mak
 
 vpath %.c $(SRC_PATH)/modules/x11_out
 
-CFLAGS= $(OPTFLAGS)
+CFLAGS= $(OPTFLAGS) -Wno-deprecated-declarations
 
 ifeq ($(DEBUGBUILD), yes)
 CFLAGS+=-g
index b9ef39686b8289d9e550ae8238b9ac4d443850a7..e2993525169c1fdbf9724d7a5f6f53693e35cff0 100644 (file)
@@ -1440,6 +1440,7 @@ DeleteX11VideoOutput (GF_VideoOutput * vout)
 /*
  * interface query
  */
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -1453,8 +1454,8 @@ const u32 *QueryInterfaces()
 /*
  * interface create
  */
-GF_BaseInterface *
-LoadInterface (u32 InterfaceType)
+GF_EXPORT
+GF_BaseInterface *LoadInterface (u32 InterfaceType)
 {
        if (InterfaceType == GF_VIDEO_OUTPUT_INTERFACE)
                return (GF_BaseInterface *) NewX11VideoOutput ();
@@ -1465,8 +1466,8 @@ LoadInterface (u32 InterfaceType)
 /*
  * interface destroy
  */
-void
-ShutdownInterface (GF_BaseInterface *ifce)
+GF_EXPORT
+void ShutdownInterface (GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType)
        {
index d47067055f20af61305feabd99c479aa37af2669..76c44e33087ab35aaef46d2b548d5a33d1b3107c 100644 (file)
@@ -465,6 +465,8 @@ void DeleteXVIDDec(GF_BaseDecoder *ifcg)
 
 #endif /*GPAC_DISABLE_AV_PARSERS*/
 
+
+GF_EXPORT
 const u32 *QueryInterfaces() 
 {
        static u32 si [] = {
@@ -476,6 +478,7 @@ const u32 *QueryInterfaces()
        return si; 
 }
 
+GF_EXPORT
 GF_BaseInterface *LoadInterface(u32 InterfaceType) 
 {
 #ifndef GPAC_DISABLE_AV_PARSERS
@@ -484,6 +487,7 @@ GF_BaseInterface *LoadInterface(u32 InterfaceType)
        return NULL;
 }
 
+GF_EXPORT
 void ShutdownInterface(GF_BaseInterface *ifce)
 {
        switch (ifce->InterfaceType) {
index dbf640e2bde4d8f9e9ccd2c74bf1f8ce1269ff5e..61018d6043d189ad905925cde6230592269626f8 100644 (file)
@@ -100,7 +100,7 @@ OrderedGroup {
                                                                        Shape {
                                                                                appearance Appearance { 
 #                                                                               material Material { emissiveColor 0 1 0}
-                     texture ImageTexture { url './../auxiliary_files/logo.jpg"}
+                     texture ImageTexture { url "./../auxiliary_files/logo.jpg"}
                     }
                                                                                geometry Box { size 20 20 20}
                                                                        }
index cc9704b0b2f62dd0e175234fadcef5e8681f31b6..6fdb997a445ddf7f6ecd34b8748f3ac1078345fe 100644 (file)
@@ -282,13 +282,11 @@ static GF_Err gf_ar_setup_output_format(GF_AudioRenderer *ar)
                while ((l = gf_list_enum(ar->audio_listeners, &k))) {
                        l->on_audio_reconfig(l->udta, in_freq, in_bps, in_ch, in_cfg);
                }
-       }
-       
+       }       
        return GF_OK;
 }
 
 
-
 static u32 gf_ar_fill_output(void *ptr, char *buffer, u32 buffer_size)
 {
        u32 written;
@@ -635,6 +633,8 @@ u32 gf_sc_ar_get_clock(GF_AudioRenderer *ar)
        if (ar->Frozen) return ar->FreezeTime - ar->startTime;
        return gf_sys_clock() - ar->startTime;
 }
+
+GF_EXPORT
 void gf_sc_reload_audio_filters(GF_Compositor *compositor)
 {
        GF_AudioRenderer *ar = compositor->audio_renderer;
@@ -656,13 +656,22 @@ void gf_sc_reload_audio_filters(GF_Compositor *compositor)
 
 GF_Err gf_sc_add_audio_listener(GF_Compositor *compositor, GF_AudioListener *al)
 {
+       GF_AudioMixer *mixer;
+       u32 sr, ch, bps, ch_cfg;
        if (!compositor || !al || !al->on_audio_frame || !al->on_audio_reconfig) return GF_BAD_PARAM;
        if (!compositor->audio_renderer) return GF_NOT_SUPPORTED;
 
-       gf_mixer_lock(compositor->audio_renderer->mixer, 1);
+       mixer = compositor->audio_renderer->mixer;
+       gf_mixer_lock(mixer, 1);
+
        if (!compositor->audio_renderer->audio_listeners) compositor->audio_renderer->audio_listeners = gf_list_new();
        gf_list_add(compositor->audio_renderer->audio_listeners, al);
-       gf_mixer_lock(compositor->audio_renderer->mixer, 0);
+
+       gf_mixer_get_config(mixer, &sr, &ch, &bps, &ch_cfg);
+
+       al->on_audio_reconfig(al->udta, sr, bps, ch, ch_cfg);
+
+       gf_mixer_lock(mixer, 0);
        return GF_OK;
 }
 
index 8672579365fb98696b232091f2c117bca91577bd..bdb227c802dd00dddb4e42b956f6fe98d46f4842 100644 (file)
@@ -969,6 +969,7 @@ void gf_sc_lock(GF_Compositor *compositor, Bool doLock)
        }
 }
 
+GF_EXPORT
 GF_Err gf_sc_set_size(GF_Compositor *compositor, u32 NewWidth, u32 NewHeight)
 {
        Bool lock_ok;
@@ -1279,6 +1280,7 @@ void gf_sc_reload_config(GF_Compositor *compositor)
        gf_sc_lock(compositor, 0);
 }
 
+GF_EXPORT
 GF_Err gf_sc_set_option(GF_Compositor *compositor, u32 type, u32 value)
 {
        GF_Err e;
@@ -1622,6 +1624,7 @@ void gf_sc_map_point(GF_Compositor *compositor, s32 X, s32 Y, Fixed *bifsX, Fixe
 }
 
 
+GF_EXPORT
 GF_Err gf_sc_get_screen_buffer(GF_Compositor *compositor, GF_VideoSurface *framebuffer, u32 depth_dump_mode)
 {
        GF_Err e;
@@ -1656,6 +1659,7 @@ GF_Err gf_sc_get_offscreen_buffer(GF_Compositor *compositor, GF_VideoSurface *fr
 }
 
 
+GF_EXPORT
 GF_Err gf_sc_release_screen_buffer(GF_Compositor *compositor, GF_VideoSurface *framebuffer)
 {
        GF_Err e;
@@ -1671,6 +1675,7 @@ GF_Err gf_sc_release_screen_buffer(GF_Compositor *compositor, GF_VideoSurface *f
        return e;
 }
 
+GF_EXPORT
 Double gf_sc_get_fps(GF_Compositor *compositor, Bool absoluteFPS)
 {
        Double fps;
@@ -2703,6 +2708,7 @@ Bool gf_sc_user_event(GF_Compositor *compositor, GF_Event *event)
        }
 }
 
+GF_EXPORT
 void gf_sc_register_extra_graph(GF_Compositor *compositor, GF_SceneGraph *extra_scene, Bool do_remove)
 {
        gf_sc_lock(compositor, 1);
index 5059bfd9d9df4a60068bf1a060f448e25834d43b..482c2dc8bbf3d5fd0d4ac57d12f9785348dc9d89 100644 (file)
@@ -1750,6 +1750,7 @@ static GF_Node *browse_parent_for_focus(GF_Compositor *compositor, GF_Node *elt,
        return browse_parent_for_focus(compositor, (GF_Node*)par, prev_focus);
 }
 
+GF_EXPORT
 u32 gf_sc_focus_switch_ring(GF_Compositor *compositor, Bool move_prev, GF_Node *focus, u32 force_focus)
 {
        Bool current_focus = 1;
index db8b1c023e40ff979ae3fb12fb272674458fe938..68a5b149ae1459764fe97bd24b7bda2f98f0de49 100644 (file)
@@ -251,6 +251,7 @@ static void TraverseBillboard(GF_Node *n, void *rs, Bool is_destroy)
                DestroyTransform(n);
                return;
        }
+       if (! tr_state->camera) return;
 
        /*can't cache the matrix here*/
        gf_mx_init(st->mx);
@@ -348,8 +349,6 @@ static void TraverseLOD(GF_Node *node, void *rs, Bool is_destroy)
                return;
        }
 
-
-
        /*WARNING: X3D/MPEG4 NOT COMPATIBLE*/
        if (gf_node_get_tag(node) == TAG_MPEG4_LOD) {
                children = ((M_LOD *) node)->level;
@@ -366,27 +365,32 @@ static void TraverseLOD(GF_Node *node, void *rs, Bool is_destroy)
        if (!children) return;
        nb_children = gf_node_list_get_count(children);
        
-       /*can't cache the matric here*/
-       usr = tr_state->camera->position;
-       pos = center;
-       gf_mx_copy(mx, tr_state->model_matrix);
-       gf_mx_inverse(&mx);
-       gf_mx_apply_vec(&mx, &usr);
-       gf_vec_diff(pos, pos, usr);
-       dist = gf_vec_len(pos);
-       for (which_child=0; which_child<ranges->count; which_child++) {
-               if (dist<ranges->vals[which_child]) break;
-       }
-       if (which_child>=nb_children) which_child = nb_children-1;
-
-       /*check if we're traversing the same child or not for audio rendering*/
-       do_all = 0;
-       if (gf_node_dirty_get(node)) {
-               gf_node_dirty_clear(node, 0);
-               do_all = 1;
-       } else if ((s32) which_child != *prev_child) {
-               *prev_child = which_child;
+       if (!tr_state->camera) {
                do_all = 1;
+               which_child = 0;
+       } else {
+               /*can't cache the matrix here*/
+               usr = tr_state->camera->position;
+               pos = center;
+               gf_mx_copy(mx, tr_state->model_matrix);
+               gf_mx_inverse(&mx);
+               gf_mx_apply_vec(&mx, &usr);
+               gf_vec_diff(pos, pos, usr);
+               dist = gf_vec_len(pos);
+               for (which_child=0; which_child<ranges->count; which_child++) {
+                       if (dist<ranges->vals[which_child]) break;
+               }
+               if (which_child>=nb_children) which_child = nb_children-1;
+
+               /*check if we're traversing the same child or not for audio rendering*/
+               do_all = 0;
+               if (gf_node_dirty_get(node)) {
+                       gf_node_dirty_clear(node, 0);
+                       do_all = 1;
+               } else if ((s32) which_child != *prev_child) {
+                       *prev_child = which_child;
+                       do_all = 1;
+               }
        }
        
        if (do_all) {
index 5d0e1b78d6b654e475b41eb66b5443802aee7c8d..bf457d67b9ef5078549a8b5f70ab23e8cff5b012 100644 (file)
@@ -1397,6 +1397,7 @@ GF_Node *compositor_svg_get_xlink_resource_node(GF_Node *node, XMLRI *xlink)
        return NULL;
 }
 
+GF_EXPORT
 GF_SceneGraph *gf_sc_animation_get_scenegraph(GF_Node *node)
 {
        SVGlinkStack *stack;
index 850af4b784c9313bf84fd0df4dc13f1d5a3083b2..335d4603467dbbc14dadcec200d2a3ce1a6397a7 100644 (file)
@@ -127,6 +127,7 @@ static GF_Err rtp_stream_init_channel(GF_RTPStreamer *rtp, u32 path_mtu, const c
        return GF_OK;
 } 
 
+GF_EXPORT
 GF_RTPStreamer *gf_rtp_streamer_new_extended(u32 streamType, u32 oti, u32 timeScale, 
                                                                const char *ip_dest, u16 port, u32 MTU, u8 TTL, const char *ifce_addr, 
                                                                 u32 flags, char *dsi, u32 dsi_len, 
@@ -456,6 +457,7 @@ GF_RTPStreamer *gf_rtp_streamer_new_extended(u32 streamType, u32 oti, u32 timeSc
 }
 
 
+GF_EXPORT
 GF_RTPStreamer *gf_rtp_streamer_new(u32 streamType, u32 oti, u32 timeScale, 
                                                                const char *ip_dest, u16 port, u32 MTU, u8 TTL, const char *ifce_addr, 
                                                                u32 flags, char *dsi, u32 dsi_len)
@@ -466,6 +468,7 @@ GF_RTPStreamer *gf_rtp_streamer_new(u32 streamType, u32 oti, u32 timeScale,
 
 }
 
+GF_EXPORT
 void gf_rtp_streamer_del(GF_RTPStreamer *streamer)
 {
        if (streamer) {
@@ -521,6 +524,7 @@ void gf_media_format_ttxt_sdp(GP_RTPPacketizer *builder, char *payload_name, cha
 #endif /*!defined(GPAC_DISABLE_ISOM) && !defined(GPAC_DISABLE_STREAMING)*/
 
 
+GF_EXPORT
 GF_Err gf_rtp_streamer_append_sdp_extended(GF_RTPStreamer *rtp, u16 ESID, char *dsi, u32 dsi_len, GF_ISOFile *isofile, u32 isotrack, char *KMS_URI, u32 width, u32 height, char **out_sdp_buffer) 
 {      
        u32 size;
@@ -666,6 +670,7 @@ GF_Err gf_rtp_streamer_append_sdp_extended(GF_RTPStreamer *rtp, u16 ESID, char *
        return GF_OK;
 } 
 
+GF_EXPORT
 char *gf_rtp_streamer_format_sdp_header(char *app_name, char *ip_dest, char *session_name, char *iod64)
 {
        u64 size;
@@ -692,6 +697,7 @@ char *gf_rtp_streamer_format_sdp_header(char *app_name, char *ip_dest, char *ses
        return sdp;
 }
 
+GF_EXPORT
 GF_Err gf_rtp_streamer_append_sdp(GF_RTPStreamer *rtp, u16 ESID, char *dsi, u32 dsi_len, char *KMS_URI, char **out_sdp_buffer) 
 {
        return gf_rtp_streamer_append_sdp_extended(rtp, ESID, dsi, dsi_len, NULL, 0, KMS_URI, 0, 0, out_sdp_buffer);
@@ -716,17 +722,20 @@ GF_Err gf_rtp_streamer_send_au(GF_RTPStreamer *rtp, char *data, u32 size, u64 ct
        return gf_rtp_streamer_send_data(rtp, data, size, size, cts, dts, is_rap, 1, 1, 0, 0, 0);
 }
 
+GF_EXPORT
 GF_Err gf_rtp_streamer_send_au_with_sn(GF_RTPStreamer *rtp, char *data, u32 size, u64 cts, u64 dts, Bool is_rap, u32 inc_au_sn)
 {
        if (inc_au_sn) rtp->packetizer->sl_header.AU_sequenceNumber += inc_au_sn;
        return gf_rtp_streamer_send_data(rtp, data, size, size, cts, dts, is_rap, 1, 1, rtp->packetizer->sl_header.AU_sequenceNumber, 0, 0);
 }
 
+GF_EXPORT
 void gf_rtp_streamer_disable_auto_rtcp(GF_RTPStreamer *streamer)
 {
        streamer->channel->no_auto_rtcp = 1;
 }
 
+GF_EXPORT
 GF_Err gf_rtp_streamer_send_rtcp(GF_RTPStreamer *streamer, Bool force_ts, u32 rtp_ts)
 {
        if (force_ts) streamer->channel->last_pck_ts = rtp_ts;
index 611926569b4907e15cef1950325f3a86601dffb0..b75f512981e43351a410c625ee01742b5e08a17f 100644 (file)
@@ -256,6 +256,7 @@ static GF_Err gf_isom_avc_config_update_ex(GF_ISOFile *the_file, u32 trackNumber
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_avc_config_update(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex, GF_AVCConfig *cfg)
 {
        return gf_isom_avc_config_update_ex(the_file, trackNumber, DescriptionIndex, cfg, 0);
@@ -266,6 +267,7 @@ GF_Err gf_isom_svc_config_update(GF_ISOFile *the_file, u32 trackNumber, u32 Desc
        return gf_isom_avc_config_update_ex(the_file, trackNumber, DescriptionIndex, cfg, is_add ? 1 : 2);
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_ipod_compatible(GF_ISOFile *the_file, u32 trackNumber)
 {
        static const u8 ipod_ext[][16] = { { 0x6B, 0x68, 0x40, 0xF2, 0x5F, 0x24, 0x4F, 0xC5, 0xBA, 0x39, 0xA5, 0x1B, 0xCF, 0x03, 0x23, 0xF3} };
index bad1efcc23ed18f1f822302df28de34a51510e35..168cd0be303e5149aae656a673c1fa716bd0ee37 100644 (file)
@@ -3107,6 +3107,7 @@ static void dump_data(FILE *trace, char *name, char *data, u32 data_size)
        fprintf(trace, "\" ");
 }
 
+GF_EXPORT
 GF_Err gf_isom_dump_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, FILE * trace)
 {
        u32 i, count;
@@ -3139,6 +3140,7 @@ GF_Err gf_isom_dump_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, F
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_dump_ismacryp_sample(GF_ISOFile *the_file, u32 trackNumber, u32 SampleNum, FILE * trace)
 {
        GF_ISOSample *samp;
@@ -3235,7 +3237,7 @@ static GF_Err apple_tag_dump(GF_Box *a, FILE * trace)
                        break;
                default:
                        if (strcmp(name, "Unknown")) {
-                               if (itune->data->data[0]) {
+                               if (itune->data && itune->data->data[0]) {
                                        fprintf(trace, " value=\"%s\" ", itune->data->data);
                                } else {
                                        fprintf(trace, " value=\"");
@@ -3247,7 +3249,8 @@ static GF_Err apple_tag_dump(GF_Box *a, FILE * trace)
                }
        }
        fprintf(trace, ">\n");
-       gf_full_box_dump((GF_Box *)itune->data, trace);
+       if (itune->data)
+               gf_full_box_dump((GF_Box *)itune->data, trace);
        DumpBox(a, trace);
        fprintf(trace, "</%sBox>\n", name);
        return GF_OK;
index c870f45c41ca141c92944750fb38595a88b0b599..bccc707e20daa6e3e5b4883312d0e0e2c0634f8f 100644 (file)
@@ -256,6 +256,7 @@ GF_Err gf_isom_full_box_get_size(GF_Box *ptr)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_box_write_header(GF_Box *ptr, GF_BitStream *bs)
 {
        if (! bs || !ptr) return GF_BAD_PARAM;
@@ -324,6 +325,7 @@ GF_Err gf_isom_box_array_size(GF_Box *parent, GF_List *list)
 
 #endif /*GPAC_DISABLE_ISOM_WRITE*/
 
+GF_EXPORT
 GF_Box *gf_isom_box_new(u32 boxType)
 {
        GF_Box *a;
@@ -580,6 +582,7 @@ GF_Box *gf_isom_box_new(u32 boxType)
 }
 
 
+GF_EXPORT
 void gf_isom_box_del(GF_Box *a)
 {
        if (!a) return;
@@ -1063,6 +1066,7 @@ GF_Err gf_isom_box_read(GF_Box *a, GF_BitStream *bs)
 
 #ifndef GPAC_DISABLE_ISOM_WRITE
 
+GF_EXPORT
 GF_Err gf_isom_box_write(GF_Box *a, GF_BitStream *bs)
 {
        switch (a->type) {
@@ -1296,6 +1300,7 @@ GF_Err gf_isom_box_write(GF_Box *a, GF_BitStream *bs)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_box_size(GF_Box *a)
 {
        switch (a->type) {
index 3ce477d4863aba7ba1044b8b47ed0ff9d3be8f6c..3eeba725d4671a6a8cbef7bcafdef12b19dd9112 100644 (file)
@@ -710,6 +710,7 @@ static void ReorderSDP(char *sdp_text, Bool is_movie_sdp)
 }
 
 //add an SDP line to the SDP container at the track level (media-specific SDP info)
+GF_EXPORT
 GF_Err gf_isom_sdp_add_track_line(GF_ISOFile *the_file, u32 trackNumber, const char *text)
 {
        GF_TrackBox *trak;
@@ -784,6 +785,7 @@ GF_Err gf_isom_sdp_clean_track(GF_ISOFile *the_file, u32 trackNumber)
 
 //add an SDP line to the SDP container at the movie level (presentation SDP info)
 //NOTE: the \r\n end of line for SDP is automatically inserted
+GF_EXPORT
 GF_Err gf_isom_sdp_add_line(GF_ISOFile *movie, const char *text)
 {
        GF_UserDataMap *map;
@@ -845,6 +847,7 @@ GF_Err gf_isom_sdp_add_line(GF_ISOFile *movie, const char *text)
 
 
 //remove all SDP info at the movie level
+GF_EXPORT
 GF_Err gf_isom_sdp_clean(GF_ISOFile *movie)
 {
        GF_UserDataMap *map;
index af64dd59b4a110b86a2b10a83550ad456edf41b8..485f1ba99ad5f98f8a8948667e8800465421bc97 100644 (file)
@@ -333,6 +333,7 @@ GF_Err gf_isom_remove_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber,
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_change_ismacryp_protection(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, char *scheme_uri, char *kms_uri)
 {
        GF_TrackBox *trak;
index 66821b9d7ea34c225ec29f4caf45c21e3f79206f..737304b39e9e0e79bbc2fb648781910ed1e532c9 100644 (file)
@@ -1992,6 +1992,7 @@ GF_Err gf_isom_release_segment(GF_ISOFile *movie, Bool reset_tables)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_open_segment(GF_ISOFile *movie, const char *fileName, u64 start_range, u64 end_range)
 {
 #ifdef GPAC_DISABLE_ISOM_FRAGMENTS
@@ -2295,6 +2296,7 @@ GF_Err gf_isom_get_track_layout_info(GF_ISOFile *movie, u32 trackNumber, u32 *wi
 
 
 /*returns total amount of media bytes in track*/
+GF_EXPORT
 u64 gf_isom_get_media_data_size(GF_ISOFile *movie, u32 trackNumber)
 {
        u32 i, size;
@@ -2614,6 +2616,7 @@ GF_Err gf_isom_get_timed_meta_data_info(GF_ISOFile *file, u32 track, u32 sampleD
        return GF_OK;
 }
 
+GF_EXPORT
 u32 gf_isom_get_next_alternate_group_id(GF_ISOFile *movie)
 {
        u32 id = 0;
@@ -2650,6 +2653,7 @@ GF_Err gf_isom_sample_get_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumb
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_get_rvc_config(GF_ISOFile *movie, u32 track, u32 sampleDescriptionIndex, u16 *rvc_predefined, char **data, u32 *size, const char **mime)
 {
        GF_MPEGVisualSampleEntryBox *entry;
@@ -2696,6 +2700,7 @@ Bool gf_isom_moov_first(GF_ISOFile *movie)
        return 0;
 }
 
+GF_EXPORT
 void gf_isom_reset_fragment_info(GF_ISOFile *movie)
 {
        u32 i;
index 33b71605e1bcb59ef551095796560f1ae7a4e87e..0ab755a20ec76f6c82081c67925c6e52322e77eb 100644 (file)
@@ -137,6 +137,7 @@ GF_Err gf_isom_add_track_to_root_od(GF_ISOFile *movie, u32 trackNumber)
 }
 
 //remove the root OD
+GF_EXPORT
 GF_Err gf_isom_remove_root_od(GF_ISOFile *movie)
 {
        GF_Err e;
@@ -150,6 +151,7 @@ GF_Err gf_isom_remove_root_od(GF_ISOFile *movie)
 }
 
 //remove a track to the root OD
+GF_EXPORT
 GF_Err gf_isom_remove_track_from_root_od(GF_ISOFile *movie, u32 trackNumber)
 {
        GF_List *esds;
@@ -232,6 +234,7 @@ GF_Err gf_isom_set_track_enabled(GF_ISOFile *movie, u32 trackNumber, u8 enableTr
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_media_language(GF_ISOFile *movie, u32 trackNumber, char *three_char_code)
 {
        GF_Err e;
@@ -313,6 +316,7 @@ GF_Err gf_isom_add_desc_to_root_od(GF_ISOFile *movie, GF_Descriptor *theDesc)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_timescale(GF_ISOFile *movie, u32 timeScale)
 {
        GF_Err e;
@@ -325,6 +329,8 @@ GF_Err gf_isom_set_timescale(GF_ISOFile *movie, u32 timeScale)
        return GF_OK;
 }
 
+
+GF_EXPORT
 GF_Err gf_isom_set_pl_indication(GF_ISOFile *movie, u8 PL_Code, u8 ProfileLevel)
 {
        GF_IsomInitialObjectDescriptor *iod;
@@ -776,6 +782,7 @@ GF_Err gf_isom_append_sample_data(GF_ISOFile *movie, u32 trackNumber, char *data
 //you must have created a StreamDescription with URL or URN specifying your referenced file
 //the data offset specifies the begining of the chunk
 //Use streamDescriptionIndex to specify the desired stream (if several)
+GF_EXPORT
 GF_Err gf_isom_add_sample_reference(GF_ISOFile *movie, u32 trackNumber, u32 StreamDescriptionIndex, GF_ISOSample *sample, u64 dataOffset)
 {
        GF_TrackBox *trak;
@@ -830,6 +837,7 @@ GF_Err gf_isom_add_sample_reference(GF_ISOFile *movie, u32 trackNumber, u32 Stre
 
 //set the duration of the last media sample. If not set, the duration of the last sample is the
 //duration of the previous one if any, or 1000 (default value).
+GF_EXPORT
 GF_Err gf_isom_set_last_sample_duration(GF_ISOFile *movie, u32 trackNumber, u32 duration)
 {
        GF_TrackBox *trak;
@@ -851,26 +859,24 @@ GF_Err gf_isom_set_last_sample_duration(GF_ISOFile *movie, u32 trackNumber, u32
        ent = (GF_SttsEntry*) &stts->entries[stts->nb_entries-1];
 
        mdur -= ent->sampleDelta;
-       if (duration) {
-               mdur += duration;
-               //we only have one sample
-               if (ent->sampleCount == 1) {
-                       ent->sampleDelta = duration;
-               } else {
-                       if (ent->sampleDelta == duration) return GF_OK;
-                       ent->sampleCount -= 1;
+       mdur += duration;
+       //we only have one sample
+       if (ent->sampleCount == 1) {
+               ent->sampleDelta = duration;
+       } else {
+               if (ent->sampleDelta == duration) return GF_OK;
+               ent->sampleCount -= 1;
 
-                       if (stts->nb_entries==stts->alloc_size) {
-                               stts->alloc_size++;
-                               stts->entries = gf_realloc(stts->entries, sizeof(GF_SttsEntry)*stts->alloc_size);
-                               if (!stts->entries) return GF_OUT_OF_MEM;
-                       }
-                       stts->entries[stts->nb_entries].sampleCount = 1;
-                       stts->entries[stts->nb_entries].sampleDelta = duration;
-                       stts->nb_entries++;
-                       //and update the write cache
-                       stts->w_currentSampleNum = trak->Media->information->sampleTable->SampleSize->sampleCount;
+               if (stts->nb_entries==stts->alloc_size) {
+                       stts->alloc_size++;
+                       stts->entries = gf_realloc(stts->entries, sizeof(GF_SttsEntry)*stts->alloc_size);
+                       if (!stts->entries) return GF_OUT_OF_MEM;
                }
+               stts->entries[stts->nb_entries].sampleCount = 1;
+               stts->entries[stts->nb_entries].sampleDelta = duration;
+               stts->nb_entries++;
+               //and update the write cache
+               stts->w_currentSampleNum = trak->Media->information->sampleTable->SampleSize->sampleCount;
        }
        trak->Media->mediaHeader->modificationTime = gf_isom_get_mp4time();
        trak->Media->mediaHeader->duration = mdur;
@@ -944,6 +950,7 @@ GF_Err gf_isom_update_sample_reference(GF_ISOFile *movie, u32 trackNumber, u32 s
 
 
 //Remove a given sample
+GF_EXPORT
 GF_Err gf_isom_remove_sample(GF_ISOFile *movie, u32 trackNumber, u32 sampleNumber)
 {
        GF_Err e;
@@ -999,6 +1006,7 @@ GF_Err gf_isom_remove_sample(GF_ISOFile *movie, u32 trackNumber, u32 sampleNumbe
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_final_name(GF_ISOFile *movie, char *filename)
 {
        GF_Err e;
@@ -1100,6 +1108,7 @@ insertIPI:
 
 //use carefully. Very usefull when you made a lot of changes (IPMP, IPI, OCI, ...)
 //THIS WILL REPLACE THE WHOLE DESCRIPTOR ...
+GF_EXPORT
 GF_Err gf_isom_change_mpeg4_description(GF_ISOFile *movie, u32 trackNumber, u32 StreamDescriptionIndex, GF_ESD *newESD)
 {
        GF_Err e;
@@ -1266,6 +1275,7 @@ GF_Err gf_isom_set_audio_info(GF_ISOFile *movie, u32 trackNumber, u32 StreamDesc
 }
 
 //set the storage mode of a file (FLAT, STREAMABLE, INTERLEAVED)
+GF_EXPORT
 GF_Err gf_isom_set_storage_mode(GF_ISOFile *movie, u8 storageMode)
 {
        GF_Err e;
@@ -1289,6 +1299,7 @@ GF_Err gf_isom_set_storage_mode(GF_ISOFile *movie, u8 storageMode)
 //update or insert a new edit segment in the track time line. Edits are used to modify
 //the media normal timing. EditTime and EditDuration are expressed in Movie TimeScale
 //If a segment with EditTime already exists, IT IS ERASED
+GF_EXPORT
 GF_Err gf_isom_set_edit_segment(GF_ISOFile *movie, u32 trackNumber, u64 EditTime, u64 EditDuration, u64 MediaTime, u8 EditMode)
 {
        GF_TrackBox *trak;
@@ -1379,6 +1390,7 @@ found:
 }
 
 //remove the edit segments for the whole track
+GF_EXPORT
 GF_Err gf_isom_remove_edit_segments(GF_ISOFile *movie, u32 trackNumber)
 {
        GF_Err e;
@@ -1429,6 +1441,7 @@ GF_Err gf_isom_remove_edit_segment(GF_ISOFile *movie, u32 trackNumber, u32 seg_i
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_append_edit_segment(GF_ISOFile *movie, u32 trackNumber, u64 EditDuration, u64 MediaTime, u8 EditMode)
 {
        GF_Err e;
@@ -1471,6 +1484,7 @@ GF_Err gf_isom_append_edit_segment(GF_ISOFile *movie, u32 trackNumber, u64 EditD
        return SetTrackDuration(trak);
 }
 
+GF_EXPORT
 GF_Err gf_isom_modify_edit_segment(GF_ISOFile *movie, u32 trackNumber, u32 seg_index, u64 EditDuration, u64 MediaTime, u8 EditMode)
 {
        GF_Err e;
@@ -1504,6 +1518,7 @@ GF_Err gf_isom_modify_edit_segment(GF_ISOFile *movie, u32 trackNumber, u32 seg_i
 }
 
 //removes the desired track
+GF_EXPORT
 GF_Err gf_isom_remove_track(GF_ISOFile *movie, u32 trackNumber)
 {
        GF_Err e;
@@ -1622,6 +1637,7 @@ GF_Err gf_isom_remove_track(GF_ISOFile *movie, u32 trackNumber)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_copyright(GF_ISOFile *movie, const char *threeCharCode, char *notice)
 {
        GF_Err e;
@@ -1664,6 +1680,7 @@ GF_Err gf_isom_set_copyright(GF_ISOFile *movie, const char *threeCharCode, char
        return udta_AddBox(movie->moov->udta, (GF_Box *) ptr);
 }
 
+GF_EXPORT
 GF_Err gf_isom_add_chapter(GF_ISOFile *movie, u32 trackNumber, u64 timestamp, char *name)
 {
        GF_Err e;
@@ -1949,7 +1966,7 @@ GF_Err gf_isom_use_compact_size(GF_ISOFile *movie, u32 trackNumber, u8 Compactio
 }
 
 
-
+GF_EXPORT
 GF_Err gf_isom_set_brand_info(GF_ISOFile *movie, u32 MajorBrand, u32 MinorVersion)
 {
        u32 i, *p;
@@ -1995,6 +2012,8 @@ GF_Err gf_isom_set_brand_info(GF_ISOFile *movie, u32 MajorBrand, u32 MinorVersio
        return GF_OK;
 }
 
+
+GF_EXPORT
 GF_Err gf_isom_modify_alternate_brand(GF_ISOFile *movie, u32 Brand, u8 AddIt)
 {
        u32 i, k, *p;
@@ -2258,6 +2277,7 @@ GF_Err gf_isom_add_sample_fragment(GF_ISOFile *movie, u32 trackNumber, u32 sampl
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_remove_sample_fragment(GF_ISOFile *movie, u32 trackNumber, u32 sampleNumber)
 {
        GF_TrackBox *trak;
@@ -2289,6 +2309,7 @@ GF_Err gf_isom_remove_sample_fragments(GF_ISOFile *movie, u32 trackNumber)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_clone_pl_indications(GF_ISOFile *orig, GF_ISOFile *dest)
 {
        GF_IsomInitialObjectDescriptor *iod_d;
@@ -2394,7 +2415,7 @@ GF_Err gf_isom_clone_movie(GF_ISOFile *orig_file, GF_ISOFile *dest_file, Bool cl
 }
 
 
-
+GF_EXPORT
 GF_Err gf_isom_clone_track(GF_ISOFile *orig_file, u32 orig_track, GF_ISOFile *dest_file, Bool keep_data_ref, u32 *dest_track)
 {
        GF_TrackBox *trak, *new_tk;
@@ -2517,6 +2538,8 @@ GF_Err gf_isom_clone_sample_descriptions(GF_ISOFile *the_file, u32 trackNumber,
        return e;
 }
 
+
+GF_EXPORT
 GF_Err gf_isom_clone_sample_description(GF_ISOFile *the_file, u32 trackNumber, GF_ISOFile *orig_file, u32 orig_track, u32 orig_desc_index, char *URLname, char *URNname, u32 *outDescriptionIndex)
 {
        GF_TrackBox *trak;
@@ -2802,6 +2825,7 @@ GF_Err gf_isom_remove_sample_description(GF_ISOFile *movie, u32 trackNumber, u32
 
 
 //sets a track reference
+GF_EXPORT
 GF_Err gf_isom_set_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferencedTrackID)
 {
        GF_Err e;
@@ -2832,6 +2856,7 @@ GF_Err gf_isom_set_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 re
 }
 
 //removes a track reference
+GF_EXPORT
 GF_Err gf_isom_remove_track_reference(GF_ISOFile *the_file, u32 trackNumber, u32 referenceType, u32 ReferenceIndex)
 {
        GF_Err e;
@@ -2943,6 +2968,7 @@ GF_Err gf_isom_remove_cts_info(GF_ISOFile *the_file, u32 trackNumber)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_cts_packing(GF_ISOFile *the_file, u32 trackNumber, Bool unpack)
 {
        GF_Err e;
@@ -2971,6 +2997,7 @@ GF_Err gf_isom_set_track_matrix(GF_ISOFile *the_file, u32 trackNumber, u32 matri
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_track_layout_info(GF_ISOFile *the_file, u32 trackNumber, u32 width, u32 height, s32 translation_x, s32 translation_y, s16 layer)
 {
        GF_TrackBox *trak = gf_isom_get_track_from_file(the_file, trackNumber);
@@ -3129,7 +3156,7 @@ GF_Err gf_isom_set_media_timescale(GF_ISOFile *the_file, u32 trackNumber, u32 ne
 }
 
 
-
+GF_EXPORT
 Bool gf_isom_is_same_sample_description(GF_ISOFile *f1, u32 tk1, u32 sdesc_index1, GF_ISOFile *f2, u32 tk2, u32 sdesc_index2)
 {
        u32 i, count;
@@ -3259,6 +3286,7 @@ Bool gf_isom_is_same_sample_description(GF_ISOFile *f1, u32 tk1, u32 sdesc_index
        return ret;
 }
 
+GF_EXPORT
 u64 gf_isom_estimate_size(GF_ISOFile *movie)
 {
        GF_Err e;
@@ -3377,6 +3405,7 @@ GF_Err gf_isom_set_max_samples_per_chunk(GF_ISOFile *movie, u32 trackNumber, u32
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_extraction_slc(GF_ISOFile *the_file, u32 trackNumber, u32 StreamDescriptionIndex, GF_SLConfig *slConfig)
 {
        GF_TrackBox *trak;
@@ -3475,6 +3504,7 @@ u32 gf_isom_get_track_priority_in_group(GF_ISOFile *the_file, u32 trackNumber)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_make_interleave(GF_ISOFile *file, Double TimeInSec)
 {
        GF_Err e;
@@ -3485,6 +3515,7 @@ GF_Err gf_isom_make_interleave(GF_ISOFile *file, Double TimeInSec)
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_handler_name(GF_ISOFile *the_file, u32 trackNumber, const char *nameUTF8)
 {
        GF_TrackBox *trak;
@@ -3687,6 +3718,7 @@ GF_Err gf_isom_add_uuid(GF_ISOFile *movie, u32 trackNumber, bin128 UUID, char *d
 
 /*Apple extensions*/
 
+GF_EXPORT
 GF_Err gf_isom_apple_set_tag(GF_ISOFile *mov, u32 tag, const char *data, u32 data_len)
 {
        GF_BitStream *bs;
@@ -3999,6 +4031,7 @@ GF_Err gf_isom_add_subsample(GF_ISOFile *movie, u32 track, u32 sampleNumber, u32
 }
 
 
+GF_EXPORT
 GF_Err gf_isom_set_rvc_config(GF_ISOFile *movie, u32 track, u32 sampleDescriptionIndex, u16 rvc_predefined, char *mime, char *data, u32 size)
 {
        GF_MPEGVisualSampleEntryBox *entry;
index e8ab639cfb3ffd1a0a77a8f76fe7c2c350b689e7..c84bfa926e2c59370e8fe6469ac2dbbac5a50efe 100644 (file)
@@ -425,6 +425,10 @@ Bool Media_IsSelfContained(GF_MediaBox *mdia, u32 StreamDescIndex)
        Media_GetSampleDesc(mdia, StreamDescIndex, &se, &drefIndex);
        if (!drefIndex) return 0;
        a = (GF_FullBox*)gf_list_get(mdia->information->dataInformation->dref->boxList, drefIndex - 1);
+       if (!a) {
+               GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, ("[iso file] broken file: Data reference index set to %d but no data reference entry found\n", drefIndex));
+               return 0;
+       }
        if (a->flags & 1) return 1;
        /*QT specific*/
        if (a->type == GF_4CC('a', 'l', 'i', 's')) return 1;
index 6fb0a9d04aa223738a7049b1e68d48fe7f9cebd7..5f17c152b0fa8d9b542c68c37a1aaa4b1d6c48be 100644 (file)
@@ -64,6 +64,7 @@ u32 gf_isom_has_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num)
        return 0;
 }
 
+GF_EXPORT
 GF_Err gf_isom_extract_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *outName, Bool *is_binary)
 {
        u32 i, count;
@@ -189,6 +190,7 @@ u32 gf_isom_get_meta_item_by_id(GF_ISOFile *file, Bool root_meta, u32 track_num,
        return 0;
 }
 
+GF_EXPORT
 GF_Err gf_isom_extract_meta_item_extended(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_id, const char *dump_file_name, char **out_data, u32 *out_size, const char **out_mime )
 {
        GF_BitStream *item_bs;
@@ -285,6 +287,7 @@ GF_Err gf_isom_extract_meta_item_extended(GF_ISOFile *file, Bool root_meta, u32
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_extract_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_id, const char *dump_file_name)
 {
        return gf_isom_extract_meta_item_extended(file, root_meta, track_num, item_id, dump_file_name, NULL, NULL, NULL);
@@ -295,6 +298,7 @@ GF_Err gf_isom_extract_meta_item_mem(GF_ISOFile *file, Bool root_meta, u32 track
        return gf_isom_extract_meta_item_extended(file, root_meta, track_num, item_id, NULL, out_data, out_size, out_mime);
 }
 
+GF_EXPORT
 u32 gf_isom_get_meta_primary_item_id(GF_ISOFile *file, Bool root_meta, u32 track_num)
 {
        GF_MetaBox *meta = gf_isom_get_meta(file, root_meta, track_num);
@@ -306,6 +310,7 @@ u32 gf_isom_get_meta_primary_item_id(GF_ISOFile *file, Bool root_meta, u32 track
 #ifndef GPAC_DISABLE_ISOM_WRITE
 
 
+GF_EXPORT
 GF_Err gf_isom_set_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 metaType)
 {
        char szName[20];
@@ -363,6 +368,7 @@ GF_Err gf_isom_set_meta_type(GF_ISOFile *file, Bool root_meta, u32 track_num, u3
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_remove_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num)
 {
        u32 i;
@@ -382,6 +388,7 @@ GF_Err gf_isom_remove_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_meta_xml(GF_ISOFile *file, Bool root_meta, u32 track_num, char *XMLFileName, Bool IsBinaryXML)
 {
        GF_Err e;
@@ -614,6 +621,7 @@ GF_Err gf_isom_add_meta_item_extended(GF_ISOFile *file, Bool root_meta, u32 trac
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_add_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, Bool self_reference, char *resource_path, const char *item_name, const char *mime_type, const char *content_encoding, const char *URL, const char *URN)
 {
        return gf_isom_add_meta_item_extended(file, root_meta, track_num, self_reference, resource_path, item_name, mime_type, content_encoding, URL, URN, NULL, 0);
@@ -624,6 +632,7 @@ GF_Err gf_isom_add_meta_item_memory(GF_ISOFile *file, Bool root_meta, u32 track_
        return gf_isom_add_meta_item_extended(file, root_meta, track_num, 0, NULL, item_name, mime_type, content_encoding, NULL, NULL, data, data_len);
 }
 
+GF_EXPORT
 GF_Err gf_isom_remove_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_id)
 {
        GF_ItemInfoEntryBox *iinf;
@@ -653,6 +662,7 @@ GF_Err gf_isom_remove_meta_item(GF_ISOFile *file, Bool root_meta, u32 track_num,
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_isom_set_meta_primary_item(GF_ISOFile *file, Bool root_meta, u32 track_num, u32 item_id)
 {
        GF_MetaBox *meta = gf_isom_get_meta(file, root_meta, track_num);
index 187ff4edf897d419847177bc15ed010ef304fbde..964ffefe46338cea770f5d1d635ba30dba2c00ca 100644 (file)
@@ -875,7 +875,7 @@ GF_Err gf_isom_close_segment(GF_ISOFile *movie, s32 subsegments_per_sidx, u32 re
        Bool first_frag_in_subseg;
        Bool no_sidx = 0;
        u32 count, idx, cur_dur, sidx_dur, sidx_idx, idx_offset, frag_count;
-       u64 last_top_box_pos, root_prev_offset, local_sidx_start, local_sidx_end, prev_earliest_cts, prev_earliest_dts;
+       u64 last_top_box_pos, root_prev_offset, local_sidx_start, local_sidx_end, prev_earliest_cts;
        GF_TrackBox *trak = NULL;
        GF_Err e;
        /*number of subsegment in this segment (eg nb references in the first SIDX found)*/
@@ -945,7 +945,6 @@ GF_Err gf_isom_close_segment(GF_ISOFile *movie, s32 subsegments_per_sidx, u32 re
        frags_per_subsidx = 0;
        
        prev_earliest_cts = 0;
-       prev_earliest_dts = ref_track_decode_time;
 
        if (daisy_chain_sidx)
                daisy_sidx = gf_list_new();
@@ -1507,6 +1506,9 @@ GF_Err gf_isom_fragment_add_sample(GF_ISOFile *movie, u32 TrackID, GF_ISOSample
        ent->Duration = Duration;
        ent->size = sample->dataLength;
        ent->flags = GF_ISOM_FORMAT_FRAG_FLAGS(PaddingBits, sample->IsRAP, DegradationPriority);
+       if (sample->IsRAP) {
+               ent->flags |= GF_ISOM_GET_FRAG_DEPEND_FLAGS(0, 2, 0, 0);
+       }
        gf_list_add(trun->entries, ent);
        
        trun->sample_count += 1;
@@ -1601,6 +1603,8 @@ GF_Err gf_isom_fragment_copy_subsample(GF_ISOFile *dest, u32 TrackID, GF_ISOFile
        GF_Err e;
        GF_TrackBox *trak;
        GF_TrackFragmentBox *traf;
+       GF_TrunEntry *ent;
+       GF_TrackFragmentRunBox *trun;
        if (!dest->moof || !(dest->FragmentsFlags & GF_ISOM_FRAG_WRITE_READY) ) return GF_BAD_PARAM;
 
        traf = GetTraf(dest, TrackID);
@@ -1609,6 +1613,25 @@ GF_Err gf_isom_fragment_copy_subsample(GF_ISOFile *dest, u32 TrackID, GF_ISOFile
        trak = gf_isom_get_track_from_file(orig, track);
        if (!trak) return GF_BAD_PARAM;
 
+       /*modify depends flags*/
+       if (trak->Media->information->sampleTable->SampleDep) {
+               u32 dependsOn, dependedOn, redundant;
+
+               dependsOn = dependedOn = redundant = 0;
+               count = gf_list_count(traf->TrackRuns);
+               if (!count) return GF_BAD_PARAM;
+               trun = (GF_TrackFragmentRunBox *)gf_list_get(traf->TrackRuns, count-1);
+               count = gf_list_count(trun->entries);
+               if (!count) return GF_BAD_PARAM;
+
+               ent = (GF_TrunEntry *)gf_list_get(trun->entries, count-1);
+               e = stbl_GetSampleDepType(trak->Media->information->sampleTable->SampleDep, sampleNumber, &dependsOn, &dependedOn, &redundant);
+               if (e) return e;
+
+               GF_ISOM_RESET_FRAG_DEPEND_FLAGS(ent->flags);
+               ent->flags |= GF_ISOM_GET_FRAG_DEPEND_FLAGS(0, dependsOn, dependedOn, redundant);
+       }
+
        /*copy subsample info if any*/
        if ( gf_isom_sample_get_subsample_entry(orig, track, sampleNumber, &sub_sample)) {
                if (!traf || !traf->tfhd->sample_desc_index) return GF_BAD_PARAM;
index 5d1c21e021c3f110e344a5036680d92b9c29d011..616cb0b648998f7f6688fac344819b32008e0dfd 100644 (file)
@@ -373,7 +373,7 @@ GF_Err gf_isom_ac3_config_new(GF_ISOFile *the_file, u32 trackNumber, GF_AC3Confi
 
 
 
-
+GF_EXPORT
 GF_Err gf_isom_get_dims_description(GF_ISOFile *movie, u32 trackNumber, u32 descriptionIndex, GF_DIMSDescription *desc)
 {
        GF_DIMSSampleEntryBox *dims;
index 5c8100f95ff9b031a7a2af7ad07da0b1544b0b3f..3ce8c61fdbd974aa65fd32e3cd63529354442899 100644 (file)
@@ -306,6 +306,7 @@ void gf_sha1_finish(GF_SHA1Context *ctx, u8 output[20] )
 /*
  * Output = SHA-1( file contents )
  */
+GF_EXPORT
 s32 gf_sha1_file( const char *path, u8 output[20] )
 {
     FILE *f;
index 8adb546936f1f2713c719857be985a2d92f88055..112ab704bf25a5d42dcffedad848555081536351 100644 (file)
@@ -393,18 +393,14 @@ static GF_Err gf_m2ts_decode_ait(GF_M2TS_AIT *ait, char  *data, u32 data_size, u
 \r
 static void gf_m2ts_process_ait(GF_M2TS_Demuxer *ts, GF_M2TS_AIT* ait){\r
 \r
-       u32 nb_app_desc,k,desc_id;\r
-\r
-       u32 nb_of_app,j,i;\r
+       u32 nb_app_desc, k, desc_id, nb_of_app, j;\r
        GF_M2TS_CHANNEL_APPLICATION_INFO* ChanAppInfo;\r
-       char* url_base;\r
-       char* url_appli_path;\r
+       char *url_base, *url_appli_path;\r
 \r
        nb_of_app = gf_list_count(ait->application_decoded);\r
        url_base = NULL;\r
        url_appli_path = NULL;\r
-       j=0;    \r
-       i=0;\r
+       j=0;\r
 \r
        /* Link the AIT and the channel */\r
        ChanAppInfo = gf_m2ts_get_channel_application_info(ts->ChannelAppList,ait->service_id); \r
index fa6f6c72fd8831c3e9f200afcdc17c8a3023e706..3f6fc62ff5abe797534d9f38d2d523ddf7e741b8 100644 (file)
@@ -2777,6 +2777,7 @@ static const u32 ac3_mod_to_chans[] = {
   2, 1, 2, 3, 3, 4, 4, 5
 };
 
+GF_EXPORT
 u32 gf_ac3_get_channels(u32 acmod)
 {
        u32 nb_ch;
@@ -2784,6 +2785,7 @@ u32 gf_ac3_get_channels(u32 acmod)
        return nb_ch;
 }
 
+GF_EXPORT
 u32 gf_ac3_get_bitrate(u32 brcode)
 {
        return ac3_sizecod_to_bitrate[brcode];
@@ -2842,6 +2844,7 @@ Bool gf_ac3_parser(u8 *buf, u32 buflen, u32 *pos, GF_AC3Header *hdr, Bool full_p
 }
 
 
+GF_EXPORT
 Bool gf_ac3_parser_bs(GF_BitStream *bs, GF_AC3Header *hdr, Bool full_parse)
 {
        u32 fscod, frmsizecod, bsid, ac3_mod, freq, framesize, bsmod;
index 6b3e02c8da04baf8b7bae80ab010ff94f1e04041..ed764fb5deafee051fd5b2d91d08e10f7dffb207 100644 (file)
@@ -278,7 +278,7 @@ static GF_Err gf_m2ts_dsmcc_download_data(GF_M2TS_DSMCC_OVERLORD *dsmcc_overlord
                }\r
        case DOWNLOAD_DATA_BLOCK:\r
                {                               \r
-                       u32 data_shift,modules_count,i;\r
+                       u32 modules_count, i;\r
                        GF_M2TS_DSMCC_DOWNLOAD_DATA_BLOCK* DownloadDataBlock;\r
                        GF_SAFEALLOC(DownloadDataBlock,GF_M2TS_DSMCC_DOWNLOAD_DATA_BLOCK);\r
                        DataMessage->dataMessagePayload = DownloadDataBlock;\r
@@ -312,7 +312,7 @@ static GF_Err gf_m2ts_dsmcc_download_data(GF_M2TS_DSMCC_OVERLORD *dsmcc_overlord
                                                return GF_CORRUPTED_DATA;\r
                                        }\r
                                        DownloadDataBlock->blockDataByte = (char*)gf_calloc(DownloadDataBlock->dataBlocksize,sizeof(char));\r
-                                       data_shift = (u32)(gf_bs_get_position(bs));\r
+                                       *data_shift = (u32)(gf_bs_get_position(bs));\r
                                        gf_bs_read_data(bs,DownloadDataBlock->blockDataByte,DownloadDataBlock->dataBlocksize);\r
                                        memcpy(dsmcc_module->buffer+dsmcc_module->byte_sift,DownloadDataBlock->blockDataByte,DownloadDataBlock->dataBlocksize*sizeof(char));\r
                                        dsmcc_module->byte_sift += DownloadDataBlock->dataBlocksize;                                                                    \r
@@ -357,14 +357,11 @@ static GF_Err gf_m2ts_dsmcc_download_data(GF_M2TS_DSMCC_OVERLORD *dsmcc_overlord
 \r
                }\r
        case DOWNLOAD_SERVER_INITIATE:\r
-\r
                {\r
-                       u32 localbyteshift;\r
                        GF_Err e;\r
                        GF_M2TS_DSMCC_DOWNLOAD_SERVER_INIT* DownloadServerInit;\r
                        GF_SAFEALLOC(DownloadServerInit,GF_M2TS_DSMCC_DOWNLOAD_SERVER_INIT);\r
                        DataMessage->dataMessagePayload = DownloadServerInit;\r
-                       localbyteshift = (u32)(gf_bs_get_position(bs));\r
                        gf_bs_read_data(bs,DownloadServerInit->serverId,20);                    \r
                        gf_m2ts_dsmcc_process_compatibility_descriptor(&DownloadServerInit->CompatibilityDescr,data,bs,data_shift);\r
                        DownloadServerInit->privateDataLength = gf_bs_read_int(bs,16);\r
@@ -942,7 +939,6 @@ static GF_Err dsmcc_process_biop_file(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_HEADER
        GF_M2TS_DSMCC_SERVICE_GATEWAY* ServiceGateway;\r
        GF_M2TS_DSMCC_FILE* File;\r
        FILE* pFile;\r
-       char* FileType;\r
        u8* descr_tag;\r
 \r
        GF_SAFEALLOC(BIOP_File,GF_M2TS_DSMCC_BIOP_FILE);\r
@@ -970,8 +966,7 @@ static GF_Err dsmcc_process_biop_file(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_HEADER
                switch(*descr_tag){\r
                                case CONTENT_TYPE_DESCRIPTOR:\r
                                        {\r
-                                               GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR* ContentTypeDescr = (GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR*)gf_list_get(BIOP_File->descriptor,0);                                         \r
-                                               FileType = strdup(ContentTypeDescr->content_type_data_byte);                                            \r
+                                               //GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR* ContentTypeDescr = (GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR*)gf_list_get(BIOP_File->descriptor,0);                                               \r
                                        }\r
                                default:\r
                                        {\r
@@ -1020,8 +1015,6 @@ static GF_Err dsmcc_process_biop_directory(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_H
 \r
        GF_M2TS_DSMCC_BIOP_DIRECTORY* BIOP_Directory;\r
        GF_M2TS_DSMCC_DIR* Dir;\r
-       char* ParentName;\r
-       char* FileType;\r
        u32 i;\r
        GF_M2TS_DSMCC_SERVICE_GATEWAY* ServiceGateway;\r
 \r
@@ -1043,7 +1036,6 @@ static GF_Err dsmcc_process_biop_directory(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_H
                ServiceGateway->objectKey_data = BIOP_Directory->Header->objectKey_data;\r
                ServiceGateway->parent = NULL;                  \r
                ServiceGateway->name = (char*)gf_strdup(dsmcc_overlord->root_dir);\r
-               ParentName = ServiceGateway->name;                      \r
        }else{\r
                /* get the dir related to the payload */\r
                Dir = dsmcc_get_directory(ServiceGateway->Dir,BIOP_Directory->Header->objectKey_data);          \r
@@ -1112,8 +1104,7 @@ static GF_Err dsmcc_process_biop_directory(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_H
                        switch(*descr_tag){\r
                                        case CONTENT_TYPE_DESCRIPTOR:\r
                                                {\r
-                                                       GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR* ContentTypeDescr = (GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR*)gf_list_get(BIOP_Directory->Name[i].descriptor ,j);                                           \r
-                                                       FileType = strdup(ContentTypeDescr->content_type_data_byte);                                            \r
+                                                       //GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR* ContentTypeDescr = (GF_M2TS_DSMCC_BIOP_CONTENT_TYPE_DESRIPTOR*)gf_list_get(BIOP_Directory->Name[i].descriptor ,j);                                         \r
                                                }\r
                                        default:\r
                                                {\r
@@ -1168,7 +1159,7 @@ static GF_Err dsmcc_process_biop_stream_event(GF_BitStream* bs,GF_M2TS_DSMCC_BIO
        u32 i;          \r
        GF_M2TS_DSMCC_BIOP_STREAM_EVENT* BIOP_StreamEvent;\r
        //GF_M2TS_DSMCC_FILE* File;     \r
-       u32 eventdata,Info_length;\r
+       u32 eventdata;\r
 \r
        GF_SAFEALLOC(BIOP_StreamEvent,GF_M2TS_DSMCC_BIOP_STREAM_EVENT);\r
 \r
@@ -1201,10 +1192,8 @@ static GF_Err dsmcc_process_biop_stream_event(GF_BitStream* bs,GF_M2TS_DSMCC_BIO
                }\r
        }\r
 \r
-       Info_length = BIOP_StreamEvent->Header->objectInfo_length - (BIOP_StreamEvent->Info.aDescription_length + 14 + BIOP_StreamEvent->eventNames_count + eventdata);\r
-\r
        BIOP_StreamEvent->serviceContextList_count = gf_bs_read_int(bs,8);\r
-       if(BIOP_StreamEvent->serviceContextList_count){\r
+       if (BIOP_StreamEvent->serviceContextList_count) {\r
                BIOP_StreamEvent->ServiceContext = (GF_M2TS_DSMCC_SERVICE_CONTEXT*)gf_calloc(BIOP_StreamEvent->serviceContextList_count,sizeof(GF_M2TS_DSMCC_SERVICE_CONTEXT));\r
                dsmcc_biop_get_context(bs,BIOP_StreamEvent->ServiceContext,BIOP_StreamEvent->serviceContextList_count);\r
        }       \r
@@ -1212,7 +1201,7 @@ static GF_Err dsmcc_process_biop_stream_event(GF_BitStream* bs,GF_M2TS_DSMCC_BIO
        BIOP_StreamEvent->messageBody_length = gf_bs_read_int(bs,32);\r
        BIOP_StreamEvent->taps_count = gf_bs_read_int(bs,8);\r
        BIOP_StreamEvent->Taps = (GF_M2TS_DSMCC_BIOP_TAPS*)gf_calloc(BIOP_StreamEvent->taps_count,sizeof(GF_M2TS_DSMCC_BIOP_TAPS));\r
-       for(i=0;i<BIOP_StreamEvent->taps_count;i++){\r
+       for (i=0;i<BIOP_StreamEvent->taps_count;i++) {\r
                BIOP_StreamEvent->Taps[i].id = gf_bs_read_int(bs,16);           \r
                BIOP_StreamEvent->Taps[i].use = gf_bs_read_int(bs,16);          \r
                BIOP_StreamEvent->Taps[i].assocTag = gf_bs_read_int(bs,16);\r
@@ -1241,13 +1230,10 @@ static GF_Err dsmcc_process_biop_stream_event(GF_BitStream* bs,GF_M2TS_DSMCC_BIO
 static GF_Err dsmcc_process_biop_stream_message(GF_BitStream* bs,GF_M2TS_DSMCC_BIOP_HEADER* BIOP_Header,GF_M2TS_DSMCC_SERVICE_GATEWAY* ServiceGateway){\r
 \r
        u32 i;          \r
-       GF_M2TS_DSMCC_BIOP_STREAM_MESSAGE* BIOP_StreamMessage;  \r
-       u32 eventdata,Info_length;\r
+       GF_M2TS_DSMCC_BIOP_STREAM_MESSAGE* BIOP_StreamMessage;\r
 \r
        GF_SAFEALLOC(BIOP_StreamMessage,GF_M2TS_DSMCC_BIOP_STREAM_MESSAGE);\r
 \r
-       eventdata = 0;\r
-\r
        BIOP_StreamMessage->Header = BIOP_Header;\r
        /* Get Info */\r
        BIOP_StreamMessage->Info.aDescription_length = gf_bs_read_int(bs,8);\r
@@ -1261,9 +1247,6 @@ static GF_Err dsmcc_process_biop_stream_message(GF_BitStream* bs,GF_M2TS_DSMCC_B
        BIOP_StreamMessage->Info.video = gf_bs_read_int(bs,8);\r
        BIOP_StreamMessage->Info.data = gf_bs_read_int(bs,8);\r
        \r
-\r
-       Info_length = BIOP_StreamMessage->Header->objectInfo_length - (BIOP_StreamMessage->Info.aDescription_length + 10);\r
-\r
        BIOP_StreamMessage->serviceContextList_count = gf_bs_read_int(bs,8);\r
        if(BIOP_StreamMessage->serviceContextList_count){\r
                BIOP_StreamMessage->ServiceContext = (GF_M2TS_DSMCC_SERVICE_CONTEXT*)gf_calloc(BIOP_StreamMessage->serviceContextList_count,sizeof(GF_M2TS_DSMCC_SERVICE_CONTEXT));\r
@@ -1857,18 +1840,15 @@ static void dsmcc_free_biop_ior(GF_M2TS_DSMCC_IOR* IOR)
        gf_list_del(IOR->taggedProfile);\r
 }\r
 \r
-static void dsmcc_free_biop_descriptor(GF_List* list){\r
+static void dsmcc_free_biop_descriptor(GF_List* list)\r
+{\r
        u8* descr_tag;\r
-       u32 descr_count;\r
-\r
-       descr_count = gf_list_count(list);\r
 \r
-\r
-       while(gf_list_count(list)){\r
+       while(gf_list_count(list)) {\r
 \r
                descr_tag = (u8*)gf_list_get(list,0);           \r
 \r
-               switch(*descr_tag){\r
+               switch(*descr_tag) {\r
 \r
                                case CACHING_PRIORITY_DESCRIPTOR:\r
                                        {\r
index 0349a32ac93871d530aa17b341ade74724757fc8..1882d24eef75029c7873b026402e20fed87ab8ee 100644 (file)
@@ -425,15 +425,16 @@ void gf_m2ts_mpe_send_datagram(GF_M2TS_Demuxer *ts, u32 mpe_pid, unsigned char *
 
 Bool gf_m2ts_compare_ip(u8 rx_ip_adress[4], u8 ip_adress_bootstrap[4])
 {
-       Bool Boostrap_ip;
        u8 i;
-       for (i=0; i<sizeof(rx_ip_adress); i++)
+       for (i=0; i<4; i++)
        {
                if (rx_ip_adress[i] != ip_adress_bootstrap[i])
-                       return Boostrap_ip = 0;
+                       return 0;
        }
-       return Boostrap_ip = 1;
+       return 1;
 }
+
+
 u32 gf_m2ts_ipdatagram_reader(u8 *datagram,GF_M2TS_IP_Packet *ip_packet, u32 offset)
 {
 
@@ -1094,7 +1095,7 @@ void socket_simu(GF_M2TS_IP_Packet *ip_packet, GF_M2TS_Demuxer *ts, Bool yield)
        }
 
        // ********************************************************
-       // Envoi des données
+       // Envoi des donn�es
        // ********************************************************
 
        e = gf_sk_send(Sock_Struct->sock, ip_packet->data, ip_packet->u32_udp_data_size - 8);
index 0bc694f06383fab2a8565230d886d22984dd394b..4a15a7b8bea25e373ad61d3cb05cd6bdbc8f9846 100644 (file)
@@ -167,6 +167,7 @@ static GF_Err gf_isom_streamer_setup_sdp(GF_ISOMRTPStreamer *streamer, char*sdpf
        return GF_OK;
 } 
 
+GF_EXPORT
 GF_Err gf_isom_streamer_write_sdp(GF_ISOMRTPStreamer *streamer, char*sdpfilename) 
 {
        return gf_isom_streamer_setup_sdp(streamer, sdpfilename, NULL);
@@ -198,6 +199,7 @@ void gf_isom_streamer_reset(GF_ISOMRTPStreamer *streamer, Bool is_loop)
        if (is_loop) streamer->timelineOrigin = 0;
 }
 
+GF_EXPORT
 GF_Err gf_isom_streamer_send_next_packet(GF_ISOMRTPStreamer *streamer, s32 send_ahead_delay, s32 max_sleep_time) 
 {
        GF_Err e = GF_OK;
@@ -330,6 +332,7 @@ static u16 check_next_port(GF_ISOMRTPStreamer *streamer, u16 first_port)
        return first_port;
 }
 
+GF_EXPORT
 GF_ISOMRTPStreamer *gf_isom_streamer_new(const char *file_name, const char *ip_dest, u16 port, Bool loop, Bool force_mpeg4, u32 path_mtu, u32 ttl, char *ifce_addr)
 {
        GF_ISOMRTPStreamer *streamer;
@@ -503,6 +506,7 @@ exit:
        return NULL;
 } 
 
+GF_EXPORT
 void gf_isom_streamer_del(GF_ISOMRTPStreamer *streamer) 
 {
        GF_RTPTrack *track = streamer->stream;
index ade42edeff9a967f121c387ee85df60e9c0dcf9a..fdf04ee8b8842cd245bd3c2d602dd7b0bd3a2f74 100644 (file)
@@ -519,6 +519,7 @@ void gf_png_flush(png_structp png)
 }
 
 /* write a png file */
+GF_EXPORT
 GF_Err gf_img_png_enc(char *data, u32 width, u32 height, s32 stride, u32 pixel_format, char *dst, u32 *dst_size)
 {
        GFpng udta;
index 3f336a154d9ca84a1b267042f185834908d478c2..9f37d0119b95726e5205b4656b328b46c16158b8 100644 (file)
@@ -609,6 +609,7 @@ remove_track:
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_media_make_psp(GF_ISOFile *mp4)
 {
        u32 i, count;
@@ -714,7 +715,7 @@ GF_Err gf_media_fragment_file(GF_ISOFile *input, const char *output_file, const
        GF_Err e;
        char sOpt[100], sKey[100];
        char szCodecs[200], szCodec[100];
-       u32 cur_seg, fragment_index, nb_fragments, max_sap_type;
+       u32 cur_seg, fragment_index, max_sap_type;
        GF_ISOFile *output;
        GF_ISOSample *sample, *next;
        GF_List *fragmenters;
@@ -1069,7 +1070,6 @@ restart_fragmentation_pass:
 
 
        max_segment_duration = 0;
-       nb_fragments=0;
 
        while ( (count = gf_list_count(fragmenters)) ) {
 
@@ -1416,8 +1416,6 @@ restart_fragmentation_pass:
 
        if (dash_mode) {
                char buffer[1000];
-               u32 h, m;
-               Double s;
 
                /*flush last segment*/
                if (!switch_segment) {
@@ -1449,9 +1447,8 @@ restart_fragmentation_pass:
                }
 
                period_duration += file_duration;
-               h = (u32) (period_duration/3600);
-               m = (u32) (period_duration-h*60)/60;
-               s = period_duration - h*3600 - m*60;
+               //u32 h = (u32) (period_duration/3600);
+               //u32 m = (u32) (period_duration-h*60)/60;
                bandwidth = (u32) (file_size * 8 / file_duration);
 
                fprintf(mpd, "   <Representation id=\"%d\" mimeType=\"%s/mp4\" codecs=\"%s\"", rep_idx ? rep_idx : 1, audio_only ? "audio" : "video", szCodecs);
@@ -1565,6 +1562,7 @@ err_exit:
 
 #endif /*GPAC_DISABLE_ISOM_FRAGMENTS*/
 
+GF_EXPORT
 GF_Err gf_media_mpd_start(char *mpd_name, char *title, Bool use_url_template, Bool single_segment, char *dash_ctx, GF_ISOFile *init_segment, Double period_duration)
 {
        u32 h, m;
@@ -1627,6 +1625,7 @@ GF_Err gf_media_mpd_start(char *mpd_name, char *title, Bool use_url_template, Bo
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_media_mpd_end(char *mpd_name)
 {
        FILE *mpd = fopen(mpd_name, "a+t");
index be9abf90526260638407436da11e926dfcf4722e..ac98067ac289675ea253ee184c2557a5cfb2791a 100644 (file)
@@ -1569,6 +1569,7 @@ static void gf_m2ts_stream_set_default_slconfig(GF_M2TS_Mux_Stream *stream)
        }
 }
 
+GF_EXPORT
 GF_M2TS_Mux_Stream *gf_m2ts_program_stream_add(GF_M2TS_Mux_Program *program, struct __elementary_stream_ifce *ifce, u32 pid, Bool is_pcr, Bool force_pes)
 {
        GF_M2TS_Mux_Stream *stream, *st;
@@ -1696,6 +1697,7 @@ GF_M2TS_Mux_Stream *gf_m2ts_program_stream_add(GF_M2TS_Mux_Program *program, str
        return stream;
 }
 
+GF_EXPORT
 GF_Err gf_m2ts_program_stream_update_ts_scale(GF_ESInterface *_self, u32 time_scale)
 {
        GF_M2TS_Mux_Stream *stream = (GF_M2TS_Mux_Stream *)_self->output_udta;
@@ -1706,7 +1708,7 @@ GF_Err gf_m2ts_program_stream_update_ts_scale(GF_ESInterface *_self, u32 time_sc
        return GF_OK;
 }
 
-
+GF_EXPORT
 GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid, u32 pmt_refresh_rate, u32 pcr_offset, Bool mpeg4_signaling)
 {
        GF_M2TS_Mux_Program *program;
@@ -1732,6 +1734,7 @@ GF_M2TS_Mux_Program *gf_m2ts_mux_program_add(GF_M2TS_Mux *muxer, u32 program_num
        return program;
 }
 
+GF_EXPORT
 GF_M2TS_Mux *gf_m2ts_mux_new(u32 mux_rate, u32 pat_refresh_rate, Bool real_time)
 {
        GF_BitStream *bs;
@@ -1804,6 +1807,7 @@ void gf_m2ts_mux_program_del(GF_M2TS_Mux_Program *prog)
        gf_free(prog);
 }
 
+GF_EXPORT
 void gf_m2ts_mux_del(GF_M2TS_Mux *mux)
 {
        while (mux->programs) {
@@ -1838,6 +1842,7 @@ void gf_m2ts_mux_update_bitrate(GF_M2TS_Mux *mux)
        }
 }
 
+GF_EXPORT
 void gf_m2ts_mux_update_config(GF_M2TS_Mux *mux, Bool reset_time)
 {
        GF_M2TS_Mux_Program *prog;
@@ -1875,11 +1880,13 @@ void gf_m2ts_mux_update_config(GF_M2TS_Mux *mux, Bool reset_time)
        }
 }
 
+GF_EXPORT
 u32 gf_m2ts_get_sys_clock(GF_M2TS_Mux *muxer)
 {
        return gf_sys_clock() - muxer->init_sys_time;
 }
 
+GF_EXPORT
 u32 gf_m2ts_get_ts_clock(GF_M2TS_Mux *muxer)
 {
        u32 now, init;
@@ -1888,6 +1895,7 @@ u32 gf_m2ts_get_ts_clock(GF_M2TS_Mux *muxer)
        return now-init;
 }
 
+GF_EXPORT
 GF_Err gf_m2ts_mux_use_single_au_pes_mode(GF_M2TS_Mux *muxer, Bool strict_au_pes_mode)
 {
        if (!muxer) return GF_BAD_PARAM;
@@ -1895,6 +1903,7 @@ GF_Err gf_m2ts_mux_use_single_au_pes_mode(GF_M2TS_Mux *muxer, Bool strict_au_pes
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_m2ts_mux_set_initial_pcr(GF_M2TS_Mux *muxer, u64 init_pcr_value)
 {
        if (!muxer) return GF_BAD_PARAM;
@@ -1902,6 +1911,7 @@ GF_Err gf_m2ts_mux_set_initial_pcr(GF_M2TS_Mux *muxer, u64 init_pcr_value)
        return GF_OK;
 }
 
+GF_EXPORT
 const char *gf_m2ts_mux_process(GF_M2TS_Mux *muxer, u32 *status)
 {
        GF_M2TS_Mux_Program *program;
index 5b632f59a4a10b89fc4d8a5642e1c07797a1b7c8..25deb74954d02a26386095b0110722c1c09abbd4 100644 (file)
@@ -3700,6 +3700,7 @@ exit:
        return e;
 }
 
+GF_EXPORT
 GF_Err gf_media_avc_rewrite_samples(GF_ISOFile *file, u32 track, u32 prev_size, u32 new_size)
 {
        u32 i, count, di, remain, msize;
@@ -5483,7 +5484,6 @@ void m2ts_rewrite_avc_sample(GF_MediaImporter *import, GF_TSImport *tsimp)
 {
        GF_Err e;
        u32 sc_pos, start;
-       char *data;
        GF_BitStream *bs;
        GF_ISOSample *samp;
        u32 count = gf_isom_get_sample_count(import->dest, tsimp->track);
@@ -5493,7 +5493,6 @@ void m2ts_rewrite_avc_sample(GF_MediaImporter *import, GF_TSImport *tsimp)
        sc_pos = 1;
        start = 0;
        bs = gf_bs_new(samp->data, samp->dataLength, GF_BITSTREAM_WRITE);
-       data = samp->data;
        while (1) {
                if (!samp->data[start+sc_pos] && !samp->data[start+sc_pos+1] && !samp->data[start+sc_pos+2] && (samp->data[start+sc_pos+3]==1)) {
                        gf_bs_seek(bs, start);
index feeed1c1d2ed74ce809b41ca1bc906224d438f3b..bf2578a7c636670edcc987bc44f53dd213281fb8 100644 (file)
@@ -159,6 +159,7 @@ GF_Err gf_mpd_parse_base_url(GF_List *container, GF_XMLNode *node)
        GF_SAFEALLOC(url, GF_MPD_BaseURL);
        if (! url) return GF_OUT_OF_MEM;
        e = gf_list_add(container, url);
+       if (e) return GF_OUT_OF_MEM;
 
        i = 0;
        while ( (att = gf_list_enum(node->attributes, &i))) {
@@ -653,7 +654,7 @@ static GF_Err gf_mpd_parse_period(GF_MPD *mpd, GF_XMLNode *root)
        return GF_OK;
 }
 
-
+GF_EXPORT
 GF_MPD *gf_mpd_new()
 {
        GF_MPD *mpd;
@@ -826,6 +827,7 @@ void gf_mpd_period_free(void *_item)
        gf_free(ptr);
 }
 
+GF_EXPORT
 void gf_mpd_del(GF_MPD *mpd)
 {
        gf_mpd_del_list(mpd->program_infos, gf_mpd_prog_info_free, 0);
@@ -838,6 +840,7 @@ void gf_mpd_del(GF_MPD *mpd)
        gf_free(mpd);
 }
 
+GF_EXPORT
 GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd, const char *default_base_url)
 {
        GF_Err e;
@@ -891,6 +894,8 @@ GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd, const char *default_b
                        mpd->max_subsegment_duration = gf_mpd_parse_duration(att->value);
                }
        }
+       if (mpd->type == GF_MPD_TYPE_STATIC)
+               mpd->minimum_update_period = 0;
 
        child_index = 0;
        while (1) {
@@ -920,6 +925,7 @@ GF_Err gf_mpd_init_from_dom(GF_XMLNode *root, GF_MPD *mpd, const char *default_b
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_m3u8_to_mpd(const char *m3u8_file, const char *base_url,
                                          const char *mpd_file,
                                          u32 reload_count, char *mimeTypeForM3U8Segments, GF_ClientService *service, Bool do_import, Bool use_mpd_templates)
index 22b243c5844d096120e99b7125478400662e1d60..6c214e3f5c2357e24f93ac01a1f6b7da77d2b97b 100644 (file)
@@ -46,6 +46,8 @@
 
 #define DEBUG_TS_PACKET 0
 
+
+GF_EXPORT
 const char *gf_m2ts_get_stream_name(u32 streamType)
 {
        switch (streamType) {
@@ -2232,6 +2234,7 @@ static void gf_m2ts_process_packet(GF_M2TS_Demuxer *ts, unsigned char *data)
        return;
 }
 
+GF_EXPORT
 GF_Err gf_m2ts_process_data(GF_M2TS_Demuxer *ts, char *data, u32 data_size)
 {
        u32 pos;
@@ -2329,6 +2332,7 @@ void gf_m2ts_set_segment_switch(GF_M2TS_Demuxer *ts)
        }
 }
 
+GF_EXPORT
 void gf_m2ts_reset_parsers(GF_M2TS_Demuxer *ts)
 {
        u32 i;
@@ -2391,6 +2395,7 @@ static void gf_m2ts_process_section_discard(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION
 {
 }
 
+GF_EXPORT
 GF_Err gf_m2ts_set_pes_framing(GF_M2TS_PES *pes, u32 mode)
 {
        GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] Setting pes framing mode of PID %d to %d\n", pes->pid, mode) );
@@ -2452,6 +2457,7 @@ GF_Err gf_m2ts_set_pes_framing(GF_M2TS_PES *pes, u32 mode)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_M2TS_Demuxer *gf_m2ts_demux_new()
 {
        GF_M2TS_Demuxer *ts;
@@ -2480,6 +2486,7 @@ GF_M2TS_Demuxer *gf_m2ts_demux_new()
        return ts;
 }
 
+GF_EXPORT
 void gf_m2ts_demux_dmscc_init(GF_M2TS_Demuxer *ts){
 
        char* temp_dir;
@@ -2504,6 +2511,7 @@ void gf_m2ts_demux_dmscc_init(GF_M2TS_Demuxer *ts){
 
 }
 
+GF_EXPORT
 void gf_m2ts_demux_del(GF_M2TS_Demuxer *ts)
 {
        u32 i;
@@ -2908,6 +2916,7 @@ static GF_Err gf_dvb_tune(GF_Tuner *tuner, const char *url, const char *chan_pat
        return GF_OK;
 }
 
+GF_EXPORT
 u32 gf_dvb_get_freq_from_url(const char *channels_config_path, const char *url)
 {
        FILE *channels_config_file;
@@ -3003,6 +3012,7 @@ static GF_Err TSDemux_SetupFile(GF_M2TS_Demuxer *ts, char *url)
 
 }
 
+GF_EXPORT
 GF_Err TSDemux_Demux_Setup(GF_M2TS_Demuxer *ts, const char *url, Bool loop)
 {
        char szURL[2048];
@@ -3041,6 +3051,7 @@ GF_Err TSDemux_Demux_Setup(GF_M2TS_Demuxer *ts, const char *url, Bool loop)
        return GF_NOT_SUPPORTED;
 }
 
+GF_EXPORT
 GF_Err TSDemux_CloseDemux(GF_M2TS_Demuxer *ts)
 {
        GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[TSDemux] Destroying demuxer\n"));
@@ -3059,7 +3070,7 @@ GF_Err TSDemux_CloseDemux(GF_M2TS_Demuxer *ts)
        return GF_OK;
 }
 
-
+GF_EXPORT
 GF_Err TSDemux_DemuxPlay(GF_M2TS_Demuxer *ts){
 
        /*set the state variable outside the TS thread. If inside, we may get called for shutdown before the TS thread has started
index 5a04550b6776ed8d30e8f7bb54f466153609aaed..021b4e582a2669466308c4da7d3a4fdea6873a4b 100644 (file)
@@ -414,6 +414,7 @@ static GF_Err gf_sm_encode_scene(GF_SceneManager *ctx, GF_ISOFile *mp4, GF_SMEnc
        GF_ISOSample *samp;
        GF_StreamContext *sc;
        GF_ESD *esd;
+       GF_MuxInfo *mux;
 #ifndef GPAC_DISABLE_BIFS_ENC
        GF_BifsEncoder *bifs_enc;
 #endif
@@ -896,6 +897,14 @@ force_scene_rap:
                gf_sm_finalize_mux(mp4, esd, (u32) init_offset);
                gf_isom_set_last_sample_duration(mp4, track, 0);
 
+               mux = gf_sm_get_mux_info(esd);
+               if (mux && mux->duration) {
+                       u64 tot_dur = mux->duration * esd->slConfig->timestampResolution / 1000;
+                       u64 dur = gf_isom_get_media_duration(mp4, track);
+                       if (dur <= tot_dur)
+                               gf_isom_set_last_sample_duration(mp4, track, (u32) (tot_dur - dur));
+               }
+
                if (delete_desc) {
                        gf_odf_desc_del((GF_Descriptor *) esd);
                        esd = NULL;
index de85f89d0b516f6772bd504eefffc301874fc851..78b908c242f4c58e78cea50f17dafcca7243aa7a 100644 (file)
@@ -3755,7 +3755,7 @@ GF_Err gf_sm_load_init_bt(GF_SceneLoader *load)
 }
 
 
-
+GF_EXPORT
 GF_List *gf_sm_load_bt_from_string(GF_SceneGraph *in_scene, char *node_str, Bool force_wrl)
 {
        GF_SceneLoader ctx;
index a2d1806e9d02d4b6f45c822b1701245b6b6197e2..c1e2ad6df783ffb3ee3aee21e8a285fe12d87744 100644 (file)
@@ -42,6 +42,7 @@ static void node_modif_stub(GF_SceneGraph *sg, GF_Node *node, GF_FieldInfo *info
 {
 }
 
+GF_EXPORT
 GF_SceneGraph *gf_sg_new()
 {
        GF_SceneGraph *tmp;
@@ -522,6 +523,7 @@ void gf_sg_set_private(GF_SceneGraph *sg, void *ptr)
        if (sg) sg->userpriv = ptr;
 }
 
+GF_EXPORT
 void *gf_sg_get_private(GF_SceneGraph *sg)
 {
        return sg ? sg->userpriv : NULL;
@@ -1977,6 +1979,7 @@ static GF_Err gf_node_get_field_by_name_enum(GF_Node *node, char *name, GF_Field
        return GF_BAD_PARAM;
 }
 
+GF_EXPORT
 GF_Err gf_node_get_field_by_name(GF_Node *node, char *name, GF_FieldInfo *field)
 {
        s32 res = -1;
@@ -2135,6 +2138,7 @@ u32 gf_xml_get_namespace_id(char *name)
        return GF_XMLNS_UNDEFINED;
 }
 
+GF_EXPORT
 GF_Err gf_sg_add_namespace(GF_SceneGraph *sg, char *name, char *qname)
 {
        u32 id;
@@ -2241,6 +2245,7 @@ const char *gf_sg_get_namespace(GF_SceneGraph *sg, u32 xmlns_id)
 }
 
 
+GF_EXPORT
 char *gf_node_dump_attribute(GF_Node *n, GF_FieldInfo *info)
 {
 #ifndef GPAC_DISABLE_SVG
index d244c57220c52f821a4f1f82c2a26abbea3b881e..6d06516ea51de1c62f959e573ad39b074a5047a1 100644 (file)
@@ -29,6 +29,8 @@
 
 #include <gpac/internal/laser_dev.h>
 
+
+GF_EXPORT
 GF_Command *gf_sg_command_new(GF_SceneGraph *graph, u32 tag)
 {
        GF_Command *ptr;
@@ -872,6 +874,7 @@ GF_Err gf_sg_command_apply(GF_SceneGraph *graph, GF_Command *com, Double time_of
        return GF_OK;
 }
 
+GF_EXPORT
 GF_CommandField *gf_sg_command_field_new(GF_Command *com)
 {
        GF_CommandField *ptr;
index a435a53ecad2dc0fcf525f7da367dbac24270ee1..4739de24d6cf70d82b5b4b16175d40972fe8f575 100644 (file)
@@ -125,6 +125,7 @@ GF_Err gf_sg_listener_add(GF_Node *listener, GF_DOMEventTarget *evt_target)
        return gf_list_add(evt_target->evt_list, listener);
 }
 
+GF_EXPORT
 GF_Err gf_node_dom_listener_add(GF_Node *node, GF_Node *listener)
 {
        if (!node || !listener) return GF_BAD_PARAM;
@@ -143,6 +144,7 @@ GF_Err gf_node_dom_listener_add(GF_Node *node, GF_Node *listener)
        return gf_sg_listener_add(listener, node->sgprivate->interact->dom_evt);
 }
 
+GF_EXPORT
 GF_Err gf_dom_listener_del(GF_Node *listener, GF_DOMEventTarget *target)
 {
        GF_FieldInfo info;
@@ -713,6 +715,7 @@ void gf_smil_setup_events(GF_Node *node)
                gf_smil_setup_event_list(node, * (GF_List **)info.far_ptr, 0);
 }
 
+GF_EXPORT
 void gf_dom_set_textContent(GF_Node *n, char *text)
 {
        GF_ParentNode *par = (GF_ParentNode *)n;
@@ -721,6 +724,7 @@ void gf_dom_set_textContent(GF_Node *n, char *text)
        if (text) gf_dom_add_text_node(n, gf_strdup( text) );
 }
 
+GF_EXPORT
 GF_DOMText *gf_dom_add_text_node(GF_Node *parent, char *text_data)
 {
        GF_DOMText *text;
@@ -742,6 +746,7 @@ GF_DOMText *gf_dom_new_text_node(GF_SceneGraph *sg)
        return text;
 }
 
+GF_EXPORT
 char *gf_dom_flatten_textContent(GF_Node *n)
 {
        u32 len = 0;
index 8b4ec65f1de08decc53d91b51c89f81e32a9e11a..02a9bbdfd66c94ef1568b98a94e98ab813f364e8 100644 (file)
@@ -3274,7 +3274,7 @@ static JSBool dcci_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, js
        GF_DOMFullNode *n;
        GF_DOM_Event evt;
        char *str;
-       jsval readonly;
+       jsval readonly=0;
        if (!JS_InstanceOf(c, obj, &dom_rt->DCCIClass, NULL) ) return JS_TRUE;
        n = (GF_DOMFullNode*) dom_get_node(c, obj);
        if (!n) return JS_TRUE;
index df72149cc1d59001efeffbed723a546df5ea6114..07d1a368c4021b80190d4c0127119433d37462c7 100644 (file)
@@ -37996,6 +37996,7 @@ u32 gf_sg_mpeg4_node_get_child_ndt(GF_Node *node)
 }
 
 
+GF_EXPORT
 u32 gf_node_mpeg4_type_by_class_name(const char *node_name)
 {
        if(!node_name) return 0;
index a6a7802fada77a5b2d03338486697e4097ec559a..e09a0729acc8462dee29c3a69347be491fa24c96 100644 (file)
@@ -166,6 +166,7 @@ static const struct dom_event_def {u32 event;  const char *name; u32 category; }
        { GF_EVENT_VP_RESIZE, "gpac_vp_changed", GF_DOM_EVENT_DOM },
 };
 
+GF_EXPORT
 u32 gf_dom_event_type_by_name(const char *name)
 {
        u32 i, count;
@@ -408,6 +409,9 @@ static const struct predef_keyid {u32 key_code;  const char *name; } predefined_
        { GF_KEY_RECORD, "Record" },
        { GF_KEY_BEGINPAGE, "BeginPage" }
 };
+
+
+GF_EXPORT
 const char *gf_dom_get_key_name(u32 key_identifier)
 {
        u32 count = sizeof(predefined_key_identifiers) / sizeof(struct predef_keyid);
@@ -3071,6 +3075,7 @@ GF_Err gf_svg_parse_element_id(GF_Node *n, const char *nodename, Bool warning_if
 }
 
 /* Parse an SVG attribute */
+GF_EXPORT
 GF_Err gf_svg_parse_attribute(GF_Node *n, GF_FieldInfo *info, char *attribute_content, u8 anim_value_type)
 {
     /* for all attributes, except strings, apply some sort of white space normalization*/
index 7a1bd54f570fb3208e73b654181b67c2d06d4746..d32206130966ec5cf011517e8806f2a48ed2225a 100644 (file)
@@ -2422,17 +2422,17 @@ static void svg_script_predestroy(GF_Node *n, void *eff, Bool is_destroy)
 static GF_Err JSScript_CreateSVGContext(GF_SceneGraph *sg)
 {
        GF_SVGJS *svg_js;
-       Bool do_lock = gf_sg_javascript_initialized();
        GF_SAFEALLOC(svg_js, GF_SVGJS);
 
-       if (do_lock) gf_sg_lock_javascript(NULL, 1);
        /*create new ecmascript context*/
        svg_js->js_ctx = gf_sg_ecmascript_new(sg);
        if (!svg_js->js_ctx) {
                gf_free(svg_js);
-               if (do_lock) gf_sg_lock_javascript(NULL, 0);
                return GF_SCRIPT_ERROR;
        }
+
+       gf_sg_lock_javascript(svg_js->js_ctx, 1);
+
        if (!svg_rt) {
                GF_SAFEALLOC(svg_rt, GF_SVGuDOM);
                JS_SETUP_CLASS(svg_rt->svgElement, "SVGElement", JSCLASS_HAS_PRIVATE, svg_element_getProperty, svg_element_setProperty, dom_element_finalize);
@@ -2449,10 +2449,12 @@ static GF_Err JSScript_CreateSVGContext(GF_SceneGraph *sg)
        sg->svg_js = svg_js;
        /*load SVG & DOM APIs*/
        svg_init_js_api(sg);
-       if (do_lock) gf_sg_lock_javascript(NULL, 0);
 
        svg_js->script_execute = svg_script_execute;
        svg_js->handler_execute = svg_script_execute_handler;
+
+       gf_sg_lock_javascript(svg_js->js_ctx, 0);
+
        return GF_OK;
 }
 
index 13a48eee343d9aa4d4e2a7fc8304bc05ee5f956c..17b4a5f63b23cd33917d3e7470cb1304053820b0 100644 (file)
@@ -351,6 +351,7 @@ Bool gf_sg_route_activate(GF_Route *r)
 }
 
 
+GF_EXPORT
 void gf_node_event_out(GF_Node *node, u32 FieldIndex)
 {
        u32 i;
index 7de338673a23217f5a892f4a1bf3c33451f4f1c3..d51f74f3ab687af5eb54ef7eea0f12e3a6630bae 100644 (file)
@@ -288,6 +288,7 @@ GF_Err gf_sg_script_field_get_info(GF_ScriptField *field, GF_FieldInfo *info)
        return GF_OK;
 }
 
+GF_EXPORT
 void gf_sg_script_event_in(GF_Node *node, GF_FieldInfo *in_field)
 {
        GF_ScriptPriv *priv = (GF_ScriptPriv *)node->sgprivate->UserPrivate;
index e7961c390cf3df79afa1a697ba5984e99fc70b5f..8ef6f5e18caa056e263b344e3c2b715ea5dd42af 100644 (file)
@@ -37,6 +37,7 @@
 
 
 /*fixes for JS > 1.8.0rc1 where GC routines have changed*/
+GF_EXPORT
 Bool gf_js_add_root(JSContext *cx, void *rp, u32 type)
 {
 #if (JS_VERSION>=185)
@@ -83,6 +84,8 @@ Bool gf_js_add_named_root(JSContext *cx, void *rp, u32 type, const char *name)
        return (JS_AddNamedRoot(cx, rp, name)==JS_TRUE) ? 1 : 0;
 #endif
 }
+
+GF_EXPORT
 Bool gf_js_remove_root(JSContext *cx, void *rp, u32 type)
 {
 #if (JS_VERSION>=185)
@@ -319,15 +322,25 @@ JSContext *gf_sg_ecmascript_new(GF_SceneGraph *sg)
                gf_sg_load_script_modules(sg);
        }
        js_rt->nb_inst++;
+
+       gf_mx_p(js_rt->mx);
+#if defined(JS_THREADSAFE) && (JS_VERSION>=185)
+       if (gf_mx_get_num_locks(js_rt->mx)==1) {
+               JS_SetRuntimeThread(js_rt->js_runtime);
+       }
+#endif
+
        ctx = JS_NewContext(js_rt->js_runtime, STACK_CHUNK_BYTES);
        JS_SetOptions(ctx, JS_GetOptions(ctx) | JSOPTION_WERROR);
 
-#ifdef JS_THREADSAFE
-#if (JS_VERSION>=185)
+#if defined(JS_THREADSAFE) && (JS_VERSION>=185)
        JS_ClearContextThread(ctx);
-       JS_ClearRuntimeThread(js_rt->js_runtime);
-#endif
+       if (gf_mx_get_num_locks(js_rt->mx)==1) {
+               JS_ClearRuntimeThread(js_rt->js_runtime);
+       }
 #endif
+       gf_mx_v(js_rt->mx);
+
        return ctx;
 }
 
@@ -355,6 +368,8 @@ void gf_sg_ecmascript_del(JSContext *ctx)
        }
 }
 
+
+GF_EXPORT
 #if (JS_VERSION>=185)
 JSBool gf_sg_js_has_instance(JSContext *c, JSObject *obj,const jsval *val, JSBool *vp)
 #else
@@ -4421,12 +4436,12 @@ Bool JSScriptFromFile(GF_Node *node, const char *opt_file, Bool no_complain)
        return 0;
 }
 
+
 static void JSScript_LoadVRML(GF_Node *node)
 {
        char *str;
        JSBool ret;
        u32 i;
-       Bool do_lock = gf_sg_javascript_initialized();
        Bool local_script;
        jsval rval, fval;
        M_Script *script = (M_Script *)node;
@@ -4453,15 +4468,14 @@ static void JSScript_LoadVRML(GF_Node *node)
        }
        local_script = str ? 1 : 0;
 
-       if (do_lock) gf_sg_lock_javascript(priv->js_ctx, 1);
+       /*lock runtime and set current thread before creating the context*/
        priv->js_ctx = gf_sg_ecmascript_new(node->sgprivate->scenegraph);
        if (!priv->js_ctx) {
-               if (do_lock) gf_sg_lock_javascript(priv->js_ctx, 0);
                GF_LOG(GF_LOG_ERROR, GF_LOG_SCRIPT, ("[VRML JS] Cannot allocate ECMAScript context for node\n"));
                return;
        }
 
-       if (!do_lock) gf_sg_lock_javascript(priv->js_ctx, 1);
+       gf_sg_lock_javascript(priv->js_ctx, 1);
 
        JS_SetContextPrivate(priv->js_ctx, node);
        gf_sg_script_init_sm_api(priv, node);
@@ -4744,6 +4758,7 @@ void gf_sg_set_script_action(GF_SceneGraph *scene, gf_sg_script_action script_ac
 
 #ifdef GPAC_HAS_SPIDERMONKEY
 
+GF_EXPORT
 GF_Node *gf_sg_js_get_node(JSContext *c, JSObject *obj)
 {
 #ifndef GPAC_DISABLE_VRML
@@ -4776,13 +4791,6 @@ Bool gf_sg_has_scripting()
 #endif
 }
 
-Bool gf_sg_javascript_initialized()
-{
-#ifdef GPAC_HAS_SPIDERMONKEY
-       if (js_rt) return 1;
-#endif
-       return 0;
-}
 
 #ifdef GPAC_HAS_SPIDERMONKEY
 
@@ -4794,13 +4802,15 @@ Bool gf_sg_javascript_initialized()
  * (mozilla doc is wrong here)
  *
  * */
+GF_EXPORT
 void gf_sg_lock_javascript(struct JSContext *cx, Bool LockIt)
 {
        if (!js_rt) return;
-       assert(cx);
+
        if (LockIt) {
                gf_mx_p(js_rt->mx);
 #ifdef JS_THREADSAFE
+               assert(cx);
                if (gf_mx_get_num_locks(js_rt->mx)==1) {
 #if (JS_VERSION>=185)
                        JS_SetRuntimeThread(js_rt->js_runtime);
@@ -4811,6 +4821,7 @@ void gf_sg_lock_javascript(struct JSContext *cx, Bool LockIt)
 #endif
        } else {
 #ifdef JS_THREADSAFE
+               assert(cx);
                if (gf_mx_get_num_locks(js_rt->mx)==1) {
                        JS_EndRequest(cx);
 #if (JS_VERSION>=185)
@@ -4823,6 +4834,7 @@ void gf_sg_lock_javascript(struct JSContext *cx, Bool LockIt)
        }
 }
 
+GF_EXPORT
 Bool gf_sg_try_lock_javascript(struct JSContext *cx)
 {
        assert(cx);
index 5c73e63f36afbeeb8d5f7b5db80c48c3d1a4794d..7459f2689ee9e410e5e9b00523bd1ff472d17d57 100644 (file)
@@ -33,6 +33,7 @@
 #include <gpac/internal/bifs_dev.h>
 
 
+GF_EXPORT
 Bool gf_node_in_table_by_tag(u32 tag, u32 NDTType)
 {
        if (!tag) return 0;
@@ -652,6 +653,7 @@ void gf_sg_vrml_field_pointer_del(void *field, u32 FieldType)
 /*********************************************************************
                MF Fields manipulation (alloc, gf_realloc, GetAt)
 *********************************************************************/
+GF_EXPORT
 const char *gf_sg_vrml_get_event_type_name(u32 EventType, Bool forX3D)
 {
        switch (EventType) {
@@ -663,6 +665,7 @@ const char *gf_sg_vrml_get_event_type_name(u32 EventType, Bool forX3D)
        }
 }
 
+GF_EXPORT
 const char *gf_sg_vrml_get_field_type_by_name(u32 FieldType)
 {
 
@@ -753,6 +756,7 @@ u32 gf_sg_field_type_by_name(char *fieldType)
 
 void gf_sg_sfurl_del(SFURL url) { if (url.url) gf_free(url.url); }
 
+GF_EXPORT
 Bool gf_sg_vrml_is_sf_field(u32 FieldType)
 {
        return (FieldType<GF_SG_VRML_FIRST_MF);
@@ -859,6 +863,7 @@ u32 gf_sg_vrml_get_sf_size(u32 FieldType)
        }
 }
 
+GF_EXPORT
 u32 gf_sg_vrml_get_sf_type(u32 FieldType)
 {
        switch (FieldType) {
@@ -1038,6 +1043,7 @@ GF_Err gf_sg_vrml_mf_alloc(void *mf, u32 FieldType, u32 NbItems)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_sg_vrml_mf_get_item(void *mf, u32 FieldType, void **new_ptr, u32 ItemPos)
 {
        u32 FieldSize;
index 8ca5e4147899a231fe89461a8be9fe9eaefe59b9..78d059bffca13d31310e44c7f7cb060a002d5276 100644 (file)
@@ -15348,6 +15348,7 @@ GF_Err gf_sg_x3d_node_get_field(GF_Node *node, GF_FieldInfo *field)
 }
 
 
+GF_EXPORT
 u32 gf_node_x3d_type_by_class_name(const char *node_name)
 {
        if(!node_name) return 0;
index 42b3240230504c44fe9d9c10d3a1819e464714e4..2e723772e4a753e01e3cce8c65eb12e3e9a83e83 100644 (file)
@@ -718,6 +718,7 @@ SVGAttribute *gf_node_create_attribute_from_datatype(u32 data_type, u32 attribut
        return att;
 }
 
+GF_EXPORT
 GF_Err gf_node_get_attribute_by_name(GF_Node *node, char *name, u32 xmlns_code, Bool create_if_not_found, Bool set_default, GF_FieldInfo *field)
 {
        u32 attribute_tag = gf_xml_get_attribute_tag(node, name, xmlns_code);
index 4441ae95e85bbc11369b6bcaa8786ec5a73397bc..6fd214a46d9ea4b4f976dc6fdee4526e0fe50617 100644 (file)
@@ -75,6 +75,7 @@ GF_Codec *gf_codec_use_codec(GF_Codec *codec, GF_ObjectManager *odm)
        tmp->odm = odm;
        tmp->flags = codec->flags | GF_ESM_CODEC_IS_USE;
        tmp->decio = codec->decio;
+       tmp->process = codec->process;
        return tmp;
 }
 
index 85015f172dc5f4f65a031f3b85801c76374a9cd3..10bc92c1ed29e5a0fe0f94a15554c57ace1bc78f 100644 (file)
@@ -889,6 +889,7 @@ GF_ClientService *gf_term_service_new(GF_Terminal *term, struct _od_manager *own
        return serv;
 }
 
+GF_EXPORT
 Bool gf_term_is_supported_url(GF_Terminal *term, const char *fileName, Bool use_parent_url, Bool no_mime_check)
 {
        GF_InputService *ifce;
index ed6fed0f3336c1d1cfc852dd230b567c420bfb24..a034b2c9ce50112361b3f2d0458f8372937a4eff 100644 (file)
@@ -60,6 +60,7 @@ static Bool gf_term_check_odm(GF_Terminal *term, GF_ObjectManager *odm)
 
 
 /*returns top-level OD of the presentation*/
+GF_EXPORT
 GF_ObjectManager *gf_term_get_root_object(GF_Terminal *term)
 {
        if (!term) return NULL;
@@ -68,6 +69,7 @@ GF_ObjectManager *gf_term_get_root_object(GF_Terminal *term)
 }
 
 /*returns number of sub-ODs in the current root. scene_od must be an inline OD*/
+GF_EXPORT
 u32 gf_term_get_object_count(GF_Terminal *term, GF_ObjectManager *scene_od)
 {
        if (!term || !scene_od) return 0;
@@ -77,6 +79,7 @@ u32 gf_term_get_object_count(GF_Terminal *term, GF_ObjectManager *scene_od)
 }
 
 /*returns indexed (0-based) OD manager in the scene*/
+GF_EXPORT
 GF_ObjectManager *gf_term_get_object(GF_Terminal *term, GF_ObjectManager *scene_od, u32 index)
 {
        if (!term || !scene_od) return NULL;
@@ -85,6 +88,7 @@ GF_ObjectManager *gf_term_get_object(GF_Terminal *term, GF_ObjectManager *scene_
        return (GF_ObjectManager *) gf_list_get(scene_od->subscene->resources, index);
 }
 
+GF_EXPORT
 u32 gf_term_object_subscene_type(GF_Terminal *term, GF_ObjectManager *odm)
 {
        if (!term || !odm) return 0;
@@ -106,6 +110,7 @@ void gf_term_select_object(GF_Terminal *term, GF_ObjectManager *odm)
        gf_scene_select_object(term->root_scene, odm);
 }
 
+GF_EXPORT
 u32 gf_term_get_current_service_id(GF_Terminal *term)
 {
        SFURL *the_url;
@@ -131,6 +136,7 @@ static void get_codec_stats(GF_Codec *dec, GF_MediaInfo *info)
        info->total_dec_time = dec->total_dec_time;
 }
 
+GF_EXPORT
 GF_Err gf_term_get_object_info(GF_Terminal *term, GF_ObjectManager *odm, GF_MediaInfo *info)
 {
        GF_Channel *ch;
@@ -268,7 +274,7 @@ GF_Err gf_term_get_object_info(GF_Terminal *term, GF_ObjectManager *odm, GF_Medi
        return GF_OK;
 }
 
-
+GF_EXPORT
 Bool gf_term_get_download_info(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, const char **server, const char **path, u32 *bytes_done, u32 *total_bytes, u32 *bytes_per_sec)
 {
        GF_DownloadSession * sess;
@@ -283,6 +289,7 @@ Bool gf_term_get_download_info(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_
        return 1;
 }
 
+GF_EXPORT
 Bool gf_term_get_channel_net_info(GF_Terminal *term, GF_ObjectManager *odm, u32 *d_enum, u32 *chid, NetStatCommand *netcom, GF_Err *ret_code)
 {
        GF_Channel *ch;
@@ -305,6 +312,7 @@ Bool gf_term_get_channel_net_info(GF_Terminal *term, GF_ObjectManager *odm, u32
        return 1;
 }
 
+GF_EXPORT
 GF_Err gf_term_get_service_info(GF_Terminal *term, GF_ObjectManager *odm, NetInfoCommand *netinfo)
 {
        GF_Err e;
@@ -317,7 +325,7 @@ GF_Err gf_term_get_service_info(GF_Terminal *term, GF_ObjectManager *odm, NetInf
        return e;
 }
 
-
+GF_EXPORT
 const char *gf_term_get_world_info(GF_Terminal *term, GF_ObjectManager *scene_od, GF_List *descriptions)
 {
        GF_Node *info;
@@ -351,7 +359,7 @@ const char *gf_term_get_world_info(GF_Terminal *term, GF_ObjectManager *scene_od
        return "GPAC";
 }
 
-
+GF_EXPORT
 GF_Err gf_term_dump_scene(GF_Terminal *term, char *rad_name, char **filename, Bool xml_dump, Bool skip_protos, GF_ObjectManager *scene_od)
 {
 #ifndef GPAC_DISABLE_SCENE_DUMP
index d1621a86bc10791196af7f874b9fc53b08f11d28..938811b2a1e34a2be818da72b83efd5654f07ae3 100644 (file)
@@ -284,7 +284,6 @@ void gf_odm_setup_entry_point(GF_ObjectManager *odm, const char *service_sub_url
        u32 od_type;
        char *ext;
        char *sub_url = (char *) service_sub_url;
-       GF_Terminal *term;
        GF_Descriptor *desc;
 
        if (odm->flags & GF_ODM_DESTROYED) {
@@ -293,8 +292,6 @@ void gf_odm_setup_entry_point(GF_ObjectManager *odm, const char *service_sub_url
        }
 //     assert(odm->OD==NULL);
 
-       term = odm->term;
-
        GF_LOG(GF_LOG_DEBUG, GF_LOG_MEDIA, ("[ODM] Setting up root object for %s\n", odm->net_service->url));
 
        if (odm->subscene) od_type = GF_MEDIA_OBJECT_SCENE;
@@ -585,10 +582,12 @@ void gf_odm_setup_object(GF_ObjectManager *odm, GF_ClientService *serv)
                        return;
                }
                odm->net_service = serv;
+               assert(odm->OD);
                if (!odm->OD->URLString) 
                        odm->net_service->nb_odm_users++;
        }       
        /*if this is a remote OD, we need a new manager and a new service...*/
+       assert(odm->OD);
        if (odm->OD->URLString) {
                GF_ClientService *parent = odm->net_service;
                char *url = odm->OD->URLString;
@@ -1881,6 +1880,7 @@ GF_Segment *gf_odm_find_segment(GF_ObjectManager *odm, char *descName)
 {
        GF_Segment *desc;
        u32 i = 0;
+       if (!odm->OD) return NULL;
        while ( (desc = (GF_Segment *)gf_list_enum(odm->OD->OCIDescriptors, &i)) ){
                if (desc->tag != GF_ODF_SEGMENT_TAG) continue;
                if (!stricmp(desc->SegmentName, descName)) return desc;
index fb4fcfa58d26c2f9716ca6a82408b7c42b02cc35..f28c221b9c3c53dd76fdee4aa81f936455815cf3 100644 (file)
@@ -82,7 +82,7 @@ static void inline_on_media_event(GF_Scene *scene, u32 type)
        gf_term_service_media_event(scene->scene_codec->odm, type); 
 }
 
-
+GF_EXPORT
 GF_Scene *gf_scene_new(GF_Scene *parentScene)
 {
        GF_Scene *tmp;
index bd44c1d1f2664794a7ac8210d9141a5f2729c44b..44ab289fb3ce2596457382d7f9264efa5d0fd2fd 100644 (file)
@@ -782,6 +782,7 @@ void gf_term_message(GF_Terminal *term, const char *service, const char *message
        gf_term_send_event(term, &evt);
 }
 
+GF_EXPORT
 GF_Err gf_term_step_clocks(GF_Terminal * term, u32 ms_diff)
 {
        u32 i, j;
@@ -1223,6 +1224,7 @@ void gf_term_lock_compositor(GF_Terminal *term, Bool LockIt)
 }
 
 /*locks media quaue*/
+GF_EXPORT
 void gf_term_lock_media_queue(GF_Terminal *term, Bool LockIt)
 {
        if (LockIt) {
@@ -1270,7 +1272,7 @@ static void media_event_collect_info(GF_ClientService *net, GF_ObjectManager *od
 void gf_term_service_media_event_with_download(GF_ObjectManager *odm, u32 event_type, u64 loaded_size, u64 total_size, u32 bytes_per_sec)
 {
 #ifndef GPAC_DISABLE_SVG
-       u32 i, count, min_buffer, min_time, transport;
+       u32 i, count, min_buffer, min_time;
        Bool locked;
        GF_DOMMediaEvent media_event;
        GF_DOM_Event evt;
@@ -1289,7 +1291,6 @@ void gf_term_service_media_event_with_download(GF_ObjectManager *odm, u32 event_
 
 
        memset(&media_event, 0, sizeof(GF_DOMMediaEvent));
-       transport = 0;
        media_event.bufferValid = 0;
        media_event.session_name = odm->net_service->url;
 
@@ -1337,6 +1338,7 @@ void gf_term_service_media_event(GF_ObjectManager *odm, u32 event_type)
 }
 
 /* Browses all registered relocators (ZIP-based, ISOFF-based or file-system-based to relocate a URI based on the locale */
+GF_EXPORT
 Bool gf_term_relocate_url(GF_Terminal *term, const char *service_url, const char *parent_url, char *out_relocated_url, char *out_localized_url) 
 {
        u32 i, count;
@@ -1810,18 +1812,21 @@ GF_Err gf_term_scene_update(GF_Terminal *term, char *type, char *com)
        return e;
 }
 
+GF_EXPORT
 GF_Err gf_term_get_screen_buffer(GF_Terminal *term, GF_VideoSurface *framebuffer)
 {
        if (!term) return GF_BAD_PARAM;
        return gf_sc_get_screen_buffer(term->compositor, framebuffer, 0);
 }
 
+GF_EXPORT
 GF_Err gf_term_get_offscreen_buffer(GF_Terminal *term, GF_VideoSurface *framebuffer, u32 view_idx, u32 depth_buffer_type)
 {
        if (!term) return GF_BAD_PARAM;
        return gf_sc_get_offscreen_buffer(term->compositor, framebuffer, view_idx, depth_buffer_type);
 }
 
+GF_EXPORT
 GF_Err gf_term_release_screen_buffer(GF_Terminal *term, GF_VideoSurface *framebuffer)
 {
        if (!term) return GF_BAD_PARAM;
@@ -1899,6 +1904,7 @@ Bool gf_term_forward_event(GF_Terminal *term, GF_Event *evt, Bool consumed, Bool
        return 0;
 }
 
+GF_EXPORT
 GF_Err gf_term_add_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef)
 {
        GF_Err e;
@@ -1911,6 +1917,7 @@ GF_Err gf_term_add_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef)
        return e;
 }
 
+GF_EXPORT
 GF_Err gf_term_remove_event_filter(GF_Terminal *terminal, GF_TermEventFilter *ef)
 {
        if (!terminal || !ef || !terminal->event_filters) return GF_BAD_PARAM;
@@ -1975,6 +1982,7 @@ static void set_clocks_speed(GF_Terminal *term, Fixed ratio)
        }
 }
 
+GF_EXPORT
 void gf_term_set_speed(GF_Terminal *term, Fixed speed)
 {
        Double fps;
@@ -2006,6 +2014,7 @@ void gf_term_set_speed(GF_Terminal *term, Fixed speed)
        gf_sc_set_fps(term->compositor, fps);
 }
 
+GF_EXPORT
 void gf_term_process_shortcut(GF_Terminal *term, GF_Event *ev)
 {
        GF_Event evt;
@@ -2243,6 +2252,7 @@ void gf_scene_switch_quality(GF_Scene *scene, Bool up)
        }
 }
 
+GF_EXPORT
 void gf_term_switch_quality(GF_Terminal *term, Bool up)
 {
        gf_scene_switch_quality(term->root_scene, up);
index 7ef1876bce8346543f4e04ff9a29f8faf4c84f31..83bf5cff0a354097584070134b495e413750626e 100644 (file)
@@ -96,6 +96,12 @@ CDECL void   scalable_free(void* ptr);
 #define CDECL  
 #endif
 
+#ifndef SYMBOL_EXPORT
+#if defined(__GNUC__) && __GNUC__ >= 4
+#define SYMBOL_EXPORT __attribute__((visibility("default")))
+#endif
+#endif
+
 #if (USE_MALLOC==DL_MALLOC)
 
 CDECL void * dlmalloc(size_t size);
@@ -169,7 +175,6 @@ char *gf_strdup(const char *str)
 #else
 
 
-CDECL
 size_t gpac_allocated_memory = 0;
 size_t gpac_nb_alloc_blocs = 0;
 
@@ -294,27 +299,31 @@ static void *(*gf_mem_realloc_proto)(void *ptr, size_t size, char *filename, int
 static void (*gf_mem_free_proto)(void *ptr, char *filename, int line) = gf_mem_free_basic;
 static char *(*gf_mem_strdup_proto)(const char *str, char *filename, int line) = gf_mem_strdup_basic;
 
-CDECL
+SYMBOL_EXPORT CDECL
 void *gf_mem_malloc(size_t size, char *filename, int line)
 {
        return gf_mem_malloc_proto(size, filename, line);
 }
-CDECL
+
+SYMBOL_EXPORT CDECL
 void *gf_mem_calloc(size_t num, size_t size_of, char *filename, int line)
 {
        return gf_mem_calloc_proto(num, size_of, filename, line);
 }
-CDECL
+
+SYMBOL_EXPORT CDECL
 void *gf_mem_realloc(void *ptr, size_t size, char *filename, int line)
 {
        return gf_mem_realloc_proto(ptr, size, filename, line);
 }
-CDECL
+
+SYMBOL_EXPORT CDECL
 void gf_mem_free(void *ptr, char *filename, int line)
 {
        gf_mem_free_proto(ptr, filename, line);
 }
-CDECL
+
+SYMBOL_EXPORT CDECL
 char *gf_mem_strdup(const char *str, char *filename, int line)
 {
        return gf_mem_strdup_proto(str, filename, line);
index 5f3808024307fa25c1a1508422e018b1bf66996c..3f8907c9a2084fbdd943b9d8614cdb494f2a4fb0 100644 (file)
@@ -182,6 +182,7 @@ u32 gf_base16_decode(char *in, u32 inSize, char *out, u32 outSize)
 
 #define ZLIB_COMPRESS_SAFE     4
 
+GF_EXPORT
 GF_Err gf_gz_compress_payload(char **data, u32 data_len, u32 *max_size)
 {
     z_stream stream;
@@ -224,6 +225,7 @@ GF_Err gf_gz_compress_payload(char **data, u32 data_len, u32 *max_size)
     return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_gz_decompress_payload(char *data, u32 data_len, char **uncompressed_data, u32 *out_size)
 {
        z_stream d_stream;
index 4487c7661d7bcc189f9924ad6da764103d6ba215..78cba2bd7dd5edf28aa01590f91c291c77becbd2 100644 (file)
@@ -846,6 +846,8 @@ static void load_line_YUV420SP(u8 *src_bits, u32 x_offset, u32 y_offset, u32 y_p
 
 static void gf_cmx_apply_argb(GF_ColorMatrix *_this, u8 *a_, u8 *r_, u8 *g_, u8 *b_);
 
+//#define COLORKEY_MPEG4_STRICT
+
 GF_EXPORT
 GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *dst_wnd, GF_Window *src_wnd, u8 alpha, Bool flip, GF_ColorKey *key, GF_ColorMatrix *cmat)
 {
@@ -1045,6 +1047,30 @@ GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *ds
                                                        load_line_yuva(src->video_buffer, x_off, the_row, src->pitch_y, src_w, src->height, tmp);
                                                }
                                                the_row = src_row - 1;
+
+                                               if (cmat) {
+                                                       for (i=0; i<2*src_w; i++) {
+                                                               u32 idx = 4*i;
+                                                               gf_cmx_apply_argb(cmat, &tmp[idx+3], &tmp[idx], &tmp[idx+1], &tmp[idx+2]);
+                                                       }
+                                               }
+                                               if (key) {
+                                                       for (i=0; i<2*src_w; i++) {
+                                                               u32 idx = 4*i;
+                                                               s32 thres, v;
+                                                               v = tmp[idx]-kr; thres = ABS(v);
+                                                               v = tmp[idx+1]-kg; thres += ABS(v);
+                                                               v = tmp[idx+2]-kb; thres += ABS(v);
+                                                               thres/=3;
+#ifdef COLORKEY_MPEG4_STRICT
+                                                               if (thres < kl) tmp[idx+3] = 0;
+                                                               else if (thres <= kh) tmp[idx+3] = (thres-kl)*ka / (kh-kl);
+#else
+                                                               if (thres < kh) tmp[idx+3] = 0;
+#endif
+                                                               else tmp[idx+3] = ka;
+                                                       }
+                                               }
                                        }
                                        rows = flip ? tmp : tmp + src_w * 4;
                                } else {
@@ -1071,7 +1097,7 @@ GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *ds
                                                        v = tmp[idx+1]-kg; thres += ABS(v);
                                                        v = tmp[idx+2]-kb; thres += ABS(v);
                                                        thres/=3;
-#if 0
+#ifdef COLORKEY_MPEG4_STRICT
                                                        if (thres < kl) tmp[idx+3] = 0;
                                                        else if (thres <= kh) tmp[idx+3] = (thres-kl)*ka / (kh-kl);
 #else
@@ -1099,7 +1125,7 @@ GF_Err gf_stretch_bits(GF_VideoSurface *dst, GF_VideoSurface *src, GF_Window *ds
                                                v = tmp[idx+1]-kg; thres += ABS(v);
                                                v = tmp[idx+2]-kb; thres += ABS(v);
                                                thres/=3;
-#if 0
+#ifdef COLORKEY_MPEG4_STRICT
                                                if (thres < kl) tmp[idx+3] = 0;
                                                else if (thres <= kh) tmp[idx+3] = (thres-kl)*ka / (kh-kl);
 #else
index 8a7763e61f35280f50395c9492eaf7d7992537e5..e12f3b486a28faf4857db669e930d598b37d8063 100644 (file)
@@ -586,6 +586,7 @@ void gf_dm_delete_cached_file_entry(const GF_DownloadManager * dm,  const char *
     GF_LOG(GF_LOG_WARNING, GF_LOG_NETWORK, ("[CACHE] Cannot find URL %s, cache file won't be deleted.\n", url));
 }
 
+GF_EXPORT
 void gf_dm_delete_cached_file_entry_session(const GF_DownloadSession * sess,  const char * url) {
     if (sess && sess->dm && url) {
         GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[CACHE] Requesting deletion for %s\n", url));
@@ -624,6 +625,7 @@ static void gf_dm_disconnect(GF_DownloadSession *sess, Bool force_close)
         gf_mx_v(sess->mx);
 }
 
+GF_EXPORT
 void gf_dm_sess_del(GF_DownloadSession *sess)
 {
     GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[Downloader] gf_dm_sess_del(%p)\n", sess ));
@@ -707,6 +709,7 @@ Bool gf_dm_is_thread_dead(GF_DownloadSession *sess)
     return (sess->flags & GF_DOWNLOAD_SESSION_THREAD_DEAD) ? 1 : 0;
 }
 
+GF_EXPORT
 GF_Err gf_dm_sess_last_error(GF_DownloadSession *sess)
 {
     if (!sess) return GF_BAD_PARAM;
@@ -878,6 +881,7 @@ GF_Err gf_dm_get_url_info(const char * url, GF_URL_Info * info, const char * bas
     return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_dm_sess_setup_from_url(GF_DownloadSession *sess, const char *url)
 {
        Bool socket_changed = 0;
@@ -986,6 +990,7 @@ static u32 gf_dm_session_thread(void *par)
 }
 
 
+GF_EXPORT
 GF_DownloadSession *gf_dm_sess_new_simple(GF_DownloadManager * dm, const char *url, u32 dl_flags,
         gf_dm_user_io user_io,
         void *usr_cbk,
@@ -1018,6 +1023,7 @@ GF_DownloadSession *gf_dm_sess_new_simple(GF_DownloadManager * dm, const char *u
     return sess;
 }
 
+GF_EXPORT
 GF_DownloadSession *gf_dm_sess_new(GF_DownloadManager *dm, const char *url, u32 dl_flags,
                                    gf_dm_user_io user_io,
                                    void *usr_cbk,
@@ -1282,7 +1288,7 @@ DownloadedCacheEntry gf_dm_refresh_cache_entry(GF_DownloadSession *sess) {
     return sess->cache_entry;
 }
 
-
+GF_EXPORT
 const char *gf_dm_sess_mime_type(GF_DownloadSession *sess)
 {
     DownloadedCacheEntry entry;
@@ -1298,6 +1304,7 @@ const char *gf_dm_sess_mime_type(GF_DownloadSession *sess)
     return gf_cache_get_mime_type( sess->cache_entry );
 }
 
+GF_EXPORT
 GF_Err gf_dm_sess_set_range(GF_DownloadSession *sess, u64 start_range, u64 end_range)
 {
        if (!sess) return GF_BAD_PARAM;
@@ -1309,6 +1316,7 @@ GF_Err gf_dm_sess_set_range(GF_DownloadSession *sess, u64 start_range, u64 end_r
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_dm_sess_process(GF_DownloadSession *sess)
 {
     Bool go;
@@ -1404,6 +1412,8 @@ static void gf_cache_cleanup_cache(GF_DownloadManager * dm) {
 }
 #endif
 
+
+GF_EXPORT
 GF_DownloadManager *gf_dm_new(GF_Config *cfg)
 {
     const char *opt;
@@ -1474,6 +1484,7 @@ void gf_dm_set_auth_callback(GF_DownloadManager *dm,
     }
 }
 
+GF_EXPORT
 void gf_dm_del(GF_DownloadManager *dm)
 {
     if (!dm)
@@ -1734,6 +1745,7 @@ Bool gf_dm_sess_can_be_cached_on_disk(const GF_DownloadSession *sess)
     return gf_cache_get_content_length(sess->cache_entry) != 0;
 }
 
+GF_EXPORT
 void gf_dm_sess_abort(GF_DownloadSession * sess)
 {
     assert(sess);
@@ -2613,7 +2625,9 @@ static void wget_NetIO(void *cbk, GF_NETIO_Parameter *param)
 }
 
 
-GF_Err gf_dm_wget(const char *url, const char *filename){
+GF_EXPORT
+GF_Err gf_dm_wget(const char *url, const char *filename)
+{
        GF_Err e;
        GF_DownloadManager * dm = NULL;
        dm = gf_dm_new(NULL);
@@ -2652,6 +2666,7 @@ GF_Err gf_dm_wget_with_cache(GF_DownloadManager * dm,
        return e;
 }
 
+GF_EXPORT
 GF_Err gf_dm_get_file_memory(const char *url, char **out_data, u32 *out_size, char **out_mime)
 {
        GF_Err e;
@@ -2709,6 +2724,7 @@ GF_Err gf_dm_get_file_memory(const char *url, char **out_data, u32 *out_size, ch
        return e;
 }
 
+GF_EXPORT
 const char *gf_dm_sess_get_resource_name(GF_DownloadSession *dnload)
 {
        return dnload ? dnload->orig_url : NULL;
@@ -2906,6 +2922,7 @@ void gf_dm_set_data_rate(GF_DownloadManager *dm, u32 rate_in_byte_per_sec)
        }
 }
 
+GF_EXPORT
 u32 gf_dm_get_data_rate(GF_DownloadManager *dm)
 {
        return dm->limit_data_rate;
index 6a0a23dce90fee10d55e72874b6d83f8aaa0381e..8de4c42d4ed9e11f0eff74224bb1b5ec7e46540d 100644 (file)
@@ -480,6 +480,7 @@ static void check_modules_dir(GF_Config *cfg)
        }\r
 }\r
 \r
+GF_EXPORT\r
 GF_Config *gf_cfg_init(const char *file, Bool *new_cfg)\r
 {\r
        GF_Config *cfg;\r
index f69a7a8332582fa638d9fc124162491a5a52c8e4..f80e2b85c029d337ada28aa3c449d795fe98ccb1 100644 (file)
@@ -75,6 +75,8 @@ static u32 sys_start_time = 0;
 
 
 #ifndef WIN32
+
+GF_EXPORT
 u32 gf_sys_clock()
 {
        struct timeval now;
@@ -84,6 +86,7 @@ u32 gf_sys_clock()
 #endif
 
 
+GF_EXPORT
 void gf_sleep(u32 ms)
 {
 #ifdef WIN32
@@ -277,6 +280,7 @@ void CE_CharToWide(char *str, unsigned short *w_str)
 
 #endif
 
+GF_EXPORT
 GF_Err gf_delete_file(const char *fileName)
 {
 #if defined(_WIN32_WCE)
@@ -329,6 +333,7 @@ u32 gf_rand()
 #include <sys/stat.h>
 #endif
 
+GF_EXPORT
 u64 gf_file_modification_time(const char *filename)
 {
 #if defined(_WIN32_WCE) 
@@ -362,6 +367,7 @@ u64 gf_file_modification_time(const char *filename)
        return 0;
 }
 
+GF_EXPORT
 FILE *gf_temp_file_new()
 {
 #if defined(_WIN32_WCE)
@@ -389,7 +395,7 @@ FILE *gf_temp_file_new()
 #endif
 }
 
-
+GF_EXPORT
 void gf_utc_time_since_1970(u32 *sec, u32 *msec)
 {
 #if defined (WIN32) && !defined(_WIN32_WCE)
@@ -430,6 +436,7 @@ void gf_get_user_name(char *buf, u32 buf_size)
 
 
 /*enumerate directories*/
+GF_EXPORT
 GF_Err gf_enum_directory(const char *dir, Bool enum_directory, gf_enum_dir_item enum_dir_fct, void *cbck, const char *filter)
 {
        char item_path[GF_MAX_PATH];
@@ -637,6 +644,7 @@ next:
 
 
 #ifndef WIN32
+GF_EXPORT
 char * my_str_upr(char *str)
 {
        u32 i;
@@ -645,6 +653,8 @@ char * my_str_upr(char *str)
        }
        return str;
 }
+
+GF_EXPORT
 char * my_str_lwr(char *str)
 {
        u32 i;
@@ -655,6 +665,7 @@ char * my_str_lwr(char *str)
 }
 #endif
 
+GF_EXPORT
 u64 gf_f64_tell(FILE *fp)
 {
 #if defined(_WIN32_WCE)
@@ -672,6 +683,7 @@ u64 gf_f64_tell(FILE *fp)
 #endif
 }
 
+GF_EXPORT
 u64 gf_f64_seek(FILE *fp, s64 offset, s32 whence)
 {
 #if defined(_WIN32_WCE)
@@ -689,6 +701,7 @@ u64 gf_f64_seek(FILE *fp, s64 offset, s32 whence)
 #endif
 }
 
+GF_EXPORT
 FILE *gf_f64_open(const char *file_name, const char *mode)
 {
 #if defined(WIN32)
@@ -705,6 +718,8 @@ FILE *gf_f64_open(const char *file_name, const char *mode)
 #if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! defined(_GNU_SOURCE)
 #define HAVE_STRERROR_R 1
 #endif
+
+GF_EXPORT
 size_t gf_fwrite(const void *ptr, size_t size, size_t nmemb, 
                        FILE *stream)
 {
@@ -759,10 +774,12 @@ Bool gf_prompt_has_input()
 {
        return kbhit();
 }
+
 char gf_prompt_get_char()
 {
        return getchar();
 }
+
 void gf_prompt_set_echo_off(Bool echo_off) 
 {
        DWORD flags;
@@ -809,6 +826,7 @@ void gf_prompt_set_echo_off(Bool echo_off)
        close_keyboard(0);
 }
 
+GF_EXPORT
 Bool gf_prompt_has_input()
 {
        u8 ch;
@@ -829,6 +847,7 @@ Bool gf_prompt_has_input()
        return 0;
 }
 
+GF_EXPORT
 char gf_prompt_get_char()
 {
        char ch;
@@ -998,6 +1017,7 @@ void gf_mem_enable_tracker();
 
 static u64 memory_at_gpac_startup = 0;
 
+GF_EXPORT
 void gf_sys_init(Bool enable_memory_tracker)
 {
        if (!sys_init) {
@@ -1093,6 +1113,7 @@ void gf_sys_init(Bool enable_memory_tracker)
        }
 }
 
+GF_EXPORT
 void gf_sys_close()
 {
        if (sys_init > 0) {
@@ -1392,9 +1413,9 @@ Bool gf_sys_get_rti_os(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
 #include <mach/shared_memory_server.h>
 #endif
 #include <mach/mach_error.h>
-       
+
 static u64 total_physical_memory = 0;
-       
+
 Bool gf_sys_get_rti_os(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
 {
        size_t length;
@@ -1675,7 +1696,7 @@ Bool gf_sys_get_rti_os(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
 
 #endif
 
-
+GF_EXPORT
 Bool gf_sys_get_rti(u32 refresh_time_ms, GF_SystemRTInfo *rti, u32 flags)
 {
        Bool res = gf_sys_get_rti_os(refresh_time_ms, rti, flags);
@@ -1701,8 +1722,7 @@ char * gf_get_default_cache_directory(){
 }
 
 
-
-
+GF_EXPORT
 Bool gf_sys_get_battery_state(Bool *onBattery, u32 *onCharge, u32*level, u32 *batteryLifeTime, u32 *batteryFullLifeTime) 
 {
 #if defined(_WIN32_WCE)
@@ -1829,7 +1849,7 @@ struct _GF_GlobalLock_opaque {
 };
 #endif
 
-
+GF_EXPORT
 GF_GlobalLock * gf_global_resource_lock(const char * resourceName){
 #ifdef WIN32
 #ifdef _WIN32_WCE
@@ -1876,6 +1896,7 @@ GF_GlobalLock * gf_global_resource_lock(const char * resourceName){
  * \param lock The resource to unlock
  * \return GF_OK if evertything went fine
  */
+GF_EXPORT
 GF_Err gf_global_resource_unlock(GF_GlobalLock * lock){
        if (!lock)
                return GF_BAD_PARAM;
index 36bd87451817cfc43ee02028ee4a5625f045f146..7a8145985f4488573a4466a5517e80c3eb676058 100644 (file)
@@ -334,6 +334,7 @@ u32 gf_modules_refresh(GF_ModuleManager *pm)
                inst->interfaces = gf_list_new();
                inst->plugman = pm;
                inst->name = gf_strdup("gm_gpac_js.dylib");
+               gf_list_add(pm->plug_list, inst);
        }
        {
                ModuleInstance *inst;
@@ -403,7 +404,7 @@ u32 gf_modules_refresh(GF_ModuleManager *pm)
        gf_enum_directory(pm->dir, 0, enum_modules, pm, ".dylib");
 #endif
 #else
-        GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Refreshing list of modules in directory %s...\n", pm->dir));
+       GF_LOG(GF_LOG_INFO, GF_LOG_CORE, ("Refreshing list of modules in directory %s...\n", pm->dir));
        gf_enum_directory(pm->dir, 0, enum_modules, pm, ".so");
 #endif
 
index 412a803cd62e94f31171f326703308c4a5179742..d17ef2f37af9018ec732c802a78fb7742e53c984 100644 (file)
@@ -307,6 +307,7 @@ static Bool gf_sk_ipv6_set_remote_address(GF_Socket *sock, const char *address,
 #endif
 
 
+GF_EXPORT
 GF_Err gf_sk_get_host_name(char *buffer)
 {
        s32 ret = gethostname(buffer, GF_MAX_IP_NAME_LEN);
@@ -346,6 +347,7 @@ GF_Err gf_sk_get_local_ip(GF_Socket *sock, char *buffer)
 }
 
 
+GF_EXPORT
 GF_Socket *gf_sk_new(u32 SocketType)
 {
        GF_Socket *tmp;
@@ -374,6 +376,7 @@ GF_Socket *gf_sk_new(u32 SocketType)
        return tmp;
 }
 
+GF_EXPORT
 GF_Err gf_sk_set_buffer_size(GF_Socket *sock, Bool SendBuffer, u32 NewSize)
 {
        if (!sock || !sock->socket) return GF_BAD_PARAM;
@@ -386,6 +389,7 @@ GF_Err gf_sk_set_buffer_size(GF_Socket *sock, Bool SendBuffer, u32 NewSize)
        return GF_OK;
 }
 
+GF_EXPORT
 GF_Err gf_sk_set_block_mode(GF_Socket *sock, u32 NonBlockingOn)
 {
        s32 res;
@@ -447,6 +451,7 @@ static void gf_sk_free(GF_Socket *sock)
 }
 
 
+GF_EXPORT
 void gf_sk_del(GF_Socket *sock)
 {
        assert( sock );
@@ -602,6 +607,7 @@ GF_Err gf_sk_connect(GF_Socket *sock, const char *PeerName, u16 PortNumber, cons
 
 //binds the given socket to the specified port. If ReUse is true
 //this will enable reuse of ports on a single machine
+GF_EXPORT
 GF_Err gf_sk_bind(GF_Socket *sock, const char *local_ip, u16 port, const char *peer_name, u16 peer_port, u32 options)
 {
 #ifdef GPAC_HAS_IPV6
@@ -804,6 +810,7 @@ GF_Err gf_sk_bind(GF_Socket *sock, const char *local_ip, u16 port, const char *p
 }
 
 //send length bytes of a buffer
+GF_EXPORT
 GF_Err gf_sk_send(GF_Socket *sock, const char *buffer, u32 length)
 {
        u32 count;
@@ -866,6 +873,7 @@ GF_Err gf_sk_send(GF_Socket *sock, const char *buffer, u32 length)
 }
 
 
+GF_EXPORT
 u32 gf_sk_is_multicast_address(const char *multi_IPAdd)
 {
 #ifdef GPAC_HAS_IPV6
@@ -894,6 +902,7 @@ u32 gf_sk_is_multicast_address(const char *multi_IPAdd)
 #endif
 }
 
+GF_EXPORT
 GF_Err gf_sk_setup_multicast(GF_Socket *sock, const char *multi_IPAdd, u16 MultiPortNumber, u32 TTL, Bool NoBind, char *local_interface_ip)
 {
        s32 ret;
@@ -1079,6 +1088,7 @@ GF_Err gf_sk_setup_multicast(GF_Socket *sock, const char *multi_IPAdd, u16 Multi
 //fetch nb bytes on a socket and fill the buffer from startFrom
 //length is the allocated size of the receiving buffer
 //BytesRead is the number of bytes read from the network
+GF_EXPORT
 GF_Err gf_sk_receive(GF_Socket *sock, char *buffer, u32 length, u32 startFrom, u32 *BytesRead)
 {
        s32 res;
index f74cc0869ae16f97a312d76cd6c682cdae15f557..ec82ad2f3e5ffe9b0535537ade8832c9b7c66c2e 100644 (file)
@@ -103,6 +103,7 @@ static const char *log_th_name(u32 id)
 #endif
 
 
+GF_EXPORT
 GF_Thread *gf_th_new(const char *name)
 {
        GF_Thread *tmp = gf_malloc(sizeof(GF_Thread));
@@ -213,6 +214,7 @@ exit:
 #endif
 }
 
+GF_EXPORT
 GF_Err gf_th_run(GF_Thread *t, u32 (*Run)(void *param), void *param)
 {
 #ifdef WIN32
@@ -286,6 +288,7 @@ void gf_th_stop(GF_Thread *t)
        Thread_Stop(t, 0);
 }
 
+GF_EXPORT
 void gf_th_del(GF_Thread *t)
 {
        Thread_Stop(t, 0);
@@ -372,6 +375,7 @@ u32 gf_th_status(GF_Thread *t)
 }
 
 
+GF_EXPORT
 u32 gf_th_id()
 {
 #ifdef WIN32
@@ -401,6 +405,7 @@ struct __tag_mutex
 };
 
 
+GF_EXPORT
 GF_Mutex *gf_mx_new(const char *name)
 {
 #ifndef WIN32
@@ -436,6 +441,7 @@ GF_Mutex *gf_mx_new(const char *name)
        return tmp;
 }
 
+GF_EXPORT
 void gf_mx_del(GF_Mutex *mx)
 {
 #ifdef WIN32
@@ -456,6 +462,7 @@ void gf_mx_del(GF_Mutex *mx)
        gf_free(mx);
 }
 
+GF_EXPORT
 void gf_mx_v(GF_Mutex *mx)
 {
        u32 caller;
@@ -488,6 +495,7 @@ void gf_mx_v(GF_Mutex *mx)
        }
 }
 
+GF_EXPORT
 u32 gf_mx_p(GF_Mutex *mx)
 {
 #ifndef WIN32
@@ -546,6 +554,7 @@ s32 gf_mx_get_num_locks(GF_Mutex *mx)
        return -1;
 }
 
+GF_EXPORT
 Bool gf_mx_try_lock(GF_Mutex *mx)
 {
        u32 caller;
@@ -601,7 +610,7 @@ struct __tag_semaphore
 #endif
 };
 
-
+GF_EXPORT
 GF_Semaphore *gf_sema_new(u32 MaxCount, u32 InitCount)
 {
        GF_Semaphore *tmp = gf_malloc(sizeof(GF_Semaphore));
@@ -644,6 +653,7 @@ GF_Semaphore *gf_sema_new(u32 MaxCount, u32 InitCount)
        return tmp;
 }
 
+GF_EXPORT
 void gf_sema_del(GF_Semaphore *sm)
 {
 #if defined(WIN32)
@@ -660,6 +670,7 @@ void gf_sema_del(GF_Semaphore *sm)
        gf_free(sm);
 }
 
+GF_EXPORT
 u32 gf_sema_notify(GF_Semaphore *sm, u32 NbRelease)
 {
        u32 prevCount;
@@ -702,6 +713,7 @@ void gf_sema_wait(GF_Semaphore *sm)
 #endif
 }
 
+GF_EXPORT
 Bool gf_sema_wait_for(GF_Semaphore *sm, u32 TimeOut)
 {
 #ifdef WIN32
index b9789f74e73fd26d3df01a277b6ef0775d13d094..0e5c754d1fa36495fe5f79917fbd1dbfdd8faf2d 100644 (file)
@@ -23,6 +23,7 @@
  */
 #include <gpac/ringbuffer.h>
 
+GF_EXPORT
 GF_Ringbuffer * gf_ringbuffer_new(u32 sz)
 {
   GF_Ringbuffer *rb;
@@ -40,6 +41,7 @@ GF_Ringbuffer * gf_ringbuffer_new(u32 sz)
   return rb;
 }
 
+GF_EXPORT
 void gf_ringbuffer_del(GF_Ringbuffer * ringbuffer){
     if (!ringbuffer)
       return;
@@ -71,6 +73,7 @@ static u32 gf_ringbuffer_available_for_write (GF_Ringbuffer * rb)
   }
 }
 
+GF_EXPORT
 u32 gf_ringbuffer_available_for_read (GF_Ringbuffer * rb)
 {
   size_t w, r;
@@ -85,6 +88,7 @@ u32 gf_ringbuffer_available_for_read (GF_Ringbuffer * rb)
   }
 }
 
+GF_EXPORT
 u32 gf_ringbuffer_read(GF_Ringbuffer *rb, u8 *dest, u32 szDest)
 {
  u32 free_sz, sz2, to_read, n1, n2;
@@ -118,6 +122,7 @@ u32 gf_ringbuffer_read(GF_Ringbuffer *rb, u8 *dest, u32 szDest)
   return to_read; 
 }
 
+GF_EXPORT
 u32 gf_ringbuffer_write (GF_Ringbuffer * rb, const u8 *src, u32 sz)
 {
   u32 free_sz, sz2, to_write, n1, n2;
index dc7fbc71d5407543b28cf5a02a468a39ff07641c..a41652658dbabd6afb74ef6ff517527b3b6f4237 100644 (file)
@@ -35,8 +35,8 @@ Acknowledgement
    Internet Society.
  */
 
-u32 
-utf8_to_ucs4(u32 * ucs4_buf, u32 utf8_len, unsigned char *utf8_buf)
+GF_EXPORT
+u32 utf8_to_ucs4(u32 * ucs4_buf, u32 utf8_len, unsigned char *utf8_buf)
 {
        const unsigned char *utf8_endbuf = utf8_buf + utf8_len;
        u32             ucs_len = 0;
index b5053c46800f762c6fb2944d6e1dff560bd3cb7b..4f50a04f9fc65921f94f81f8485646ebc56e8b3a 100644 (file)
@@ -88,7 +88,7 @@ char *gf_url_get_absolute_path(const char *pathName, const char *parentPath)
        return gf_strdup(pathName);
 }
 
-
+GF_EXPORT
 char *gf_url_concatenate(const char *parentName, const char *pathName)
 {
        u32 pathSepCount, i, prot_type;