Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions include/gpac/Remotery.h
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ typedef enum rmtSampleFlags
#define rmt_LogText(text) \
RMT_OPTIONAL(RMT_ENABLED, _rmt_LogText(text))

#define rmt_SendText(text) \
RMT_OPTIONAL(RMT_ENABLED, _rmt_SendText(text))

#define rmt_EnableSampling(enable) \
RMT_OPTIONAL(RMT_ENABLED, _rmt_EnableSampling(enable))

Expand Down Expand Up @@ -630,6 +633,7 @@ RMT_API void _rmt_SetGlobalInstance(Remotery* remotery);
RMT_API Remotery* _rmt_GetGlobalInstance(void);
RMT_API void _rmt_SetCurrentThreadName(rmtPStr thread_name);
RMT_API void _rmt_LogText(rmtPStr text);
RMT_API void _rmt_SendText(rmtPStr text);
RMT_API void _rmt_BeginCPUSample(rmtPStr name, rmtU32 flags, rmtU32* hash_cache);
RMT_API void _rmt_EndCPUSample(void);
RMT_API void _rmt_EnableSampling(rmtBool enable);
Expand Down
2 changes: 2 additions & 0 deletions include/gpac/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,8 @@ typedef struct __tag_sock_group GF_SockGroup;
#define GF_SOCK_TYPE_UDP_UN 0x04
#endif

#define GF_SOCK_TYPE_WS 0x05

/*!
\brief socket constructor

Expand Down
9 changes: 7 additions & 2 deletions include/gpac/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,12 @@ typedef void (*gf_rmt_user_callback)(void *udta, const char* text);
GF_Err gf_sys_profiler_set_callback(void *udta, gf_rmt_user_callback rmt_usr_cbk);


/*! Sends a log message to remotery web client
\param msg text message to send. The message format should be json
\return GF_OK if success, GF_BAD_PARAM if profiler is not running, GF_NOT_SUPPORTED if profiler not supported
*/
GF_Err gf_sys_profiler_log(const char *msg);

/*! Sends a message to remotery web client
\param msg text message to send. The message format should be json
\return GF_OK if success, GF_BAD_PARAM if profiler is not running, GF_NOT_SUPPORTED if profiler not supported
Expand Down Expand Up @@ -2292,7 +2298,7 @@ Bool gf_creds_check_membership(const char *username, const char *users, const ch

/*to call whenever the OpenGL library is opened - this function is needed to bind OpenGL and remotery, and to load
OpenGL extensions on windows
not exported, and not included in src/compositor/gl_inc.h since it may be needed even when no OpenGL
not exported, and not included in src/compositor/gl_inc.h since it may be needed even when no OpenGL
calls are made by the caller*/
void gf_opengl_init();

Expand Down Expand Up @@ -2357,4 +2363,3 @@ void gf_gl_txw_reset(GF_GLTextureWrapper *tx);


#endif /*_GF_CORE_H_*/

42 changes: 23 additions & 19 deletions share/doc/idl/nodejs.idl
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ This section documents the JavaScript API used to query the filter session.

Unless explictly stated, errors are handled through exceptions.

All constants from GPAC are exported in the module object (e.g. use gpac.GF_Err ...)
All constants from GPAC are exported in the module object (e.g. use gpac.GF_Err ...)


The API is very close to the GPAC python bindings.
Expand Down Expand Up @@ -71,6 +71,12 @@ void set_args(Array args);
*/
void set_rmt_fun(function callback);


/*! send log message to profiler (Remotery) - see \ref gf_sys_profiler_log
\param text text to send
*/
void rmt_log(DOMString text);

/*! send message to profiler (Remotery) - see \ref gf_sys_profiler_send
\param text text to send
*/
Expand Down Expand Up @@ -185,7 +191,7 @@ By default the filter session will run with implicit linking.
/*! FilterSession object*/
interface _FilterSession {

/*! constructor for filter session - see \ref gf_fs_new_defaults. Other options MUST be passed as libgpac options using \ref set_args
/*! constructor for filter session - see \ref gf_fs_new_defaults. Other options MUST be passed as libgpac options using \ref set_args
\param flags session flags
*/
FilterSession(unsigned long flags=0);
Expand Down Expand Up @@ -237,7 +243,7 @@ _Filter load(DOMString fname);

/*! post a user task to the filter sesison - see \ref gf_fs_post_user_task

The task object must have an execute callback with no parameter and returning false to cancel the task or the reschedule time in milliseconds
The task object must have an execute callback with no parameter and returning false to cancel the task or the reschedule time in milliseconds

\param task task object to post
*/
Expand Down Expand Up @@ -454,7 +460,7 @@ Fields have the same types, names and semantics as \ref GF_FilterStats, except:
- filter_alias which is exposed as a boolean.
*/
interface FilterStatistics {

};

/*! Statistics object for pid as defined in libgpac.
Expand All @@ -466,7 +472,7 @@ interface PidStatistics {
};


/*! PropertyValue for filter, PIDs and packets are passed as
/*! PropertyValue for filter, PIDs and packets are passed as
:
- native JS types for integers and strings
- nFraction for 32 and 64 bit fractions
Expand All @@ -481,7 +487,7 @@ Pointer properties are passed back as "INTERNAL_POINTER" string and cannot be se
Properties corresponding to constants are usually passed as strings, for example `StreamType`, `CodecID`, `PixelFormat`, `AudioFormat`.
*/
interface PropertyValue {

};

/*! fraction object */
Expand Down Expand Up @@ -543,7 +549,7 @@ A custom filter must implement the \ref CustomFilter class, and optionally provi
- process_event: callback for processing and event
- reconfigure_output: callback for output reconfiguration (PID capability negociation)

A custom filter must also declare its capabilities, input and output, using push_cap method
A custom filter must also declare its capabilities, input and output, using push_cap method
\code

let fs = new gpac.FilterSession();
Expand Down Expand Up @@ -865,7 +871,7 @@ void discard_block();
void allow_direct_dispatch();

/*! get current clock type info - see \ref gf_filter_pid_get_clock_info
\return clock type
\return clock type
*/
unsigned long get_clock_type();

Expand Down Expand Up @@ -948,7 +954,7 @@ _FilterPacket new_pck_ref(_FilterPacket ipck, unsigned long size=0, unsigned lon
_FilterPacket new_pck(unsigned long size=0);

/*! creates a new packet sharing memory of the filter - see \ref gf_filter_pck_new_shared
The filter object must have a `packet_release` method with arguments [ FilterPid, FilterPacket ]
The filter object must have a `packet_release` method with arguments [ FilterPid, FilterPacket ]
\param data the data to use
\return the new FilterPacket or None if failure
*/
Expand Down Expand Up @@ -985,7 +991,7 @@ unsigned long dur;

/*! if true, the session has been aborted and this is the final flush for this buffer*/
boolean is_final_flush;

};

/*! filter packet for custom filters
Expand Down Expand Up @@ -1131,7 +1137,7 @@ Events properties are read-only for input events and read/write for events creat
*/
interface _FilterEvent
{

};


Expand All @@ -1157,7 +1163,7 @@ When running the session in multithreaded mode, the dash demuxer will always be
/*! interface for custom DASH algorithms

Callbacks may be changed at runtime, however if the object passed to initialize the binding has no on_download_monitor function, rate monitoring will be disabled for the binding*/
interface _DASHCustomAlgorithm
interface _DASHCustomAlgorithm
{

/*! Callback (optional) called upon a period reset.
Expand Down Expand Up @@ -1202,7 +1208,7 @@ long on_download_monitor(_DASHGroup group, _DASHGroupDownloadStatistics stats);


/*! interface for custom DASH groups*/
interface _DASHGroup
interface _DASHGroup
{

/*! Index of group, as used in callbacks */
Expand All @@ -1219,7 +1225,7 @@ _DASHSRD SRD;
};

/*! interface for custom DASH groups*/
interface _DASHQualityInfo
interface _DASHQualityInfo
{

/*! bandwidth in bits per second*/
Expand Down Expand Up @@ -1273,7 +1279,7 @@ attribute readonly Array sizes;
};

/*! segemnt size info*/
interface _DASHSegmentInfo
interface _DASHSegmentInfo
{
/*! segemnt size*/
attribute readonly unsigned long long size;
Expand Down Expand Up @@ -1343,7 +1349,7 @@ attribute readonly unsigned long buffer_dur;

/*! duration of segment being downloaded, in milliseconds - 0 if unknown*/
attribute readonly unsigned long current_seg_dur;

};

/*! Spacial Relationship Descriptor for DASH group*/
Expand All @@ -1366,7 +1372,7 @@ attribute readonly unsigned long fw;

/*! total height of SRD descriptor for this tile*/
attribute readonly unsigned long fh;

};


Expand Down Expand Up @@ -1622,5 +1628,3 @@ attribute readonly DOMString value;
};

/*! @} */


12 changes: 11 additions & 1 deletion share/nodejs/src/gpac_napi.c
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,16 @@ napi_value gpac_set_rmt_fun(napi_env env, napi_callback_info info)
napi_create_reference(env, argv[0], 1, &gpac->rmt_ref);
return NULL;
}

napi_value gpac_rmt_log(napi_env env, napi_callback_info info)
{
NARG_ARGS(1, 1)
NARG_STR(msg, 0, NULL);
if (msg)
gf_sys_profiler_log(msg);
return NULL;
}

napi_value gpac_rmt_send(napi_env env, napi_callback_info info)
{
NARG_ARGS(1, 1)
Expand Down Expand Up @@ -3872,7 +3882,7 @@ void fs_on_filter_creation(void *udta, GF_Filter *filter, Bool is_destroy)
napi_env env = napi_fs->env;

//set to NULL means final nodeJS addon shutdown, do not notify

if (napi_fs->async_ctx != NULL) {
GPAC_NAPI *gpac;
if ( napi_get_instance_data(env, (void **) &gpac) != napi_ok) {
Expand Down
Loading