From: Alessio Treglia Date: Sun, 27 May 2012 09:22:52 +0000 (+0200) Subject: Imported Upstream version 0.5.0~dfsg0 X-Git-Tag: archive/raspbian/1.0.1+dfsg1-4+rpi1~1^2~15^2~16 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=18c758e5c75b25c9c159e9247820375b5178783a;p=gpac.git Imported Upstream version 0.5.0~dfsg0 --- diff --git a/Changelog b/Changelog index 5506b0f..78660d9 100644 --- a/Changelog +++ b/Changelog @@ -1,14 +1,23 @@ -27/08/09: - - Added overwrite of profile and level of AVC streams when adding tracks in mp4box(from ISOFF or .264). Use ":profile=X" and ":level=Z" when importing - - Fixed chapters and text tracks handling for iTunes. Using the -ipd option in MP4Box should fix all subtitles tracks. - When adding a track (including subtitle), it is now possible to override the track layout. For example: - MP4Box -add test.srt:layout=0x20x0x-1 test.mp4 - will set the track box to be max width of the file tracks, 20 pixels height, translated by 0 pixels left and aligned to the bottom (max height - 20) - To add a chapter track, you simply have to add ":chap" in the -add command. - - Added modular compilation of most libgpac features. See configure or include/gpac/configuration - - Fixed streaming interoperability with Live555 - - More fixed and speed improvement in VRML/BIFS scripting - - Added support for PBuffers on Win32/DirectX +Full Changelog is available here: +https://sourceforge.net/apps/trac/gpac/log/ + +25/05/2012: GPAC 0.5.0 + - MPEG-DASH and Apple HLS support in GPAC Clients + - MPEG-DASH segmenter for ISO files and MPEG-2 TS in MP4Box + - MP42TS generator now supports HLS output + - Support for MPEG-U and W3C widgets + - UPnP and DLNA support in the player through Platinum libraries, interfaced in JavaScript + - Better support for AVC and SVC muxing in MP4 + - Support for OpenSVC decoder + - Stereo and Multi-view renderer for auto-stereoscopic screens + - iOS and Android support (but Symbian support has been dropped) + - Camera input through "camera://default" URLs on Windows, OSX 32bit, Linux V4L v1 and Android + - experimental audio filters + - Better T-DMB support + - experimental DVB-MPE and DSM-CC support + - BIFS ExtendedCore2D profile support + - more work on GUI + - and many many fixes and improvements in players and MP4Box 02/12/08: GPAC 0.4.5 - Support for AC3 in ISO Media, AC3 decoder (liba52) RTP hinting diff --git a/INSTALLME b/INSTALLME index ae0f038..d648cae 100644 --- a/INSTALLME +++ b/INSTALLME @@ -1,7 +1,9 @@ -Installation instructions for latest GPAC svn version: +Installation instructions for latest GPAC svn version and GPAC release 0.5.0 - May 2012: For Windows, Linux and Mac OS X versions, follow the instructions on http://gpac.sourceforge.net/home_download.php +For Android, follow the instructions in gpac/build/android/README + For WindowsMobile platform, get the latest package of gpac extra libs available on GPAC svn: http://gpac.svn.sourceforge.net/viewvc/gpac/trunk/gpac_extra_libs/gpac_extra_libs.zip and follow the instructions in gpac/doc/INSTALL.wCE @@ -9,7 +11,7 @@ and follow the instructions in gpac/doc/INSTALL.wCE -Installation instructions for GPAC 0.4.5 - December 2008: +Other Installation instructions for GPAC * Foreword @@ -18,7 +20,9 @@ Installation instructions for GPAC 0.4.5 - December 2008: limited (no still image, no audio, no video, no text, no scripting). It is therefore recommended to download the extra lib package available at http://sourceforge.net/projects/gpac. Compilation instructions for these libraries are provided per library in the package. - The current extra_lib package to use with gpac 0.4.5 is gpac_extra_libs 0.4.5. + + The current extra_lib package to use with gpac 0.5.0 is gpac_extra_libs available at sourceforge: +http://gpac.svn.sourceforge.net/viewvc/gpac/trunk/gpac_extra_libs/gpac_extra_libs.zip?view=log In case you have some of these libs already installed on your system, the detailed list of dependencies is * freetype2 from version 2.1.4 on. @@ -32,19 +36,17 @@ are provided per library in the package. * faad2, version 2.0 or above (2.6.1 working) * liba52, version 0.7.4 * OpenJPEG, version 1.3 - - Windows user are invited to download and install the Microsoft Platform SDK at - http://www.microsoft.com/msdownload/platformsdk/sdkupdate - If you don't have enough bandwidth (it's big) the GDIplus SDK is also included in the gpac_extra_lib package + * OpenSVCDecoder, version 1.3 * Installing GPAC /!\ GPAC won't compile if the 'svnversion' command (shipped with every Subversion package) is not in your path /!\ +!!OUTDATED - please see online instructions instead!! Detailed instruction for Win32 MSVC Compilation are available in gpac/doc/INSTALL.w32 Detailed instruction for WinCE eVC Compilation are available in gpac/doc/INSTALL.wCE - +s Detailed instruction for GCC Compilation are available in gpac/doc/INSTALL.gcc Detailed instruction for GCC cross-compilation for familiar+GPE systems are available in gpac/doc/INSTALL.gpe diff --git a/Makefile b/Makefile index 0d13ebb..13b2533 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ all: version $(MAKE) -C modules all version: - @if which svnversion >/dev/null; then echo "#define GPAC_SVN_REVISION \"$(shell svnversion $(SRC_PATH) )\"" > $(SRC_PATH)/include/gpac/version.h ; else echo "No SVN Version found"; fi + @if [ -d ".svn" ]; then if which svnversion >/dev/null; then echo "#define GPAC_SVN_REVISION \"$(shell svnversion $(SRC_PATH) )\"" > $(SRC_PATH)/include/gpac/version.h ; else echo "No SVN Version found"; fi; fi lib: version $(MAKE) -C src all @@ -60,7 +60,9 @@ install: ifeq ($(DISABLE_ISOFF), no) $(INSTALL) $(INSTFLAGS) -m 755 bin/gcc/MP4Box "$(DESTDIR)$(prefix)/bin" endif +ifeq ($(DISABLE_PLAYER), no) $(INSTALL) $(INSTFLAGS) -m 755 bin/gcc/MP4Client "$(DESTDIR)$(prefix)/bin" +endif if [ -d $(DESTDIR)$(prefix)/$(libdir)/pkgconfig ] ; then \ $(INSTALL) $(INSTFLAGS) -m 644 gpac.pc "$(DESTDIR)$(prefix)/$(libdir)/pkgconfig" ; \ fi diff --git a/README b/README index 4addd3f..ab1c8cd 100644 --- a/README +++ b/README @@ -1,10 +1,10 @@ -README for GPAC version 0.4.5, December 2008. +README for GPAC version 0.5.0, May 2012. GPAC is a multimedia framework oriented towards rich media and distributed under the LGPL license (see COPYING). GPAC supports many multimedia formats, from simple audiovisual containers (avi, mov, mpg) to complex presentation formats (MPEG-4 Systems, SVG Tiny 1.2, VRML/X3D). GPAC supports scripting of presentation for MPEG4/VRML/X3D through mozilla SpiderMonkey javascript engine. -GPAC currently supports local playback, http download and play and RTP/RTSP streaming over UDP (unicast or multicast) or TCP. +GPAC currently supports local playback, http progressive download, Adaptive HTTP Streaming (MPEG-DASH, HLS), RTP/RTSP streaming over UDP (unicast or multicast) or TCP and TS demuxing (from file, IP or DVB4Linux). GPAC also features MP4Box, a multimedia swiss-army knife for the prompt. For compilation and installation instruction, check INSTALL file diff --git a/TODO b/TODO index 3478c94..3586187 100644 --- a/TODO +++ b/TODO @@ -1,27 +1,7 @@ -todo items as of version 0.4.5: - * more refinement for several top scenes support (display overlays & co). - -utopic roadmap -v0.5.0: - * maybe support for glyph-based texturing rather than string-based - * SMIL support ? - -v0.6.0: - * M4Flex (ex FlexMux) support - * Flexible IPMP integration - * JNI interfacing and MPEG-J APIs - * native SWF support in client ? - -v1.0.0: - * full rendering (MPEG-4 AFX ?) - -Future work on authoring tools is not still well defined. The current state has bt/vrml/XMT-A support, it could be interesting to have XMT-O support. The SWF converter -still needs lots of work to support ActionScript and co but this will likely not be developed by your servitor. Other graphics converter are more-or-less droped. -The main authoring focus should now be a better V4Studio-like app, to create simple content as well as act as a live studio. - - -droped items: -* Hardware accelerated 2D raster: from most doc on OpenGL and co, there is no waranty of any kind that backbuffer content is not altered when swaping buffers. -This is a big issue since the 2D renderer main strength is to compute diffs between frames... 2D acceleration is however available with the 3D renderer -* MatteTexture fix: given the lack of acceleration in 2D, the matteTexture in the 2D renderer will be just to slow to be usable, and therefore won't be fixed -for a while... MatteTexture with the 3D renderer will be fixed however, trying to use openGL texenv stuff and multitexturing +todo items as of version 0.5.0: + * more work on DASH support + * improve stereo/multiview renderer and texture+depth support + * more work on DIMS/RME and scene generation support + * rearchitecture of modules + * more SVG support (filter , SVG 2.0) + \ No newline at end of file diff --git a/applications/Makefile b/applications/Makefile index 4683ad5..16b0b7a 100644 --- a/applications/Makefile +++ b/applications/Makefile @@ -1,15 +1,17 @@ include ../config.mak -APPDIRS=mp4client +APPDIRS= + +ifeq ($(DISABLE_PLAYER), no) +APPDIRS+=mp4client +endif ifeq ($(DISABLE_ISOFF), no) APPDIRS+=mp4box ifeq ($(DISABLE_M2TS), no) -ifeq ($(DISABLE_SENG), no) APPDIRS+=mp42ts endif endif -endif V4STUDIODIR= INSTDIRS=mp4client diff --git a/applications/mp42ts/Makefile b/applications/mp42ts/Makefile index 9b99262..f41ae96 100644 --- a/applications/mp42ts/Makefile +++ b/applications/mp42ts/Makefile @@ -2,7 +2,7 @@ include ../../config.mak vpath %.c $(SRC_PATH)/applications/mp42ts -CFLAGS= $(OPTFLAGS) -I"$(SRC_PATH)/include" +CFLAGS= $(OPTFLAGS) -DGPAC_HAVE_CONFIG_H -I"$(SRC_PATH)/include" ifeq ($(DEBUGBUILD), yes) CFLAGS+=-g diff --git a/applications/mp42ts/main.c b/applications/mp42ts/main.c index 57e1c48..64bd043 100644 --- a/applications/mp42ts/main.c +++ b/applications/mp42ts/main.c @@ -25,9 +25,15 @@ #include #include #include +#include + +#ifndef GPAC_DISABLE_STREAMING #include +#endif + +#ifndef GPAC_DISABLE_SENG #include -#include +#endif #ifdef GPAC_DISABLE_ISOM @@ -104,7 +110,9 @@ typedef struct u32 nb_streams, pcr_idx; GF_ESInterface streams[40]; GF_Descriptor *iod; +#ifndef GPAC_DISABLE_SENG GF_SceneEngine *seng; +#endif GF_Thread *th; char *src_name; u32 rate; @@ -153,7 +161,10 @@ typedef struct } GF_SimpleDataDescriptor; //TODO: find a clean way to save this data +#ifndef GPAC_DISABLE_PLAYER static u32 audio_OD_stream_id = (u32)-1; +#endif + #define AUDIO_OD_ESID 100 #define AUDIO_DATA_ESID 101 #define VIDEO_DATA_ESID 105 @@ -164,7 +175,9 @@ enum GF_MP42TS_FILE, /*open mpeg2ts file*/ GF_MP42TS_UDP, /*open udp socket*/ GF_MP42TS_RTP, /*open rtp socket*/ +#ifndef GPAC_DISABLE_PLAYER GF_MP42TS_HTTP, /*open http downloader*/ +#endif }; static GF_Err mp4_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param) @@ -433,6 +446,7 @@ static void fill_isom_es_ifce(M2TSProgram *prog, GF_ESInterface *ifce, GF_ISOFil } +#ifndef GPAC_DISABLE_SENG static GF_Err seng_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param) { if (act_type==GF_ESI_INPUT_DESTROY) { @@ -445,6 +459,8 @@ static GF_Err seng_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param) return GF_OK; } +#endif + #ifndef GPAC_DISABLE_STREAMING typedef struct @@ -512,6 +528,8 @@ static GF_Err void_input_ctrl(GF_ESInterface *ifce, u32 act_type, void *param) } /*AAC import features*/ +#ifndef GPAC_DISABLE_PLAYER + void *audio_prog = NULL; static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, u64 ts); #define DONT_USE_TERMINAL_MODULE_API @@ -557,6 +575,9 @@ static GF_Err encode_audio_desc(GF_ESD *esd, GF_SimpleDataDescriptor *audio_desc return GF_OK; } +#endif + + static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, u64 ts) { u32 i; @@ -565,6 +586,7 @@ static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, if (calling_object) { M2TSProgram *prog = (M2TSProgram *)calling_object; +#ifndef GPAC_DISABLE_PLAYER if (ESID == AUDIO_DATA_ESID) { if (audio_OD_stream_id != (u32)-1) { /*this is the first time we get some audio data. Therefore we are sure we can retrieve the audio descriptor. Then we'll @@ -641,7 +663,7 @@ static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, /*overwrite timing as it is flushed to 0 on discontinuities*/ ts += audio_discontinuity_offset; } - +#endif i=0; while (inb_streams){ if (prog->streams[i].output_ctrl==NULL) { @@ -683,6 +705,7 @@ static void SampleCallBack(void *calling_object, u16 ESID, char *data, u32 size, static volatile Bool run = 1; +#ifndef GPAC_DISABLE_SENG static GF_ESIStream * set_broadcast_params(M2TSProgram *prog, u16 esid, u32 period, u32 ts_delta, u16 aggregate_on_stream, Bool adjust_carousel_time, Bool force_rap, Bool aggregate_au, Bool discard_pending, Bool signal_rap, Bool signal_critical, Bool version_inc) { u32 i=0; @@ -732,9 +755,11 @@ static GF_ESIStream * set_broadcast_params(M2TSProgram *prog, u16 esid, u32 peri } else { esi->repeat_rate = 0; } - return priv; } +#endif + +#ifndef GPAC_DISABLE_SENG static Bool seng_output(void *param) { @@ -914,6 +939,8 @@ static Bool seng_output(void *param) return e ? 1 : 0; } +#endif + #ifndef GPAC_DISABLE_STREAMING static void rtp_sl_packet_cbk(void *udta, char *payload, u32 size, GF_SLHeader *hdr, GF_Err e) @@ -1033,6 +1060,7 @@ static void fill_rtp_es_ifce(GF_ESInterface *ifce, GF_SDPMedia *media, GF_SDPInf } #endif /*GPAC_DISABLE_STREAMING*/ +#ifndef GPAC_DISABLE_SENG void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 period) { GF_Err e = GF_OK; @@ -1062,6 +1090,7 @@ void fill_seng_es_ifce(GF_ESInterface *ifce, u32 i, GF_SceneEngine *seng, u32 pe ifce->input_ctrl = seng_input_ctrl; } +#endif 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) { @@ -1069,7 +1098,6 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp GF_SDPInfo *sdp; #endif u32 i; - GF_Err e; memset(prog, 0, sizeof(M2TSProgram)); prog->mpeg4_signaling = mpeg4_signaling; @@ -1225,6 +1253,7 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp GF_X_Attribute *att; char *sdp_buf; u32 sdp_size; + GF_Err e; FILE *_sdp = fopen(src, "rt"); if (!_sdp) { fprintf(stderr, "Error opening %s - no such file\n", src); @@ -1290,6 +1319,8 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp return 2; } else #endif /*GPAC_DISABLE_STREAMING*/ + +#ifndef GPAC_DISABLE_SENG if (strstr(src, ".bt")) //open .bt file { u32 load_type=0; @@ -1430,7 +1461,9 @@ static Bool open_program(M2TSProgram *prog, char *src, u32 carousel_rate, u32 mp prog->src_name = update; gf_th_run(prog->th, seng_output, prog); return 1; - } else { + } else +#endif + { FILE *f = fopen(src, "rt"); if (f) { fclose(f); @@ -1510,8 +1543,10 @@ static GFINLINE GF_Err parse_args(int argc, char **argv, u32 *mux_rate, u32 *car *audio_input_type = GF_MP42TS_UDP; else if (!strnicmp(arg, "rtp://", 6)) *audio_input_type = GF_MP42TS_RTP; +#ifndef GPAC_DISABLE_PLAYER else if (!strnicmp(arg, "http://", 7)) *audio_input_type = GF_MP42TS_HTTP; +#endif /*http needs to get the complete URL*/ switch(*audio_input_type) { case GF_MP42TS_UDP: @@ -1527,11 +1562,13 @@ static GFINLINE GF_Err parse_args(int argc, char **argv, u32 *mux_rate, u32 *car *audio_input_ip = gf_strdup(arg+6); } break; +#ifndef GPAC_DISABLE_PLAYER case GF_MP42TS_HTTP: /* No need to dup since it may come from argv */ *audio_input_ip = arg; assert(audio_input_port != 0); break; +#endif default: assert(0); } @@ -1855,7 +1892,9 @@ int main(int argc, char **argv) prev_seg_time.sec = 0; prev_seg_time.nanosec = 0; video_buffer_size = 0; +#ifndef GPAC_DISABLE_PLAYER aac_reader = AAC_Reader_new(); +#endif muxer = NULL; single_au_pes = 0; bifs_use_pes = 0; @@ -1991,10 +2030,12 @@ int main(int argc, char **argv) /*TODO: not implemented*/ assert(0); break; +#ifndef GPAC_DISABLE_PLAYER case GF_MP42TS_HTTP: audio_prog = (void*)&progs[nb_progs-1]; aac_download_file(aac_reader, audio_input_ip); break; +#endif case GF_MP42TS_FILE: assert(0); /*audio live input is restricted to realtime/streaming*/ break; @@ -2042,7 +2083,7 @@ int main(int argc, char **argv) /*****************/ last_print_time = gf_sys_clock(); while (run) { - u32 ts, status; + u32 status; /*check for some audio input from the network*/ if (audio_input_ip) { @@ -2055,6 +2096,7 @@ int main(int argc, char **argv) SampleCallBack((void*)&progs[nb_progs-1], AUDIO_DATA_ESID, audio_input_buffer, read, gf_m2ts_get_sys_clock(muxer)); } break; +#ifndef GPAC_DISABLE_PLAYER case GF_MP42TS_HTTP: /*nothing to do: AAC_OnLiveData is called automatically*/ /*check we're still alive*/ @@ -2070,6 +2112,7 @@ int main(int argc, char **argv) gf_odf_desc_del((GF_Descriptor *)esd); } break; +#endif default: assert(0); } @@ -2125,6 +2168,7 @@ int main(int argc, char **argv) } #ifndef GPAC_DISABLE_STREAMING if (ts_output_rtp != NULL) { + u32 ts; hdr.SequenceNumber++; /*muxer clock at 90k*/ ts = muxer->time.sec*90000 + muxer->time.nanosec*9/100000; @@ -2201,7 +2245,9 @@ exit: #ifndef GPAC_DISABLE_STREAMING if (rtp_out) gf_free(rtp_out); #endif +#ifndef GPAC_DISABLE_PLAYER if (aac_reader) AAC_Reader_del(aac_reader); +#endif if (muxer) gf_m2ts_mux_del(muxer); for (i=0; i +#include #if defined(GPAC_DISABLE_ISOM) || defined(GPAC_DISABLE_ISOM_WRITE) @@ -30,8 +30,12 @@ #else +#ifndef GPAC_DISABLE_X3D #include +#endif +#ifndef GPAC_DISABLE_BIFS #include +#endif #include #include #include @@ -41,6 +45,9 @@ #include #include +#ifndef GPAC_DISABLE_SMGR +#include +#endif extern u32 swf_flags; extern Float swf_flatten_angle; @@ -682,6 +689,7 @@ void PrintNode(const char *name, u32 graph_type) void PrintBuiltInNodes(u32 graph_type) { +#if !defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_X3D) && !defined(GPAC_DISABLE_SVG) GF_Node *node; GF_SceneGraph *sg; u32 i, nb_in, nb_not_in, start_tag, end_tag; @@ -740,6 +748,9 @@ void PrintBuiltInNodes(u32 graph_type) } else { fprintf(stdout, "\n%d nodes supported - %d nodes not supported\n", nb_in, nb_not_in); } +#else + fprintf(stdout, "\nNo scene graph enabled in this MP4Box build\n"); +#endif } #ifndef GPAC_DISABLE_ISOM_DUMP diff --git a/applications/mp4box/fileimport.c b/applications/mp4box/fileimport.c index 0745ed8..e7ccf03 100644 --- a/applications/mp4box/fileimport.c +++ b/applications/mp4box/fileimport.c @@ -23,13 +23,20 @@ */ -#include -#include +#include #include #include -#include +#if !defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_X3D) && !defined(GPAC_DISABLE_SVG) +#include +#endif +#ifndef GPAC_DISABLE_SMGR +#include +#endif +#ifndef GPAC_DISABLE_BIFS +#include +#endif #ifndef GPAC_DISABLE_ISOM_WRITE #include diff --git a/applications/mp4box/live.c b/applications/mp4box/live.c index e0ddba5..0b577c8 100644 --- a/applications/mp4box/live.c +++ b/applications/mp4box/live.c @@ -25,11 +25,16 @@ */ -#include #include #include + +#ifndef GPAC_DISABLE_SENG #include +#endif +#ifndef GPAC_DISABLE_STREAMING +#include #include +#endif #if defined(GPAC_DISABLE_ISOM) || defined(GPAC_DISABLE_ISOM_WRITE) @@ -450,7 +455,6 @@ int live_session(int argc, char **argv) u32 period, ts_delta, signal_critical; u16 es_id; e = GF_OK; - /* souchay : needs to initialize those two vars... */ aggregate_au = 1; es_id = 0; no_rap = 0; diff --git a/applications/mp4box/main.c b/applications/mp4box/main.c index fc806c5..54e0e0e 100644 --- a/applications/mp4box/main.c +++ b/applications/mp4box/main.c @@ -23,9 +23,12 @@ */ -#include #include +#ifndef GPAC_DISABLE_SMGR +#include +#endif + #ifdef GPAC_DISABLE_ISOM #error "Cannot compile MP4Box if GPAC is not built with ISO File Format support" @@ -33,9 +36,16 @@ #else #include + /*RTP packetizer flags*/ +#ifndef GPAC_DISABLE_STREAMING #include +#endif + +#ifndef GPAC_DISABLE_MCRYPT #include +#endif + #include #include @@ -45,14 +55,18 @@ #define BUFFSIZE 8192 /*in fileimport.c*/ + +#ifndef GPAC_DISABLE_MEDIA_IMPORT +void convert_file_info(char *inName, u32 trackID); +#endif + #ifndef GPAC_DISABLE_ISOM_WRITE GF_Err import_file(GF_ISOFile *dest, char *inName, u32 import_flags, Double force_fps, u32 frames_per_sample); GF_Err split_isomedia_file(GF_ISOFile *mp4, Double split_dur, u32 split_size_kb, char *inName, Double InterleavingTime, Double chunk_start, Bool adjust_split_end, char *outName, const char *tmpdir); GF_Err cat_isomedia_file(GF_ISOFile *mp4, char *fileName, u32 import_flags, Double force_fps, u32 frames_per_sample, char *tmp_dir, Bool force_cat); -#if !defined(GPAC_DISABLE_MEDIA_IMPORT) && !defined(GPAC_DISABLE_SCENE_ENCODER) -void convert_file_info(char *inName, u32 trackID); +#if !defined(GPAC_DISABLE_SCENE_ENCODER) GF_Err EncodeFile(char *in, GF_ISOFile *mp4, GF_SMEncodeOptions *opts, FILE *logs); GF_Err EncodeFileChunk(char *chunkFile, char *bifs, char *inputContext, char *outputContext, const char *tmpdir); #endif @@ -999,9 +1013,6 @@ typedef struct u32 item_id; } MetaAction; -/*for SDP_EX, AddTrack and RemTrack*/ -#define MAX_CUMUL_OPS 20 - #ifndef GPAC_DISABLE_ISOM_WRITE static Bool parse_meta_args(MetaAction *meta, char *opts) { @@ -1082,7 +1093,7 @@ typedef struct u32 switchGroupID; } TSELAction; -static Bool parse_tsel_args(TSELAction *tsel_list, char *opts, u32 *nb_tsel_act) +static Bool parse_tsel_args(TSELAction **__tsel_list, char *opts, u32 *nb_tsel_act) { u32 act; u32 refTrackID = 0; @@ -1092,6 +1103,7 @@ static Bool parse_tsel_args(TSELAction *tsel_list, char *opts, u32 *nb_tsel_act) u32 nb_criteria = 0; TSELAction *tsel_act; char szSlot[1024], *next; + TSELAction *tsel_list = *__tsel_list; has_switch_id = 0; act = tsel_list[*nb_tsel_act].act_type; @@ -1132,10 +1144,9 @@ static Bool parse_tsel_args(TSELAction *tsel_list, char *opts, u32 *nb_tsel_act) } } else if (!strnicmp(szSlot, "trackID=", 8) || !strchr(szSlot, '=') ) { - if (*nb_tsel_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track selection operations allowed\n", MAX_CUMUL_OPS); - return 0; - } + __tsel_list = realloc(__tsel_list, sizeof(TSELAction) * (*nb_tsel_act + 1)); + tsel_list = *__tsel_list; + tsel_act = &tsel_list[*nb_tsel_act]; memset(tsel_act, 0, sizeof(TSELAction)); tsel_act->act_type = act; @@ -1157,10 +1168,7 @@ static Bool parse_tsel_args(TSELAction *tsel_list, char *opts, u32 *nb_tsel_act) } -#define CHECK_NEXT_ARG if (i+1==(u32)argc) { fprintf(stdout, "Missing arg - please check usage\n"); return 1; } - -#define CHECK_META_OPS CHECK_NEXT_ARG if (nb_meta_act>=MAX_CUMUL_OPS) { fprintf(stdout, "Sorry - no more than %d meta operations allowed\n", MAX_CUMUL_OPS); return 1; } - +#define CHECK_NEXT_ARG if (i+1==(u32)argc) { fprintf(stdout, "Missing arg - please check usage\n"); MP4BOX_EXIT_WITH_CODE(1); } typedef struct { @@ -1194,8 +1202,15 @@ enum GF_ISOM_CONV_TYPE_PSP }; -/*for dash*/ -#define MAX_DASH_REP 30 +#define MP4BOX_EXIT_WITH_CODE(__ret_code) \ + if (sdp_lines) free(sdp_lines); \ + if (metas) free(metas); \ + if (tracks) free(tracks); \ + if (tsel_acts) free(tsel_acts); \ + if (brand_add) free(brand_add); \ + if (brand_rem) free(brand_rem); \ + if (dash_inputs) free(dash_inputs); \ + return __ret_code; \ int mp4boxMain(int argc, char **argv) { @@ -1204,20 +1219,27 @@ int mp4boxMain(int argc, char **argv) #ifndef GPAC_DISABLE_SCENE_ENCODER GF_SMEncodeOptions opts; #endif -#if !defined(GPAC_DISABLE_STREAMING) && !defined(GPAC_DISABLE_SENG) - SDPLine sdp_lines[MAX_CUMUL_OPS]; -#endif + SDPLine *sdp_lines = NULL; Double InterleavingTime, split_duration, split_start, import_fps, dash_duration; - MetaAction metas[MAX_CUMUL_OPS]; - TrackAction tracks[MAX_CUMUL_OPS]; - TSELAction tsel_acts[MAX_CUMUL_OPS]; + MetaAction *metas = NULL; + TrackAction *tracks = NULL; + TSELAction *tsel_acts = NULL; u64 movie_time; s32 subsegs_per_sidx; - u32 brand_add[MAX_CUMUL_OPS]; - u32 i, MTUSize, stat_level, hint_flags, info_track_id, import_flags, nb_add, nb_cat, ismaCrypt, agg_samples, nb_sdp_ex, max_ptime, raw_sample_num, split_size, nb_meta_act, nb_track_act, rtp_rate, major_brand, nb_alt_brand_add, nb_alt_brand_rem, old_interleave, car_dur, minor_version, conv_type, nb_tsel_acts, program_number; - Bool HintIt, needSave, FullInter, Frag, HintInter, dump_std, dump_rtp, dump_mode, regular_iod, trackID, HintCopy, remove_sys_tracks, remove_hint, force_new, remove_root_od, import_subtitle, dump_chap; - Bool print_sdp, print_info, open_edit, track_dump_type, dump_isom, dump_cr, force_ocr, encode, do_log, do_flat, dump_srt, dump_ttxt, chunk_mode, dump_ts, do_saf, do_mpd, dump_m2ts, dump_cart, do_hash, verbose, force_cat, pack_wgt, single_group; + u32 *brand_add = NULL; + u32 *brand_rem = NULL; + u32 i, stat_level, hint_flags, info_track_id, import_flags, nb_add, nb_cat, ismaCrypt, agg_samples, nb_sdp_ex, max_ptime, raw_sample_num, split_size, nb_meta_act, nb_track_act, rtp_rate, major_brand, nb_alt_brand_add, nb_alt_brand_rem, old_interleave, car_dur, minor_version, conv_type, nb_tsel_acts, program_number; + Bool HintIt, needSave, FullInter, Frag, HintInter, dump_std, dump_rtp, dump_mode, regular_iod, trackID, remove_sys_tracks, remove_hint, force_new, remove_root_od, import_subtitle, dump_chap; + Bool print_sdp, print_info, open_edit, track_dump_type, dump_isom, dump_cr, force_ocr, encode, do_log, do_flat, dump_srt, dump_ttxt, dump_ts, do_saf, do_mpd, dump_m2ts, dump_cart, do_hash, verbose, force_cat, pack_wgt, single_group; char *inName, *outName, *arg, *mediaSource, *tmpdir, *input_ctx, *output_ctx, *drm_file, *avi2raw, *cprt, *chap_file, *pes_dump, *itunes_tags, *pack_file, *raw_cat, *seg_name, *dash_ctx; + +#ifndef GPAC_DISABLE_SCENE_ENCODER + Bool chunk_mode=0; +#endif +#ifndef GPAC_DISABLE_ISOM_HINTING + Bool HintCopy=0; + u32 MTUSize = 1450; +#endif GF_ISOFile *file; Bool stream_rtp=0; Bool live_scene=0; @@ -1228,14 +1250,14 @@ int mp4boxMain(int argc, char **argv) Bool use_url_template=0; Bool seg_at_rap =0; Bool adjust_split_end = 0; - char *dash_inputs[MAX_DASH_REP]; + char **dash_inputs = NULL; u32 nb_dash_inputs = 0; char *gf_logs = NULL; char *seg_ext = NULL; if (argc < 2) { PrintUsage(); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } nb_tsel_acts = nb_add = nb_cat = nb_track_act = nb_sdp_ex = max_ptime = raw_sample_num = nb_meta_act = rtp_rate = major_brand = nb_alt_brand_add = nb_alt_brand_rem = car_dur = minor_version = 0; @@ -1248,9 +1270,8 @@ int mp4boxMain(int argc, char **argv) import_flags = 0; split_size = 0; movie_time = 0; - MTUSize = 1450; - HintCopy = FullInter = HintInter = encode = do_log = old_interleave = do_saf = do_mpd = do_hash = verbose = 0; - chunk_mode = dump_mode = Frag = force_ocr = remove_sys_tracks = agg_samples = remove_hint = keep_sys_tracks = remove_root_od = single_group = 0; + FullInter = HintInter = encode = do_log = old_interleave = do_saf = do_mpd = do_hash = verbose = 0; + dump_mode = Frag = force_ocr = remove_sys_tracks = agg_samples = remove_hint = keep_sys_tracks = remove_root_od = single_group = 0; conv_type = HintIt = needSave = print_sdp = print_info = regular_iod = dump_std = open_edit = dump_isom = dump_rtp = dump_cr = dump_chap = dump_srt = dump_ttxt = force_new = dump_ts = dump_m2ts = dump_cart = import_subtitle = force_cat = pack_wgt = 0; subsegs_per_sidx = 0; track_dump_type = 0; @@ -1269,7 +1290,9 @@ int mp4boxMain(int argc, char **argv) do_flat = 0; inName = outName = mediaSource = input_ctx = output_ctx = drm_file = avi2raw = cprt = chap_file = pack_file = raw_cat = NULL; +#ifndef GPAC_DISABLE_SWF_IMPORT swf_flags = GF_SM_SWF_SPLIT_TIMELINE; +#endif swf_flatten_angle = 0.0f; tmpdir = NULL; @@ -1281,29 +1304,28 @@ int mp4boxMain(int argc, char **argv) if (arg[0] != '-') { if (argc < 3) { fprintf(stdout, "Error - only one input file found as argument, please check usage\n"); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } else if (inName) { if (dash_duration) { if (!nb_dash_inputs) { + dash_inputs = realloc(dash_inputs, sizeof(char *) * (nb_dash_inputs+1) ); dash_inputs[nb_dash_inputs] = inName; nb_dash_inputs++; } - if (MAX_DASH_REP<=nb_dash_inputs) { - fprintf(stdout, "Error - Max %d representations can be DASH'ed\n", MAX_DASH_REP); - return 1; - } + dash_inputs = realloc(dash_inputs, sizeof(char *) * (nb_dash_inputs+1) ); + dash_inputs[nb_dash_inputs] = arg; nb_dash_inputs++; } else { fprintf(stdout, "Error - 2 input names specified, please check usage\n"); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } } else { inName = arg; } } - else if (!stricmp(arg, "-?")) { PrintUsage(); return 0; } - else if (!stricmp(arg, "-version")) { PrintVersion(); return 0; } + else if (!stricmp(arg, "-?")) { PrintUsage(); MP4BOX_EXIT_WITH_CODE(0); } + else if (!stricmp(arg, "-version")) { PrintVersion(); MP4BOX_EXIT_WITH_CODE(0); } else if (!stricmp(arg, "-sdp")) print_sdp = 1; else if (!stricmp(arg, "-quiet")) quiet = 2; else if (!stricmp(arg, "-logs")) { @@ -1348,7 +1370,7 @@ int mp4boxMain(int argc, char **argv) if (strlen(argv[i+1])==5) trackID = 2; else trackID = 1 + atoi(argv[i+1] + 5); } - else { fprintf(stdout, "Usage: \"-aviraw video\" or \"-aviraw audio\"\n"); return 1; } + else { fprintf(stdout, "Usage: \"-aviraw video\" or \"-aviraw audio\"\n"); MP4BOX_EXIT_WITH_CODE(1); } track_dump_type = GF_EXPORT_AVI_NATIVE; i++; } @@ -1398,14 +1420,14 @@ int mp4boxMain(int argc, char **argv) dump_iod = 1; } #ifndef GPAC_DISABLE_VRML - else if (!stricmp(arg, "-node")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 0); return (0); } - else if (!stricmp(arg, "-xnode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 1); return (0); } - else if (!stricmp(arg, "-nodes")) { PrintBuiltInNodes(0); return (0); } - else if (!stricmp(arg, "-xnodes")) { PrintBuiltInNodes(1); return (0); } + else if (!stricmp(arg, "-node")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 0); MP4BOX_EXIT_WITH_CODE(0); } + else if (!stricmp(arg, "-xnode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 1); MP4BOX_EXIT_WITH_CODE(0); } + else if (!stricmp(arg, "-nodes")) { PrintBuiltInNodes(0); MP4BOX_EXIT_WITH_CODE(0); } + else if (!stricmp(arg, "-xnodes")) { PrintBuiltInNodes(1); MP4BOX_EXIT_WITH_CODE(0); } #endif #ifndef GPAC_DISABLE_SVG - else if (!stricmp(arg, "-snode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 2); return (0); } - else if (!stricmp(arg, "-snodes")) { PrintBuiltInNodes(2); return (0); } + else if (!stricmp(arg, "-snode")) { CHECK_NEXT_ARG PrintNode(argv[i+1], 2); MP4BOX_EXIT_WITH_CODE(0); } + else if (!stricmp(arg, "-snodes")) { PrintBuiltInNodes(2); MP4BOX_EXIT_WITH_CODE(0); } else if (!stricmp(arg, "-std")) dump_std = 1; #endif @@ -1449,7 +1471,7 @@ int mp4boxMain(int argc, char **argv) trackID = 0; } #ifdef GPAC_DISABLE_ISOM_WRITE - if (trackID) { fprintf(stdout, "Error: Read-Only version - subtitle conversion not available\n"); return 1; } + if (trackID) { fprintf(stdout, "Error: Read-Only version - subtitle conversion not available\n"); MP4BOX_EXIT_WITH_CODE(1); } #endif if (!stricmp(arg, "-ttxt")) dump_ttxt = 1; else dump_srt = 1; @@ -1462,7 +1484,7 @@ int mp4boxMain(int argc, char **argv) } } -#ifndef GPAC_DISABLE_ISOM_WRITE +#ifndef GPAC_DISABLE_SWF_IMPORT /*SWF importer options*/ else if (!stricmp(arg, "-global")) swf_flags |= GF_SM_SWF_STATIC_DICT; else if (!stricmp(arg, "-no-ctrl")) swf_flags &= ~GF_SM_SWF_SPLIT_TIMELINE; @@ -1479,6 +1501,8 @@ int mp4boxMain(int argc, char **argv) swf_flatten_angle = (Float) atof(argv[i+1]); i++; } +#endif +#ifndef GPAC_DISABLE_ISOM_WRITE else if (!stricmp(arg, "-isma")) { conv_type = GF_ISOM_CONV_TYPE_ISMA; open_edit = 1; } else if (!stricmp(arg, "-3gp")) { conv_type = GF_ISOM_CONV_TYPE_3GPP; open_edit = 1; } else if (!stricmp(arg, "-ipod")) { conv_type = GF_ISOM_CONV_TYPE_IPOD; open_edit = 1; } @@ -1593,10 +1617,8 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-add-sdp") || !stricmp(arg, "-sdp_ex")) { char *id; CHECK_NEXT_ARG - if (nb_sdp_ex>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d extra SDP lines allowed\n", MAX_CUMUL_OPS); - return 1; - } + sdp_lines = realloc(sdp_lines, sizeof(SDPLine) * (nb_sdp_ex+1) ); + id = strchr(argv[i+1], ':'); if (id) { id[0] = 0; @@ -1663,10 +1685,8 @@ int mp4boxMain(int argc, char **argv) } else if (!stricmp(arg, "-rem") || !stricmp(arg, "-disable") || !stricmp(arg, "-enable")) { CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + if (!stricmp(arg, "-enable")) tracks[nb_track_act].act_type = 6; else if (!stricmp(arg, "-disable")) tracks[nb_track_act].act_type = 7; else tracks[nb_track_act].act_type = 0; @@ -1678,16 +1698,14 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-par")) { char szTK[20], *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + tracks[nb_track_act].act_type = 4; strcpy(szTK, argv[i+1]); ext = strchr(szTK, '='); if (!ext) { fprintf(stdout, "Bad format for track par - expecting ID=PAR_NUM:PAR_DEN got %s\n", argv[i+1]); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } if (!stricmp(ext+1, "none")) { tracks[nb_track_act].par_num = tracks[nb_track_act].par_den = -1; @@ -1703,10 +1721,8 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-lang")) { char szTK[20], *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + tracks[nb_track_act].act_type = 1; tracks[nb_track_act].lang[3] = 0; tracks[nb_track_act].trackID = 0; @@ -1729,15 +1745,13 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-delay")) { char szTK[20], *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + strcpy(szTK, argv[i+1]); ext = strchr(szTK, '='); if (!ext) { fprintf(stdout, "Bad format for track delay - expecting ID=DLAY got %s\n", argv[i+1]); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } tracks[nb_track_act].act_type = 2; tracks[nb_track_act].delay_ms = atoi(ext+1); @@ -1750,22 +1764,20 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-ref")) { char *szTK, *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + szTK = argv[i+1]; ext = strchr(szTK, ':'); if (!ext) { fprintf(stdout, "Bad format for track reference - expecting ID:XXXX:refID got %s\n", argv[i+1]); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } tracks[nb_track_act].act_type = 8; ext[0] = 0; tracks[nb_track_act].trackID = atoi(szTK); ext[0] = ':'; szTK = ext+1; ext = strchr(szTK, ':'); if (!ext) { fprintf(stdout, "Bad format for track reference - expecting ID:XXXX:refID got %s\n", argv[i+1]); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } ext[0] = 0; strncpy(tracks[nb_track_act].lang, szTK, 4); @@ -1778,15 +1790,13 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-name")) { char szTK[GF_MAX_PATH], *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + strcpy(szTK, argv[i+1]); ext = strchr(szTK, '='); if (!ext) { fprintf(stdout, "Bad format for track name - expecting ID=name got %s\n", argv[i+1]); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } tracks[nb_track_act].act_type = 5; tracks[nb_track_act].hdl_name = strchr(argv[i+1], '=') + 1; @@ -1910,10 +1920,8 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-set-kms")) { char szTK[20], *ext; CHECK_NEXT_ARG - if (nb_track_act>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d track operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + tracks = realloc(tracks, sizeof(TrackAction) * (nb_track_act+1)); + strncpy(szTK, argv[i+1], 19); ext = strchr(szTK, '='); tracks[nb_track_act].act_type = 3; @@ -1955,7 +1963,7 @@ int mp4boxMain(int argc, char **argv) CHECK_NEXT_ARG if (!strstr(argv[i+1], ":")) { fprintf(stdout, "Chunk extraction usage: \"-splitx start:end\" expressed in seconds\n"); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } sscanf(argv[i+1], "%lf:%lf", &split_start, &split_duration); split_duration -= split_start; @@ -1965,7 +1973,8 @@ int mp4boxMain(int argc, char **argv) } /*meta*/ else if (!stricmp(arg, "-set-meta")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 0; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -1973,7 +1982,8 @@ int mp4boxMain(int argc, char **argv) i++; } else if (!stricmp(arg, "-add-item")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 1; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -1981,7 +1991,8 @@ int mp4boxMain(int argc, char **argv) i++; } else if (!stricmp(arg, "-rem-item")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 2; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -1989,7 +2000,8 @@ int mp4boxMain(int argc, char **argv) i++; } else if (!stricmp(arg, "-set-primary")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 3; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -1997,7 +2009,8 @@ int mp4boxMain(int argc, char **argv) i++; } else if (!stricmp(arg, "-set-xml")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 4; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -2005,21 +2018,24 @@ int mp4boxMain(int argc, char **argv) i++; } else if (!stricmp(arg, "-rem-xml")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 6; if (parse_meta_args(&metas[nb_meta_act], argv[i+1])) i++; nb_meta_act++; open_edit = 1; } else if (!stricmp(arg, "-dump-xml")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 7; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; i++; } else if (!stricmp(arg, "-dump-item")) { - CHECK_META_OPS + metas = realloc(metas, sizeof(MetaAction) * (nb_meta_act+1)); + metas[nb_meta_act].act_type = 8; parse_meta_args(&metas[nb_meta_act], argv[i+1]); nb_meta_act++; @@ -2027,9 +2043,9 @@ int mp4boxMain(int argc, char **argv) } else if (!stricmp(arg, "-group-add") || !stricmp(arg, "-group-rem-track") || !stricmp(arg, "-group-rem")) { tsel_acts[nb_tsel_acts].act_type = !stricmp(arg, "-group-rem") ? 2 : ( !stricmp(arg, "-group-rem-track") ? 1 : 0 ); - if (parse_tsel_args(tsel_acts, argv[i+1], &nb_tsel_acts)==0) { + if (parse_tsel_args(&tsel_acts, argv[i+1], &nb_tsel_acts)==0) { fprintf(stdout, "Invalid group syntax - check usage\n"); - return 1; + MP4BOX_EXIT_WITH_CODE(1); } open_edit=1; i++; @@ -2065,21 +2081,19 @@ int mp4boxMain(int argc, char **argv) else if (!stricmp(arg, "-ab")) { char *b = argv[i+1]; CHECK_NEXT_ARG - if (nb_alt_brand_add>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d brand remove operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + brand_add = realloc(brand_add, sizeof(u32) * (nb_alt_brand_add+1)); + brand_add[nb_alt_brand_add] = GF_4CC(b[0], b[1], b[2], b[3]); nb_alt_brand_add++; open_edit = 1; i++; } else if (!stricmp(arg, "-rb")) { + char *b = argv[i+1]; CHECK_NEXT_ARG - if (nb_alt_brand_rem>=MAX_CUMUL_OPS) { - fprintf(stdout, "Sorry - no more than %d brand remove operations allowed\n", MAX_CUMUL_OPS); - return 1; - } + brand_rem = realloc(brand_rem, sizeof(u32) * (nb_alt_brand_rem+1)); + + brand_rem[nb_alt_brand_rem] = GF_4CC(b[0], b[1], b[2], b[3]); nb_alt_brand_rem++; open_edit = 1; i++; @@ -2087,7 +2101,7 @@ int mp4boxMain(int argc, char **argv) #endif else if (!stricmp(arg, "-languages")) { PrintLanguages(); - return 0; + MP4BOX_EXIT_WITH_CODE(0); } else if (!stricmp(arg, "-h")) { if (i+1== (u32) argc) PrintUsage(); @@ -2122,7 +2136,7 @@ int mp4boxMain(int argc, char **argv) #endif } else PrintUsage(); - return 0; + MP4BOX_EXIT_WITH_CODE(0); } else if (!stricmp(arg, "-v")) verbose++; else if (!stricmp(arg, "-tag-list")) { @@ -2130,23 +2144,25 @@ int mp4boxMain(int argc, char **argv) for (i=0; i> gpaccab.inf +ECHO Provider = "GPAC 0.5.0-r%gpac_revision%" >> gpaccab.inf type gpac.inf >> gpaccab.inf CabWiz gpaccab.inf @@ -12,7 +12,7 @@ CabWiz gpaccab.inf ECHO off ECHO [CEAppManager]> gpac.ini -ECHO Version = 0.4.6-r%gpac_revision%>> gpac.ini +ECHO Version = 0.5.0-r%gpac_revision%>> gpac.ini ECHO Component = GPAC for Windows Mobile>> gpac.ini ECHO [GPAC for Windows Mobile]>> gpac.ini ECHO Description = GPAC MPEG-4 Player>> gpac.ini @@ -24,7 +24,7 @@ ECHO CabFiles = gpaccab.cab >> gpac.ini ECHO on ezsetup -l english -i gpac.ini -r readme.txt -e ../../../../COPYING -o gpac.exe -rename gpac.exe "GPAC_0.4.6-r%gpac_revision%_WindowsMobile.exe" +rename gpac.exe "GPAC_0.5.0-r%gpac_revision%_WindowsMobile.exe" DEL gpaccab.cab DEL gpaccab.inf DEL gpac.ini diff --git a/bin/smartphone 2003 (armv4)/release/install/gpac.inf b/bin/smartphone 2003 (armv4)/release/install/gpac.inf index e442453..5879e32 100644 --- a/bin/smartphone 2003 (armv4)/release/install/gpac.inf +++ b/bin/smartphone 2003 (armv4)/release/install/gpac.inf @@ -1,5 +1,5 @@ ;[Version] -;Provider = "GPAC 0.4.6" +;Provider = "GPAC 0.5.0" Signature = "$Windows NT$" CESignature = "$Windows CE$" diff --git a/bin/smartphone 2003 (armv4)/release/install/readme.txt b/bin/smartphone 2003 (armv4)/release/install/readme.txt index 0a561e1..46dd627 100644 --- a/bin/smartphone 2003 (armv4)/release/install/readme.txt +++ b/bin/smartphone 2003 (armv4)/release/install/readme.txt @@ -1,4 +1,4 @@ -This will install GPAC version 0.4.5 for ARM PocketPC/SmartPhones 2003 Platforms +This will install GPAC version 0.5.0 for ARM PocketPC/SmartPhones 2003 Platforms GPAC is an open source MPEG-4 framework developped by ENST and available at: http://gpac.sourceforge.net diff --git a/bin/win32/release/nsis_install/gpac_installer.nsi b/bin/win32/release/nsis_install/gpac_installer.nsi index b391018..65437e9 100644 --- a/bin/win32/release/nsis_install/gpac_installer.nsi +++ b/bin/win32/release/nsis_install/gpac_installer.nsi @@ -1,662 +1,662 @@ -;-------------------------------- -;General -!define GPAC_VERSION 0.4.6-DEV -!include default.out - -!define GPAC_ROOT ..\..\..\.. - -InstallDir "$PROGRAMFILES\GPAC" -InstallDirRegKey HKCU "SOFTWARE\GPAC" "InstallDir" - -RequestExecutionLevel user - - -;-------------------------------- -;Include Modern UI - - !include "MUI2.nsh" - -WindowIcon on -Icon "..\..\..\..\doc\osmo4.ico" -UninstallIcon "..\..\..\..\doc\osmo4.ico" - - -;-------------------------------- -;Interface Settings - - !define MUI_ABORTWARNING - -Var DIALOG -Var Label -Var Confirm - -LangString PAGE_TITLE ${LANG_ENGLISH} "Title" -LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle" - -Function EnableNext - Pop $R1 - ${NSD_GetState} $Confirm $R1 - GetDlgItem $0 $HWNDPARENT 1 - ${If} $R1 == ${BST_CHECKED} - EnableWindow $0 1 - ${Else} - EnableWindow $0 0 - ${Endif} -FunctionEnd - -Function customPage - !insertmacro MUI_HEADER_TEXT "Patents and Royalties" "Please read carefully the following clause." - GetDlgItem $0 $HWNDPARENT 1 - EnableWindow $0 0 - nsDialogs::Create 1018 - Pop $DIALOG - - ${NSD_CreateLabel} 0 0 100% 120u "Multimedia technologies are often covered by various patents which are most of the time hard to identify. These patents may or may not apply in your local jurisdiction. By installing this software, you acknowledge that you may have to pay royaltee fees in order to legally use this software. Do not proceed with this setup if you do not understand or do not agree with these terms. In any case, the authors and/or distributors bears no liability for any infringing usage of this software, which is provided for educational or research purposes." - Pop $Label - - ${NSD_CreateCheckBox} 0 -30 100% 12u "I understand and accept the conditions" - Pop $Confirm - GetFunctionAddress $0 EnableNext - nsDialogs::OnClick $Confirm $0 - - - nsDialogs::Show -FunctionEnd - -;-------------------------------- -;Pages - - !insertmacro MUI_PAGE_WELCOME - !insertmacro MUI_PAGE_LICENSE "${GPAC_ROOT}\COPYING" - Page custom customPage - !insertmacro MUI_PAGE_COMPONENTS - !insertmacro MUI_PAGE_DIRECTORY - - !insertmacro MUI_PAGE_INSTFILES - !insertmacro MUI_PAGE_FINISH - - !insertmacro MUI_UNPAGE_CONFIRM - !insertmacro MUI_UNPAGE_INSTFILES - - !insertmacro MUI_LANGUAGE "English" - -ComponentText "This will install the GPAC Framework on your computer. Select which optional things you want installed." -DirText "This will install the GPAC Framework on your computer. Choose a directory" - - -Function FctWriteRegStrAuth - ;local var - Push $0 - Push $R0 - Push $R1 - Push $R2 - Push $R3 - ;pop function arguments - Exch 5 - Pop $R3 - Exch 5 - Pop $R2 - Exch 5 - Pop $R1 - Exch 5 - Pop $R0 - - ;test if calling HKCR - StrCmp $R0 "HKCR" +1 +3 - WriteRegStr HKCR $R1 $R2 $R3 - goto lbl_end - - #has current user admin privileges? - userInfo::getAccountType - Pop $0 - StrCmp $0 "Admin" lbl_admin lbl_not_admin - - lbl_admin: - WriteRegStr HKLM $R1 $R2 $R3 - goto lbl_end - - lbl_not_admin: - WriteRegStr HKCU $R1 $R2 $R3 - - lbl_end: - Pop $R3 - Pop $R2 - Pop $R1 - Pop $R0 - Pop $0 -FunctionEnd - -!macro WriteRegStrAuth HKREG SUBREG ENTRY VALUESTR - Push "${HKREG}" - Push "${SUBREG}" - Push "${ENTRY}" - Push "${VALUESTR}" - Call FctWriteRegStrAuth -!macroend - -!define WriteRegStrAuth "!insertmacro WriteRegStrAuth" - - -Function un.FctDeleteRegKeyAuth - ;local var - Push $0 - Push $R0 - Push $R1 - ;pop function arguments - Exch 3 - Pop $R1 - Exch 3 - Pop $R0 - - ;test if calling HKCR - StrCmp $R0 "HKCR" +1 +3 - DeleteRegKey HKCR $R1 - goto lbl_end - - #has current user admin privileges? - userInfo::getAccountType - Pop $0 - StrCmp $0 "Admin" lbl_admin lbl_not_admin - - lbl_admin: - DeleteRegKey HKLM $R1 - goto lbl_end - - lbl_not_admin: - DeleteRegKey HKCU $R1 - - lbl_end: - Pop $0 - Pop $R1 - Pop $R0 -FunctionEnd - -!macro DeleteRegKeyAuth HKREG SUBREG - Push "${HKREG}" - Push "${SUBREG}" - Call un.FctDeleteRegKeyAuth -!macroend - -!define DeleteRegKeyAuth "!insertmacro DeleteRegKeyAuth" - - -Function InsertGDIPLUS - Push $R0 - Push $R1 - ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion - StrCmp $R0 "" 0 lbl_winnt - - ;NOT NT - ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion VersionNumber - - StrCpy $R1 $R0 1 - ; win95, NOT SUPPORTED - StrCmp $R1 '4' 0 lbl_err_95 - StrCpy $R1 $R0 3 - StrCmp $R1 '4.0' lbl_err_95 - ;winME or 98 otherwise - StrCmp $R1 '4.9' lbl_add lbl_add - -lbl_err_nt: - MessageBox MB_OK "Microsoft GDI+ cannot be installed on NT 3 Systems" - Goto lbl_done - -lbl_err_95: - MessageBox MB_OK "Microsoft GDI+ cannot be installed on Windows 95 and older Systems" - Goto lbl_done - -lbl_winnt: - StrCpy $R1 $R0 1 - StrCmp $R1 '3' lbl_err_nt - StrCmp $R1 '4' lbl_add - StrCpy $R1 $R0 3 - StrCmp $R1 '5.0' lbl_add ;2000 - StrCmp $R1 '5.1' lbl_xp ;XP - StrCmp $R1 '5.2' lbl_done ;.NET server - -lbl_add: - File ".\Gdiplus.dll" - -lbl_xp: - File "..\gm_gdip_raster.dll" - -lbl_done: -FunctionEnd - - -;osmo4 install -Section "Osmo4/GPAC Player" SecOsmo4 - SectionIn RO - SetOutPath $INSTDIR - - File /oname=ReadMe.txt "${GPAC_ROOT}\README" - File /oname=License.txt "${GPAC_ROOT}\COPYING" - File /oname=Changelog.txt "${GPAC_ROOT}\Changelog" - File "${GPAC_ROOT}\doc\configuration.html" - File "${GPAC_ROOT}\doc\gpac.mp4" - - File "..\Osmo4.exe" - File "..\..\..\..\doc\osmo4.ico" - File "..\libgpac.dll" - File "..\gm_dummy_in.dll" - File "..\gm_dx_hw.dll" - File "..\js32.dll" - File "..\gm_gpac_js.dll" - File "..\libeay32.dll" - File "..\ssleay32.dll" - File "..\gm_ismacryp.dll" - - ;create default cache - SetOutPath $INSTDIR\cache - - - ;copy GUI - SetOutPath $INSTDIR\gui - File "..\..\..\..\gui\gui.bt" - File "..\..\..\..\gui\gui.js" - File "..\..\..\..\gui\gwlib.js" - File "..\..\..\..\gui\mpegu-core.js" - SetOutPath $INSTDIR\gui\icons - File /r /x .svn ..\..\..\..\gui\icons\* - SetOutPath $INSTDIR\gui\extensions - File /r /x .svn ..\..\..\..\gui\extensions\* - - SetOutPath $INSTDIR - - ${WriteRegStrAuth} HKCU "SOFTWARE\GPAC" "InstallDir" "$INSTDIR" - ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "DisplayName" "Osmo4/GPAC (remove only)" - ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "UninstallString" "$INSTDIR\uninstall.exe" - WriteUninstaller "uninstall.exe" - -SectionEnd - -SubSection "GPAC Plugins" SecPlugins - - -; -; 2 install modes, normal one and full one - -Section "MPEG-4 BIFS Decoder" SecBIFS - SectionIn 1 - File "..\gm_bifs_dec.dll" -SectionEnd - -Section "MPEG-4 ODF Decoder" SecODF - SectionIn 1 - File "..\gm_odf_dec.dll" -SectionEnd - -Section "MPEG-4 LASeR Decoder" SecLASeR - SectionIn 1 - File "..\gm_laser_dec.dll" -SectionEnd - -Section "MPEG-4 SAF Demultiplexer" SecSAF - SectionIn 1 - File "..\gm_saf_in.dll" -SectionEnd - -Section "Textual MPEG-4 Loader" SecTextLoad - SectionIn 1 - File "..\gm_ctx_load.dll" -SectionEnd - -Section "Image Package (PNG, JPEG, BMP)" SecIMG - SectionIn 1 - File "..\gm_img_in.dll" -SectionEnd - -Section "AAC Audio" SecAAC - SectionIn 1 - File "..\gm_aac_in.dll" -SectionEnd - -Section "MP3 Audio" SecMP3 - SectionIn 1 - File "..\gm_mp3_in.dll" -SectionEnd - -Section "AC3 Audio" SecAC3 - SectionIn 1 - File "..\gm_ac3_in.dll" -SectionEnd - -Section "FFMPEG" SecFFMPEG - SectionIn 1 - File "..\gm_ffmpeg_in.dll" - File "..\avcodec-*.dll" - File "..\avformat-*.dll" - File "..\avutil-*.dll" - File "..\swscale-*.dll" -SectionEnd - -Section "XviD Video Decoder" SecXVID - SectionIn 1 - File "..\gm_xvid_dec.dll" -SectionEnd - -;Section "AMR NB & WB" SecAMRFT -; SectionIn 1 -; File "..\gm_amr_float_dec.dll" -;SectionEnd - -Section "Subtitles" SecSUBS - SectionIn 1 - File "..\gm_timedtext.dll" -SectionEnd - -Section "ISO File Format" SecISOFF - SectionIn 1 - File "..\gm_isom_in.dll" -SectionEnd - -Section "MPEG-2 TS" SecM2TS - SectionIn 1 - File "..\gm_mpegts_in.dll" -SectionEnd - -Section "RTP/RTSP" SecRTP - SectionIn 1 - File "..\gm_rtp_in.dll" -SectionEnd - -Section "SVG" SecSVG - SectionIn 1 - File "..\gm_svg_in.dll" -SectionEnd - - -Section "GDI+" SecGDIP - SectionIn 1 - call InsertGDIPLUS -SectionEnd - -Section "GPAC 2D Raster" SecG2DS - SectionIn 1 - File "..\gm_soft_raster.dll" -SectionEnd - -Section "FreeType" SecFT - SectionIn 1 - File "..\gm_ft_font.dll" -SectionEnd - -Section "Windows MME Audio" SecWAVE - SectionIn 1 - File "..\gm_wav_out.dll" -SectionEnd - -Section "Xiph" SecXIPH - SectionIn 1 - File "..\gm_ogg.dll" -SectionEnd - -Section "OpenSVC Decoder" SecOSVC - SectionIn 1 - File "..\OpenSVCdecoder.plg" - File "..\gm_opensvc_dec.dll" -SectionEnd - -Section "MPEG DASH Suppport" SecDASH - SectionIn 1 - File "..\gm_mpd_in.dll" -SectionEnd - -Section "UPnP Support" SecUPnP - SectionIn 1 - File "..\gm_platinum.dll" -SectionEnd - -Section "Widget Manager" SecMPEGU - SectionIn 1 - File "..\gm_widgetman.dll" -SectionEnd - -;Section "MobileIP Framework" SecMobIP -; SectionIn 1 -; File "..\gm_mobile_ip.dll" -; File "..\MobileSession.dll" -;SectionEnd - - -;Section "OFFIS Audio compressor" SecOffisComp -; SectionIn 1 -; ;copy GUI -; File "..\gm_offis_compressor.dll" -; File "..\QtCore4.dll" -; File "..\QtGui4.dll" -; SetOutPath $INSTDIR\gui\extensions -; File /r /x .svn ..\..\..\..\gui\extensions\offis* -; SetOutPath $INSTDIR -;SectionEnd - -SubSectionEnd - - -Section "MP4Box" SecMP4B - SectionIn 1 - SetOutPath $INSTDIR - File "..\MP4Box.exe" - File "..\MP42TS.exe" - - Push $INSTDIR - Call AddToPath -SectionEnd - - -Section "GPAC SDK" SecSDK - SectionIn 1 - SetOutPath $INSTDIR\sdk\include - File /r /x CVS ..\..\..\..\include\*.h - SetOutPath $INSTDIR\sdk\lib - File ..\libgpac.lib - File ..\..\..\..\extra_lib\lib\win32\release\js32.lib -SectionEnd - - -!define HK_MOZ "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" - -Section "Osmozilla" SecZILLA - SectionIn 1 - SetOutPath $INSTDIR - File "..\nposmozilla.dll" - File "..\nposmozilla.xpt" - - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Path" "$INSTDIR\nposmozilla.dll" - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "XPTPath" "$INSTDIR\nposmozilla.xpt" - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Version" "${GPAC_VERSION}" - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Vendor" "GPAC" - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Description" "GPAC plugin" - ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "ProductName" "Osmozilla" -SectionEnd - - -Section "GPAX" SecGPAX - SectionIn 1 - SetOutPath $INSTDIR - File "..\GPAX.dll" - RegDLL "$INSTDIR\GPAX.dll" -SectionEnd - - -Section "MP4Client" SecMP4C - SectionIn 1 - SetOutPath $INSTDIR - File "..\MP4Client.exe" -SectionEnd - - - -Section "Windows Runtime Libraries" SecMSVCRT - SectionIn 1 - File "..\Microsoft.VC90.CRT.manifest" - File "..\Microsoft.VC90.MFC.manifest" - File "..\msvcr90.dll" - File "..\mfc90.dll" -SectionEnd - - - - -SubSection "Osmo4 Shortcuts" - -Section "Add Start Menu Shortcuts" - SectionIn 1 - #has current user admin privileges? - userInfo::getAccountType - Pop $0 - StrCmp $0 "Admin" +1 +2 - SetShellVarContext all - CreateDirectory "$SMPROGRAMS\Osmo4" - CreateShortCut "$SMPROGRAMS\Osmo4\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 - CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (Classic UI).lnk" "$INSTDIR\Osmo4.exe" "" - CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (New UI).lnk" "$INSTDIR\MP4Client.exe" "-gui" - CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (New UI With Console).lnk" "$INSTDIR\MP4Client.exe" "" - CreateShortCut "$SMPROGRAMS\Osmo4\Readme.lnk" "$INSTDIR\ReadMe.txt" - CreateShortCut "$SMPROGRAMS\Osmo4\License.lnk" "$INSTDIR\License.txt" - CreateShortCut "$SMPROGRAMS\Osmo4\History.lnk" "$INSTDIR\changelog.txt" - CreateShortCut "$SMPROGRAMS\Osmo4\Configuration Info.lnk" "$INSTDIR\configuration.html" -SectionEnd - -Section "Add shortcut to QuickLaunch" - SectionIn 1 - CreateShortCut "$QUICKLAUNCH\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0 -SectionEnd - -Section "Add shortcut to Desktop" - SectionIn 1 - CreateShortCut "$DESKTOP\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0 -SectionEnd - -!define SHCNE_ASSOCCHANGED 0x08000000 -!define SHCNF_IDLIST 0 - -Section "Make Osmo4 the default MPEG-4 Player" - SectionIn 1 - ;write file association - ${WriteRegStrAuth} HKCR GPAC\mp4\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" - ${WriteRegStrAuth} HKCR GPAC\mp4\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" - ${WriteRegStrAuth} HKCR .mp4 "" "GPAC\mp4" - !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' - -SectionEnd - -Section "Associate 3GPP files (3GP) with Osmo4" - SectionIn 1 - ;write file association - ${WriteRegStrAuth} HKCR GPAC\3gp\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" - ${WriteRegStrAuth} HKCR GPAC\3gp\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" - ${WriteRegStrAuth} HKCR .3gp "" "GPAC\3gp" - !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' -SectionEnd - -Section "Associate 3GPP2 files (3G2) with Osmo4" - SectionIn 1 - ;write file association - ${WriteRegStrAuth} HKCR GPAC\3g2\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" - ${WriteRegStrAuth} HKCR GPAC\3g2\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" - ${WriteRegStrAuth} HKCR .3g2 "" "GPAC\3g2" - !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' -SectionEnd - -SubSectionEnd - - - -!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecOsmo4} "Osmo4 player" - !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "GPAC Plugins" - !insertmacro MUI_DESCRIPTION_TEXT ${SecBIFS} "MPEG-4 BIFS Scene Decoder" - !insertmacro MUI_DESCRIPTION_TEXT ${SecODF} "MPEG-4 Object Descriptor Decoder" - !insertmacro MUI_DESCRIPTION_TEXT ${SecLASeR} "MPEG-4 LASeR Scene Decoder" - !insertmacro MUI_DESCRIPTION_TEXT ${SecTextLoad} "Support for uncompressed MPEG-4 (BT and XMT), VRML and X3D textual formats" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSAF} "MPEG-4 SAF Demultiplexer" - !insertmacro MUI_DESCRIPTION_TEXT ${SecIMG} "Support for PNG, JPEG, BMP and JPEG2000 images" - !insertmacro MUI_DESCRIPTION_TEXT ${SecAAC} "Support for MPEG-4 Audio HE-AAC decoder and web radios" - !insertmacro MUI_DESCRIPTION_TEXT ${SecMP3} "Support for MPEG-1/2 Audio (inc. MP3) decoder and web radios" - !insertmacro MUI_DESCRIPTION_TEXT ${SecAC3} "Support for Dolby AC3 decoder and web radios" - !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMPEG} "Support for FFMPEG libraries for various format decoding and demultiplexing" - !insertmacro MUI_DESCRIPTION_TEXT ${SecXVID} "Support for XVID library for MPEG-4 Video Part 2 decoding" - !insertmacro MUI_DESCRIPTION_TEXT ${SecAMRFT} "Support for AMR and AMR WideBand decoder and web radios" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSUBS} "Subtitle support include SRT, SUB, 3GPP and MPEG-4 Text formats" - !insertmacro MUI_DESCRIPTION_TEXT ${SecISOFF} "Support for ISO-based file formats (3GP, MP4, MJ2K)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecM2TS} "Support for MPEG-2 Transport Stream" - !insertmacro MUI_DESCRIPTION_TEXT ${SecRTP} "Support for RTP and RTSP IP streaming" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSVG} "Support for SVG including progressive loading" - !insertmacro MUI_DESCRIPTION_TEXT ${SecGDIP} "GDIPlus-based rasterizer" - !insertmacro MUI_DESCRIPTION_TEXT ${SecG2DS} "GPAC software rasterizer" - !insertmacro MUI_DESCRIPTION_TEXT ${SecFT} "FreeType font parsing" - !insertmacro MUI_DESCRIPTION_TEXT ${SecWAVE} "Windows MME Audio output support" - !insertmacro MUI_DESCRIPTION_TEXT ${SecXIPH} "Support for XIPP OGG, Vorbis and Theora media" - !insertmacro MUI_DESCRIPTION_TEXT ${SecOSVC} "Support for SVC decoding through OpenSVC Decoder" - !insertmacro MUI_DESCRIPTION_TEXT ${SecDASH} "HTTP Streaming using MPEG DASH" - !insertmacro MUI_DESCRIPTION_TEXT ${SecUPnP} "Support for UPnP based on Platinum" - !insertmacro MUI_DESCRIPTION_TEXT ${SecMPEGU} "Support for W3C and MPEG-U Widgets" - !insertmacro MUI_DESCRIPTION_TEXT ${SecMobIP} "UNIGE Mobile IP Framework" - !insertmacro MUI_DESCRIPTION_TEXT ${SecOffisComp} "OFFIS Audio Compressor" - !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4B} "MP4Box command-line tool for various multimedia operations" - !insertmacro MUI_DESCRIPTION_TEXT ${SecSDK} "GPAC SDK: headers and library files needed to develop modules for GPAC or appllication based on GPAC" - !insertmacro MUI_DESCRIPTION_TEXT ${SecZILLA} "GPAC playback support NPAPI-based browsers (FireFox/Gecko, Safari/WebKit)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecGPAX} "GPAC playback support using ActiveX component (Internet Explorer)" - !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4C} "GPAC command-line player and AVI dumper" - -!insertmacro MUI_FUNCTION_DESCRIPTION_END - - -Function .onInstSuccess -; MessageBox MB_YESNO "GPAC Framework installation complete. Do you want to launch the Osmo4 player?" IDNO NoLaunch -; Exec $INSTDIR\Osmo4.exe -; NoLaunch: -FunctionEnd - - - - - -; uninstall stuff - -UninstallText "This will uninstall OSMO4/GPAC from your computer. Hit next to continue." - -; special uninstall section. -Section "Uninstall" - ; remove registry keys - ${DeleteRegKeyAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" - ${DeleteRegKeyAuth} HKCU "SOFTWARE\GPAC" - ${DeleteRegKeyAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" - ${DeleteRegKeyAuth} HKCR GPAC\mp4\DefaultIcon - ${DeleteRegKeyAuth} HKCR GPAC\mp4\shell\open\command - ${DeleteRegKeyAuth} HKCR GPAC\mp4 - ${DeleteRegKeyAuth} HKCR .mp4 - ${DeleteRegKeyAuth} HKCR GPAC\3gp\DefaultIcon - ${DeleteRegKeyAuth} HKCR GPAC\3gp\shell\open\command - ${DeleteRegKeyAuth} HKCR GPAC\3gp - ${DeleteRegKeyAuth} HKCR .3gp - ${DeleteRegKeyAuth} HKCR GPAC\3g2\DefaultIcon - ${DeleteRegKeyAuth} HKCR GPAC\3g2\shell\open\command - ${DeleteRegKeyAuth} HKCR GPAC\3g2 - ${DeleteRegKeyAuth} HKCR .3g2 - ${DeleteRegKeyAuth} HKCR GPAC - - UnRegDLL "$INSTDIR\GPAX.dll" - RMDir /r $INSTDIR - Push $INSTDIR - Call un.RemoveFromPath - #has current user admin privileges? - userInfo::getAccountType - Pop $0 - StrCmp $0 "Admin" +1 +2 - SetShellVarContext all - Delete "$SMPROGRAMS\Osmo4\*.*" - RMDir "$SMPROGRAMS\Osmo4" - Delete "$QUICKLAUNCH\Osmo4.lnk" - Delete "$DESKTOP\Osmo4.lnk" - -SectionEnd - -;path modif functions -!verbose 3 -!include "WinMessages.NSH" -!verbose 4 +;-------------------------------- +;General +!define GPAC_VERSION 0.5.0 +!include default.out + +!define GPAC_ROOT ..\..\..\.. + +InstallDir "$PROGRAMFILES\GPAC" +InstallDirRegKey HKCU "SOFTWARE\GPAC" "InstallDir" + +RequestExecutionLevel user + + +;-------------------------------- +;Include Modern UI + + !include "MUI2.nsh" + +WindowIcon on +Icon "..\..\..\..\doc\osmo4.ico" +UninstallIcon "..\..\..\..\doc\osmo4.ico" + + +;-------------------------------- +;Interface Settings + + !define MUI_ABORTWARNING + +Var DIALOG +Var Label +Var Confirm + +LangString PAGE_TITLE ${LANG_ENGLISH} "Title" +LangString PAGE_SUBTITLE ${LANG_ENGLISH} "Subtitle" + +Function EnableNext + Pop $R1 + ${NSD_GetState} $Confirm $R1 + GetDlgItem $0 $HWNDPARENT 1 + ${If} $R1 == ${BST_CHECKED} + EnableWindow $0 1 + ${Else} + EnableWindow $0 0 + ${Endif} +FunctionEnd + +Function customPage + !insertmacro MUI_HEADER_TEXT "Patents and Royalties" "Please read carefully the following clause." + GetDlgItem $0 $HWNDPARENT 1 + EnableWindow $0 0 + nsDialogs::Create 1018 + Pop $DIALOG + + ${NSD_CreateLabel} 0 0 100% 120u "Multimedia technologies are often covered by various patents which are most of the time hard to identify. These patents may or may not apply in your local jurisdiction. By installing this software, you acknowledge that you may have to pay royaltee fees in order to legally use this software. Do not proceed with this setup if you do not understand or do not agree with these terms. In any case, the authors and/or distributors bears no liability for any infringing usage of this software, which is provided for educational or research purposes." + Pop $Label + + ${NSD_CreateCheckBox} 0 -30 100% 12u "I understand and accept the conditions" + Pop $Confirm + GetFunctionAddress $0 EnableNext + nsDialogs::OnClick $Confirm $0 + + + nsDialogs::Show +FunctionEnd + +;-------------------------------- +;Pages + + !insertmacro MUI_PAGE_WELCOME + !insertmacro MUI_PAGE_LICENSE "${GPAC_ROOT}\COPYING" + Page custom customPage + !insertmacro MUI_PAGE_COMPONENTS + !insertmacro MUI_PAGE_DIRECTORY + + !insertmacro MUI_PAGE_INSTFILES + !insertmacro MUI_PAGE_FINISH + + !insertmacro MUI_UNPAGE_CONFIRM + !insertmacro MUI_UNPAGE_INSTFILES + + !insertmacro MUI_LANGUAGE "English" + +ComponentText "This will install the GPAC Framework on your computer. Select which optional things you want installed." +DirText "This will install the GPAC Framework on your computer. Choose a directory" + + +Function FctWriteRegStrAuth + ;local var + Push $0 + Push $R0 + Push $R1 + Push $R2 + Push $R3 + ;pop function arguments + Exch 5 + Pop $R3 + Exch 5 + Pop $R2 + Exch 5 + Pop $R1 + Exch 5 + Pop $R0 + + ;test if calling HKCR + StrCmp $R0 "HKCR" +1 +3 + WriteRegStr HKCR $R1 $R2 $R3 + goto lbl_end + + #has current user admin privileges? + userInfo::getAccountType + Pop $0 + StrCmp $0 "Admin" lbl_admin lbl_not_admin + + lbl_admin: + WriteRegStr HKLM $R1 $R2 $R3 + goto lbl_end + + lbl_not_admin: + WriteRegStr HKCU $R1 $R2 $R3 + + lbl_end: + Pop $R3 + Pop $R2 + Pop $R1 + Pop $R0 + Pop $0 +FunctionEnd + +!macro WriteRegStrAuth HKREG SUBREG ENTRY VALUESTR + Push "${HKREG}" + Push "${SUBREG}" + Push "${ENTRY}" + Push "${VALUESTR}" + Call FctWriteRegStrAuth +!macroend + +!define WriteRegStrAuth "!insertmacro WriteRegStrAuth" + + +Function un.FctDeleteRegKeyAuth + ;local var + Push $0 + Push $R0 + Push $R1 + ;pop function arguments + Exch 3 + Pop $R1 + Exch 3 + Pop $R0 + + ;test if calling HKCR + StrCmp $R0 "HKCR" +1 +3 + DeleteRegKey HKCR $R1 + goto lbl_end + + #has current user admin privileges? + userInfo::getAccountType + Pop $0 + StrCmp $0 "Admin" lbl_admin lbl_not_admin + + lbl_admin: + DeleteRegKey HKLM $R1 + goto lbl_end + + lbl_not_admin: + DeleteRegKey HKCU $R1 + + lbl_end: + Pop $0 + Pop $R1 + Pop $R0 +FunctionEnd + +!macro DeleteRegKeyAuth HKREG SUBREG + Push "${HKREG}" + Push "${SUBREG}" + Call un.FctDeleteRegKeyAuth +!macroend + +!define DeleteRegKeyAuth "!insertmacro DeleteRegKeyAuth" + + +Function InsertGDIPLUS + Push $R0 + Push $R1 + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion + StrCmp $R0 "" 0 lbl_winnt + + ;NOT NT + ReadRegStr $R0 HKLM SOFTWARE\Microsoft\Windows\CurrentVersion VersionNumber + + StrCpy $R1 $R0 1 + ; win95, NOT SUPPORTED + StrCmp $R1 '4' 0 lbl_err_95 + StrCpy $R1 $R0 3 + StrCmp $R1 '4.0' lbl_err_95 + ;winME or 98 otherwise + StrCmp $R1 '4.9' lbl_add lbl_add + +lbl_err_nt: + MessageBox MB_OK "Microsoft GDI+ cannot be installed on NT 3 Systems" + Goto lbl_done + +lbl_err_95: + MessageBox MB_OK "Microsoft GDI+ cannot be installed on Windows 95 and older Systems" + Goto lbl_done + +lbl_winnt: + StrCpy $R1 $R0 1 + StrCmp $R1 '3' lbl_err_nt + StrCmp $R1 '4' lbl_add + StrCpy $R1 $R0 3 + StrCmp $R1 '5.0' lbl_add ;2000 + StrCmp $R1 '5.1' lbl_xp ;XP + StrCmp $R1 '5.2' lbl_done ;.NET server + +lbl_add: + File ".\Gdiplus.dll" + +lbl_xp: + File "..\gm_gdip_raster.dll" + +lbl_done: +FunctionEnd + + +;osmo4 install +Section "Osmo4/GPAC Player" SecOsmo4 + SectionIn RO + SetOutPath $INSTDIR + + File /oname=ReadMe.txt "${GPAC_ROOT}\README" + File /oname=License.txt "${GPAC_ROOT}\COPYING" + File /oname=Changelog.txt "${GPAC_ROOT}\Changelog" + File "${GPAC_ROOT}\doc\configuration.html" + File "${GPAC_ROOT}\doc\gpac.mp4" + + File "..\Osmo4.exe" + File "..\..\..\..\doc\osmo4.ico" + File "..\libgpac.dll" + File "..\gm_dummy_in.dll" + File "..\gm_dx_hw.dll" + File "..\js32.dll" + File "..\gm_gpac_js.dll" + File "..\libeay32.dll" + File "..\ssleay32.dll" + File "..\gm_ismacryp.dll" + + ;create default cache + SetOutPath $INSTDIR\cache + + + ;copy GUI + SetOutPath $INSTDIR\gui + File "..\..\..\..\gui\gui.bt" + File "..\..\..\..\gui\gui.js" + File "..\..\..\..\gui\gwlib.js" + File "..\..\..\..\gui\mpegu-core.js" + SetOutPath $INSTDIR\gui\icons + File /r /x .svn ..\..\..\..\gui\icons\* + SetOutPath $INSTDIR\gui\extensions + File /r /x .svn ..\..\..\..\gui\extensions\* + + SetOutPath $INSTDIR + + ${WriteRegStrAuth} HKCU "SOFTWARE\GPAC" "InstallDir" "$INSTDIR" + ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "DisplayName" "Osmo4/GPAC (remove only)" + ${WriteRegStrAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" "UninstallString" "$INSTDIR\uninstall.exe" + WriteUninstaller "uninstall.exe" + +SectionEnd + +SubSection "GPAC Plugins" SecPlugins + + +; +; 2 install modes, normal one and full one + +Section "MPEG-4 BIFS Decoder" SecBIFS + SectionIn 1 + File "..\gm_bifs_dec.dll" +SectionEnd + +Section "MPEG-4 ODF Decoder" SecODF + SectionIn 1 + File "..\gm_odf_dec.dll" +SectionEnd + +Section "MPEG-4 LASeR Decoder" SecLASeR + SectionIn 1 + File "..\gm_laser_dec.dll" +SectionEnd + +Section "MPEG-4 SAF Demultiplexer" SecSAF + SectionIn 1 + File "..\gm_saf_in.dll" +SectionEnd + +Section "Textual MPEG-4 Loader" SecTextLoad + SectionIn 1 + File "..\gm_ctx_load.dll" +SectionEnd + +Section "Image Package (PNG, JPEG, BMP)" SecIMG + SectionIn 1 + File "..\gm_img_in.dll" +SectionEnd + +Section "AAC Audio" SecAAC + SectionIn 1 + File "..\gm_aac_in.dll" +SectionEnd + +Section "MP3 Audio" SecMP3 + SectionIn 1 + File "..\gm_mp3_in.dll" +SectionEnd + +Section "AC3 Audio" SecAC3 + SectionIn 1 + File "..\gm_ac3_in.dll" +SectionEnd + +Section "FFMPEG" SecFFMPEG + SectionIn 1 + File "..\gm_ffmpeg_in.dll" + File "..\avcodec-*.dll" + File "..\avformat-*.dll" + File "..\avutil-*.dll" + File "..\swscale-*.dll" +SectionEnd + +Section "XviD Video Decoder" SecXVID + SectionIn 1 + File "..\gm_xvid_dec.dll" +SectionEnd + +;Section "AMR NB & WB" SecAMRFT +; SectionIn 1 +; File "..\gm_amr_float_dec.dll" +;SectionEnd + +Section "Subtitles" SecSUBS + SectionIn 1 + File "..\gm_timedtext.dll" +SectionEnd + +Section "ISO File Format" SecISOFF + SectionIn 1 + File "..\gm_isom_in.dll" +SectionEnd + +Section "MPEG-2 TS" SecM2TS + SectionIn 1 + File "..\gm_mpegts_in.dll" +SectionEnd + +Section "RTP/RTSP" SecRTP + SectionIn 1 + File "..\gm_rtp_in.dll" +SectionEnd + +Section "SVG" SecSVG + SectionIn 1 + File "..\gm_svg_in.dll" +SectionEnd + + +Section "GDI+" SecGDIP + SectionIn 1 + call InsertGDIPLUS +SectionEnd + +Section "GPAC 2D Raster" SecG2DS + SectionIn 1 + File "..\gm_soft_raster.dll" +SectionEnd + +Section "FreeType" SecFT + SectionIn 1 + File "..\gm_ft_font.dll" +SectionEnd + +Section "Windows MME Audio" SecWAVE + SectionIn 1 + File "..\gm_wav_out.dll" +SectionEnd + +Section "Xiph" SecXIPH + SectionIn 1 + File "..\gm_ogg.dll" +SectionEnd + +Section "OpenSVC Decoder" SecOSVC + SectionIn 1 + File "..\OpenSVCdecoder.plg" + File "..\gm_opensvc_dec.dll" +SectionEnd + +Section "MPEG DASH Suppport" SecDASH + SectionIn 1 + File "..\gm_mpd_in.dll" +SectionEnd + +Section "UPnP Support" SecUPnP + SectionIn 1 + File "..\gm_platinum.dll" +SectionEnd + +Section "Widget Manager" SecMPEGU + SectionIn 1 + File "..\gm_widgetman.dll" +SectionEnd + +;Section "MobileIP Framework" SecMobIP +; SectionIn 1 +; File "..\gm_mobile_ip.dll" +; File "..\MobileSession.dll" +;SectionEnd + + +;Section "OFFIS Audio compressor" SecOffisComp +; SectionIn 1 +; ;copy GUI +; File "..\gm_offis_compressor.dll" +; File "..\QtCore4.dll" +; File "..\QtGui4.dll" +; SetOutPath $INSTDIR\gui\extensions +; File /r /x .svn ..\..\..\..\gui\extensions\offis* +; SetOutPath $INSTDIR +;SectionEnd + +SubSectionEnd + + +Section "MP4Box" SecMP4B + SectionIn 1 + SetOutPath $INSTDIR + File "..\MP4Box.exe" + File "..\MP42TS.exe" + + Push $INSTDIR + Call AddToPath +SectionEnd + + +Section "GPAC SDK" SecSDK + SectionIn 1 + SetOutPath $INSTDIR\sdk\include + File /r /x CVS ..\..\..\..\include\*.h + SetOutPath $INSTDIR\sdk\lib + File ..\libgpac.lib + File ..\..\..\..\extra_lib\lib\win32\release\js32.lib +SectionEnd + + +!define HK_MOZ "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" + +Section "Osmozilla" SecZILLA + SectionIn 1 + SetOutPath $INSTDIR + File "..\nposmozilla.dll" + File "..\nposmozilla.xpt" + + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Path" "$INSTDIR\nposmozilla.dll" + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "XPTPath" "$INSTDIR\nposmozilla.xpt" + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Version" "${GPAC_VERSION}" + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Vendor" "GPAC" + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "Description" "GPAC plugin" + ${WriteRegStrAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" "ProductName" "Osmozilla" +SectionEnd + + +Section "GPAX" SecGPAX + SectionIn 1 + SetOutPath $INSTDIR + File "..\GPAX.dll" + RegDLL "$INSTDIR\GPAX.dll" +SectionEnd + + +Section "MP4Client" SecMP4C + SectionIn 1 + SetOutPath $INSTDIR + File "..\MP4Client.exe" +SectionEnd + + + +Section "Windows Runtime Libraries" SecMSVCRT + SectionIn 1 + File "..\Microsoft.VC90.CRT.manifest" + File "..\Microsoft.VC90.MFC.manifest" + File "..\msvcr90.dll" + File "..\mfc90.dll" +SectionEnd + + + + +SubSection "Osmo4 Shortcuts" + +Section "Add Start Menu Shortcuts" + SectionIn 1 + #has current user admin privileges? + userInfo::getAccountType + Pop $0 + StrCmp $0 "Admin" +1 +2 + SetShellVarContext all + CreateDirectory "$SMPROGRAMS\Osmo4" + CreateShortCut "$SMPROGRAMS\Osmo4\Uninstall.lnk" "$INSTDIR\uninstall.exe" "" "$INSTDIR\uninstall.exe" 0 + CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (Classic UI).lnk" "$INSTDIR\Osmo4.exe" "" + CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (New UI).lnk" "$INSTDIR\MP4Client.exe" "-gui" + CreateShortCut "$SMPROGRAMS\Osmo4\Osmo4 (New UI With Console).lnk" "$INSTDIR\MP4Client.exe" "" + CreateShortCut "$SMPROGRAMS\Osmo4\Readme.lnk" "$INSTDIR\ReadMe.txt" + CreateShortCut "$SMPROGRAMS\Osmo4\License.lnk" "$INSTDIR\License.txt" + CreateShortCut "$SMPROGRAMS\Osmo4\History.lnk" "$INSTDIR\changelog.txt" + CreateShortCut "$SMPROGRAMS\Osmo4\Configuration Info.lnk" "$INSTDIR\configuration.html" +SectionEnd + +Section "Add shortcut to QuickLaunch" + SectionIn 1 + CreateShortCut "$QUICKLAUNCH\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0 +SectionEnd + +Section "Add shortcut to Desktop" + SectionIn 1 + CreateShortCut "$DESKTOP\Osmo4.lnk" "$INSTDIR\Osmo4.exe" "" "$INSTDIR\Osmo4.exe" 0 +SectionEnd + +!define SHCNE_ASSOCCHANGED 0x08000000 +!define SHCNF_IDLIST 0 + +Section "Make Osmo4 the default MPEG-4 Player" + SectionIn 1 + ;write file association + ${WriteRegStrAuth} HKCR GPAC\mp4\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" + ${WriteRegStrAuth} HKCR GPAC\mp4\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" + ${WriteRegStrAuth} HKCR .mp4 "" "GPAC\mp4" + !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' + +SectionEnd + +Section "Associate 3GPP files (3GP) with Osmo4" + SectionIn 1 + ;write file association + ${WriteRegStrAuth} HKCR GPAC\3gp\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" + ${WriteRegStrAuth} HKCR GPAC\3gp\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" + ${WriteRegStrAuth} HKCR .3gp "" "GPAC\3gp" + !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' +SectionEnd + +Section "Associate 3GPP2 files (3G2) with Osmo4" + SectionIn 1 + ;write file association + ${WriteRegStrAuth} HKCR GPAC\3g2\DefaultIcon "" "$INSTDIR\Osmo4.ico, 0" + ${WriteRegStrAuth} HKCR GPAC\3g2\Shell\open\command "" "$INSTDIR\Osmo4.exe %L" + ${WriteRegStrAuth} HKCR .3g2 "" "GPAC\3g2" + !system 'shell32.dll::SHChangeNotify(i, i, i, i) v (${SHCNE_ASSOCCHANGED}, ${SHCNF_IDLIST}, 0, 0)' +SectionEnd + +SubSectionEnd + + + +!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN + !insertmacro MUI_DESCRIPTION_TEXT ${SecOsmo4} "Osmo4 player" + !insertmacro MUI_DESCRIPTION_TEXT ${SecPlugins} "GPAC Plugins" + !insertmacro MUI_DESCRIPTION_TEXT ${SecBIFS} "MPEG-4 BIFS Scene Decoder" + !insertmacro MUI_DESCRIPTION_TEXT ${SecODF} "MPEG-4 Object Descriptor Decoder" + !insertmacro MUI_DESCRIPTION_TEXT ${SecLASeR} "MPEG-4 LASeR Scene Decoder" + !insertmacro MUI_DESCRIPTION_TEXT ${SecTextLoad} "Support for uncompressed MPEG-4 (BT and XMT), VRML and X3D textual formats" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSAF} "MPEG-4 SAF Demultiplexer" + !insertmacro MUI_DESCRIPTION_TEXT ${SecIMG} "Support for PNG, JPEG, BMP and JPEG2000 images" + !insertmacro MUI_DESCRIPTION_TEXT ${SecAAC} "Support for MPEG-4 Audio HE-AAC decoder and web radios" + !insertmacro MUI_DESCRIPTION_TEXT ${SecMP3} "Support for MPEG-1/2 Audio (inc. MP3) decoder and web radios" + !insertmacro MUI_DESCRIPTION_TEXT ${SecAC3} "Support for Dolby AC3 decoder and web radios" + !insertmacro MUI_DESCRIPTION_TEXT ${SecFFMPEG} "Support for FFMPEG libraries for various format decoding and demultiplexing" + !insertmacro MUI_DESCRIPTION_TEXT ${SecXVID} "Support for XVID library for MPEG-4 Video Part 2 decoding" + !insertmacro MUI_DESCRIPTION_TEXT ${SecAMRFT} "Support for AMR and AMR WideBand decoder and web radios" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSUBS} "Subtitle support include SRT, SUB, 3GPP and MPEG-4 Text formats" + !insertmacro MUI_DESCRIPTION_TEXT ${SecISOFF} "Support for ISO-based file formats (3GP, MP4, MJ2K)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecM2TS} "Support for MPEG-2 Transport Stream" + !insertmacro MUI_DESCRIPTION_TEXT ${SecRTP} "Support for RTP and RTSP IP streaming" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSVG} "Support for SVG including progressive loading" + !insertmacro MUI_DESCRIPTION_TEXT ${SecGDIP} "GDIPlus-based rasterizer" + !insertmacro MUI_DESCRIPTION_TEXT ${SecG2DS} "GPAC software rasterizer" + !insertmacro MUI_DESCRIPTION_TEXT ${SecFT} "FreeType font parsing" + !insertmacro MUI_DESCRIPTION_TEXT ${SecWAVE} "Windows MME Audio output support" + !insertmacro MUI_DESCRIPTION_TEXT ${SecXIPH} "Support for XIPP OGG, Vorbis and Theora media" + !insertmacro MUI_DESCRIPTION_TEXT ${SecOSVC} "Support for SVC decoding through OpenSVC Decoder" + !insertmacro MUI_DESCRIPTION_TEXT ${SecDASH} "HTTP Streaming using MPEG DASH" + !insertmacro MUI_DESCRIPTION_TEXT ${SecUPnP} "Support for UPnP based on Platinum" + !insertmacro MUI_DESCRIPTION_TEXT ${SecMPEGU} "Support for W3C and MPEG-U Widgets" + !insertmacro MUI_DESCRIPTION_TEXT ${SecMobIP} "UNIGE Mobile IP Framework" + !insertmacro MUI_DESCRIPTION_TEXT ${SecOffisComp} "OFFIS Audio Compressor" + !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4B} "MP4Box command-line tool for various multimedia operations" + !insertmacro MUI_DESCRIPTION_TEXT ${SecSDK} "GPAC SDK: headers and library files needed to develop modules for GPAC or appllication based on GPAC" + !insertmacro MUI_DESCRIPTION_TEXT ${SecZILLA} "GPAC playback support NPAPI-based browsers (FireFox/Gecko, Safari/WebKit)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecGPAX} "GPAC playback support using ActiveX component (Internet Explorer)" + !insertmacro MUI_DESCRIPTION_TEXT ${SecMP4C} "GPAC command-line player and AVI dumper" + +!insertmacro MUI_FUNCTION_DESCRIPTION_END + + +Function .onInstSuccess +; MessageBox MB_YESNO "GPAC Framework installation complete. Do you want to launch the Osmo4 player?" IDNO NoLaunch +; Exec $INSTDIR\Osmo4.exe +; NoLaunch: +FunctionEnd + + + + + +; uninstall stuff + +UninstallText "This will uninstall OSMO4/GPAC from your computer. Hit next to continue." + +; special uninstall section. +Section "Uninstall" + ; remove registry keys + ${DeleteRegKeyAuth} HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\Osmo4" + ${DeleteRegKeyAuth} HKCU "SOFTWARE\GPAC" + ${DeleteRegKeyAuth} HKCU "SOFTWARE\MozillaPlugins\@gpac/osmozilla,version=1.0" + ${DeleteRegKeyAuth} HKCR GPAC\mp4\DefaultIcon + ${DeleteRegKeyAuth} HKCR GPAC\mp4\shell\open\command + ${DeleteRegKeyAuth} HKCR GPAC\mp4 + ${DeleteRegKeyAuth} HKCR .mp4 + ${DeleteRegKeyAuth} HKCR GPAC\3gp\DefaultIcon + ${DeleteRegKeyAuth} HKCR GPAC\3gp\shell\open\command + ${DeleteRegKeyAuth} HKCR GPAC\3gp + ${DeleteRegKeyAuth} HKCR .3gp + ${DeleteRegKeyAuth} HKCR GPAC\3g2\DefaultIcon + ${DeleteRegKeyAuth} HKCR GPAC\3g2\shell\open\command + ${DeleteRegKeyAuth} HKCR GPAC\3g2 + ${DeleteRegKeyAuth} HKCR .3g2 + ${DeleteRegKeyAuth} HKCR GPAC + + UnRegDLL "$INSTDIR\GPAX.dll" + RMDir /r $INSTDIR + Push $INSTDIR + Call un.RemoveFromPath + #has current user admin privileges? + userInfo::getAccountType + Pop $0 + StrCmp $0 "Admin" +1 +2 + SetShellVarContext all + Delete "$SMPROGRAMS\Osmo4\*.*" + RMDir "$SMPROGRAMS\Osmo4" + Delete "$QUICKLAUNCH\Osmo4.lnk" + Delete "$DESKTOP\Osmo4.lnk" + +SectionEnd + +;path modif functions +!verbose 3 +!include "WinMessages.NSH" +!verbose 4 !ifndef WriteEnvStr_RegKey !ifdef ALL_USERS @@ -665,12 +665,12 @@ SectionEnd !else !define WriteEnvStr_RegKey 'HKCU "Environment"' !endif -!endif - -; AddToPath - Adds the given dir to the search path. -; Input - head of the stack -; Note - Win9x systems requires reboot - +!endif + +; AddToPath - Adds the given dir to the search path. +; Input - head of the stack +; Note - Win9x systems requires reboot + Function AddToPath Exch $0 Push $1 @@ -734,11 +734,11 @@ Function AddToPath Pop $2 Pop $1 Pop $0 -FunctionEnd - -; RemoveFromPath - Remove a given dir from the path -; Input: head of the stack - +FunctionEnd + +; RemoveFromPath - Remove a given dir from the path +; Input: head of the stack + Function un.RemoveFromPath Exch $0 Push $1 @@ -820,21 +820,21 @@ Function un.RemoveFromPath Pop $2 Pop $1 Pop $0 -FunctionEnd - -########################################### -# Utility Functions # -########################################### - -; IsNT -; no input -; output, top of the stack = 1 if NT or 0 if not -; -; Usage: -; Call IsNT -; Pop $R0 -; ($R0 at this point is 1 or 0) - +FunctionEnd + +########################################### +# Utility Functions # +########################################### + +; IsNT +; no input +; output, top of the stack = 1 if NT or 0 if not +; +; Usage: +; Call IsNT +; Pop $R0 +; ($R0 at this point is 1 or 0) + !macro IsNT un Function ${un}IsNT Push $0 @@ -849,24 +849,24 @@ Function ${un}IsNT ; NT!!! Pop $0 Push 1 -FunctionEnd -!macroend -!insertmacro IsNT "" -!insertmacro IsNT "un." - -; StrStr -; input, top of stack = string to search for -; top of stack-1 = string to search in -; output, top of stack (replaces with the portion of the string remaining) -; modifies no other variables. -; -; Usage: -; Push "this is a long ass string" -; Push "ass" -; Call StrStr -; Pop $R0 -; ($R0 at this point is "ass string") - +FunctionEnd +!macroend +!insertmacro IsNT "" +!insertmacro IsNT "un." + +; StrStr +; input, top of stack = string to search for +; top of stack-1 = string to search in +; output, top of stack (replaces with the portion of the string remaining) +; modifies no other variables. +; +; Usage: +; Push "this is a long ass string" +; Push "ass" +; Call StrStr +; Pop $R0 +; ($R0 at this point is "ass string") + !macro StrStr un Function ${un}StrStr Exch $R1 ; st=haystack,old$R1, $R1=needle @@ -898,4 +898,4 @@ done: FunctionEnd !macroend !insertmacro StrStr "" -!insertmacro StrStr "un." +!insertmacro StrStr "un." diff --git a/configure b/configure index 3b0f3a0..2da22e1 100755 --- a/configure +++ b/configure @@ -101,7 +101,6 @@ has_ipv6="no" has_dvb4linux="no" has_xmlrpc="no" has_openjpeg="no" -has_libxml2="no" gprof_build="no" static_build="no" want_pic="no" @@ -117,7 +116,9 @@ disable_od="no" disable_bifs="no" disable_bifs_enc="no" disable_laser="no" -disable_beng="no" +disable_saf="no" +disable_smgr="no" +disable_seng="no" disable_qtvr="no" disable_avi="no" disable_m2ps="no" @@ -143,6 +144,11 @@ disable_isoff_frag="no" disable_isoff_hint="no" disable_isoff_frag="no" disable_streaming="no" +disable_player="no" +disable_scenegraph="no" +disable_dvbx="no" +disable_vobsub="no" +disable_ttxt="no" enable_depth_compositor="no" enable_renoir="no" has_avcap="no" @@ -243,7 +249,8 @@ Configuration options for libgpac - all options can be enabled with --enable-opt --disable-bifs disable BIFS --disable-bifs-enc disable BIFS coder --disable-laser disable LASeR coder - --disable-beng disable scene encoder engine + --disable-saf disable SAF container + --disable-seng disable scene encoder engine --disable-qtvr disable import of Cubic QTVR files --disable-avi disable AVI --disable-ogg disable OGG @@ -269,6 +276,12 @@ Configuration options for libgpac - all options can be enabled with --enable-opt --disable-isoff-hint disable ISO File Format hinting --disable-isoff-frag disable fragments in ISO File Format --disable-streaming disable RTP/RTSP/SDP + --disable-dvb disable DVB-specific tools (MPE, FEC, DSM-CC) + --disable-vobsub disable VobSub support + --disable-sman disable scene manager + --disable-ttxt disable TTXT (3GPP / MPEG-4 Timed Text) support + --disable-player disable player (terminal and compositor) + --disable-scenegraph disable scenegraph, scene parsers and player (terminal and compositor) Extra libraries configuration. You can turn a libray off or force using the local version in gpac/extra_lib/ --use-js=OPT force SpiderMonkey ECMAScript OPT=[no,local] @@ -1418,18 +1431,6 @@ EOF fi #end wx test -#if svg isn't disabled -if test "$disable_svg" != "yes"; then - #then check libxm2 presence via pkg-config - if $pkg_config libxml-2.0 --exists > /dev/null 2>&1 ; then - libxml2_cflags=`$pkg_config libxml-2.0 --cflags` - libxml2_lib_flags=`$pkg_config libxml-2.0 --libs` - has_libxml2="yes" - fi -fi - - - #look for IPv6 cat > $TMPC << EOF #include @@ -1697,7 +1698,7 @@ for opt do --enable-pulseaudio=*) has_pulseaudio="yes" ;; - --disable-all) has_pulseaudio="no"; has_alsa="no"; disable_3d="yes"; disable_svg="yes"; disable_vrml="yes"; disable_od="yes"; disable_bifs="yes"; disable_bifs_enc="yes"; disable_laser="yes"; disable_beng="yes"; disable_qtvr="yes"; disable_avi="yes"; disable_ogg="yes"; disable_m2ps="yes"; disable_m2ts="yes"; disable_m2ts_mux="yes"; disable_parsers="yes"; disable_import="yes"; disable_export="yes"; disable_swf="yes"; disable_scene_stats="yes"; disable_scene_dump="yes"; disable_scene_encode="yes"; disable_loader_isoff="yes"; disable_od_dump="yes"; disable_isom_dump="yes"; disable_mcrypt="yes"; disable_isoff="yes"; disable_isoff_write="yes"; disable_isoff_hint="yes"; disable_isoff_frag="yes"; disable_streaming="yes"; disable_x3d="yes"; disable_loader_bt="yes"; disable_loader_xmt="yes"; has_dvb4linux="no" + --disable-all) has_pulseaudio="no"; has_alsa="no"; disable_3d="yes"; disable_svg="yes"; disable_vrml="yes"; disable_od="yes"; disable_bifs="yes"; disable_bifs_enc="yes"; disable_laser="yes"; disable_seng="yes"; disable_qtvr="yes"; disable_avi="yes"; disable_ogg="yes"; disable_m2ps="yes"; disable_m2ts="yes"; disable_m2ts_mux="yes"; disable_parsers="yes"; disable_import="yes"; disable_export="yes"; disable_swf="yes"; disable_scene_stats="yes"; disable_scene_dump="yes"; disable_scene_encode="yes"; disable_loader_isoff="yes"; disable_od_dump="yes"; disable_isom_dump="yes"; disable_mcrypt="yes"; disable_isoff="yes"; disable_isoff_write="yes"; disable_isoff_hint="yes"; disable_isoff_frag="yes"; disable_streaming="yes"; disable_x3d="yes"; disable_loader_bt="yes"; disable_loader_xmt="yes"; has_dvb4linux="no"; disable_player="yes"; disable_vobsub="yes"; disable_ttxt="yes"; disable_saf="yes"; disable_smgr="yes" ;; --disable-3d) disable_3d="yes" @@ -1732,9 +1733,9 @@ for opt do ;; --enable-laser) disable_laser="no" ;; - --disable-beng) disable_beng="yes" + --disable-seng) disable_seng="yes" ;; - --enable-beng) disable_beng="no" + --enable-seng) disable_seng="no" ;; --disable-qtvr) disable_qtvr="yes" ;; @@ -1834,7 +1835,34 @@ for opt do ;; --enable-streaming) disable_streaming="no" ;; - + --disable-player) disable_player="yes" + ;; + --enable-player) disable_player="no" + ;; + --disable-scenegraph) disable_scenegraph="yes" + ;; + --enable-scenegraph) disable_scenegraph="no" + ;; + --disable-dvbx) disable_dvbx="yes" + ;; + --enable-dvbx) disable_dvbx="no" + ;; + --disable-vobsub) disable_vobsub="yes" + ;; + --enable-vobsub) disable_vobsub="no" + ;; + --disable-ttxt) disable_ttxt="yes" + ;; + --enable-ttxt) disable_ttxt="no" + ;; + --disable-saf) disable_saf="yes" + ;; + --enable-saf) disable_saf="no" + ;; + --disable-smgr) disable_smgr="yes" + ;; + --enable-smgr) disable_smgr="no" + ;; esac done @@ -2065,7 +2093,27 @@ if test "$cpu" = "sh4"; then fi fi - +if test "$disable_scenegraph" = "yes" ; then +disable_3d="yes" +disable_svg="yes" +disable_vrml="yes" +disable_x3d="yes" +disable_od="no" +disable_bifs="yes" +disable_bifs_enc="yes" +disable_laser="yes" +disable_seng="yes" +disable_qtvr="yes" +disable_swf="yes" +disable_scene_stats="yes" +disable_scene_dump="yes" +disable_scene_encode="yes" +disable_loader_isoff="yes" +disable_loader_bt="yes" +disable_loader_xmt="yes" +disable_streaming="yes" +disable_player="yes" +fi #prepare for config.h writing TMPH="${TMPDIR1}/gpac-conf-${RANDOM}-$$-${RANDOM}.h" @@ -2080,12 +2128,16 @@ version_minor=`grep '#define GPAC_VERSION_MINOR ' $source_path/include/gpac/tool version_micro=`grep '#define GPAC_VERSION_MICRO ' $source_path/include/gpac/tools.h | sed -e 's/.*\([0-9]\)\+$/\1/'` soname_version="${version_major}.${version_minor}.${version_micro}" -if which svnversion >/dev/null -then +if [ -d ".svn" ]; then + if which svnversion >/dev/null + then revision="`svnversion \"$source_path\"`" echo "#define GPAC_SVN_REVISION \"$revision\"" > $source_path/include/gpac/version.h -else + else echo "Cannot find SVN revision" + fi +else + echo "#define GPAC_SVN_REVISION \"4065\"" > $source_path/include/gpac/version.h fi echo "" @@ -2111,9 +2163,29 @@ echo "fixed-point version: $use_fixed_point" echo "IPV6 Support: $has_ipv6" +if test "$disable_player" = "yes" ; then + echo "Player disabled" + echo "#define GPAC_DISABLE_PLAYER" >> $TMPH + disable_laser="yes" +fi +if test "$disable_smgr" = "yes" ; then +disable_seng="yes" +disable_qtvr="yes" +disable_swf="yes" +disable_scene_stats="yes" +disable_scene_dump="yes" +disable_scene_encode="yes" +disable_loader_isoff="yes" +disable_loader_bt="yes" +disable_loader_xmt="yes" +disable_svg="yes" + echo "Scene Manager disabled" + echo "#define GPAC_DISABLE_SMGR" >> $TMPH +fi if test "$disable_svg" = "yes" ; then echo "SVG disabled" echo "#define GPAC_DISABLE_SVG" >> $TMPH + disable_laser="yes" fi if test "$disable_vrml" = "yes" ; then echo "MPEG-4/VRML/X3D disabled" @@ -2139,7 +2211,11 @@ if test "$disable_laser" = "yes" ; then echo "LASeR coder disabled" echo "#define GPAC_DISABLE_LASER" >> $TMPH fi -if test "$disable_beng" = "yes" ; then +if test "$disable_saf" = "yes" ; then + echo "SAF container disabled" + echo "#define GPAC_DISABLE_SAF" >> $TMPH +fi +if test "$disable_seng" = "yes" ; then echo "Scene encoder engine disabled" echo "#define GPAC_DISABLE_SENG" >> $TMPH fi @@ -2239,6 +2315,19 @@ if test "$disable_streaming" = "yes" ; then echo "RTP/RTSP/SDP streaming disabled" echo "#define GPAC_DISABLE_STREAMING" >> $TMPH fi +if test "$disable_dvbx" = "yes" ; then + echo "DVB MPE and DSM-CC disabled" + echo "#define GPAC_DISABLE_MPE" >> $TMPH + echo "#define GPAC_DISABLE_DSMCC" >> $TMPH +fi +if test "$disable_vobsub" = "yes" ; then + echo "VobSub disabled" + echo "#define GPAC_DISABLE_VOBSUB" >> $TMPH +fi +if test "$disable_ttxt" = "yes" ; then + echo "TimedText disabled" + echo "#define GPAC_DISABLE_TTXT" >> $TMPH +fi if test "$enable_depth_compositor" = "yes" ; then echo "Depth Compositor enabled" @@ -2529,13 +2618,32 @@ then echo "FREENECT_LDLAGS=$freenect_ld" >> config.mak fi +echo "DISABLE_PLAYER=$disable_player" >> config.mak +echo "DISABLE_STREAMING=$disable_streaming" >> config.mak echo "DISABLE_SVG=$disable_svg" >> config.mak +echo "DISABLE_LASER=$disable_laser" >> config.mak +echo "DISABLE_SAF=$disable_saf" >> config.mak +echo "DISABLE_BIFS=$disable_bifs" >> config.mak +echo "DISABLE_SENG=$disable_seng" >> config.mak +echo "DISABLE_LOADER_ISOFF=$disable_loader_isoff" >> config.mak echo "DISABLE_LOADER_BT=$disable_loader_bt" >> config.mak -echo "HAS_LIBXML2=$has_libxml2" >> config.mak -if test "$has_libxml2" = "yes"; then - echo "XML2_CFLAGS=$libxml2_cflags" >> config.mak - echo "XML2_LIBS=$libxml2_lib_flags" >> config.mak -fi +echo "DISABLE_LOADER_XMT=$disable_loader_xmt" >> config.mak +echo "DISABLE_LOADER_QTVR=$disable_qtvr" >> config.mak +echo "DISABLE_LOADER_SWF=$disable_swf" >> config.mak +echo "DISABLE_SCENE_STATS=$disable_scene_stats" >> config.mak +echo "DISABLE_SCENE_DUMP=$disable_scene_dump" >> config.mak +echo "DISABLE_SCENE_ENCODE=$disable_scene_encode" >> config.mak +echo "DISABLE_SCENEGRAPH=$disable_scenegraph" >> config.mak +echo "DISABLE_MCRYPT=$disable_mcrypt" >> config.mak +echo "DISABLE_DVBX=$disable_dvbx" >> config.mak +echo "DISABLE_AVILIB=$disable_avi" >> config.mak +echo "DISABLE_M2PS=$disable_m2ps" >> config.mak +echo "DISABLE_OGG=$disable_ogg" >> config.mak +echo "DISABLE_ISOFF_HINT=$disable_isoff_hint" >> config.mak +echo "DISABLE_VOBSUB=$disable_vobsub" >> config.mak +echo "DISABLE_TTXT=$disable_ttxt" >> config.mak +echo "DISABLE_SMGR=$disable_smgr" >> config.mak + if test "$disable_parsers" = "yes" ; then disable_m2ts_mux="yes" fi @@ -2544,9 +2652,7 @@ if test "$disable_m2ts_mux" = "yes" -o "$disable_m2ts" = "yes" ; then 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 diff --git a/doc/GPAC UPnP.doc b/doc/GPAC UPnP.doc index 817770b..10ea072 100644 Binary files a/doc/GPAC UPnP.doc and b/doc/GPAC UPnP.doc differ diff --git a/doc/INSTALL.gcc b/doc/INSTALL.gcc index 7026a5e..a3517cc 100644 --- a/doc/INSTALL.gcc +++ b/doc/INSTALL.gcc @@ -1,4 +1,4 @@ -Installation instructions for GPAC 0.4.5 on GCC-powered platforms +Installation instructions for GPAC on GCC-powered platforms last modified: December 2008 0 Foreword diff --git a/doc/INSTALL.gpe b/doc/INSTALL.gpe index b767b32..84169cb 100644 --- a/doc/INSTALL.gpe +++ b/doc/INSTALL.gpe @@ -1,4 +1,4 @@ -Installation instructions for GPAC 0.4.5 on Familiar+GPE platforms +Installation instructions for GPAC on Familiar+GPE platforms last modified: December 2008 0 Foreword diff --git a/doc/INSTALL.symbian b/doc/INSTALL.symbian index 0f77545..3918cd5 100644 --- a/doc/INSTALL.symbian +++ b/doc/INSTALL.symbian @@ -2,6 +2,8 @@ Installation instructions for GPAC 0.4.5 on Symbian 9.1 (S60 3rd Edition) platfo last modified: December 2008 0 Foreword + ! GPAC versions later than 0.4.5 are no longer supported on Symbian ! + Compilation has only been tested with GCCE & Nokia S60 SDK In order to fully compile, you must get: - the complete S60 3rd edition SDK (maintainance release) diff --git a/doc/INSTALL.w32 b/doc/INSTALL.w32 index 0b2b589..21411fb 100644 --- a/doc/INSTALL.w32 +++ b/doc/INSTALL.w32 @@ -1,12 +1,12 @@ -Installation instructions for GPAC 0.4.5 on windows platform -last modified: December 2008 +Installation instructions for GPAC on windows platform +last modified: May 2012 0 Foreword - Compilation has only been tested with MSVC 6 and VS2005 (VC8). + For any question on the installation procedure, please refer to http://gpac.sourceforge.net/home_download.php The output directory for all plugins and applications is - gpac/bin/w32_deb in debug mode - gpac/bin/w32_rel in release mode + gpac/bin/win32/debug in debug mode + gpac/bin/win32/release in release mode As of 0.2.2, GPAC cannot be compiled without ZLIB. You'd better make sure it is installed locally or on your system (zlib is provided in gpac_extra_libs package) @@ -19,7 +19,8 @@ II GPAC compilation open the GPAC workspace: gpac/build/msvc6/GPAC.dsw with MSVC6 - gpac/build/msvc8/gpac.sln with VS2005 + gpac/build/msvc8/gpac.sln with VS2005 + gpac/build/msvc9/gpac.sln with VS2008 NEVER ATTEMPT TO LOAD A PROJECT OUTSIDE THIS WORKSPACE, AS DEPENDENCY RULES WILL BE BROKEN diff --git a/doc/INSTALL.wCE b/doc/INSTALL.wCE index 619e4f2..e308319 100644 --- a/doc/INSTALL.wCE +++ b/doc/INSTALL.wCE @@ -1,5 +1,5 @@ -Installation instructions for GPAC 0.4.5 on windows CE platform -last modified: Mai 2007 +Installation instructions for GPAC on windows CE platform +last modified: Mai 2012 0 Foreword @@ -7,12 +7,12 @@ last modified: Mai 2007 Compilation has only been tested with evc4 and ARM platforms - GPAC 0.4.5 should be stable on most devices running PocketPC/SmartPhone 2003. It has know bugs with higher versions + GPAC should be stable on most devices running PocketPC/SmartPhone 2003. It has know bugs with higher versions of the Windows Mobile OS, but should still be stable. The output directory for all plugins and applications for Windows PocketPC 2003 is - gpac/bin/arm_ppc03_deb in debug mode - gpac/bin/arm_ppc03_rel in release mode + gpac/bin/Smartphone 2003/Debug in debug mode + gpac/bin/Smartphone 2003/Release in release mode As of 0.2.2, GPAC cannot be compiled without ZLIB. You'd better make sure it is installed locally or on your system (zlib is provided in gpac_extra_libs package) @@ -22,7 +22,8 @@ I Extra lib installation II GPAC compilation - open /build/msevc4/GPAC.dsw (GPAC workspace) with MS eVC4 + open /build/msvc8/gpac.sln (GPAC workspace) with MSVC 2005 + open /build/msvc9/gpac.sln (GPAC workspace) with MSVC 2008 NEVER ATTEMPT TO LOAD A PROJECT OUTSIDE THIS WORKSPACE diff --git a/doc/ISO 639-2 codes.txt b/doc/ISO 639-2 codes.txt index 54f255f..7296581 100644 --- a/doc/ISO 639-2 codes.txt +++ b/doc/ISO 639-2 codes.txt @@ -1,4 +1,4 @@ -Codes used in GPAC are according to ISO/IEC 639-2/T as of GPAC 0.4.6-DEV internal rev. 6 +Codes used in GPAC are according to ISO/IEC 639-2/T "Abkhazian","abk","ab", "Achinese","ace","", diff --git a/doc/configuration.html b/doc/configuration.html index b87b7e4..019f6c6 100644 Binary files a/doc/configuration.html and b/doc/configuration.html differ diff --git a/doc/doxyfile b/doc/doxyfile index 0dc2d7b..d545a45 100644 --- a/doc/doxyfile +++ b/doc/doxyfile @@ -4,7 +4,7 @@ # Project related configuration options #--------------------------------------------------------------------------- PROJECT_NAME = libgpac -PROJECT_NUMBER = 0.4.5 +PROJECT_NUMBER = 0.5.0 OUTPUT_DIRECTORY = . CREATE_SUBDIRS = NO OUTPUT_LANGUAGE = English diff --git a/doc/man/gpac.1 b/doc/man/gpac.1 index 5befdc0..15254f2 100644 --- a/doc/man/gpac.1 +++ b/doc/man/gpac.1 @@ -1,4 +1,4 @@ -.TH "GPAC" 1 "December 2006" "GPAC Configuration" "GPAC Configuration" +.TH "GPAC" 1 "May 2012" "GPAC Configuration" "GPAC Configuration" . .SH NAME .LP @@ -6,7 +6,7 @@ GPAC \- MPEG-4 Systems Framework and Software Development Kit .SH "DESCRIPTION" .LP GPAC stands (does it ?) for GPAC Project on Advanced Content. It is an implementation of the MPEG-4 Systems standard written in ANSI C. GPAC provides tools for media playback, vector graphics and 3D rendering, MPEG-4 authoring and distribution. -This man page is about configuration of the GPAC framework version 0.4.5. +This man page is about configuration of the GPAC framework version 0.5.0. . .SH INTRODUCTION Some applications in the GPAC framework use a configuration file shared among modules and reloadable at run time. This file is located in the user home directory and called ".gpacrc". diff --git a/gpac.spec b/gpac.spec index 7d98972..88a620c 100644 --- a/gpac.spec +++ b/gpac.spec @@ -1,11 +1,11 @@ # $Id: gpac.spec,v 1.5 2008-12-02 18:04:42 jeanlf Exp $ Summary: GPAC is a multimedia framework covering MPEG-4, VRML/X3D and SVG. Name: gpac -Version: 0.4.5 -Release: DEV +Version: 0.5.0 +Release: 0.5.0 License: LGPL Group: Applications/Multimedia -Source0: gpac-0.4.5.tar.gz%{?_with_amr:Source1:http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-700.zip} +Source0: gpac-0.5.0.tar.gz%{?_with_amr:Source1:http://www.3gpp.org/ftp/Specs/archive/26_series/26.073/26073-700.zip} URL: http://gpac.sourceforge.net/ BuildRoot: %{_tmppath}/%{name}-root Requires: SDL @@ -36,19 +36,18 @@ standard (ISO/IEC 14496-1) developed from scratch in C. The main development goal is to provide a clean (a.k.a. readable by as many people as possible), small and flexible alternative to the MPEG-4 Systems reference software (known as IM1 and distributed in ISO/IEC 14496-5). +GPAC covers a very large part of the MPEG-4 standard, and features what can probably +be seen as the most advanced and robust 2D MPEG-4 Player available worldwide, as well as +a decent 3D MPEG-4/VRML player. The second development goal is to achieve integration of recent multimedia -standards (SVG/SMIL, VRML, X3D, SWF, etc) into a single framework. -GPAC already supports most of VRML97 and SVG Tiny 1.2, as well as some X3D and simple SWF support. - -GPAC already features 2D and 3D multimedia playback, MPEG-4 Systems -encoders/multiplexers and publishing tools for content distribution. +standards for content playback (SVG/SMIL, VRML, X3D, SWF, etc) and content delivery into a single framework. +GPAC features 2D and 3D multimedia playback, MPEG-4 Systems (BIFS and LASeR) encoders, multiplexers and +publishing tools for content distribution, such as RTP streamers, MPEG-2 TS muxers, ISO Base Media File (MP4 & 3GP a.k.a. ISO/IEC 14496-12) +and MPEG DASH muxers. GPAC is licensed under the GNU Lesser General Public License. -The current GPAC release (0.4.5) already covers a very large part of the MPEG-4 standard, -and features what can probably be seen as the most advanced and robust 2D MPEG-4 -Player available worldwide, as well as a decent 3D MPEG-4/VRML player. Available rpmbuild rebuild options : --without : js freetype faad a52 jpeg png mad xvid ffmpeg diff --git a/include/gpac/crypt.h b/include/gpac/crypt.h index 9b681e3..6518c83 100644 --- a/include/gpac/crypt.h +++ b/include/gpac/crypt.h @@ -156,37 +156,6 @@ u32 gf_crypt_str_get_algo_supported_key_sizes(const char *algorithm, int *keys); #endif /*GPAC_DISABLE_MCRYPT*/ -/*SHA1 from Christophe Devine*/ -typedef struct -{ - u32 total[2]; - u32 state[5]; - u8 buffer[64]; -} GF_SHA1Context; - -/* - * Core SHA-1 functions - */ -void gf_sha1_starts(GF_SHA1Context *ctx ); -void gf_sha1_update(GF_SHA1Context *ctx, u8 *input, u32 length); -void gf_sha1_finish(GF_SHA1Context *ctx, u8 digest[20] ); - -/* - * Output SHA-1(file contents), returns 0 if successful. - */ -int gf_sha1_file(const char *filename, u8 digest[20]); - -/* - * Output SHA-1(buf) - */ -void gf_sha1_csum(u8 *buf, u32 buflen, u8 digest[20]); - -/* - * Output HMAC-SHA-1(key,buf) - */ -void gf_sha1_hmac(u8 *key, u32 keylen, u8 *buf, u32 buflen, u8 digest[20]); - - #ifdef __cplusplus } #endif diff --git a/include/gpac/internal/bifs_tables.h b/include/gpac/internal/bifs_tables.h index e07aae3..e83cccc 100644 --- a/include/gpac/internal/bifs_tables.h +++ b/include/gpac/internal/bifs_tables.h @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Tue Nov 08 09:10:57 2011 - BY MPEG4Gen for GPAC Version 0.4.6-DEV + BY MPEG4Gen for GPAC Version 0.5.0 */ #ifndef _NDT_H diff --git a/include/gpac/internal/compositor_dev.h b/include/gpac/internal/compositor_dev.h index ef3cea0..5ab1422 100644 --- a/include/gpac/internal/compositor_dev.h +++ b/include/gpac/internal/compositor_dev.h @@ -167,6 +167,9 @@ struct __tag_compositor /*compositor exclusive access to the scene and display*/ GF_Mutex *mx; + /*list of modules containing hardcoded proto implementations*/ + GF_List *proto_modules; + /*the main scene graph*/ GF_SceneGraph *scene; /*extra scene graphs (OSD, etc), always registered in draw order. That's the module responsability diff --git a/include/gpac/internal/m3u8.h b/include/gpac/internal/m3u8.h index d8709e4..320e401 100644 --- a/include/gpac/internal/m3u8.h +++ b/include/gpac/internal/m3u8.h @@ -1,7 +1,8 @@ /** * GPAC - Multimedia Framework C SDK * - * Copyright (c) Jean Le Feuvre 2000-2005 + * Authors: Pierre Souchay + * Copyright (c) Telecom ParisTech 2010-2012 * All rights reserved * * This file is part of GPAC @@ -19,7 +20,6 @@ * You should have received a copy of the GNU Lesser General Public * License along with this library; see the file COPYING. If not, write to * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * Written by Pierre Souchay for VizionR SAS * */ #ifndef M3U8_PLAYLIST_H diff --git a/include/gpac/internal/media_dev.h b/include/gpac/internal/media_dev.h index c6c4b26..956426d 100644 --- a/include/gpac/internal/media_dev.h +++ b/include/gpac/internal/media_dev.h @@ -27,7 +27,10 @@ #define _GF_MEDIA_DEV_H_ #include + +#ifndef GPAC_DISABLE_STREAMING #include +#endif #ifndef GPAC_DISABLE_ISOM void gf_media_get_sample_average_infos(GF_ISOFile *file, u32 Track, u32 *avgSize, u32 *MaxSize, u32 *TimeDelta, u32 *maxCTSDelta, u32 *const_duration, u32 *bandwidth); diff --git a/include/gpac/internal/vobsub.h b/include/gpac/internal/vobsub.h index 2b82d98..a723b14 100644 --- a/include/gpac/internal/vobsub.h +++ b/include/gpac/internal/vobsub.h @@ -27,6 +27,7 @@ #define _GF_VOBSUB_H_ #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/gpac/ismacryp.h b/include/gpac/ismacryp.h index 270b299..dac6e47 100644 --- a/include/gpac/ismacryp.h +++ b/include/gpac/ismacryp.h @@ -37,9 +37,6 @@ GF_Err gf_ismacryp_gpac_get_info(u32 stream_id, char *drm_file, char *key, char /*loads key and salt for MPEG4IP protected files*/ Bool gf_ismacryp_mpeg4ip_get_info(char *kms_uri, char *key, char *salt); - -/*computes file hash. If file is ISO-based, computre hash according to OMA (P)DCF (without MutableDRMInformation box)*/ -GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]); enum { diff --git a/include/gpac/media_tools.h b/include/gpac/media_tools.h index bd3b2a8..b2fe236 100644 --- a/include/gpac/media_tools.h +++ b/include/gpac/media_tools.h @@ -33,6 +33,8 @@ extern "C" { #include #include +/*computes file hash. If file is ISO-based, computre hash according to OMA (P)DCF (without MutableDRMInformation box)*/ +GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]); #ifndef GPAC_DISABLE_ISOM /*creates (if needed) a GF_ESD for the given track - THIS IS RESERVED for local playback diff --git a/include/gpac/modules/hardcoded_proto.h b/include/gpac/modules/hardcoded_proto.h new file mode 100644 index 0000000..10f0f15 --- /dev/null +++ b/include/gpac/modules/hardcoded_proto.h @@ -0,0 +1,68 @@ +/* + * GPAC - Multimedia Framework C SDK + * + * Authors: Ivica Arsov, Jean Le Feuvre + * Copyright (c) Telecom ParisTech 2012 + * All rights reserved + * + * This file is part of GPAC / modules interfaces + * + * GPAC is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * GPAC is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; see the file COPYING. If not, write to + * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ + + +#ifndef _GF_MODULE_PROTO_MOD_H_ +#define _GF_MODULE_PROTO_MOD_H_ + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/*interface name and version for Built-in proto User Extensions*/ +#define GF_HARDCODED_PROTO_INTERFACE GF_4CC('G','H','P', '1') + +typedef struct _hc_proto_mod +{ + /* interface declaration*/ + GF_DECL_MODULE_INTERFACE + + /*load hardcoded proto + compositor: compositor used for loading + node: proto node to be loaded + */ + Bool (*init)(GF_Compositor* compositor, GF_Node* node); + + /*check if the module can load a proto + url: url to check + */ + Bool (*can_load_proto)(const char* url); + + /*module private*/ + void *udta; +} GF_HardcodedProto; + + +#ifdef __cplusplus +} +#endif + + +#endif /*#define _GF_MODULE_PROTO_MOD_H_*/ + diff --git a/include/gpac/mpegts.h b/include/gpac/mpegts.h index 542d563..9bc55da 100644 --- a/include/gpac/mpegts.h +++ b/include/gpac/mpegts.h @@ -1117,8 +1117,7 @@ GF_Err gf_m2ts_program_stream_update_ts_scale(GF_ESInterface *_self, u32 time_sc #endif /*GPAC_DISABLE_MPEG2TS_MUX*/ /******************* Demux DVB ****************************/ -#include -#include + #define UDP_BUFFER_SIZE 0x40000 #define M2TS_BUFFER_MAX 400 diff --git a/include/gpac/nodes_mpeg4.h b/include/gpac/nodes_mpeg4.h index 7652b0f..5520c08 100644 --- a/include/gpac/nodes_mpeg4.h +++ b/include/gpac/nodes_mpeg4.h @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Tue Nov 08 09:10:57 2011 - BY MPEG4Gen for GPAC Version 0.4.6-DEV + BY MPEG4Gen for GPAC Version 0.5.0 */ #ifndef _nodes_mpeg4_H diff --git a/include/gpac/nodes_x3d.h b/include/gpac/nodes_x3d.h index e81579c..b3a1fc1 100644 --- a/include/gpac/nodes_x3d.h +++ b/include/gpac/nodes_x3d.h @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Fri Jul 31 16:39:50 2009 - BY X3DGen for GPAC Version 0.4.6-DEV + BY X3DGen for GPAC Version 0.5.0 */ #ifndef _GF_X3D_NODES_H diff --git a/include/gpac/tools.h b/include/gpac/tools.h index 7f74223..f4e50d3 100644 --- a/include/gpac/tools.h +++ b/include/gpac/tools.h @@ -61,7 +61,7 @@ extern "C" { * NO SPACE in GPAC_VERSION for proper install * SONAME versions must be digits (not strings) */ -#define GPAC_VERSION "0.4.6-DEV" +#define GPAC_VERSION "0.5.0" #define GPAC_VERSION_MAJOR 2 #define GPAC_VERSION_MINOR 0 #define GPAC_VERSION_MICRO 0 @@ -831,6 +831,27 @@ GF_Err gf_gz_compress_payload(char **data, u32 data_len, u32 *out_size); GF_Err gf_gz_decompress_payload(char *data, u32 data_len, char **uncompressed_data, u32 *out_size); +/*SHA1*/ +typedef struct __sha1_context GF_SHA1Context; + +/* + * Core SHA-1 functions + */ +GF_SHA1Context *gf_sha1_starts(); +void gf_sha1_update(GF_SHA1Context *ctx, u8 *input, u32 length); +void gf_sha1_finish(GF_SHA1Context *ctx, u8 digest[20] ); + +/* + * Output SHA-1(file contents), returns 0 if successful. + */ +int gf_sha1_file(const char *filename, u8 digest[20]); + +/* + * Output SHA-1(buf) + */ +void gf_sha1_csum(u8 *buf, u32 buflen, u8 digest[20]); + + #ifdef GPAC_ANDROID typedef void (*fm_callback_func)(void *cbk_obj, u32 type, u32 param, int *value); extern void gf_fm_request_set_callback(void *cbk_obj, fm_callback_func cbk_func); diff --git a/modules/Makefile b/modules/Makefile index 5de07db..7e313c2 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -1,7 +1,11 @@ include ../config.mak #all OS and lib independent -PLUGDIRS=aac_in ac3_in audio_filter bifs_dec ctx_load dummy_in soft_raster mp3_in isom_in odf_dec rtp_in timedtext img_in svg_in saf_in mpegts_in ismacryp mpd_in +PLUGDIRS=aac_in ac3_in audio_filter bifs_dec dummy_in soft_raster mp3_in isom_in odf_dec rtp_in timedtext img_in saf_in mpegts_in ismacryp mpd_in + +ifeq ($(DISABLE_SMGR), no) +PLUGDIRS+=ctx_load svg_in +endif ifeq ($(DISABLE_SVG), no) PLUGDIRS+=laser_dec svg_in widgetman @@ -105,6 +109,10 @@ endif endif +ifeq ($(DISABLE_PLAYER), yes) +PLUGDIRS= +endif + all: plugs diff --git a/modules/ffmpeg_in/ffmpeg_in.h b/modules/ffmpeg_in/ffmpeg_in.h index cf2a20e..4b2bdf5 100644 --- a/modules/ffmpeg_in/ffmpeg_in.h +++ b/modules/ffmpeg_in/ffmpeg_in.h @@ -152,7 +152,7 @@ void FFDEC_Delete(void *ifce); //#define FFMPEG_DUMP_REMOTE -#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 102, 0) +#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 113, 1) #define USE_PRE_0_7 1 #endif diff --git a/modules/platinum/GPACPlatinum.cpp b/modules/platinum/GPACPlatinum.cpp index 7109b18..e998ca3 100644 --- a/modules/platinum/GPACPlatinum.cpp +++ b/modules/platinum/GPACPlatinum.cpp @@ -528,7 +528,7 @@ void GF_UPnP::OnMediaServerAdd(PLT_DeviceDataReference& device, int added) static JSBool upnpdevice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp) { char *prop_name; - GPAC_DeviceItem *dev = (GPAC_DeviceItem *)JS_GetPrivate(c, obj); + GPAC_DeviceItem *dev = (GPAC_DeviceItem *)SMJS_GET_PRIVATE(c, obj); if (!dev) return JS_FALSE; if (!SMJS_ID_IS_STRING(id)) return JS_TRUE; @@ -546,6 +546,10 @@ static JSBool upnpdevice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETT } else if (!strcmp(prop_name, "ServicesCount")) { u32 count = gf_list_count(dev->m_Services); + if (!count) { + dev->RefreshServiceList(); + count = gf_list_count(dev->m_Services); + } *vp = INT_TO_JSVAL(count); } SMJS_FREE(c, prop_name); @@ -557,7 +561,7 @@ static JSBool upnp_device_subscribe(JSContext *c, JSObject *obj, uintN argc, jsv { PLT_Service* service; char *service_uuid; - GPAC_DeviceItem *item = (GPAC_DeviceItem *)JS_GetPrivate(c, obj); + GPAC_DeviceItem *item = (GPAC_DeviceItem *)SMJS_GET_PRIVATE(c, obj); if (!item || (argc!=2) ) return JS_FALSE; if (!JSVAL_IS_STRING(argv[0])) return JS_FALSE; @@ -577,7 +581,7 @@ static JSBool SMJS_FUNCTION(upnp_device_find_service) char *service_uuid; SMJS_OBJ SMJS_ARGS - GPAC_DeviceItem *item = (GPAC_DeviceItem *)JS_GetPrivate(c, obj); + GPAC_DeviceItem *item = (GPAC_DeviceItem *)SMJS_GET_PRIVATE(c, obj); if (!item || !argc) return JS_FALSE; service_uuid = SMJS_CHARS(c, argv[0]); @@ -596,7 +600,7 @@ static JSBool SMJS_FUNCTION(upnp_device_get_service) u32 service_index; SMJS_OBJ SMJS_ARGS - GPAC_DeviceItem *item = (GPAC_DeviceItem *)JS_GetPrivate(c, obj); + GPAC_DeviceItem *item = (GPAC_DeviceItem *)SMJS_GET_PRIVATE(c, obj); if (!item || !argc || !JSVAL_IS_INT(argv[0])) return JS_FALSE; service_index = JSVAL_TO_INT(argv[0]); @@ -624,7 +628,7 @@ void GF_UPnP::OnDeviceAdd(GPAC_DeviceItem *item, int added) item->obj = JS_NewObject(m_pJSCtx, &upnpGenericDeviceClass, 0, 0); item->m_pUPnP = this; gf_js_add_root(m_pJSCtx, &item->obj, GF_JSGC_OBJECT); - JS_SetPrivate(item->js_ctx, item->obj, item); + SMJS_SET_PRIVATE(item->js_ctx, item->obj, item); } JS_LookupProperty(m_pJSCtx, m_pObj, "onDeviceAdd", &funval); @@ -640,7 +644,7 @@ void GF_UPnP::OnDeviceAdd(GPAC_DeviceItem *item, int added) static JSBool upnp_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp) { char *prop_name; - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp) return JS_FALSE; if (!SMJS_ID_IS_STRING(id)) return JS_TRUE; @@ -672,7 +676,7 @@ static JSBool upnp_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, js static JSBool upnp_setProperty(JSContext *c, JSObject *obj, SMJS_PROP_SETTER, jsval *vp) { char *prop_name; - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp) return JS_FALSE; if (!SMJS_ID_IS_STRING(id)) return JS_TRUE; @@ -707,7 +711,7 @@ static JSBool SMJS_FUNCTION(upnp_get_device) GPAC_DeviceItem *device; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || !argc || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE; idx = JSVAL_TO_INT(argv[0]); @@ -720,7 +724,7 @@ static JSBool SMJS_FUNCTION(upnp_get_device) device->obj = JS_NewObject(upnp->m_pJSCtx, &upnp->upnpGenericDeviceClass, 0, 0); device->m_pUPnP = upnp; gf_js_add_root(upnp->m_pJSCtx, &device->obj, GF_JSGC_OBJECT); - JS_SetPrivate(device->js_ctx, device->obj, device); + SMJS_SET_PRIVATE(device->js_ctx, device->obj, device); } SMJS_SET_RVAL( OBJECT_TO_JSVAL(device->obj) ); return JS_TRUE; @@ -732,7 +736,7 @@ static JSBool SMJS_FUNCTION(upnp_find_service) char *serv_name; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc!=2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_STRING(argv[1]) ) return JS_FALSE; dev_ip = SMJS_CHARS(c, argv[0]); @@ -816,7 +820,7 @@ static JSBool SMJS_FUNCTION(upnp_renderer_open) char *item, *resource_url; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc<1) ) return JS_FALSE; render = upnp_renderer_get_device(upnp, c, obj); @@ -885,7 +889,7 @@ static JSBool SMJS_FUNCTION_EXT(upnp_renderer_playback, u32 act_type) GPAC_MediaRendererItem *render; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp) return JS_FALSE; render = upnp_renderer_get_device(upnp, c, obj); @@ -945,7 +949,7 @@ static JSBool SMJS_FUNCTION(upnp_get_renderer) JSObject *s_obj; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || !upnp->m_pAVCtrlPoint || (argc!=1) ) return JS_FALSE; GPAC_MediaRendererItem *mr = NULL; @@ -964,7 +968,7 @@ static JSBool SMJS_FUNCTION(upnp_get_renderer) if (!mr) return JS_FALSE; s_obj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, 0); - JS_SetPrivate(c, s_obj, upnp); + SMJS_SET_PRIVATE(c, s_obj, upnp); JS_DefineProperty(c, s_obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(c, mr->m_device->GetFriendlyName()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineProperty(c, s_obj, "UUID", STRING_TO_JSVAL( JS_NewStringCopyZ(c, mr->m_UUID ) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); @@ -986,7 +990,7 @@ static JSBool SMJS_FUNCTION(upnp_server_browse) char *dir, *filter, *_dir, *_filter; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc!=2) ) return JS_FALSE; server = upnp_server_get_device(upnp, c, obj); @@ -1039,7 +1043,7 @@ static JSBool SMJS_FUNCTION(upnp_server_has_parent_dir) { GPAC_MediaServerItem *server; SMJS_OBJ - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp) return JS_FALSE; server = upnp_server_get_device(upnp, c, obj); @@ -1053,7 +1057,7 @@ static JSBool SMJS_FUNCTION(upnp_server_get_resource_uri) u32 idx; SMJS_OBJ SMJS_ARGS - PLT_MediaObject *mo = (PLT_MediaObject *)JS_GetPrivate(c, obj); + PLT_MediaObject *mo = (PLT_MediaObject *)SMJS_GET_PRIVATE(c, obj); if (!mo || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE; idx = JSVAL_TO_INT(argv[0]); if (idxm_Resources.GetItemCount()) { @@ -1071,7 +1075,7 @@ static JSBool SMJS_FUNCTION(upnp_server_get_file) JSObject *f_obj; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE; server = upnp_server_get_device(upnp, c, obj); @@ -1084,7 +1088,7 @@ static JSBool SMJS_FUNCTION(upnp_server_get_file) if (!mo) return JS_TRUE; f_obj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, 0); - JS_SetPrivate(c, f_obj, mo); + SMJS_SET_PRIVATE(c, f_obj, mo); JS_DefineProperty(c, f_obj, "ObjectID", STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_ObjectID)), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineProperty(c, f_obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(c, mo->m_Title)), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); @@ -1104,7 +1108,7 @@ static JSBool SMJS_FUNCTION(upnp_server_get_file_uri) u32 id; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc!=1) || !JSVAL_IS_INT(argv[0]) ) return JS_FALSE; server = upnp_server_get_device(upnp, c, obj); @@ -1127,7 +1131,7 @@ static JSBool SMJS_FUNCTION(upnp_get_server) JSObject *s_obj; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || !upnp->m_pAVCtrlPoint || (argc!=1)) return JS_FALSE; @@ -1146,7 +1150,7 @@ static JSBool SMJS_FUNCTION(upnp_get_server) } if (!ms) return JS_FALSE; s_obj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, 0); - JS_SetPrivate(c, s_obj, upnp); + SMJS_SET_PRIVATE(c, s_obj, upnp); JS_DefineProperty(c, s_obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(c, ms->m_device->GetFriendlyName()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineProperty(c, s_obj, "UUID", STRING_TO_JSVAL( JS_NewStringCopyZ(c, ms->m_UUID ) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); @@ -1164,7 +1168,7 @@ static JSBool SMJS_FUNCTION(upnp_get_server) static JSBool SMJS_FUNCTION(upnp_bind_renderer) { SMJS_OBJ - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp) return JS_TRUE; upnp->m_renderer_bound = 1; @@ -1180,7 +1184,7 @@ static JSBool SMJS_FUNCTION(upnp_share_resource) NPT_String resourceURI; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || !upnp->m_pMediaServer || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_TRUE; url = SMJS_CHARS(c, argv[0]); if (!url) return JS_TRUE; @@ -1204,7 +1208,7 @@ static JSBool SMJS_FUNCTION(upnp_share_virtual_resource) char *res_url, *res_val, *mime; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || !upnp->m_pMediaServer || (argc<2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_STRING(argv[1]) ) return JS_TRUE; res_url = SMJS_CHARS(c, argv[0]); if (!res_url) return JS_TRUE; @@ -1234,7 +1238,7 @@ static JSBool SMJS_FUNCTION(upnp_device_setup_service) NPT_Result res; SMJS_OBJ SMJS_ARGS - GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj); + GPAC_GenericDevice *device = (GPAC_GenericDevice *)SMJS_GET_PRIVATE(c, obj); if (!device) return JS_FALSE; if (argc<3) return JS_FALSE; @@ -1278,7 +1282,7 @@ static JSBool SMJS_FUNCTION(upnp_device_start) jsval sval; char *str; SMJS_OBJ - GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj); + GPAC_GenericDevice *device = (GPAC_GenericDevice *)SMJS_GET_PRIVATE(c, obj); if (!device) return JS_FALSE; if (JS_LookupProperty(device->m_pUPnP->m_pJSCtx, obj, "PresentationURL", &sval) && JSVAL_IS_STRING(sval)) { @@ -1353,7 +1357,7 @@ static JSBool SMJS_FUNCTION(upnp_device_start) static JSBool SMJS_FUNCTION(upnp_device_stop) { SMJS_OBJ - GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj); + GPAC_GenericDevice *device = (GPAC_GenericDevice *)SMJS_GET_PRIVATE(c, obj); if (!device) return JS_FALSE; PLT_DeviceHostReference devRef(device); @@ -1379,7 +1383,7 @@ static GPAC_GenericDevice *upnp_create_generic_device(GF_UPnP *upnp, JSObject*gl JS_DefineFunction(upnp->m_pJSCtx, device->obj, "SetupService", upnp_device_setup_service, 0, 0); JS_DefineFunction(upnp->m_pJSCtx, device->obj, "Start", upnp_device_start, 0, 0); // JS_DefineFunction(upnp->m_pJSCtx, device->obj, "Stop", upnp_device_stop, 0, 0); - JS_SetPrivate(upnp->m_pJSCtx, device->obj, device); + SMJS_SET_PRIVATE(upnp->m_pJSCtx, device->obj, device); if (!upnp->m_Devices) upnp->m_Devices = gf_list_new(); gf_list_add(upnp->m_Devices, device); @@ -1392,7 +1396,7 @@ static JSBool SMJS_FUNCTION(upnp_create_device) char *id, *name; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc != 2)) return JS_FALSE; id = SMJS_CHARS(c, argv[0]); @@ -1417,10 +1421,10 @@ static JSBool SMJS_FUNCTION(upnp_delete_device) GPAC_GenericDevice *device; SMJS_OBJ SMJS_ARGS - GF_UPnP *upnp = (GF_UPnP *)JS_GetPrivate(c, obj); + GF_UPnP *upnp = (GF_UPnP *)SMJS_GET_PRIVATE(c, obj); if (!upnp || (argc != 1)) return JS_FALSE; - device = (GPAC_GenericDevice *) JS_GetPrivate(c, JSVAL_TO_OBJECT(argv[0]) ); + device = (GPAC_GenericDevice *) SMJS_GET_PRIVATE(c, JSVAL_TO_OBJECT(argv[0]) ); if (!device) return JS_FALSE; gf_list_del_item(upnp->m_Devices, device); @@ -1497,7 +1501,7 @@ Bool GF_UPnP::LoadJS(GF_TermExtJS *param) JS_InitClass(m_pJSCtx, (JSObject*)param->global, 0, &upnpClass, 0, 0, upnpClassProps, upnpClassFuncs, 0, 0); m_pObj = JS_DefineObject(m_pJSCtx, (JSObject*)param->global, "UPnP", &upnpClass, 0, 0); - JS_SetPrivate(m_pJSCtx, m_pObj, this); + SMJS_SET_PRIVATE(m_pJSCtx, m_pObj, this); JS_SETUP_CLASS(upnpDeviceClass, "UPNPAVDEVICE", JSCLASS_HAS_PRIVATE, JS_PropertyStub, JS_PropertyStub_forSetter, JS_FinalizeStub); diff --git a/modules/platinum/GenericDevice.cpp b/modules/platinum/GenericDevice.cpp index 514c27d..962acf4 100644 --- a/modules/platinum/GenericDevice.cpp +++ b/modules/platinum/GenericDevice.cpp @@ -61,7 +61,7 @@ void GPAC_ServiceItem::DetachJS() { if (obj) { gf_js_remove_root(js_ctx, &obj, GF_JSGC_OBJECT); - JS_SetPrivate(js_ctx, obj, NULL); + SMJS_SET_PRIVATE(js_ctx, obj, NULL); obj = NULL; } if (!JSVAL_IS_NULL(on_event)) { @@ -106,7 +106,7 @@ GPAC_DeviceItem::~GPAC_DeviceItem() void GPAC_DeviceItem::DetachJS() { if (obj) { gf_js_remove_root(js_ctx, &obj, GF_JSGC_OBJECT); - JS_SetPrivate(js_ctx, obj, NULL); + SMJS_SET_PRIVATE(js_ctx, obj, NULL); obj = NULL; } while (gf_list_count(m_Services)) { @@ -125,7 +125,7 @@ static JSBool SMJS_FUNCTION(upnp_service_set_listener) u32 i; SMJS_OBJ SMJS_ARGS - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service || !argc || !JSVAL_IS_OBJECT(argv[0])) return JS_FALSE; if (argc<1) { @@ -184,7 +184,7 @@ static JSBool SMJS_FUNCTION(upnp_service_set_action_listener) u32 i; SMJS_OBJ SMJS_ARGS - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service || (argc<2) || !JSVAL_IS_STRING(argv[0]) || !JSVAL_IS_OBJECT(argv[1])) return JS_FALSE; name = SMJS_CHARS(c, argv[0]); @@ -234,10 +234,23 @@ static JSBool SMJS_FUNCTION(upnp_service_set_action_listener) return JS_TRUE; } +static JSBool SMJS_FUNCTION(upnp_service_get_scpd) +{ + NPT_String name; + SMJS_OBJ + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); + if (!service ) + return JS_FALSE; + + service->m_service->GetSCPDXML(name); + SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, name) ) ); + return JS_TRUE; +} + JSBool upnpservice_getProperty(JSContext *c, JSObject *obj, SMJS_PROP_GETTER, jsval *vp) { char *prop_name; - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service) return JS_FALSE; if (!SMJS_ID_IS_STRING(id)) return JS_TRUE; @@ -261,7 +274,7 @@ static JSBool SMJS_FUNCTION(upnp_service_has_var) char *name = NULL; SMJS_OBJ SMJS_ARGS - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE; @@ -277,7 +290,7 @@ static JSBool SMJS_FUNCTION(upnp_service_has_action) char *name = NULL; SMJS_OBJ SMJS_ARGS - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE; @@ -302,7 +315,7 @@ static JSBool SMJS_FUNCTION(upnp_service_call_action) char *action_name = NULL; SMJS_OBJ SMJS_ARGS - GPAC_ServiceItem *service = (GPAC_ServiceItem *)JS_GetPrivate(c, obj); + GPAC_ServiceItem *service = (GPAC_ServiceItem *)SMJS_GET_PRIVATE(c, obj); if (!service || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE; action_name = SMJS_CHARS(c, argv[0]); @@ -381,6 +394,16 @@ static JSBool SMJS_FUNCTION(upnp_service_call_action) #endif +void GPAC_DeviceItem::RefreshServiceList() +{ + u32 i; + NPT_Array services = m_device->GetServices(); + + for (i=0; iGetServiceType()); + } +} GPAC_ServiceItem *GPAC_DeviceItem::FindService(const char *type) { @@ -403,7 +426,7 @@ GPAC_ServiceItem *GPAC_DeviceItem::FindService(const char *type) serv->js_ctx = js_ctx; serv->obj = JS_NewObject(serv->js_ctx, &m_pUPnP->upnpServiceClass, 0, obj); gf_js_add_root(serv->js_ctx, &serv->obj, GF_JSGC_OBJECT); - JS_SetPrivate(serv->js_ctx, serv->obj, serv); + SMJS_SET_PRIVATE(serv->js_ctx, serv->obj, serv); JS_DefineProperty(serv->js_ctx, serv->obj, "Name", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceID()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineProperty(serv->js_ctx, serv->obj, "Type", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, service->GetServiceType()) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); JS_DefineProperty(serv->js_ctx, serv->obj, "Hostname", STRING_TO_JSVAL( JS_NewStringCopyZ(serv->js_ctx, m_device->GetURLBase().GetHost() ) ), 0, 0, JSPROP_READONLY | JSPROP_PERMANENT); @@ -412,6 +435,7 @@ GPAC_ServiceItem *GPAC_DeviceItem::FindService(const char *type) JS_DefineFunction(serv->js_ctx, serv->obj, "HasAction", upnp_service_has_action, 2, 0); JS_DefineFunction(serv->js_ctx, serv->obj, "CallAction", upnp_service_call_action, 2, 0); JS_DefineFunction(serv->js_ctx, serv->obj, "SetActionListener", upnp_service_set_action_listener, 2, 0); + JS_DefineFunction(serv->js_ctx, serv->obj, "GetSCPD", upnp_service_get_scpd, 1, 0); #endif @@ -495,7 +519,7 @@ static JSBool SMJS_FUNCTION(upnp_action_get_argument_value) char *arg_name = NULL; SMJS_OBJ SMJS_ARGS - PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj); + PLT_Action *action = (PLT_Action *) SMJS_GET_PRIVATE(c, obj); if (!action || !argc || !JSVAL_IS_STRING(argv[0])) return JS_FALSE; arg_name = SMJS_CHARS(c, argv[0]); @@ -510,7 +534,7 @@ static JSBool SMJS_FUNCTION(upnp_action_get_error_code) { NPT_String res; SMJS_OBJ - PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj); + PLT_Action *action = (PLT_Action *) SMJS_GET_PRIVATE(c, obj); if (!action ) return JS_FALSE; SMJS_SET_RVAL( INT_TO_JSVAL( action->GetErrorCode() )); return JS_TRUE; @@ -521,7 +545,7 @@ static JSBool SMJS_FUNCTION(upnp_action_get_error) NPT_String res; unsigned int code; SMJS_OBJ - PLT_Action *action = (PLT_Action *) JS_GetPrivate(c, obj); + PLT_Action *action = (PLT_Action *) SMJS_GET_PRIVATE(c, obj); if (!action ) return JS_FALSE; SMJS_SET_RVAL( STRING_TO_JSVAL( JS_NewStringCopyZ(c, action->GetError( code ) ) ) ); return JS_TRUE; @@ -617,7 +641,7 @@ NPT_Result GPAC_GenericController::OnActionResponse(NPT_Result res, PLT_ActionRe GF_LOG(GF_LOG_INFO, GF_LOG_NETWORK, ("[UPnP] Calling handler for response %s\n", (char *) action->GetActionDesc().GetName())); act_obj = JS_NewObject(serv->js_ctx, &item->m_pUPnP->upnpDeviceClass, 0, item->obj); - JS_SetPrivate(serv->js_ctx, act_obj, (void *)action.AsPointer() ); + SMJS_SET_PRIVATE(serv->js_ctx, act_obj, (void *)action.AsPointer() ); JS_DefineFunction(serv->js_ctx, act_obj, "GetArgumentValue", upnp_action_get_argument_value, 1, 0); JS_DefineFunction(serv->js_ctx, act_obj, "GetErrorCode", upnp_action_get_error_code, 1, 0); JS_DefineFunction(serv->js_ctx, act_obj, "GetError", upnp_action_get_error, 1, 0); @@ -737,7 +761,7 @@ static JSBool SMJS_FUNCTION(upnp_service_set_state_variable) char *name, *val; SMJS_OBJ SMJS_ARGS - GPAC_Service* service = (GPAC_Service*) JS_GetPrivate(c, obj); + GPAC_Service* service = (GPAC_Service*) SMJS_GET_PRIVATE(c, obj); if (!service) return JS_FALSE; name = SMJS_CHARS(c, argv[0]); @@ -760,7 +784,7 @@ void GPAC_Service::SetupJS(JSContext *c, GF_UPnP *upnp, JSObject *parent) m_pCtx = c; m_pObj = JS_NewObject(c, &upnp->upnpDeviceClass, 0, parent); gf_js_add_root(m_pCtx, &m_pObj, GF_JSGC_OBJECT); - JS_SetPrivate(c, m_pObj, this); + SMJS_SET_PRIVATE(c, m_pObj, this); JS_DefineFunction(c, m_pObj, "SetStateVariable", upnp_service_set_state_variable, 2, 0); } @@ -837,7 +861,7 @@ static JSBool SMJS_FUNCTION(upnp_action_get_argument) char *act_name; SMJS_OBJ SMJS_ARGS - GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj); + GPAC_GenericDevice *device = (GPAC_GenericDevice *)SMJS_GET_PRIVATE(c, obj); if (!device || !argc || !JSVAL_IS_STRING(argv[0]) ) return JS_FALSE; act_name = SMJS_CHARS(c, argv[0]); @@ -853,7 +877,7 @@ static JSBool SMJS_FUNCTION(upnp_action_send_reply) { SMJS_OBJ SMJS_ARGS - GPAC_GenericDevice *device = (GPAC_GenericDevice *)JS_GetPrivate(c, obj); + GPAC_GenericDevice *device = (GPAC_GenericDevice *)SMJS_GET_PRIVATE(c, obj); if (!device) return JS_FALSE; if (argc && JSVAL_IS_OBJECT(argv[0]) ) { @@ -941,7 +965,7 @@ GPAC_GenericDevice::OnAction(PLT_ActionReference& action, JSObject *js_action = JS_NewObject(m_pUPnP->m_pJSCtx, &m_pUPnP->upnpDeviceClass, 0, 0); argv[0] = OBJECT_TO_JSVAL(js_action); - JS_SetPrivate(m_pUPnP->m_pJSCtx, js_action, this); + SMJS_SET_PRIVATE(m_pUPnP->m_pJSCtx, js_action, this); act_ref = action; @@ -956,7 +980,7 @@ GPAC_GenericDevice::OnAction(PLT_ActionReference& action, jsval rval; JS_CallFunctionValue(m_pUPnP->m_pJSCtx, obj, act_proc, 1, argv, &rval); - JS_SetPrivate(m_pUPnP->m_pJSCtx, js_action, NULL); + SMJS_SET_PRIVATE(m_pUPnP->m_pJSCtx, js_action, NULL); m_pUPnP->LockJavascript(0); if (JSVAL_IS_INT(rval) && (JSVAL_TO_INT(rval) != 0)) { diff --git a/modules/platinum/GenericDevice.h b/modules/platinum/GenericDevice.h index 083e0c5..e498684 100644 --- a/modules/platinum/GenericDevice.h +++ b/modules/platinum/GenericDevice.h @@ -59,6 +59,7 @@ public: GF_UPnP *m_pUPnP; GPAC_ServiceItem *FindService(const char *type); + void RefreshServiceList(); GF_List *m_Services; #ifdef GPAC_HAS_SPIDERMONKEY diff --git a/regression_tests/svg/all_syntaxes_1.1F2.svg b/regression_tests/svg/all_syntaxes_1.1F2.svg index a04560b..ad81ac8 100644 --- a/regression_tests/svg/all_syntaxes_1.1F2.svg +++ b/regression_tests/svg/all_syntaxes_1.1F2.svg @@ -176,7 +176,7 @@ font-variant="normal" font-weight="all" font-stretch="all" - font-size="all" + font-size="12" unicode-range="U+0-7FFFFFFF, U+0-7FFFFFFF" units-per-em="2048" panose-1="0 1 2 3 4 5 6 7 8 9" diff --git a/regression_tests/svg/utfscript.svg b/regression_tests/svg/utfscript.svg index 7849941..3729e8d 100644 --- a/regression_tests/svg/utfscript.svg +++ b/regression_tests/svg/utfscript.svg @@ -1,5 +1,4 @@ - Léa diff --git a/regression_tests/utfscript.svg b/regression_tests/utfscript.svg index 7849941..3729e8d 100644 --- a/regression_tests/utfscript.svg +++ b/regression_tests/utfscript.svg @@ -1,5 +1,4 @@ - Léa diff --git a/src/Makefile b/src/Makefile index 3bdad5b..c0f4cb2 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,16 +15,25 @@ LDFLAGS+=-pg endif ## libgpac objects gathering: src/utils -LIBGPAC_UTILS=utils/os_divers.o utils/os_net.o utils/os_module.o utils/os_thread.o utils/os_config_init.o utils/list.o utils/base_encoding.o utils/bitstream.o utils/color.o utils/configfile.o utils/cache.o utils/downloader.o utils/error.o utils/math.o utils/path2d.o utils/path2d_stroker.o utils/module.o utils/token.o utils/uni_bidi.o utils/url.o utils/utf.o utils/xml_parser.o utils/alloc.o utils/ringbuffer.o utils/unicode.o +LIBGPAC_UTILS=utils/os_divers.o utils/os_net.o utils/os_module.o utils/os_thread.o utils/os_config_init.o utils/list.o utils/base_encoding.o utils/bitstream.o utils/color.o utils/configfile.o utils/cache.o utils/downloader.o utils/error.o utils/math.o utils/path2d.o utils/path2d_stroker.o utils/module.o utils/token.o utils/uni_bidi.o utils/url.o utils/utf.o utils/xml_parser.o utils/alloc.o utils/ringbuffer.o utils/unicode.o utils/sha1.o ## libgpac objects gathering: src/ietf +LIBGPAC_IETF= +ifeq ($(DISABLE_STREAMING), no) LIBGPAC_IETF=ietf/rtcp.o ietf/rtp.o ietf/rtp_packetizer.o ietf/rtp_pck_3gpp.o ietf/rtp_pck_mpeg12.o ietf/rtp_pck_mpeg4.o ietf/rtsp_command.o ietf/rtsp_common.o ietf/rtsp_response.o ietf/rtsp_session.o ietf/sdp.o ietf/rtp_depacketizer.o ietf/rtp_streamer.o +endif ## libgpac objects gathering: src/bifs +LIBGPAC_BIFS= +ifeq ($(DISABLE_BIFS), no) LIBGPAC_BIFS=bifs/arith_decoder.o bifs/bifs_codec.o bifs/bifs_node_tables.o bifs/com_dec.o bifs/com_enc.o bifs/conditional.o bifs/field_decode.o bifs/field_encode.o bifs/memory_decoder.o bifs/predictive_mffield.o bifs/quantize.o bifs/script_dec.o bifs/script_enc.o bifs/unquantize.o +endif ## libgpac objects gathering: src/isomedia -LIBGPAC_ISOM=isomedia/avc_ext.o isomedia/box_code_3gpp.o isomedia/box_code_apple.o isomedia/box_code_base.o isomedia/box_code_isma.o isomedia/box_code_meta.o isomedia/box_dump.o isomedia/box_funcs.o isomedia/data_map.o isomedia/hint_track.o isomedia/hinting.o isomedia/isma_sample.o isomedia/isom_intern.o isomedia/isom_read.o isomedia/isom_store.o isomedia/isom_write.o isomedia/media.o isomedia/media_odf.o isomedia/meta.o isomedia/movie_fragments.o isomedia/sample_descs.o isomedia/stbl_read.o isomedia/stbl_write.o isomedia/track.o isomedia/tx3g.o +LIBGPAC_ISOM=isomedia/avc_ext.o isomedia/box_code_3gpp.o isomedia/box_code_apple.o isomedia/box_code_base.o isomedia/box_code_isma.o isomedia/box_code_meta.o isomedia/box_dump.o isomedia/box_funcs.o isomedia/data_map.o isomedia/isma_sample.o isomedia/isom_intern.o isomedia/isom_read.o isomedia/isom_store.o isomedia/isom_write.o isomedia/media.o isomedia/media_odf.o isomedia/meta.o isomedia/movie_fragments.o isomedia/sample_descs.o isomedia/stbl_read.o isomedia/stbl_write.o isomedia/track.o isomedia/tx3g.o +ifeq ($(DISABLE_ISOFF_HINT), no) +LIBGPAC_ISOM+=isomedia/hint_track.o isomedia/hinting.o +endif ## libgpac objects gathering: src/odf LIBGPAC_ODF=odf/desc_private.o odf/descriptors.o odf/ipmpx_code.o odf/ipmpx_dump.o odf/ipmpx_parse.o odf/oci_codec.o odf/odf_code.o odf/odf_codec.o odf/odf_command.o odf/odf_dump.o odf/odf_parse.o odf/qos.o odf/slc.o @@ -33,13 +42,80 @@ LIBGPAC_ODF=odf/desc_private.o odf/descriptors.o odf/ipmpx_code.o odf/ipmpx_dump LIBGPAC_SCENE=scenegraph/base_scenegraph.o scenegraph/mpeg4_animators.o scenegraph/commands.o scenegraph/mpeg4_nodes.o scenegraph/mpeg4_valuator.o scenegraph/vrml_interpolators.o scenegraph/vrml_proto.o scenegraph/vrml_route.o scenegraph/vrml_script.o scenegraph/vrml_smjs.o scenegraph/vrml_tools.o scenegraph/x3d_nodes.o scenegraph/svg_attributes.o scenegraph/svg_types.o scenegraph/svg_smjs.o scenegraph/smil_anim.o scenegraph/smil_timing.o scenegraph/svg_properties.o scenegraph/dom_events.o scenegraph/dom_smjs.o scenegraph/xbl_process.o scenegraph/xml_ns.o ## libgpac objects gathering: src/mcrypt -LIBGPAC_MCRYPT=mcrypt/cbc.o mcrypt/cfb.o mcrypt/ctr.o mcrypt/des.o mcrypt/ecb.o mcrypt/g_crypt.o mcrypt/ncfb.o mcrypt/nofb.o mcrypt/ofb.o mcrypt/rijndael-128.o mcrypt/rijndael-192.o mcrypt/rijndael-256.o mcrypt/stream.o mcrypt/tripledes.o mcrypt/sha1.o +LIBGPAC_MCRYPT= +ifeq ($(DISABLE_MCRYPT), no) +LIBGPAC_MCRYPT+=mcrypt/cbc.o mcrypt/cfb.o mcrypt/ctr.o mcrypt/des.o mcrypt/ecb.o mcrypt/g_crypt.o mcrypt/ncfb.o mcrypt/nofb.o mcrypt/ofb.o mcrypt/rijndael-128.o mcrypt/rijndael-192.o mcrypt/rijndael-256.o mcrypt/stream.o mcrypt/tripledes.o +endif ## libgpac objects gathering: src/media tools -LIBGPAC_MEDIATOOLS=media_tools/ait.o media_tools/av_parsers.o media_tools/avilib.o media_tools/dsmcc.o media_tools/dvb.o media_tools/filestreamer.o media_tools/gpac_ogg.o media_tools/img.o media_tools/ismacryp.o media_tools/isom_hinter.o media_tools/isom_tools.o media_tools/media_export.o media_tools/media_import.o media_tools/mpeg2_ps.o media_tools/text_import.o media_tools/saf.o media_tools/mpegts.o media_tools/dvb_mpe.o media_tools/reedsolomon.o media_tools/vobsub.o media_tools/m2ts_mux.o media_tools/m3u8.o media_tools/mpd.o +LIBGPAC_MEDIATOOLS=media_tools/av_parsers.o media_tools/img.o media_tools/isom_tools.o media_tools/media_export.o media_tools/media_import.o media_tools/mpegts.o media_tools/m2ts_mux.o media_tools/m3u8.o media_tools/mpd.o +ifeq ($(DISABLE_STREAMING), no) +LIBGPAC_MEDIATOOLS+=media_tools/filestreamer.o +endif +ifeq ($(DISABLE_DVBX), no) +LIBGPAC_MEDIATOOLS+=media_tools/ait.o media_tools/dsmcc.o media_tools/dvb_mpe.o media_tools/reedsolomon.o +endif +ifeq ($(DISABLE_AVILIB), no) +LIBGPAC_MEDIATOOLS+=media_tools/avilib.o +endif +ifeq ($(DISABLE_M2PS), no) +LIBGPAC_MEDIATOOLS+=media_tools/mpeg2_ps.o +endif +ifeq ($(DISABLE_OGG), no) +LIBGPAC_MEDIATOOLS+=media_tools/gpac_ogg.o +endif +ifeq ($(DISABLE_MCRYPT), no) +LIBGPAC_MEDIATOOLS+=media_tools/ismacryp.o +endif +ifeq ($(DISABLE_ISOFF_HINT), no) +LIBGPAC_MEDIATOOLS+=media_tools/isom_hinter.o +endif +ifeq ($(DISABLE_SAF), no) +LIBGPAC_MEDIATOOLS+=media_tools/saf.o +endif +ifeq ($(DISABLE_VOBSUB), no) +LIBGPAC_MEDIATOOLS+=media_tools/vobsub.o +endif +ifeq ($(DISABLE_TTXT), no) +LIBGPAC_MEDIATOOLS+=media_tools/text_import.o +endif + ## libgpac objects gathering: src/scene_manager -LIBGPAC_SCENEMANAGER=scene_manager/loader_bt.o scene_manager/loader_isom.o scene_manager/loader_qt.o scene_manager/loader_xmt.o scene_manager/scene_dump.o scene_manager/scene_manager.o scene_manager/scene_stats.o scene_manager/swf_parse.o scene_manager/swf_bifs.o scene_manager/text_to_bifs.o scene_manager/scene_engine.o scene_manager/encode_isom.o scene_manager/loader_svg.o +LIBGPAC_SCENEMANAGER= +ifeq ($(DISABLE_SMGR), no) +LIBGPAC_SCENEMANAGER+=scene_manager/scene_manager.o +endif +ifeq ($(DISABLE_LOADER_BT), no) +LIBGPAC_SCENEMANAGER+=scene_manager/loader_bt.o scene_manager/text_to_bifs.o +endif +ifeq ($(DISABLE_LOADER_XMT), no) +LIBGPAC_SCENEMANAGER+=scene_manager/loader_xmt.o +endif +ifeq ($(DISABLE_LOADER_ISOFF), no) +LIBGPAC_SCENEMANAGER+=scene_manager/loader_isom.o +endif +ifeq ($(DISABLE_LOADER_QTVR), no) +LIBGPAC_SCENEMANAGER+=scene_manager/loader_qt.o +endif +ifeq ($(DISABLE_SVG), no) +LIBGPAC_SCENEMANAGER+=scene_manager/loader_svg.o +endif +ifeq ($(DISABLE_LOADER_SWF), no) +LIBGPAC_SCENEMANAGER+=scene_manager/swf_parse.o scene_manager/swf_bifs.o +endif +ifeq ($(DISABLE_SCENE_DUMP), no) +LIBGPAC_SCENEMANAGER+=scene_manager/scene_dump.o +endif +ifeq ($(DISABLE_SCENE_STATS), no) +LIBGPAC_SCENEMANAGER+=scene_manager/scene_stats.o +endif +ifeq ($(DISABLE_SENG), no) +LIBGPAC_SCENEMANAGER+=scene_manager/scene_engine.o +endif +ifeq ($(DISABLE_SCENE_ENCODE), no) +LIBGPAC_SCENEMANAGER+=scene_manager/encode_isom.o +endif ## libgpac objects gathering: src/terminal LIBGPAC_TERMINAL=terminal/channel.o terminal/clock.o terminal/decoder.o terminal/term_node_init.o terminal/input_sensor.o terminal/media_control.o terminal/media_manager.o terminal/media_memory.o terminal/media_object.o terminal/media_sensor.o terminal/mpeg4_inline.o terminal/network_service.o terminal/object_browser.o terminal/object_manager.o terminal/scene.o terminal/terminal.o terminal/svg_external.o @@ -47,9 +123,19 @@ LIBGPAC_TERMINAL=terminal/channel.o terminal/clock.o terminal/decoder.o terminal ## libgpac objects gathering: src/compositor LIBGPAC_COMPOSITOR=compositor/audio_input.o compositor/audio_mixer.o compositor/audio_render.o compositor/bindable.o compositor/camera.o compositor/compositor.o compositor/compositor_2d.o compositor/compositor_3d.o compositor/compositor_node_init.o compositor/drawable.o compositor/events.o compositor/font_engine.o compositor/hc_flash_shape.o compositor/hardcoded_protos.o compositor/mesh.o compositor/mesh_collide.o compositor/mesh_tesselate.o compositor/mpeg4_animstream.o compositor/mpeg4_audio.o compositor/mpeg4_background.o compositor/mpeg4_background2d.o compositor/mpeg4_bitmap.o compositor/mpeg4_composite.o compositor/mpeg4_form.o compositor/mpeg4_geometry_2d.o compositor/mpeg4_geometry_3d.o compositor/mpeg4_geometry_ifs2d.o compositor/mpeg4_geometry_ils2d.o compositor/mpeg4_gradients.o compositor/mpeg4_grouping.o compositor/mpeg4_grouping_2d.o compositor/mpeg4_grouping_3d.o compositor/mpeg4_layer_2d.o compositor/mpeg4_layer_3d.o compositor/mpeg4_layout.o compositor/mpeg4_lighting.o compositor/mpeg4_path_layout.o compositor/mpeg4_sensors.o compositor/mpeg4_sound.o compositor/mpeg4_text.o compositor/mpeg4_textures.o compositor/mpeg4_timesensor.o compositor/mpeg4_viewport.o compositor/navigate.o compositor/offscreen_cache.o compositor/svg_base.o compositor/svg_filters.o compositor/svg_font.o compositor/svg_geometry.o compositor/svg_grouping.o compositor/svg_media.o compositor/svg_paint_servers.o compositor/svg_text.o compositor/texturing.o compositor/texturing_gl.o compositor/visual_manager.o compositor/visual_manager_2d.o compositor/visual_manager_2d_draw.o compositor/visual_manager_3d.o compositor/visual_manager_3d_gl.o compositor/x3d_geometry.o +ifeq ($(DISABLE_PLAYER), yes) +LIBGPAC_COMPOSITOR= +LIBGPAC_TERMINAL= +endif +ifeq ($(DISABLE_SCENEGRAPH), yes) +LIBGPAC_SCENE= +endif + + + ## libgpac objects gathering: src/laser LIBGPAC_LASER= -ifeq ($(DISABLE_SVG), no) +ifeq ($(DISABLE_LASER), no) LIBGPAC_LASER=laser/lsr_enc.o laser/lsr_dec.o laser/lsr_tables.o endif @@ -108,10 +194,6 @@ endif ## libgpac compositor compilation options COMPOSITOR_CFLAGS= -## SVG disabled -ifeq ($(DISABLE_SVG), yes) -COMPOSITOR_CFLAGS+=-DGPAC_DISABLE_SVG -endif ## Add prefix before every lib ifneq ($(prefix), /usr/local) diff --git a/src/bifs/bifs_node_tables.c b/src/bifs/bifs_node_tables.c index 220014b..a024495 100644 --- a/src/bifs/bifs_node_tables.c +++ b/src/bifs/bifs_node_tables.c @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Tue Nov 08 09:10:57 2011 - BY MPEG4Gen for GPAC Version 0.4.6-DEV + BY MPEG4Gen for GPAC Version 0.5.0 */ diff --git a/src/compositor/compositor.c b/src/compositor/compositor.c index 19ca532..71b4645 100644 --- a/src/compositor/compositor.c +++ b/src/compositor/compositor.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "nodes_stacks.h" @@ -457,7 +458,6 @@ GF_Compositor *gf_sc_new(GF_User *user, Bool self_threaded, GF_Terminal *term) { GF_Err e; GF_Compositor *tmp; - GF_SAFEALLOC(tmp, GF_Compositor); if (!tmp){ @@ -467,7 +467,17 @@ GF_Compositor *gf_sc_new(GF_User *user, Bool self_threaded, GF_Terminal *term) tmp->user = user; tmp->term = term; tmp->mx = gf_mx_new("Compositor"); - + + /*load proto modules*/ + if (user) { + u32 i; + tmp->proto_modules = gf_list_new(); + for (i=0; i< gf_modules_get_count(user->modules); i++) { + GF_HardcodedProto *ifce = (GF_HardcodedProto *) gf_modules_load_interface(user->modules, i, GF_HARDCODED_PROTO_INTERFACE); + if (ifce) gf_list_add(tmp->proto_modules, ifce); + } + } + if (self_threaded) { @@ -568,6 +578,15 @@ void gf_sc_del(GF_Compositor *compositor) if (compositor->audio_renderer) gf_sc_ar_del(compositor->audio_renderer); compositor->audio_renderer = NULL; + /*unload proto modules*/ + if (compositor->proto_modules) { + u32 i; + for (i=0; i< gf_list_count(compositor->proto_modules); i++) { + GF_HardcodedProto *ifce = gf_list_get(compositor->proto_modules, i); + gf_modules_close_interface((GF_BaseInterface *) ifce); + } + gf_list_del(compositor->proto_modules); + } #ifdef GF_SR_EVENT_QUEUE gf_mx_p(compositor->ev_mx); while (gf_list_count(compositor->events)) { @@ -822,10 +841,10 @@ GF_Err gf_sc_set_scene(GF_Compositor *compositor, GF_SceneGraph *scene_graph) SVG_Length *w, *h; SVG_ViewBox *vb; Bool is_svg = 0; -#endif - const char *opt; u32 tag; GF_Node *top_node; +#endif + const char *opt; Bool had_size_info = compositor->has_size_info; /*get pixel size if any*/ gf_sg_get_scene_size_info(compositor->scene, &width, &height); @@ -839,11 +858,11 @@ GF_Err gf_sc_set_scene(GF_Compositor *compositor, GF_SceneGraph *scene_graph) /*default back color is black*/ if (! (compositor->user->init_flags & GF_TERM_WINDOWLESS)) compositor->back_color = 0xFF000000; +#ifndef GPAC_DISABLE_SVG top_node = gf_sg_get_root_node(compositor->scene); tag = 0; if (top_node) tag = gf_node_get_tag(top_node); -#ifndef GPAC_DISABLE_SVG w = h = NULL; vb = NULL; if ((tag>=GF_NODE_RANGE_FIRST_SVG) && (tag<=GF_NODE_RANGE_LAST_SVG)) { @@ -1729,10 +1748,10 @@ GF_Node *gf_sc_pick_node(GF_Compositor *compositor, s32 X, s32 Y) static void gf_sc_setup_root_visual(GF_Compositor *compositor, GF_Node *top_node) { if (top_node && !compositor->root_visual_setup) { - Bool force_navigate=0; GF_SceneGraph *scene = compositor->scene; u32 node_tag; #ifndef GPAC_DISABLE_3D + Bool force_navigate=0; Bool was_3d = compositor->visual->type_3d; #endif compositor->root_visual_setup = 1; diff --git a/src/compositor/hardcoded_protos.c b/src/compositor/hardcoded_protos.c index 159b27a..695cae4 100644 --- a/src/compositor/hardcoded_protos.c +++ b/src/compositor/hardcoded_protos.c @@ -28,6 +28,9 @@ #include "offscreen_cache.h" #include "mpeg4_grouping.h" +#include +#include + #ifndef GPAC_DISABLE_VRML #ifndef GPAC_DISABLE_3D @@ -984,7 +987,8 @@ void compositor_init_hardcoded_proto(GF_Compositor *compositor, GF_Node *node) { MFURL *proto_url; GF_Proto *proto; - u32 i; + u32 i, j; + GF_HardcodedProto *ifce; proto = gf_node_get_proto(node); if (!proto) return; @@ -1034,6 +1038,16 @@ void compositor_init_hardcoded_proto(GF_Compositor *compositor, GF_Node *node) compositor_init_hc_flashshape(compositor, node); return; } + + /*check proto modules*/ + if (compositor->proto_modules) { + j = 0; + while ( (ifce = (GF_HardcodedProto *)gf_list_enum(compositor->proto_modules, &j) )) { + if ( ifce->can_load_proto(url) && ifce->init(compositor, node) ) { + return; + } + } + } } } diff --git a/src/compositor/mpeg4_grouping_2d.c b/src/compositor/mpeg4_grouping_2d.c index ec81c5d..6baf398 100644 --- a/src/compositor/mpeg4_grouping_2d.c +++ b/src/compositor/mpeg4_grouping_2d.c @@ -45,7 +45,7 @@ static void TraverseSwitch(GF_Node *node, void *rs, Bool is_destroy) GF_TraverseState *tr_state; tr_state = (GF_TraverseState *)rs; children = NULL; - /* souchay : be sure to be initialized, -1 seems reasonable since we check if (whichChoice>=0) */ + whichChoice = -1; if (is_destroy) { gf_sc_check_focus_upon_destroy(node); diff --git a/src/compositor/mpeg4_viewport.c b/src/compositor/mpeg4_viewport.c index 8e53985..673087d 100644 --- a/src/compositor/mpeg4_viewport.c +++ b/src/compositor/mpeg4_viewport.c @@ -416,10 +416,10 @@ static void TraverseNavigationInfo(GF_Node *node, void *rs, Bool is_destroy) #ifndef GPAC_DISABLE_3D SFVec3f start, end; Fixed scale; + ViewStack *st = (ViewStack *) gf_node_get_private(node); #endif GF_TraverseState *tr_state = (GF_TraverseState *)rs; M_NavigationInfo *ni = (M_NavigationInfo *) node; - ViewStack *st = (ViewStack *) gf_node_get_private(node); if (is_destroy) { DestroyViewStack(node); diff --git a/src/export.cpp b/src/export.cpp index 6d63bd9..04692ab 100644 --- a/src/export.cpp +++ b/src/export.cpp @@ -87,9 +87,6 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_gz_compress_payload) ) #pragma comment (linker, EXPORT_SYMBOL(gf_gz_decompress_payload) ) -/* Font */ -#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_new) ) - /* Memory */ #ifdef GPAC_MEMORY_TRACKING #pragma comment (linker, EXPORT_SYMBOL(gf_mem_malloc) ) @@ -900,6 +897,7 @@ /*plugin_network.h exports*/ +#ifndef GPAC_DISABLE_PLAYER #pragma comment (linker, EXPORT_SYMBOL(gf_term_on_message) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_on_connect) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_on_disconnect) ) @@ -926,7 +924,7 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_term_remove_event_filter) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_lock_media_queue) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_get_current_service_id) ) - +#endif /*ietf.h exports*/ #ifndef GPAC_DISABLE_STREAMING @@ -1133,12 +1131,13 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_ismacryp_decrypt_file) ) #pragma comment (linker, EXPORT_SYMBOL(gf_ismacryp_encrypt_track) ) #pragma comment (linker, EXPORT_SYMBOL(gf_ismacryp_decrypt_track) ) -#endif - #pragma comment (linker, EXPORT_SYMBOL(gf_ismacryp_gpac_get_info) ) #pragma comment (linker, EXPORT_SYMBOL(gf_ismacryp_mpeg4ip_get_info) ) - + +#endif + /*scene_manager.h exports*/ + #ifndef GPAC_DISABLE_SCENE_STATS #pragma comment (linker, EXPORT_SYMBOL(gf_sm_stats_new) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sm_stats_del) ) @@ -1149,6 +1148,7 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_sm_stats_for_command) ) #endif +#ifndef GPAC_DISABLE_SMGR #pragma comment (linker, EXPORT_SYMBOL(gf_sm_new) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sm_del) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sm_stream_new) ) @@ -1162,6 +1162,8 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_sm_load_run) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sm_load_suspend) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sm_import_bifs_subtitle) ) +#endif + #ifndef GPAC_DISABLE_LOADER_BT #pragma comment (linker, EXPORT_SYMBOL(gf_sm_load_bt_from_string) ) #endif @@ -1233,6 +1235,7 @@ #endif #endif /*GPAC_DISABLE_BIFS*/ +#if !defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_X3D) && !defined(GPAC_DISABLE_SVG) /*scenegraph.h exports*/ #pragma comment (linker, EXPORT_SYMBOL(gf_node_get_tag) ) @@ -1303,6 +1306,7 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_node_dump_attribute) ) + #ifndef GPAC_DISABLE_SVG #pragma comment (linker, EXPORT_SYMBOL(gf_node_dom_listener_add) ) #pragma comment (linker, EXPORT_SYMBOL(gf_dom_event_type_by_name) ) @@ -1434,7 +1438,10 @@ #endif /*GPAC_DISABLE_VRML*/ +#endif //!defined(GPAC_DISABLE_VRML) && !defined(GPAC_DISABLE_X3D) && !defined(GPAC_DISABLE_SVG) + +#ifndef GPAC_DISABLE_PLAYER /*terminal.h exports*/ #pragma comment (linker, EXPORT_SYMBOL(gf_term_new) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_del) ) @@ -1485,7 +1492,30 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_term_lock_compositor) ) #pragma comment (linker, EXPORT_SYMBOL(gf_term_switch_quality) ) +/*terminal_dev exports*/ +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_new) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_del) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_get_time) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_attach_to_compositor) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_find_odm) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_set_duration) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_setup_object) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_register_extra_graph) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_force_size) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_process_anchor) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_scene_disconnect) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_odm_new) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_odm_setup_object) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_odm_disconnect) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_odm_setup_es) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_odm_remove_es) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_term_node_callback) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_term_message) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_clock_time) ) +#endif + +#ifndef GPAC_DISABLE_PLAYER /*compositor.h exports*/ #pragma comment (linker, EXPORT_SYMBOL(gf_sc_new) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sc_del) ) @@ -1543,26 +1573,12 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_sc_audio_stop) ) #pragma comment (linker, EXPORT_SYMBOL(gf_sc_audio_restart) ) -/*terminal_dev exports*/ -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_new) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_del) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_get_time) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_attach_to_compositor) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_find_odm) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_set_duration) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_setup_object) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_register_extra_graph) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_force_size) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_process_anchor) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_scene_disconnect) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_odm_new) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_odm_setup_object) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_odm_disconnect) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_odm_setup_es) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_odm_remove_es) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_term_node_callback) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_term_message) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_clock_time) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_new) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_set_font) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_create_span) ) +#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_refresh_span_bounds) ) + +#endif /*mpegts.h exports*/ #ifndef GPAC_DISABLE_MPEG2TS @@ -1576,12 +1592,13 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_crc32_check) ) /* carousel.h */ +#ifndef GPAC_DISABLE_DSMCC #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_get_channel_application_info) ) #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_process_dsmcc) ) #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_init_dsmcc_overlord) ) #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_get_dmscc_overlord) ) #pragma comment (linker, EXPORT_SYMBOL(gf_m2ts_demux_dmscc_init) ) - +#endif #ifndef GPAC_DISABLE_MPEG2TS_MUX @@ -1630,11 +1647,6 @@ #pragma comment (linker, EXPORT_SYMBOL(gf_laser_encoder_get_rap) ) #endif /*GPAC_DISABLE_LASER*/ -#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_new) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_set_font) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_create_span) ) -#pragma comment (linker, EXPORT_SYMBOL(gf_font_manager_refresh_span_bounds) ) - /*download.h exports*/ #pragma comment (linker, EXPORT_SYMBOL(gf_dm_wget) ) #pragma comment (linker, EXPORT_SYMBOL(gf_dm_wget_with_cache) ) diff --git a/src/laser/lsr_tables.c b/src/laser/lsr_tables.c index accca3f..f0e6cec 100644 --- a/src/laser/lsr_tables.c +++ b/src/laser/lsr_tables.c @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Tue May 15 11:18:46 2007 - BY SVGGen for GPAC Version 0.4.3-DEV + BY SVGGen for GPAC Version 0.5.0 */ diff --git a/src/mcrypt/sha1.c b/src/mcrypt/sha1.c deleted file mode 100644 index 3ce8c61..0000000 --- a/src/mcrypt/sha1.c +++ /dev/null @@ -1,382 +0,0 @@ -/* - * FIPS-180-1 compliant SHA-1 implementation - * - * Copyright (C) 2003-2006 Christophe Devine - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License, version 2.1 as published by the Free Software Foundation. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, - * MA 02110-1301 USA - */ -/* - * The SHA-1 standard was published by NIST in 1993. - * - * http://www.itl.nist.gov/fipspubs/fip180-1.htm - */ - -#ifndef _CRT_SECURE_NO_DEPRECATE -#define _CRT_SECURE_NO_DEPRECATE 1 -#endif - -#include - -/* - * 32-bit integer manipulation macros (big endian) - */ -#ifndef GET_UINT32_BE -#define GET_UINT32_BE(n,b,i) \ -{ \ - (n) = ( (u32) (b)[(i) ] << 24 ) \ - | ( (u32) (b)[(i) + 1] << 16 ) \ - | ( (u32) (b)[(i) + 2] << 8 ) \ - | ( (u32) (b)[(i) + 3] ); \ -} -#endif -#ifndef PUT_UINT32_BE -#define PUT_UINT32_BE(n,b,i) \ -{ \ - (b)[(i) ] = (u8) ( (n) >> 24 ); \ - (b)[(i) + 1] = (u8) ( (n) >> 16 ); \ - (b)[(i) + 2] = (u8) ( (n) >> 8 ); \ - (b)[(i) + 3] = (u8) ( (n) ); \ -} -#endif - -/* - * SHA-1 context setup - */ -void gf_sha1_starts(GF_SHA1Context *ctx ) -{ - ctx->total[0] = 0; - ctx->total[1] = 0; - - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; -} - -static void sha1_process(GF_SHA1Context *ctx, u8 data[64] ) -{ - u32 temp, W[16], A, B, C, D, E; - - GET_UINT32_BE( W[0], data, 0 ); - GET_UINT32_BE( W[1], data, 4 ); - GET_UINT32_BE( W[2], data, 8 ); - GET_UINT32_BE( W[3], data, 12 ); - GET_UINT32_BE( W[4], data, 16 ); - GET_UINT32_BE( W[5], data, 20 ); - GET_UINT32_BE( W[6], data, 24 ); - GET_UINT32_BE( W[7], data, 28 ); - GET_UINT32_BE( W[8], data, 32 ); - GET_UINT32_BE( W[9], data, 36 ); - GET_UINT32_BE( W[10], data, 40 ); - GET_UINT32_BE( W[11], data, 44 ); - GET_UINT32_BE( W[12], data, 48 ); - GET_UINT32_BE( W[13], data, 52 ); - GET_UINT32_BE( W[14], data, 56 ); - GET_UINT32_BE( W[15], data, 60 ); - -#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) - -#define R(t) \ -( \ - temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ - W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ - ( W[t & 0x0F] = S(temp,1) ) \ -) - -#define P(a,b,c,d,e,x) \ -{ \ - e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ -} - - A = ctx->state[0]; - B = ctx->state[1]; - C = ctx->state[2]; - D = ctx->state[3]; - E = ctx->state[4]; - -#define F(x,y,z) (z ^ (x & (y ^ z))) -#define K 0x5A827999 - - P( A, B, C, D, E, W[0] ); - P( E, A, B, C, D, W[1] ); - P( D, E, A, B, C, W[2] ); - P( C, D, E, A, B, W[3] ); - P( B, C, D, E, A, W[4] ); - P( A, B, C, D, E, W[5] ); - P( E, A, B, C, D, W[6] ); - P( D, E, A, B, C, W[7] ); - P( C, D, E, A, B, W[8] ); - P( B, C, D, E, A, W[9] ); - P( A, B, C, D, E, W[10] ); - P( E, A, B, C, D, W[11] ); - P( D, E, A, B, C, W[12] ); - P( C, D, E, A, B, W[13] ); - P( B, C, D, E, A, W[14] ); - P( A, B, C, D, E, W[15] ); - P( E, A, B, C, D, R(16) ); - P( D, E, A, B, C, R(17) ); - P( C, D, E, A, B, R(18) ); - P( B, C, D, E, A, R(19) ); - -#undef K -#undef F - -#define F(x,y,z) (x ^ y ^ z) -#define K 0x6ED9EBA1 - - P( A, B, C, D, E, R(20) ); - P( E, A, B, C, D, R(21) ); - P( D, E, A, B, C, R(22) ); - P( C, D, E, A, B, R(23) ); - P( B, C, D, E, A, R(24) ); - P( A, B, C, D, E, R(25) ); - P( E, A, B, C, D, R(26) ); - P( D, E, A, B, C, R(27) ); - P( C, D, E, A, B, R(28) ); - P( B, C, D, E, A, R(29) ); - P( A, B, C, D, E, R(30) ); - P( E, A, B, C, D, R(31) ); - P( D, E, A, B, C, R(32) ); - P( C, D, E, A, B, R(33) ); - P( B, C, D, E, A, R(34) ); - P( A, B, C, D, E, R(35) ); - P( E, A, B, C, D, R(36) ); - P( D, E, A, B, C, R(37) ); - P( C, D, E, A, B, R(38) ); - P( B, C, D, E, A, R(39) ); - -#undef K -#undef F - -#define F(x,y,z) ((x & y) | (z & (x | y))) -#define K 0x8F1BBCDC - - P( A, B, C, D, E, R(40) ); - P( E, A, B, C, D, R(41) ); - P( D, E, A, B, C, R(42) ); - P( C, D, E, A, B, R(43) ); - P( B, C, D, E, A, R(44) ); - P( A, B, C, D, E, R(45) ); - P( E, A, B, C, D, R(46) ); - P( D, E, A, B, C, R(47) ); - P( C, D, E, A, B, R(48) ); - P( B, C, D, E, A, R(49) ); - P( A, B, C, D, E, R(50) ); - P( E, A, B, C, D, R(51) ); - P( D, E, A, B, C, R(52) ); - P( C, D, E, A, B, R(53) ); - P( B, C, D, E, A, R(54) ); - P( A, B, C, D, E, R(55) ); - P( E, A, B, C, D, R(56) ); - P( D, E, A, B, C, R(57) ); - P( C, D, E, A, B, R(58) ); - P( B, C, D, E, A, R(59) ); - -#undef K -#undef F - -#define F(x,y,z) (x ^ y ^ z) -#define K 0xCA62C1D6 - - P( A, B, C, D, E, R(60) ); - P( E, A, B, C, D, R(61) ); - P( D, E, A, B, C, R(62) ); - P( C, D, E, A, B, R(63) ); - P( B, C, D, E, A, R(64) ); - P( A, B, C, D, E, R(65) ); - P( E, A, B, C, D, R(66) ); - P( D, E, A, B, C, R(67) ); - P( C, D, E, A, B, R(68) ); - P( B, C, D, E, A, R(69) ); - P( A, B, C, D, E, R(70) ); - P( E, A, B, C, D, R(71) ); - P( D, E, A, B, C, R(72) ); - P( C, D, E, A, B, R(73) ); - P( B, C, D, E, A, R(74) ); - P( A, B, C, D, E, R(75) ); - P( E, A, B, C, D, R(76) ); - P( D, E, A, B, C, R(77) ); - P( C, D, E, A, B, R(78) ); - P( B, C, D, E, A, R(79) ); - -#undef K -#undef F - - ctx->state[0] += A; - ctx->state[1] += B; - ctx->state[2] += C; - ctx->state[3] += D; - ctx->state[4] += E; -} - -/* - * SHA-1 process buffer - */ -void gf_sha1_update(GF_SHA1Context *ctx, u8 *input, u32 ilen ) -{ - s32 fill; - u32 left; - - if( ilen <= 0 ) - return; - - left = ctx->total[0] & 0x3F; - fill = 64 - left; - - ctx->total[0] += ilen; - ctx->total[0] &= 0xFFFFFFFF; - - if( ctx->total[0] < (u32) ilen ) - ctx->total[1]++; - - if( left && (s32) ilen >= fill ) - { - memcpy( (void *) (ctx->buffer + left), - (void *) input, fill ); - sha1_process( ctx, ctx->buffer ); - input += fill; - ilen -= fill; - left = 0; - } - - while( ilen >= 64 ) - { - sha1_process( ctx, input ); - input += 64; - ilen -= 64; - } - - if( ilen > 0 ) - { - memcpy( (void *) (ctx->buffer + left), - (void *) input, ilen ); - } -} - -static const u8 sha1_padding[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -/* - * SHA-1 final digest - */ -void gf_sha1_finish(GF_SHA1Context *ctx, u8 output[20] ) -{ - u32 last, padn; - u32 high, low; - u8 msglen[8]; - - high = ( ctx->total[0] >> 29 ) - | ( ctx->total[1] << 3 ); - low = ( ctx->total[0] << 3 ); - - PUT_UINT32_BE( high, msglen, 0 ); - PUT_UINT32_BE( low, msglen, 4 ); - - last = ctx->total[0] & 0x3F; - padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); - - gf_sha1_update( ctx, (u8 *) sha1_padding, padn ); - gf_sha1_update( ctx, msglen, 8 ); - - PUT_UINT32_BE( ctx->state[0], output, 0 ); - PUT_UINT32_BE( ctx->state[1], output, 4 ); - PUT_UINT32_BE( ctx->state[2], output, 8 ); - PUT_UINT32_BE( ctx->state[3], output, 12 ); - PUT_UINT32_BE( ctx->state[4], output, 16 ); -} - -/* - * Output = SHA-1( file contents ) - */ -GF_EXPORT -s32 gf_sha1_file( const char *path, u8 output[20] ) -{ - FILE *f; - size_t n; - GF_SHA1Context ctx; - u8 buf[1024]; - - if( ( f = gf_f64_open( path, "rb" ) ) == NULL ) - return( 1 ); - - gf_sha1_starts( &ctx ); - - while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) - gf_sha1_update( &ctx, buf, (s32) n ); - - gf_sha1_finish( &ctx, output ); - - fclose( f ); - return( 0 ); -} - -/* - * Output = SHA-1( input buffer ) - */ -void gf_sha1_csum( u8 *input, u32 ilen, u8 output[20] ) -{ - GF_SHA1Context ctx; - - gf_sha1_starts( &ctx ); - gf_sha1_update( &ctx, input, ilen ); - gf_sha1_finish( &ctx, output ); -} - -/* - * Output = HMAC-SHA-1( input buffer, hmac key ) - */ -void gf_sha1_hmac( u8 *key, u32 keylen, - u8 *input, u32 ilen, - u8 output[20] ) -{ - s32 i; - GF_SHA1Context ctx; - u8 k_ipad[64]; - u8 k_opad[64]; - u8 tmpbuf[20]; - - memset( k_ipad, 0x36, 64 ); - memset( k_opad, 0x5C, 64 ); - - for( i = 0; i < (s32) keylen; i++ ) - { - if( i >= 64 ) break; - - k_ipad[i] ^= key[i]; - k_opad[i] ^= key[i]; - } - - gf_sha1_starts( &ctx ); - gf_sha1_update( &ctx, k_ipad, 64 ); - gf_sha1_update( &ctx, input, ilen ); - gf_sha1_finish( &ctx, tmpbuf ); - - gf_sha1_starts( &ctx ); - gf_sha1_update( &ctx, k_opad, 64 ); - gf_sha1_update( &ctx, tmpbuf, 20 ); - gf_sha1_finish( &ctx, output ); - - memset( k_ipad, 0, 64 ); - memset( k_opad, 0, 64 ); - memset( tmpbuf, 0, 20 ); - memset( &ctx, 0, sizeof(GF_SHA1Context ) ); -} - diff --git a/src/media_tools/av_parsers.c b/src/media_tools/av_parsers.c index 3f6fc62..92c2b4e 100644 --- a/src/media_tools/av_parsers.c +++ b/src/media_tools/av_parsers.c @@ -23,10 +23,12 @@ */ #include -#include #include #include +#ifndef GPAC_DISABLE_OGG +#include +#endif GF_EXPORT const char *gf_m4v_get_profile_name(u8 video_pl) @@ -1561,10 +1563,10 @@ static u32 avc_emulation_bytes_add_count(unsigned char *buffer, u32 nal_size) while (i < nal_size) { /*ISO 14496-10: "Within the NAL unit, any four-byte sequence that starts with 0x000003 other than the following sequences shall not occur at any byte-aligned position: - – 0x00000300 - – 0x00000301 - – 0x00000302 - – 0x00000303" + \96 0x00000300 + \96 0x00000301 + \96 0x00000302 + \96 0x00000303" */ if (num_zero == 2 && buffer[i] < 0x04) { /*emulation code found*/ @@ -1622,10 +1624,10 @@ static u32 avc_emulation_bytes_remove_count(unsigned char *buffer, u32 nal_size) { /*ISO 14496-10: "Within the NAL unit, any four-byte sequence that starts with 0x000003 other than the following sequences shall not occur at any byte-aligned position: - – 0x00000300 - – 0x00000301 - – 0x00000302 - – 0x00000303" + \96 0x00000300 + \96 0x00000301 + \96 0x00000302 + \96 0x00000303" */ if (num_zero == 2 && buffer[i] == 0x03 @@ -1750,8 +1752,8 @@ s32 AVC_ReadSeqInfo(char *sps_data, u32 sps_size, AVCState *avc, u32 subseq_sps, u8 separate_colour_plane_flag = gf_bs_read_int(bs, 1); /* Depending on the value of separate_colour_plane_flag, the value of the variable ChromaArrayType is assigned as follows. - – If separate_colour_plane_flag is equal to 0, ChromaArrayType is set equal to chroma_format_idc. - – Otherwise (separate_colour_plane_flag is equal to 1), ChromaArrayType is set equal to 0. + \96 If separate_colour_plane_flag is equal to 0, ChromaArrayType is set equal to chroma_format_idc. + \96 Otherwise (separate_colour_plane_flag is equal to 1), ChromaArrayType is set equal to 0. */ if (separate_colour_plane_flag) ChromaArrayType = 0; } @@ -2583,6 +2585,8 @@ u32 AVC_ReformatSEI_NALU(char *buffer, u32 nal_size, AVCState *avc) return (written>1) ? written : 0; } +#ifndef GPAC_DISABLE_ISOM + static u8 avc_get_sar_idx(u32 w, u32 h) { u32 i; @@ -2592,7 +2596,6 @@ static u8 avc_get_sar_idx(u32 w, u32 h) return 0xFF; } -#ifndef GPAC_DISABLE_ISOM GF_Err AVC_ChangePAR(GF_AVCConfig *avcc, s32 ar_n, s32 ar_d) { GF_BitStream *orig, *mod; diff --git a/src/media_tools/dvb.c b/src/media_tools/dvb.c deleted file mode 100644 index 9abf791..0000000 --- a/src/media_tools/dvb.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - * GPAC - Multimedia Framework C SDK - * - * Copyright (c)2006-201X ENST - All rights reserved - * - * This file is part of GPAC / MPEG2-TS sub-project - * - * GPAC is gf_free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License as published by - * the gf_free Software Foundation; either version 2, or (at your option) - * any later version. - * - * GPAC is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; see the file COPYING. If not, write to - * the gf_free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. - * - */ - - -#include -#include - - -/* decodes an Modified Julian Date (MJD) into a Co-ordinated Universal Time (UTC) -See annex C of DVB-SI ETSI EN 300468 */ -void dvb_decode_mjd_date(u32 date, u16 *year, u8 *month, u8 *day) -{ - u32 yp, mp, k; - yp = (u32)((date - 15078.2)/365.25); - mp = (u32)((date - 14956.1 - (u32)(yp * 365.25))/30.6001); - *day = (u32)(date - 14956 - (u32)(yp * 365.25) - (u32)(mp * 30.6001)); - if (mp == 14 || mp == 15) k = 1; - else k = 0; - *year = yp + k + 1900; - *month = mp - 1 - k*12; - assert(*year>=1900 && *year<=2100 && *month && *month<=12 && *day && *day<=31); -} - -#if 0 /*disabled since mktime doesn't exist on Windows Mobile*/ -/* decodes an Modified Julian Date (MJD) into a unix time (i.e. seconds since Jan 1st 1970) */ -void dvb_decode_mjd_to_unix_time(u8 *data, time_t *unix_time) { - struct tm time; - char tmp_time[10]; - u16 year = (u16)time.tm_year; - u8 month = (u8) time.tm_mon; - u8 day = (u8) time.tm_mday; - - memset(&time, 0, sizeof(struct tm)); - dvb_decode_mjd_date((data[0] << 8) | data[1], &year, &month, &day); - time.tm_year = year - 1900; - time.tm_mon = month-1; /* months are 0-based in time_t */ - time.tm_mday = day; - time.tm_isdst = -1; /* we don't want to apply Daylight Saving Time */ - - sprintf(tmp_time, "%02x", data[2]); - time.tm_hour = atoi(tmp_time); - sprintf(tmp_time, "%02x", data[3]); - time.tm_min = atoi(tmp_time); - sprintf(tmp_time, "%02x", data[4]); - time.tm_sec = atoi(tmp_time); - *unix_time = mktime(&time); -} -#endif diff --git a/src/media_tools/ismacryp.c b/src/media_tools/ismacryp.c index acaa0dc..39e9d8f 100644 --- a/src/media_tools/ismacryp.c +++ b/src/media_tools/ismacryp.c @@ -32,6 +32,8 @@ #include +#if !defined(GPAC_DISABLE_MCRYPT) + typedef struct { GF_List *tcis; @@ -257,7 +259,7 @@ Bool gf_ismacryp_mpeg4ip_get_info(char *kms_uri, char *key, char *salt) return 0; } -#if !defined(GPAC_DISABLE_MCRYPT) && !defined(GPAC_DISABLE_ISOM_WRITE) +#ifndef GPAC_DISABLE_ISOM_WRITE static GFINLINE void resync_IV(GF_Crypt *mc, u64 BSO, char *salt) { @@ -892,70 +894,6 @@ GF_Err gf_ismacryp_crypt_file(GF_ISOFile *mp4, const char *drm_file) return e; } -#endif /*!defined(GPAC_DISABLE_MCRYPT) && !defined(GPAC_DISABLE_ISOM_WRITE)*/ - -GF_EXPORT -GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]) -{ - u8 block[1024]; - u32 read; - u64 size, tot; - FILE *in; - GF_SHA1Context ctx; -#ifndef GPAC_DISABLE_ISOM - GF_BitStream *bs = NULL; - Bool is_isom = gf_isom_probe_file(file); -#endif - - in = gf_f64_open(file, "rb"); - gf_f64_seek(in, 0, SEEK_END); - size = gf_f64_tell(in); - gf_f64_seek(in, 0, SEEK_SET); - - gf_sha1_starts(&ctx); - tot = 0; -#ifndef GPAC_DISABLE_ISOM - if (is_isom) bs = gf_bs_from_file(in, GF_BITSTREAM_READ); -#endif - - while (tot #include + +GF_EXPORT +GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]) +{ + u8 block[1024]; + u32 read; + u64 size, tot; + FILE *in; + GF_SHA1Context *ctx; +#ifndef GPAC_DISABLE_ISOM + GF_BitStream *bs = NULL; + Bool is_isom = gf_isom_probe_file(file); +#endif + + in = gf_f64_open(file, "rb"); + gf_f64_seek(in, 0, SEEK_END); + size = gf_f64_tell(in); + gf_f64_seek(in, 0, SEEK_SET); + + ctx = gf_sha1_starts(); + tot = 0; +#ifndef GPAC_DISABLE_ISOM + if (is_isom) bs = gf_bs_from_file(in, GF_BITSTREAM_READ); +#endif + + while (tot +#endif + +#ifndef GPAC_DISABLE_OGG #include +#endif + +#ifndef GPAC_DISABLE_VOBSUB #include +#endif + + #include GF_Err gf_media_export_nhml(GF_MediaExporter *dumper, Bool dims_doc); @@ -439,6 +449,7 @@ GF_Err gf_media_export_samples(GF_MediaExporter *dumper) static GF_Err gf_dump_to_vobsub(GF_MediaExporter *dumper, char *szName, u32 track, char *dsi, u32 dsiSize) { +#ifndef GPAC_DISABLE_VOBSUB FILE *fidx, *fsub; u32 width, height, i, count, di; GF_ISOSample *samp; @@ -554,6 +565,9 @@ static GF_Err gf_dump_to_vobsub(GF_MediaExporter *dumper, char *szName, u32 trac fclose(fidx); return GF_OK; +#else + return GF_NOT_SUPPORTED; +#endif } /*QCP codec GUIDs*/ @@ -1813,6 +1827,7 @@ typedef struct GF_Err gf_media_export_saf(GF_MediaExporter *dumper) { +#ifndef GPAC_DISABLE_SAF u32 count, i, s_count, di, tot_samp, samp_done; char out_file[GF_MAX_PATH]; GF_SAFMuxer *mux; @@ -1914,6 +1929,9 @@ GF_Err gf_media_export_saf(GF_MediaExporter *dumper) gf_saf_mux_del(mux); return GF_OK; +#else + return GF_NOT_SUPPORTED; +#endif } #ifndef GPAC_DISABLE_MPEG2TS diff --git a/src/media_tools/media_import.c b/src/media_tools/media_import.c index 25deb74..e80f708 100644 --- a/src/media_tools/media_import.c +++ b/src/media_tools/media_import.c @@ -25,9 +25,15 @@ #include +#ifndef GPAC_DISABLE_AVILIB #include +#endif +#ifndef GPAC_DISABLE_OGG #include +#endif +#ifndef GPAC_DISABLE_VOBSUB #include +#endif #include #include #include @@ -5130,6 +5136,7 @@ exit: GF_Err gf_import_saf(GF_MediaImporter *import) { +#ifndef GPAC_DISABLE_SAF GF_Err e; u32 track; u64 tot; @@ -5300,9 +5307,11 @@ GF_Err gf_import_saf(GF_MediaImporter *import) gf_set_progress("Importing SAF", tot, tot); MP4T_RecomputeBitRate(import->dest, track); return GF_OK; +#else + return GF_NOT_SUPPORTED; +#endif } - typedef struct { GF_MediaImporter *import; @@ -6271,6 +6280,7 @@ GF_Err gf_import_mpeg_ts(GF_MediaImporter *import) GF_Err gf_import_vobsub(GF_MediaImporter *import) { +#ifndef GPAC_DISABLE_VOBSUB static const u8 null_subpic[] = { 0x00, 0x09, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0xFF }; char filename[GF_MAX_PATH]; FILE *file = NULL; @@ -6522,6 +6532,9 @@ error: } return err; +#else + return GF_NOT_SUPPORTED; +#endif } #ifndef GPAC_DISABLE_AV_PARSERS @@ -6658,7 +6671,9 @@ exit: GF_EXPORT GF_Err gf_media_import(GF_MediaImporter *importer) { +#ifndef GPAC_DISABLE_TTXT GF_Err gf_import_timed_text(GF_MediaImporter *import); +#endif GF_Err e; char *ext, *xml_type; char *fmt = ""; @@ -6776,8 +6791,13 @@ GF_Err gf_media_import(GF_MediaImporter *importer) return gf_import_saf(importer); /*text subtitles*/ if (!strnicmp(ext, ".srt", 4) || !strnicmp(ext, ".sub", 4) || !strnicmp(ext, ".ttxt", 5) - || !stricmp(fmt, "SRT") || !stricmp(fmt, "SUB") || !stricmp(fmt, "TEXT") ) - return gf_import_timed_text(importer); + || !stricmp(fmt, "SRT") || !stricmp(fmt, "SUB") || !stricmp(fmt, "TEXT") ) { +#ifndef GPAC_DISABLE_TTXT + return gf_import_timed_text(importer); +#else + return GF_NOT_SUPPORTED; +#endif + } /*VobSub*/ if (!strnicmp(ext, ".idx", 4) || !stricmp(fmt, "VOBSUB")) return gf_import_vobsub(importer); @@ -6794,7 +6814,11 @@ GF_Err gf_media_import(GF_MediaImporter *importer) if (xml_type) { if (!stricmp(xml_type, "TextStream") || !stricmp(xml_type, "text3GTrack") ) { gf_free(xml_type); +#ifndef GPAC_DISABLE_TTXT return gf_import_timed_text(importer); +#else + return GF_NOT_SUPPORTED; +#endif } else if (!stricmp(xml_type, "NHNTStream")) { gf_free(xml_type); diff --git a/src/media_tools/mpegts.c b/src/media_tools/mpegts.c index 78521db..9cc877b 100644 --- a/src/media_tools/mpegts.c +++ b/src/media_tools/mpegts.c @@ -37,13 +37,16 @@ #include #endif -#define DUMP_MPE_IP_DATAGRAMS //#define FORCE_DISABLE_MPEG4SL_OVER_MPEG2TS -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE #include #endif +#ifndef GPAC_DISABLE_DSMCC +#include +#endif + #define DEBUG_TS_PACKET 0 @@ -811,7 +814,7 @@ void gf_m2ts_es_del(GF_M2TS_ES *es) GF_M2TS_SECTION_ES *ses = (GF_M2TS_SECTION_ES *)es; if (ses->sec) gf_m2ts_section_filter_del(ses->sec); -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE if (es->flags & GF_M2TS_ES_IS_MPE) gf_dvb_mpe_section_del(es); #endif @@ -841,22 +844,27 @@ static void gf_m2ts_section_complete(GF_M2TS_Demuxer *ts, GF_M2TS_SectionFilter { if (!sec->process_section) { if ((ts->on_event && (sec->section[0]==GF_M2TS_TABLE_ID_AIT)) ) { +#ifndef GPAC_DISABLE_DSMCC GF_M2TS_SL_PCK pck; pck.data_len = sec->length; pck.data = sec->section; pck.stream = (GF_M2TS_ES *)ses; //ts->on_event(ts, GF_M2TS_EVT_AIT_FOUND, &pck); on_ait_section(ts, GF_M2TS_EVT_AIT_FOUND, &pck); +#endif } else if ((ts->on_event && (sec->section[0]==GF_M2TS_TABLE_ID_DSM_CC_ENCAPSULATED_DATA || sec->section[0]==GF_M2TS_TABLE_ID_DSM_CC_UN_MESSAGE || sec->section[0]==GF_M2TS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGE || sec->section[0]==GF_M2TS_TABLE_ID_DSM_CC_STREAM_DESCRIPTION || sec->section[0]==GF_M2TS_TABLE_ID_DSM_CC_PRIVATE)) ) { + +#ifndef GPAC_DISABLE_DSMCC GF_M2TS_SL_PCK pck; pck.data_len = sec->length; pck.data = sec->section; pck.stream = (GF_M2TS_ES *)ses; on_dsmcc_section(ts,GF_M2TS_EVT_DSMCC_FOUND,&pck); //ts->on_event(ts, GF_M2TS_EVT_DSMCC_FOUND, &pck); +#endif } -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE else if (ts->on_mpe_event && ((ses && (ses->flags & GF_M2TS_EVT_DVB_MPE)) || (sec->section[0]==GF_M2TS_TABLE_ID_INT)) ) { GF_M2TS_SL_PCK pck; pck.data_len = sec->length; @@ -1278,7 +1286,22 @@ static void gf_m2ts_process_nit(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *nit_es, GF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, ("[MPEG-2 TS] NIT table processing (not yet implemented)")); } -extern void dvb_decode_mjd_date(u32 date, u16 *year, u8 *month, u8 *day); +/* decodes an Modified Julian Date (MJD) into a Co-ordinated Universal Time (UTC) +See annex C of DVB-SI ETSI EN 300468 */ +static void dvb_decode_mjd_date(u32 date, u16 *year, u8 *month, u8 *day) +{ + u32 yp, mp, k; + yp = (u32)((date - 15078.2)/365.25); + mp = (u32)((date - 14956.1 - (u32)(yp * 365.25))/30.6001); + *day = (u32)(date - 14956 - (u32)(yp * 365.25) - (u32)(mp * 30.6001)); + if (mp == 14 || mp == 15) k = 1; + else k = 0; + *year = yp + k + 1900; + *month = mp - 1 - k*12; + assert(*year>=1900 && *year<=2100 && *month && *month<=12 && *day && *day<=31); +} + + static void gf_m2ts_process_tdt_tot(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *tdt_tot_es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status) { unsigned char *data; @@ -1522,13 +1545,6 @@ static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF } break; - - - /*to refine with generic private section redispatching to AIT or other afterwards*/ - es = gf_ait_section_new(pmt->program->number); - ses = (GF_M2TS_SECTION_ES *)es; - ses->sec = gf_m2ts_section_filter_new(NULL, 0); - break; case GF_M2TS_13818_6_ANNEX_A: case GF_M2TS_13818_6_ANNEX_B: case GF_M2TS_13818_6_ANNEX_C: @@ -1551,7 +1567,7 @@ static void gf_m2ts_process_pmt(GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF case GF_M2TS_MPE_SECTIONS: GF_LOG(GF_LOG_INFO, GF_LOG_CONTAINER, ("stream type MPE found : pid = %d \n", pid)); -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE es = gf_dvb_mpe_section_new(); if (es->flags & GF_M2TS_ES_IS_SECTION) { /* NULL means: trigger the call to on_event with DVB_GENERAL type and the raw section as payload */ @@ -2476,7 +2492,7 @@ GF_M2TS_Demuxer *gf_m2ts_demux_new() ts->eit = gf_m2ts_section_filter_new(NULL/*gf_m2ts_process_eit*/, 1); ts->tdt_tot = gf_m2ts_section_filter_new(gf_m2ts_process_tdt_tot, 1); -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE gf_dvb_mpe_init(ts); #endif @@ -2548,11 +2564,12 @@ void gf_m2ts_demux_del(GF_M2TS_Demuxer *ts) if (ts->tdt_tot) gf_list_del(ts->SDTs); -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE gf_dvb_mpe_shutdown(ts); #endif if(gf_list_count(ts->dsmcc_controler)){ +#ifndef GPAC_DISABLE_DSMCC GF_M2TS_DSMCC_OVERLORD* dsmcc_overlord = (GF_M2TS_DSMCC_OVERLORD*)gf_list_get(ts->dsmcc_controler,0); gf_cleanup_dir(dsmcc_overlord->root_dir); gf_rmdir(dsmcc_overlord->root_dir); @@ -2560,12 +2577,15 @@ void gf_m2ts_demux_del(GF_M2TS_Demuxer *ts) if(ts->dsmcc_root_dir){ gf_free(ts->dsmcc_root_dir); } +#endif } while(gf_list_count(ts->ChannelAppList)){ +#ifndef GPAC_DISABLE_DSMCC GF_M2TS_CHANNEL_APPLICATION_INFO* ChanAppInfo = (GF_M2TS_CHANNEL_APPLICATION_INFO*)gf_list_get(ts->ChannelAppList,0); gf_m2ts_delete_channel_application_info(ChanAppInfo); gf_list_rem(ts->ChannelAppList,0); +#endif } gf_list_del(ts->ChannelAppList); @@ -2574,7 +2594,7 @@ void gf_m2ts_demux_del(GF_M2TS_Demuxer *ts) void gf_m2ts_print_info(GF_M2TS_Demuxer *ts) { -#ifdef DUMP_MPE_IP_DATAGRAMS +#ifndef GPAC_DISABLE_MPE gf_m2ts_print_mpe_info(ts); #endif } diff --git a/src/media_tools/saf.c b/src/media_tools/saf.c index c6ea069..79e777a 100644 --- a/src/media_tools/saf.c +++ b/src/media_tools/saf.c @@ -26,6 +26,7 @@ #include #include #include +#include enum { diff --git a/src/odf/descriptors.c b/src/odf/descriptors.c index 16cbcbd..780aef6 100644 --- a/src/odf/descriptors.c +++ b/src/odf/descriptors.c @@ -639,8 +639,12 @@ GF_Err gf_odf_del_text_cfg(GF_TextConfig *desc) GF_EXPORT GF_Err gf_odf_get_text_config(GF_DefaultDescriptor *dsi, u8 oti, GF_TextConfig *cfg) { - u32 i, j; - Bool has_alt_format, has_sd; + u32 i; + Bool has_alt_format; +#ifndef GPAC_DISABLE_ISOM + Bool has_sd; + u32 j; +#endif GF_Err e; GF_BitStream *bs; if (!dsi || !dsi->data || !dsi->dataLength || !cfg) return GF_BAD_PARAM; @@ -657,7 +661,11 @@ GF_Err gf_odf_get_text_config(GF_DefaultDescriptor *dsi, u8 oti, GF_TextConfig * cfg->timescale = gf_bs_read_int(bs, 24); has_alt_format = gf_bs_read_int(bs, 1); cfg->sampleDescriptionFlags = gf_bs_read_int(bs, 2); +#ifndef GPAC_DISABLE_ISOM has_sd = gf_bs_read_int(bs, 1); +#else + gf_bs_read_int(bs, 1); +#endif cfg->has_vid_info = gf_bs_read_int(bs, 1); gf_bs_read_int(bs, 3); cfg->layer = gf_bs_read_int(bs, 8); @@ -717,7 +725,9 @@ GF_Err gf_odf_get_text_config(GF_DefaultDescriptor *dsi, u8 oti, GF_TextConfig * cfg->vert_offset = gf_bs_read_int(bs, 16); } +#ifndef GPAC_DISABLE_ISOM exit: +#endif gf_bs_del(bs); if (e) ResetTextConfig(cfg); return e; diff --git a/src/scenegraph/base_scenegraph.c b/src/scenegraph/base_scenegraph.c index c1e2ad6..05187c4 100644 --- a/src/scenegraph/base_scenegraph.c +++ b/src/scenegraph/base_scenegraph.c @@ -622,7 +622,9 @@ GF_Err gf_node_unregister(GF_Node *pNode, GF_Node *parentNode) u32 j; GF_Route *r; #endif +#ifdef GPAC_HAS_SPIDERMONKEY Bool detach=0; +#endif GF_SceneGraph *pSG; if (!pNode) return GF_OK; @@ -641,7 +643,9 @@ GF_Err gf_node_unregister(GF_Node *pNode, GF_Node *parentNode) if (prev) prev->next = nlist->next; else pNode->sgprivate->parents = nlist->next; gf_free(nlist); +#ifdef GPAC_HAS_SPIDERMONKEY if (pNode->sgprivate->parents==NULL) detach=1; +#endif break; } } diff --git a/src/scenegraph/mpeg4_nodes.c b/src/scenegraph/mpeg4_nodes.c index 07d1a36..f020ce1 100644 --- a/src/scenegraph/mpeg4_nodes.c +++ b/src/scenegraph/mpeg4_nodes.c @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Tue Nov 08 09:10:57 2011 - BY MPEG4Gen for GPAC Version 0.4.6-DEV + BY MPEG4Gen for GPAC Version 0.5.0 */ #include diff --git a/src/scenegraph/x3d_nodes.c b/src/scenegraph/x3d_nodes.c index 78d059b..c7e36e2 100644 --- a/src/scenegraph/x3d_nodes.c +++ b/src/scenegraph/x3d_nodes.c @@ -26,7 +26,7 @@ /* DO NOT MOFIFY - File generated on GMT Fri Jul 31 16:39:50 2009 - BY X3DGen for GPAC Version 0.4.6-DEV + BY X3DGen for GPAC Version 0.5.0 */ diff --git a/src/terminal/media_object.c b/src/terminal/media_object.c index d6dec1f..1c08338 100644 --- a/src/terminal/media_object.c +++ b/src/terminal/media_object.c @@ -33,6 +33,7 @@ #include +#ifndef GPAC_DISABLE_SVG static GF_MediaObject *get_sync_reference(GF_Scene *scene, XMLRI *iri, u32 o_type, GF_Node *orig_ref, Bool *post_pone) { MFURL mfurl; @@ -51,14 +52,11 @@ static GF_MediaObject *get_sync_reference(GF_Scene *scene, XMLRI *iri, u32 o_typ else ref = gf_sg_find_node_by_name(scene->graph, iri->string); if (ref) { -#ifndef GPAC_DISABLE_SVG GF_FieldInfo info; -#endif /*safety check, break cyclic references*/ if (ref==orig_ref) return NULL; switch (ref->sgprivate->tag) { -#ifndef GPAC_DISABLE_SVG case TAG_SVG_audio: o_type = GF_MEDIA_OBJECT_AUDIO; if (gf_node_get_attribute_by_tag(ref, TAG_XLINK_ATT_href, 0, 0, &info)==GF_OK) { @@ -71,7 +69,6 @@ static GF_MediaObject *get_sync_reference(GF_Scene *scene, XMLRI *iri, u32 o_typ return get_sync_reference(scene, info.far_ptr, o_type, orig_ref ? orig_ref : ref, post_pone); } return NULL; -#endif default: return NULL; } @@ -87,6 +84,8 @@ static GF_MediaObject *get_sync_reference(GF_Scene *scene, XMLRI *iri, u32 o_typ if (!res) *post_pone = 1; return res; } +#endif + GF_EXPORT GF_MediaObject *gf_mo_register(GF_Node *node, MFURL *url, Bool lock_timelines, Bool force_new_res) diff --git a/src/terminal/terminal.c b/src/terminal/terminal.c index 44ab289..b68b308 100644 --- a/src/terminal/terminal.c +++ b/src/terminal/terminal.c @@ -1243,6 +1243,7 @@ void gf_term_lock_net(GF_Terminal *term, Bool LockIt) } } +#ifndef GPAC_DISABLE_SVG static void media_event_collect_info(GF_ClientService *net, GF_ObjectManager *odm, GF_DOMMediaEvent *media_event, u32 *min_time, u32 *min_buffer) { u32 i=0; @@ -1268,6 +1269,7 @@ static void media_event_collect_info(GF_ClientService *net, GF_ObjectManager *od } } } +#endif void gf_term_service_media_event_with_download(GF_ObjectManager *odm, u32 event_type, u64 loaded_size, u64 total_size, u32 bytes_per_sec) { @@ -1704,6 +1706,7 @@ void gf_term_attach_service(GF_Terminal *term, GF_InputService *service_hdl) GF_EXPORT GF_Err gf_term_scene_update(GF_Terminal *term, char *type, char *com) { +#ifndef GPAC_DISABLE_SMGR GF_Err e; GF_StreamContext *sc; GF_ESD *esd; @@ -1810,6 +1813,9 @@ GF_Err gf_term_scene_update(GF_Terminal *term, char *type, char *com) } gf_sm_del(load.ctx); return e; +#else + return GF_NOT_SUPPORTED; +#endif } GF_EXPORT diff --git a/src/utils/cache.c b/src/utils/cache.c index 8745c8b..56a8471 100644 --- a/src/utils/cache.c +++ b/src/utils/cache.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include diff --git a/src/utils/color.c b/src/utils/color.c index 78cba2b..75534af 100644 --- a/src/utils/color.c +++ b/src/utils/color.c @@ -23,7 +23,7 @@ */ -#include +#include #include #include diff --git a/src/utils/downloader.c b/src/utils/downloader.c index e12f3b4..b297cb1 100644 --- a/src/utils/downloader.c +++ b/src/utils/downloader.c @@ -30,7 +30,6 @@ #include #include #include -#include #include #include diff --git a/src/utils/sha1.c b/src/utils/sha1.c new file mode 100644 index 0000000..b78cdec --- /dev/null +++ b/src/utils/sha1.c @@ -0,0 +1,722 @@ +#ifndef _CRT_SECURE_NO_DEPRECATE +#define _CRT_SECURE_NO_DEPRECATE 1 +#endif + +#include + +#ifndef PUT_UINT32_BE +#define PUT_UINT32_BE(n,b,i) \ +{ \ + (b)[(i) ] = (u8) ( (n) >> 24 ); \ + (b)[(i) + 1] = (u8) ( (n) >> 16 ); \ + (b)[(i) + 2] = (u8) ( (n) >> 8 ); \ + (b)[(i) + 3] = (u8) ( (n) ); \ +} +#endif + +#if 0 +/* + * FIPS-180-1 compliant SHA-1 implementation + * + * Copyright (C) 2003-2006 Christophe Devine + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License, version 2.1 as published by the Free Software Foundation. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, + * MA 02110-1301 USA + */ +/* + * The SHA-1 standard was published by NIST in 1993. + * + * http://www.itl.nist.gov/fipspubs/fip180-1.htm + */ + + +struct __sha1_context +{ + u32 total[2]; + u32 state[5]; + u8 buffer[64]; +}; + +/* + * 32-bit integer manipulation macros (big endian) + */ +#ifndef GET_UINT32_BE +#define GET_UINT32_BE(n,b,i) \ +{ \ + (n) = ( (u32) (b)[(i) ] << 24 ) \ + | ( (u32) (b)[(i) + 1] << 16 ) \ + | ( (u32) (b)[(i) + 2] << 8 ) \ + | ( (u32) (b)[(i) + 3] ); \ +} +#endif + +/* + * SHA-1 context setup + */ +GF_SHA1Context *gf_sha1_starts() +{ + GF_SHA1Context *ctx; + GF_SAFEALLOC(ctx, GF_SHA1Context); + ctx->total[0] = 0; + ctx->total[1] = 0; + + ctx->state[0] = 0x67452301; + ctx->state[1] = 0xEFCDAB89; + ctx->state[2] = 0x98BADCFE; + ctx->state[3] = 0x10325476; + ctx->state[4] = 0xC3D2E1F0; + return ctx; +} + +static void sha1_process(GF_SHA1Context *ctx, u8 data[64] ) +{ + u32 temp, W[16], A, B, C, D, E; + + GET_UINT32_BE( W[0], data, 0 ); + GET_UINT32_BE( W[1], data, 4 ); + GET_UINT32_BE( W[2], data, 8 ); + GET_UINT32_BE( W[3], data, 12 ); + GET_UINT32_BE( W[4], data, 16 ); + GET_UINT32_BE( W[5], data, 20 ); + GET_UINT32_BE( W[6], data, 24 ); + GET_UINT32_BE( W[7], data, 28 ); + GET_UINT32_BE( W[8], data, 32 ); + GET_UINT32_BE( W[9], data, 36 ); + GET_UINT32_BE( W[10], data, 40 ); + GET_UINT32_BE( W[11], data, 44 ); + GET_UINT32_BE( W[12], data, 48 ); + GET_UINT32_BE( W[13], data, 52 ); + GET_UINT32_BE( W[14], data, 56 ); + GET_UINT32_BE( W[15], data, 60 ); + +#define S(x,n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n))) + +#define R(t) \ +( \ + temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ \ + W[(t - 14) & 0x0F] ^ W[ t & 0x0F], \ + ( W[t & 0x0F] = S(temp,1) ) \ +) + +#define P(a,b,c,d,e,x) \ +{ \ + e += S(a,5) + F(b,c,d) + K + x; b = S(b,30); \ +} + + A = ctx->state[0]; + B = ctx->state[1]; + C = ctx->state[2]; + D = ctx->state[3]; + E = ctx->state[4]; + +#define F(x,y,z) (z ^ (x & (y ^ z))) +#define K 0x5A827999 + + P( A, B, C, D, E, W[0] ); + P( E, A, B, C, D, W[1] ); + P( D, E, A, B, C, W[2] ); + P( C, D, E, A, B, W[3] ); + P( B, C, D, E, A, W[4] ); + P( A, B, C, D, E, W[5] ); + P( E, A, B, C, D, W[6] ); + P( D, E, A, B, C, W[7] ); + P( C, D, E, A, B, W[8] ); + P( B, C, D, E, A, W[9] ); + P( A, B, C, D, E, W[10] ); + P( E, A, B, C, D, W[11] ); + P( D, E, A, B, C, W[12] ); + P( C, D, E, A, B, W[13] ); + P( B, C, D, E, A, W[14] ); + P( A, B, C, D, E, W[15] ); + P( E, A, B, C, D, R(16) ); + P( D, E, A, B, C, R(17) ); + P( C, D, E, A, B, R(18) ); + P( B, C, D, E, A, R(19) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0x6ED9EBA1 + + P( A, B, C, D, E, R(20) ); + P( E, A, B, C, D, R(21) ); + P( D, E, A, B, C, R(22) ); + P( C, D, E, A, B, R(23) ); + P( B, C, D, E, A, R(24) ); + P( A, B, C, D, E, R(25) ); + P( E, A, B, C, D, R(26) ); + P( D, E, A, B, C, R(27) ); + P( C, D, E, A, B, R(28) ); + P( B, C, D, E, A, R(29) ); + P( A, B, C, D, E, R(30) ); + P( E, A, B, C, D, R(31) ); + P( D, E, A, B, C, R(32) ); + P( C, D, E, A, B, R(33) ); + P( B, C, D, E, A, R(34) ); + P( A, B, C, D, E, R(35) ); + P( E, A, B, C, D, R(36) ); + P( D, E, A, B, C, R(37) ); + P( C, D, E, A, B, R(38) ); + P( B, C, D, E, A, R(39) ); + +#undef K +#undef F + +#define F(x,y,z) ((x & y) | (z & (x | y))) +#define K 0x8F1BBCDC + + P( A, B, C, D, E, R(40) ); + P( E, A, B, C, D, R(41) ); + P( D, E, A, B, C, R(42) ); + P( C, D, E, A, B, R(43) ); + P( B, C, D, E, A, R(44) ); + P( A, B, C, D, E, R(45) ); + P( E, A, B, C, D, R(46) ); + P( D, E, A, B, C, R(47) ); + P( C, D, E, A, B, R(48) ); + P( B, C, D, E, A, R(49) ); + P( A, B, C, D, E, R(50) ); + P( E, A, B, C, D, R(51) ); + P( D, E, A, B, C, R(52) ); + P( C, D, E, A, B, R(53) ); + P( B, C, D, E, A, R(54) ); + P( A, B, C, D, E, R(55) ); + P( E, A, B, C, D, R(56) ); + P( D, E, A, B, C, R(57) ); + P( C, D, E, A, B, R(58) ); + P( B, C, D, E, A, R(59) ); + +#undef K +#undef F + +#define F(x,y,z) (x ^ y ^ z) +#define K 0xCA62C1D6 + + P( A, B, C, D, E, R(60) ); + P( E, A, B, C, D, R(61) ); + P( D, E, A, B, C, R(62) ); + P( C, D, E, A, B, R(63) ); + P( B, C, D, E, A, R(64) ); + P( A, B, C, D, E, R(65) ); + P( E, A, B, C, D, R(66) ); + P( D, E, A, B, C, R(67) ); + P( C, D, E, A, B, R(68) ); + P( B, C, D, E, A, R(69) ); + P( A, B, C, D, E, R(70) ); + P( E, A, B, C, D, R(71) ); + P( D, E, A, B, C, R(72) ); + P( C, D, E, A, B, R(73) ); + P( B, C, D, E, A, R(74) ); + P( A, B, C, D, E, R(75) ); + P( E, A, B, C, D, R(76) ); + P( D, E, A, B, C, R(77) ); + P( C, D, E, A, B, R(78) ); + P( B, C, D, E, A, R(79) ); + +#undef K +#undef F + + ctx->state[0] += A; + ctx->state[1] += B; + ctx->state[2] += C; + ctx->state[3] += D; + ctx->state[4] += E; +} + +/* + * SHA-1 process buffer + */ +void gf_sha1_update(GF_SHA1Context *ctx, u8 *input, u32 ilen ) +{ + s32 fill; + u32 left; + + if( ilen <= 0 ) + return; + + left = ctx->total[0] & 0x3F; + fill = 64 - left; + + ctx->total[0] += ilen; + ctx->total[0] &= 0xFFFFFFFF; + + if( ctx->total[0] < (u32) ilen ) + ctx->total[1]++; + + if( left && (s32) ilen >= fill ) + { + memcpy( (void *) (ctx->buffer + left), + (void *) input, fill ); + sha1_process( ctx, ctx->buffer ); + input += fill; + ilen -= fill; + left = 0; + } + + while( ilen >= 64 ) + { + sha1_process( ctx, input ); + input += 64; + ilen -= 64; + } + + if( ilen > 0 ) + { + memcpy( (void *) (ctx->buffer + left), + (void *) input, ilen ); + } +} + +static const u8 sha1_padding[64] = +{ + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +/* + * SHA-1 final digest + */ +void gf_sha1_finish(GF_SHA1Context *ctx, u8 output[20] ) +{ + u32 last, padn; + u32 high, low; + u8 msglen[8]; + + high = ( ctx->total[0] >> 29 ) + | ( ctx->total[1] << 3 ); + low = ( ctx->total[0] << 3 ); + + PUT_UINT32_BE( high, msglen, 0 ); + PUT_UINT32_BE( low, msglen, 4 ); + + last = ctx->total[0] & 0x3F; + padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last ); + + gf_sha1_update( ctx, (u8 *) sha1_padding, padn ); + gf_sha1_update( ctx, msglen, 8 ); + + PUT_UINT32_BE( ctx->state[0], output, 0 ); + PUT_UINT32_BE( ctx->state[1], output, 4 ); + PUT_UINT32_BE( ctx->state[2], output, 8 ); + PUT_UINT32_BE( ctx->state[3], output, 12 ); + PUT_UINT32_BE( ctx->state[4], output, 16 ); + + gf_free(ctx); +} +#else + +/* + * sha1.c + * + * Copyright (C) 1998, 2009 + * Paul E. Jones + * All Rights Reserved + * + * Freeware Public License (FPL) + * + * This software is licensed as "freeware." Permission to distribute + * this software in source and binary forms, including incorporation + * into other products, is hereby granted without a fee. THIS SOFTWARE + * IS PROVIDED 'AS IS' AND WITHOUT ANY EXPRESSED OR IMPLIED WARRANTIES, + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS FOR A PARTICULAR PURPOSE. THE AUTHOR SHALL NOT BE HELD + * LIABLE FOR ANY DAMAGES RESULTING FROM THE USE OF THIS SOFTWARE, EITHER + * DIRECTLY OR INDIRECTLY, INCLUDING, BUT NOT LIMITED TO, LOSS OF DATA + * OR DATA BEING RENDERED INACCURATE. + * + ***************************************************************************** + * $Id: sha1.c 12 2009-06-22 19:34:25Z paulej $ + ***************************************************************************** + * + * Description: + * This file implements the Secure Hashing Standard as defined + * in FIPS PUB 180-1 published April 17, 1995. + * + * The Secure Hashing Standard, which uses the Secure Hashing + * Algorithm (SHA), produces a 160-bit message digest for a + * given data stream. In theory, it is highly improbable that + * two messages will produce the same message digest. Therefore, + * this algorithm can serve as a means of providing a "fingerprint" + * for a message. + * + * Portability Issues: + * SHA-1 is defined in terms of 32-bit "words". This code was + * written with the expectation that the processor has at least + * a 32-bit machine word size. If the machine word size is larger, + * the code should still function properly. One caveat to that + * is that the input functions taking characters and character + * arrays assume that only 8 bits of information are stored in each + * character. + * + * Caveats: + * SHA-1 is designed to work with messages less than 2^64 bits + * long. Although SHA-1 allows a message digest to be generated for + * messages of any number of bits less than 2^64, this + * implementation only works with messages with a length that is a + * multiple of the size of an 8-bit character. + * + */ + +/* + * This structure will hold context information for the hashing + * operation + */ +struct __sha1_context +{ + unsigned Message_Digest[5]; /* Message Digest (output) */ + + unsigned Length_Low; /* Message length in bits */ + unsigned Length_High; /* Message length in bits */ + + unsigned char Message_Block[64]; /* 512-bit message blocks */ + int Message_Block_Index; /* Index into message block array */ + + int Computed; /* Is the digest computed? */ + int Corrupted; /* Is the message digest corruped? */ +}; + +/* + * Define the circular shift macro + */ +#define SHA1CircularShift(bits,word) \ + ((((word) << (bits)) & 0xFFFFFFFF) | \ + ((word) >> (32-(bits)))) + + +/* + * SHA1ProcessMessageBlock + * + * Description: + * This function will process the next 512 bits of the message + * stored in the Message_Block array. + * + * Parameters: + * None. + * + * Returns: + * Nothing. + * + * Comments: + * Many of the variable names in the SHAContext, especially the + * single character names, were used because those were the names + * used in the publication. + * + * + */ +void SHA1ProcessMessageBlock(GF_SHA1Context *context) +{ + const unsigned K[] = /* Constants defined in SHA-1 */ + { + 0x5A827999, + 0x6ED9EBA1, + 0x8F1BBCDC, + 0xCA62C1D6 + }; + int t; /* Loop counter */ + unsigned temp; /* Temporary word value */ + unsigned W[80]; /* Word sequence */ + unsigned A, B, C, D, E; /* Word buffers */ + + /* + * Initialize the first 16 words in the array W + */ + for(t = 0; t < 16; t++) + { + W[t] = ((unsigned) context->Message_Block[t * 4]) << 24; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 1]) << 16; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 2]) << 8; + W[t] |= ((unsigned) context->Message_Block[t * 4 + 3]); + } + + for(t = 16; t < 80; t++) + { + W[t] = SHA1CircularShift(1,W[t-3] ^ W[t-8] ^ W[t-14] ^ W[t-16]); + } + + A = context->Message_Digest[0]; + B = context->Message_Digest[1]; + C = context->Message_Digest[2]; + D = context->Message_Digest[3]; + E = context->Message_Digest[4]; + + for(t = 0; t < 20; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | ((~B) & D)) + E + W[t] + K[0]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 20; t < 40; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[1]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 40; t < 60; t++) + { + temp = SHA1CircularShift(5,A) + + ((B & C) | (B & D) | (C & D)) + E + W[t] + K[2]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + for(t = 60; t < 80; t++) + { + temp = SHA1CircularShift(5,A) + (B ^ C ^ D) + E + W[t] + K[3]; + temp &= 0xFFFFFFFF; + E = D; + D = C; + C = SHA1CircularShift(30,B); + B = A; + A = temp; + } + + context->Message_Digest[0] = + (context->Message_Digest[0] + A) & 0xFFFFFFFF; + context->Message_Digest[1] = + (context->Message_Digest[1] + B) & 0xFFFFFFFF; + context->Message_Digest[2] = + (context->Message_Digest[2] + C) & 0xFFFFFFFF; + context->Message_Digest[3] = + (context->Message_Digest[3] + D) & 0xFFFFFFFF; + context->Message_Digest[4] = + (context->Message_Digest[4] + E) & 0xFFFFFFFF; + + context->Message_Block_Index = 0; +} + +/* + * SHA1PadMessage + * + * Description: + * According to the standard, the message must be padded to an even + * 512 bits. The first padding bit must be a '1'. The last 64 + * bits represent the length of the original message. All bits in + * between should be 0. This function will pad the message + * according to those rules by filling the Message_Block array + * accordingly. It will also call SHA1ProcessMessageBlock() + * appropriately. When it returns, it can be assumed that the + * message digest has been computed. + * + * Parameters: + * context: [in/out] + * The context to pad + * + * Returns: + * Nothing. + * + * Comments: + * + */ +static void SHA1PadMessage(GF_SHA1Context *context) +{ + /* + * Check to see if the current message block is too small to hold + * the initial padding bits and length. If so, we will pad the + * block, process it, and then continue padding into a second + * block. + */ + if (context->Message_Block_Index > 55) + { + context->Message_Block[context->Message_Block_Index++] = 0x80; + while(context->Message_Block_Index < 64) + { + context->Message_Block[context->Message_Block_Index++] = 0; + } + + SHA1ProcessMessageBlock(context); + + while(context->Message_Block_Index < 56) + { + context->Message_Block[context->Message_Block_Index++] = 0; + } + } + else + { + context->Message_Block[context->Message_Block_Index++] = 0x80; + while(context->Message_Block_Index < 56) + { + context->Message_Block[context->Message_Block_Index++] = 0; + } + } + + /* + * Store the message length as the last 8 octets + */ + context->Message_Block[56] = (context->Length_High >> 24) & 0xFF; + context->Message_Block[57] = (context->Length_High >> 16) & 0xFF; + context->Message_Block[58] = (context->Length_High >> 8) & 0xFF; + context->Message_Block[59] = (context->Length_High) & 0xFF; + context->Message_Block[60] = (context->Length_Low >> 24) & 0xFF; + context->Message_Block[61] = (context->Length_Low >> 16) & 0xFF; + context->Message_Block[62] = (context->Length_Low >> 8) & 0xFF; + context->Message_Block[63] = (context->Length_Low) & 0xFF; + + SHA1ProcessMessageBlock(context); +} +/* + * SHA1Reset + * + * Description: + * This function will initialize the SHA1Context in preparation + * for computing a new message digest. + * + * Parameters: + * context: [in/out] + * The context to reset. + * + * Returns: + * Nothing. + * + * Comments: + * + */ +GF_SHA1Context *gf_sha1_starts() +{ + GF_SHA1Context *context; + GF_SAFEALLOC(context, GF_SHA1Context); + context->Length_Low = 0; + context->Length_High = 0; + context->Message_Block_Index = 0; + + context->Message_Digest[0] = 0x67452301; + context->Message_Digest[1] = 0xEFCDAB89; + context->Message_Digest[2] = 0x98BADCFE; + context->Message_Digest[3] = 0x10325476; + context->Message_Digest[4] = 0xC3D2E1F0; + + context->Computed = 0; + context->Corrupted = 0; + return context; +} + +void gf_sha1_update(GF_SHA1Context *context, u8 *message_array, u32 length ) +{ + if (!length) + { + return; + } + + if (context->Computed || context->Corrupted) + { + context->Corrupted = 1; + return; + } + + while(length-- && !context->Corrupted) + { + context->Message_Block[context->Message_Block_Index++] = + (*message_array & 0xFF); + + context->Length_Low += 8; + /* Force it to 32 bits */ + context->Length_Low &= 0xFFFFFFFF; + if (context->Length_Low == 0) + { + context->Length_High++; + /* Force it to 32 bits */ + context->Length_High &= 0xFFFFFFFF; + if (context->Length_High == 0) + { + /* Message is too long */ + context->Corrupted = 1; + } + } + + if (context->Message_Block_Index == 64) + { + SHA1ProcessMessageBlock(context); + } + + message_array++; + } +} +void gf_sha1_finish(GF_SHA1Context *context, u8 output[20] ) +{ + if (context->Corrupted) + { + return; + } + + if (!context->Computed) + { + SHA1PadMessage(context); + context->Computed = 1; + } + PUT_UINT32_BE( context->Message_Digest[0], output, 0 ); + PUT_UINT32_BE( context->Message_Digest[1], output, 4 ); + PUT_UINT32_BE( context->Message_Digest[2], output, 8 ); + PUT_UINT32_BE( context->Message_Digest[3], output, 12 ); + PUT_UINT32_BE( context->Message_Digest[4], output, 16 ); + + gf_free(context); +} + +#endif + +/* + * Output = SHA-1( file contents ) + */ +GF_EXPORT +s32 gf_sha1_file( const char *path, u8 output[20] ) +{ + FILE *f; + size_t n; + GF_SHA1Context *ctx; + u8 buf[1024]; + + if( ( f = gf_f64_open( path, "rb" ) ) == NULL ) + return( 1 ); + + ctx = gf_sha1_starts(); + + while( ( n = fread( buf, 1, sizeof( buf ), f ) ) > 0 ) + gf_sha1_update(ctx, buf, (s32) n ); + + gf_sha1_finish(ctx, output ); + + fclose( f ); + return( 0 ); +} + +/* + * Output = SHA-1( input buffer ) + */ +void gf_sha1_csum( u8 *input, u32 ilen, u8 output[20] ) +{ + GF_SHA1Context *ctx; + + ctx = gf_sha1_starts(); + gf_sha1_update(ctx, input, ilen ); + gf_sha1_finish(ctx, output ); +} + +