Skip to content

Commit

Permalink
moved some JS scene APIs to filtersession and new core API
Browse files Browse the repository at this point in the history
  • Loading branch information
jeanlf committed Jul 9, 2020
1 parent a2e4998 commit a55b5b0
Show file tree
Hide file tree
Showing 36 changed files with 1,329 additions and 844 deletions.
2 changes: 1 addition & 1 deletion applications/mp4box/filedump.c
Original file line number Diff line number Diff line change
Expand Up @@ -3103,7 +3103,6 @@ void DumpMovieInfo(GF_ISOFile *file)
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ARTIST, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tArtist: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ALBUM, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tAlbum: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMMENT, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tComment: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACK, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tTrack: %d / %d\n", tag[3], tag[5]);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COMPOSER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tComposer: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_WRITER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tWriter: %s\n", tag);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_ALBUM_ARTIST, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tAlbum Artist: %s\n", tag);
Expand Down Expand Up @@ -3131,6 +3130,7 @@ void DumpMovieInfo(GF_ISOFile *file)
}
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACKNUMBER, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tTrackNumber: %d / %d\n", (0xff00 & (tag[2]<<8)) | (0xff & tag[3]), (0xff00 & (tag[4]<<8)) | (0xff & tag[5]));
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACK, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tTrack: %s\n", tag);
// if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_TRACK, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tTrack: %d / %d\n", tag[3], tag[5]);
if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_GROUP, &tag, &tag_len)==GF_OK) fprintf(stderr, "\tGroup: %s\n", tag);

if (gf_isom_apple_get_tag(file, GF_ISOM_ITUNE_COVER_ART, &tag, &tag_len)==GF_OK) {
Expand Down
9 changes: 8 additions & 1 deletion applications/mp4box/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,17 @@ static u32 PrintHelpForArgs(char *arg_name, GF_GPACArg *args, Bool exact_match)
{
u32 res=0;
u32 i=0;
u32 alen = (u32) strlen(arg_name);
while (args[i].name) {
GF_GPACArg *arg = &args[i];
GF_GPACArg an_arg;
if (exact_match && strcmp(arg_name, arg->name)) {
Bool do_match = GF_FALSE;
if (!strcmp(arg_name, arg->name))
do_match = GF_TRUE;
else if ((alen < (u32) strlen(arg->name)) && (arg->name[alen]==' ') && !strncmp(arg_name, arg->name, alen))
do_match = GF_TRUE;

if (exact_match && !do_match) {
i++;
continue;
}
Expand Down
1 change: 1 addition & 0 deletions build/android/jni/libgpac/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ LOCAL_SRC_FILES := \
../../../../src/isomedia/stbl_write.c \
../../../../src/isomedia/track.c \
../../../../src/isomedia/tx3g.c \
../../../../src/jsmods/core.c \
../../../../src/jsmods/evg.c \
../../../../src/jsmods/scene_js.c \
../../../../src/jsmods/storage.c \
Expand Down
1 change: 1 addition & 0 deletions build/msvc14/libgpac.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@
<ClCompile Include="..\..\src\isomedia\stbl_write.c" />
<ClCompile Include="..\..\src\isomedia\track.c" />
<ClCompile Include="..\..\src\isomedia\tx3g.c" />
<ClCompile Include="..\..\src\jsmods\core.c" />
<ClCompile Include="..\..\src\jsmods\evg.c" />
<ClCompile Include="..\..\src\jsmods\scene_js.c" />
<ClCompile Include="..\..\src\jsmods\storage.c" />
Expand Down
3 changes: 3 additions & 0 deletions build/msvc14/libgpac.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -1508,6 +1508,9 @@
<ClCompile Include="..\..\src\jsmods\xhr.c">
<Filter>jsmods</Filter>
</ClCompile>
<ClCompile Include="..\..\src\jsmods\core.c">
<Filter>jsmods</Filter>
</ClCompile>
<ClCompile Include="..\..\src\scenegraph\dom_js.c">
<Filter>scenegraph</Filter>
</ClCompile>
Expand Down
6 changes: 5 additions & 1 deletion build/xcode/gpac.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,7 @@
9239B8D6207369E5005F7264 /* enc_jpg.c in Sources */ = {isa = PBXBuildFile; fileRef = 9239B8D5207369E5005F7264 /* enc_jpg.c */; };
9239B8D82073AFEF005F7264 /* enc_png.c in Sources */ = {isa = PBXBuildFile; fileRef = 9239B8D72073AFEF005F7264 /* enc_png.c */; };
923C337D234794F2001CED08 /* evg.c in Sources */ = {isa = PBXBuildFile; fileRef = 923C337C234794F2001CED08 /* evg.c */; };
923E3FE624B7316F0022660A /* core.c in Sources */ = {isa = PBXBuildFile; fileRef = 923E3FE524B7316F0022660A /* core.c */; };
923E89CB20B6F04600F299B2 /* g_crypt_openssl.c in Sources */ = {isa = PBXBuildFile; fileRef = 923E89C620B6F04600F299B2 /* g_crypt_openssl.c */; };
923E89CC20B6F04600F299B2 /* tiny_aes.h in Headers */ = {isa = PBXBuildFile; fileRef = 923E89C720B6F04600F299B2 /* tiny_aes.h */; };
923E89CD20B6F04600F299B2 /* g_crypt.c in Sources */ = {isa = PBXBuildFile; fileRef = 923E89C820B6F04600F299B2 /* g_crypt.c */; };
Expand Down Expand Up @@ -853,6 +854,7 @@
9239B8D5207369E5005F7264 /* enc_jpg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = enc_jpg.c; path = filters/enc_jpg.c; sourceTree = "<group>"; };
9239B8D72073AFEF005F7264 /* enc_png.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = enc_png.c; path = filters/enc_png.c; sourceTree = "<group>"; };
923C337C234794F2001CED08 /* evg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = evg.c; path = jsmods/evg.c; sourceTree = "<group>"; };
923E3FE524B7316F0022660A /* core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = core.c; path = jsmods/core.c; sourceTree = "<group>"; };
923E89C620B6F04600F299B2 /* g_crypt_openssl.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g_crypt_openssl.c; path = crypto/g_crypt_openssl.c; sourceTree = "<group>"; };
923E89C720B6F04600F299B2 /* tiny_aes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tiny_aes.h; path = crypto/tiny_aes.h; sourceTree = "<group>"; };
923E89C820B6F04600F299B2 /* g_crypt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = g_crypt.c; path = crypto/g_crypt.c; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1941,9 +1943,10 @@
92D6C5982343BEC600262217 /* jsmods */ = {
isa = PBXGroup;
children = (
9273463223506D370081AF74 /* storage.c */,
923E3FE524B7316F0022660A /* core.c */,
923C337C234794F2001CED08 /* evg.c */,
92D6C5992343BED700262217 /* scene_js.c */,
9273463223506D370081AF74 /* storage.c */,
929383A22355A6EF00AAAFA8 /* WebGL */,
92D6C59A2343BED700262217 /* xhr.c */,
);
Expand Down Expand Up @@ -2824,6 +2827,7 @@
920101BA18D5A445003D1ACA /* path2d.c in Sources */,
920101BB18D5A445003D1ACA /* path2d_stroker.c in Sources */,
920101BD18D5A445003D1ACA /* sha1.c in Sources */,
923E3FE624B7316F0022660A /* core.c in Sources */,
9206823420EA96AA0041169F /* mux_gsf.c in Sources */,
920101C018D5A445003D1ACA /* token.c in Sources */,
92B9A5A91F8660D700A24FE4 /* bindable.c in Sources */,
Expand Down
4 changes: 4 additions & 0 deletions build/xcode/gpac4ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@
925FF2A51ABC53F30085B04C /* odf_parse_common.h in Headers */ = {isa = PBXBuildFile; fileRef = 925FF2A31ABC53F30085B04C /* odf_parse_common.h */; };
925FF2A61ABC53F30085B04C /* smjs_api.h in Headers */ = {isa = PBXBuildFile; fileRef = 925FF2A41ABC53F30085B04C /* smjs_api.h */; };
925FF2A71ABC55030085B04C /* os_file.c in Sources */ = {isa = PBXBuildFile; fileRef = 71CCF2361277045100339E12 /* os_file.c */; };
9262B10C24B7791B009B059D /* core.c in Sources */ = {isa = PBXBuildFile; fileRef = 9262B10B24B7791B009B059D /* core.c */; };
92734635235084A50081AF74 /* storage.c in Sources */ = {isa = PBXBuildFile; fileRef = 92734634235084A50081AF74 /* storage.c */; };
9274295A24647B98009ADD8D /* bsrw.c in Sources */ = {isa = PBXBuildFile; fileRef = 9274295924647B98009ADD8D /* bsrw.c */; };
9280E7251DD23FFE001E6441 /* iTunesArtwork in Resources */ = {isa = PBXBuildFile; fileRef = 9236FDEF1DD23F1400B3E86F /* iTunesArtwork */; };
Expand Down Expand Up @@ -940,6 +941,7 @@
925730A31A0916DB0057FF04 /* libbz2.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbz2.dylib; path = usr/lib/libbz2.dylib; sourceTree = SDKROOT; };
925FF2A31ABC53F30085B04C /* odf_parse_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = odf_parse_common.h; sourceTree = "<group>"; };
925FF2A41ABC53F30085B04C /* smjs_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = smjs_api.h; sourceTree = "<group>"; };
9262B10B24B7791B009B059D /* core.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = core.c; path = ../../src/jsmods/core.c; sourceTree = "<group>"; };
92734634235084A50081AF74 /* storage.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = storage.c; path = ../../src/jsmods/storage.c; sourceTree = "<group>"; };
9274295924647B98009ADD8D /* bsrw.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = bsrw.c; path = ../../src/filters/bsrw.c; sourceTree = "<group>"; };
9281B62E21C92D00006B0FD5 /* gui */ = {isa = PBXFileReference; lastKnownFileType = folder; name = gui; path = ../../share/gui; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1800,6 +1802,7 @@
92D6C5A32343BF5000262217 /* jsmods */ = {
isa = PBXGroup;
children = (
9262B10B24B7791B009B059D /* core.c */,
929867782357A0DA008A2CC6 /* webgl.h */,
9210BA1C234A909400ED2DFF /* evg.c */,
92D6C5A52343BF6A00262217 /* scene_js.c */,
Expand Down Expand Up @@ -2408,6 +2411,7 @@
71CCF2B21277045100339E12 /* hint_track.c in Sources */,
92EB6D6720E4E17F00A97A49 /* filter.c in Sources */,
92EB6E1220E4E19700A97A49 /* reframe_h263.c in Sources */,
9262B10C24B7791B009B059D /* core.c in Sources */,
71CCF2B31277045100339E12 /* hinting.c in Sources */,
71CCF2B41277045100339E12 /* drm_sample.c in Sources */,
92EB6DCD20E4E19700A97A49 /* reframe_nalu.c in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion share/doc/doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,7 @@ WARN_LOGFILE = doxygen_warnings.txt
# Note: If this tag is empty the current directory is searched.

#for some weird reason on OSX enumeration does not work properly, add IDL files by hand
INPUT=../../include/gpac/ ../../README.md ../../share/doc/idl/jsf.idl ../../share/doc/idl/xhr.idl ../../share/doc/idl/evg.idl ../../share/doc/idl/scenejs.idl ../../share/doc/idl/storage.idl ../../share/doc/idl/webgl.idl ../../share/doc/idl/filtersession.idl
INPUT=../../include/gpac/ ../../README.md ../../share/doc/idl/core.idl ../../share/doc/idl/jsf.idl ../../share/doc/idl/xhr.idl ../../share/doc/idl/evg.idl ../../share/doc/idl/scenejs.idl ../../share/doc/idl/storage.idl ../../share/doc/idl/webgl.idl ../../share/doc/idl/filtersession.idl

# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
Expand Down
157 changes: 157 additions & 0 deletions share/doc/idl/core.idl
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
/*
\file
\brief silence !
*/

typedef char *DOMString;

/*!

\defgroup core_grp JS Core API for libgpac
\ingroup jsapi_grp
\brief JavaScript API for libgpac core tools.

This section documents the JavaScript API used to query and control libgpac.

Errors are handled through exceptions.

@{

*/

/*! global context property representing the one and only JSGPACCoreSystem object attached to the loaded script*/
attribute JSGPACCoreSystem Sys;


/*!\brief JSGPACCoreSystem API

The JSGPACCoreSystem interface has a single instance exposed to the script under the name "Sys".
It implements binding to the underlying instance of libgpac.
*/
interface JSGPACCoreSystem {

/*! launch arguments*/
attribute Array args;

/*! marks an argument as used (for argument tracking at prompt)
\param arg_idx index of argument to mark as used
\param arg_used if true, argument is marked as used
*/
attribute void set_arg_used(unsigned int arg_idx, boolean arg_used);

/*! gets string for error
\param e the error code
\return the corresponding string*/
DOMString error_string(GF_Err e);


/*! returns character input from prompt, or null if no input (this will be moved soon to core API)
\return input char, or NULL if no input
*/
attribute DOMString prompt_input();


/*! wait character input from prompt and returns it
\return string entered at prompt
*/
attribute DOMString prompt_string();


/*! enumerate directories
\param dir the directory to enumerate
\param filter the filter for file extensions. If "dir", only enumerate directories
\param go_up if true, enumerate parent directory or root (/).
\return array of FileInformation interface*/
Array enum_directory(DOMString dir, optional DOMString filter=null, optional DOMString filter=null, optional bool go_up=false);

/*! number of cores */
attribute readonly unsigned long nb_cores;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long sampling_period_duration;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long total_cpu_time;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long process_cpu_time;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long total_cpu_time_diff;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long process_cpu_time_diff;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long cpu_idle_time;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long total_cpu_usage;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long process_cpu_usage;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long pid;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long thread_count;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long long process_memory;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long long physical_memory;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long long physical_memory_avail;

/*! see \ref GF_SystemRTInfo */
attribute readonly unsigned long long gpac_memory;

/*! last working directory */
attribute DOMString last_wdir;

/*! indicates if running on battery or with power charge*/
readonly attribute boolean batteryOn;

/*! indicates if battery is charging*/
readonly attribute boolean batteryCharging;

/*! battery percent (0 to 100)*/
readonly attribute unsigned long batteryPercent;

/*! estimated battery lifetime - see \ref gf_sys_get_battery_state*/
readonly attribute unsigned long batteryLifeTime;

/*! estimated battery lifetime in full charge - see \ref gf_sys_get_battery_state*/
readonly attribute unsigned long batteryFullLifeTime;

/*! host name*/
readonly DOMString hostname;

};


/*! object used for file enumeration*/
interface FileInformation {
/*! file name*/
DOMString name;
/*! file path*/
DOMString path;
/*! true if directory*/
boolean directory;
/*! true if drive root (local HDD, USB or other mount points)*/
boolean drive;
/*! true if hidden file*/
boolean hidden;
/*! true if system file*/
boolean system;
/*! file size in bytes*/
unsigned long long size;
/*! last modification UTC time*/
unsigned long long last_modified;
};

/*! @} */

6 changes: 6 additions & 0 deletions share/doc/idl/filtersession.idl
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ attribute long nb_filters;
/*! check if the calling task is the last task in the session - see \ref gf_fs_is_last_task*/
readonly attribute boolean last_task;

/*! max capped HTTP download rate - used for DASH simulations mostly*/
attribute unsigned long http_max_bitrate;

/*! current http download rate averaged on all active resources*/
readonly attribute unsigned long http_bitrate;

};


Expand Down
Loading

0 comments on commit a55b5b0

Please sign in to comment.