Fork me on GitHub
Data Fields
janus_plugin Struct Reference

The plugin session and callbacks interface. More...

#include <plugin.h>

Collaboration diagram for janus_plugin:
Collaboration graph
[legend]

Data Fields

int(*const init )(janus_callbacks *callback, const char *config_path)
 Plugin initialization/constructor. More...
 
void(*const destroy )(void)
 Plugin deinitialization/destructor. More...
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this plugin was compiled against. More...
 
int(*const get_version )(void)
 Informative method to request the numeric version of the plugin. More...
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the plugin. More...
 
const char *(*const get_description )(void)
 Informative method to request a description of the plugin. More...
 
const char *(*const get_name )(void)
 Informative method to request the name of the plugin. More...
 
const char *(*const get_author )(void)
 Informative method to request the author of the plugin. More...
 
const char *(*const get_package )(void)
 Informative method to request the package name of the plugin (what will be used in web applications to refer to it) More...
 
void(*const create_session )(janus_plugin_session *handle, int *error)
 Method to create a new session/handle for a peer. More...
 
struct janus_plugin_result *(*const handle_message )(janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)
 Method to handle an incoming message/request from a peer. More...
 
void(*const setup_media )(janus_plugin_session *handle)
 Callback to be notified when the associated PeerConnection is up and ready to be used. More...
 
void(*const incoming_rtp )(janus_plugin_session *handle, int video, char *buf, int len)
 Method to handle an incoming RTP packet from a peer. More...
 
void(*const incoming_rtcp )(janus_plugin_session *handle, int video, char *buf, int len)
 Method to handle an incoming RTCP packet from a peer. More...
 
void(*const incoming_data )(janus_plugin_session *handle, char *buf, int len)
 Method to handle incoming SCTP/DataChannel data from a peer (text only, for the moment) More...
 
void(*const slow_link )(janus_plugin_session *handle, int uplink, int video)
 Method to be notified by the core when too many NACKs have been received or sent by Janus, and so a slow or potentially unreliable network is to be expected for this peer. More...
 
void(*const hangup_media )(janus_plugin_session *handle)
 Callback to be notified about DTLS alerts from a peer (i.e., the PeerConnection is not valid any more) More...
 
void(*const destroy_session )(janus_plugin_session *handle, int *error)
 Method to destroy a session/handle for a peer. More...
 
json_t *(*const query_session )(janus_plugin_session *handle)
 Method to get plugin-specific info of a session/handle. More...
 

Detailed Description

The plugin session and callbacks interface.

Field Documentation

void(* const janus_plugin::create_session) (janus_plugin_session *handle, int *error)

Method to create a new session/handle for a peer.

Parameters
[in]handleThe plugin/gateway session that will be used for this peer
[out]errorAn integer that may contain information about any error
void(* const janus_plugin::destroy) (void)

Plugin deinitialization/destructor.

void(* const janus_plugin::destroy_session) (janus_plugin_session *handle, int *error)

Method to destroy a session/handle for a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[out]errorAn integer that may contain information about any error
int(* const janus_plugin::get_api_compatibility) (void)

Informative method to request the API version this plugin was compiled against.

Note
This was added in version 0.0.7 of Janus, to address changes to the API that might break existing plugin or the core itself. All plugins MUST implement this method and return JANUS_PLUGIN_API_VERSION to make this work, or they will be rejected by the core. Do NOT try to launch a <= 0.0.7 plugin on a >= 0.0.7 Janus or it will crash.
const char*(* const janus_plugin::get_author) (void)

Informative method to request the author of the plugin.

const char*(* const janus_plugin::get_description) (void)

Informative method to request a description of the plugin.

const char*(* const janus_plugin::get_name) (void)

Informative method to request the name of the plugin.

const char*(* const janus_plugin::get_package) (void)

Informative method to request the package name of the plugin (what will be used in web applications to refer to it)

int(* const janus_plugin::get_version) (void)

Informative method to request the numeric version of the plugin.

const char*(* const janus_plugin::get_version_string) (void)

Informative method to request the string version of the plugin.

struct janus_plugin_result*(* const janus_plugin::handle_message) (janus_plugin_session *handle, char *transaction, json_t *message, json_t *jsep)

Method to handle an incoming message/request from a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]transactionThe transaction identifier for this message/request
[in]messageThe json_t object containing the message/request JSON
[in]jsepThe json_t object containing the JSEP type/SDP, if available
Returns
A janus_plugin_result instance that may contain a response (for immediate/synchronous replies), an ack (for asynchronously managed requests) or an error
void(* const janus_plugin::hangup_media) (janus_plugin_session *handle)

Callback to be notified about DTLS alerts from a peer (i.e., the PeerConnection is not valid any more)

Parameters
[in]handleThe plugin/gateway session used for this peer
void(* const janus_plugin::incoming_data) (janus_plugin_session *handle, char *buf, int len)

Method to handle incoming SCTP/DataChannel data from a peer (text only, for the moment)

Note
We currently only support text data, binary data will follow... please also notice that DataChannels send unterminated strings, so you'll have to terminate them with a \0 yourself to use them.
Parameters
[in]handleThe plugin/gateway session used for this peer
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void(* const janus_plugin::incoming_rtcp) (janus_plugin_session *handle, int video, char *buf, int len)

Method to handle an incoming RTCP packet from a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]videoWhether this is related to an audio or a video stream
[in]bufThe message data (buffer)
[in]lenThe buffer lenght
void(* const janus_plugin::incoming_rtp) (janus_plugin_session *handle, int video, char *buf, int len)

Method to handle an incoming RTP packet from a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]videoWhether this is an audio or a video frame
[in]bufThe packet data (buffer)
[in]lenThe buffer lenght
int(* const janus_plugin::init) (janus_callbacks *callback, const char *config_path)

Plugin initialization/constructor.

Parameters
[in]callbackThe callback instance the plugin can use to contact the Janus core
[in]config_pathPath of the folder where the configuration for this plugin can be found
Returns
0 in case of success, a negative integer in case of error
json_t*(* const janus_plugin::query_session) (janus_plugin_session *handle)

Method to get plugin-specific info of a session/handle.

Note
This was added in version 0.0.7 of Janus. Janus assumes the string is always allocated, so don't return constants here
Parameters
[in]handleThe plugin/gateway session used for this peer
Returns
A json_t object with the requested info
void(* const janus_plugin::setup_media) (janus_plugin_session *handle)

Callback to be notified when the associated PeerConnection is up and ready to be used.

Parameters
[in]handleThe plugin/gateway session used for this peer
void(* const janus_plugin::slow_link) (janus_plugin_session *handle, int uplink, int video)

Method to be notified by the core when too many NACKs have been received or sent by Janus, and so a slow or potentially unreliable network is to be expected for this peer.

Note
Beware that this callback may be called more than once in a row, (even though never more than once per second), until things go better for that PeerConnection. You may or may not want to handle this callback and act on it, considering you can get bandwidth information from REMB feedback sent by the peer if the browser supports it. Besides, your plugin may not have access to encoder related settings to slow down or decreae the bitrate if required after the callback is called. Nevertheless, it can be useful for debugging, or for informing your users about potential issues that may be happening media-wise.
Parameters
[in]handleThe plugin/gateway session used for this peer
[in]uplinkWhether this is related to the uplink (Janus to peer) or downlink (peer to Janus)
[in]videoWhether this is related to an audio or a video stream

The documentation for this struct was generated from the following file: