Hi Alon,
StatusInfo looks like this:
[Prefix="Arris::"]
interface StatusInfo {
readonly attribute unsigned long bitrate;
readonly attribute unsigned long networkthroughput;
readonly attribute unsigned long optimalbitrate;
readonly attribute unsigned long droppedframes;
readonly attribute unsigned long stalls;
readonly attribute double decodeFPS;
readonly attribute double renderFPS;
readonly attribute unsigned long audiosegments;
readonly attribute unsigned long videosegments;
readonly attribute unsigned long h264frames;
readonly attribute unsigned long rgbframes;
readonly attribute unsigned long pcmframes;
readonly attribute double seconds;
readonly attribute double duration;
readonly attribute double cacheduration;
readonly attribute PlayerState playerstate;
readonly attribute boolean frontendrunning;
readonly attribute boolean audiodemuxerrunning;
readonly attribute boolean videodemuxerrunning;
readonly attribute boolean decoderrunning;
readonly attribute boolean audiorendererrunning;
readonly attribute boolean videorendererrunning;
readonly attribute PlayerError lasterror;
};
On Wednesday, February 14, 2018 at 3:34:47 PM UTC-8, Alon Zakai wrote:
>
> How did you define StatusInfo in the idl file?
>
> On Tue, Feb 13, 2018 at 12:05 PM, Scott Watson <[email protected]
> <javascript:>> wrote:
>
>> Hi folks,
>>
>> I'm trying to create a callback mechanism to call into JS from C++. I
>> have a pure virtual C++ class that defines the callback interface defined
>> as:
>>
>> class MediaPlayerDelegate {
>> public:
>> virtual void PlayerStateChanged(PlayerState state, void *context)=0;
>> virtual void PlayerStatus(StatusInfo *status, void *context)=0;
>> virtual void PlayerErrorEncountered(PlayerError error, void *context
>> )=0;
>> };
>>
>>
>>
>> and I've described it in the IDL file as:
>>
>> [Prefix="Arris::", NoDelete]
>> callback interface MediaPlayerDelegate {
>> void PlayerStateChanged(PlayerState state, any context);
>> void PlayerStatus(StatusInfo status, any context);
>> void PlayerErrorEncountered(PlayerError error, any context);
>> };
>>
>>
>> [JSImplementation="MediaPlayerDelegate"]
>> interface MediaPlayerJSDelegate {
>> void MediaPlayerJSDelegate();
>> void PlayerStateChanged(PlayerState state, any context);
>> void PlayerStatus(StatusInfo status, any context);
>> void PlayerErrorEncountered(PlayerError error, any context);
>> };
>>
>>
>>
>> But the generated code for the PlayerStatus method won't compile. My
>> glue.cpp file looks like this:
>>
>> void PlayerStatus(Arris::StatusInfo arg0, void* arg1) {
>> EM_ASM_INT({
>> var self = Module['getCache'](Module['MediaPlayerJSDelegate'])[$0];
>> if (!self.hasOwnProperty('PlayerStatus')) throw 'a
>> JSImplementation must implement all functions, you forgot
>> MediaPlayerJSDelegate::PlayerStatus.';
>> self['PlayerStatus']($1,$2);
>> }, (int)this, (int)arg0, arg1);
>> }
>>
>>
>> Why isn't arg0 a StatusInfo *?
>>
>> If I make the change manually it builds but making the callback generates
>> an exception. The other two methods work fine.
>>
>> Any suggestions?
>>
>> -------
>> Scott
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "emscripten-discuss" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
--
You received this message because you are subscribed to the Google Groups
"emscripten-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.