Fork me on GitHub
Loading...
Searching...
No Matches
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.
 
void(*const destroy )(void)
 Plugin deinitialization/destructor.
 
int(*const get_api_compatibility )(void)
 Informative method to request the API version this plugin was compiled against.
 
int(*const get_version )(void)
 Informative method to request the numeric version of the plugin.
 
const char *(*const get_version_string )(void)
 Informative method to request the string version of the plugin.
 
const char *(*const get_description )(void)
 Informative method to request a description of the plugin.
 
const char *(*const get_name )(void)
 Informative method to request the name of the plugin.
 
const char *(*const get_author )(void)
 Informative method to request the author of the plugin.
 
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)
 
void(*const create_session )(janus_plugin_session *handle, int *error)
 Method to create a new session/handle for a peer.
 
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.
 
struct json_t *(*const handle_admin_message )(json_t *message)
 Method to handle an incoming Admin API message/request.
 
void(*const setup_media )(janus_plugin_session *handle)
 Callback to be notified when the associated PeerConnection is up and ready to be used.
 
void(*const incoming_rtp )(janus_plugin_session *handle, janus_plugin_rtp *packet)
 Method to handle an incoming RTP packet from a peer.
 
void(*const incoming_rtcp )(janus_plugin_session *handle, janus_plugin_rtcp *packet)
 Method to handle an incoming RTCP packet from a peer.
 
void(*const incoming_data )(janus_plugin_session *handle, janus_plugin_data *packet)
 Method to handle incoming SCTP/DataChannel data from a peer (text only, for the moment)
 
void(*const data_ready )(janus_plugin_session *handle)
 Method to be notified about the fact that the datachannel is ready to be written.
 
void(*const slow_link )(janus_plugin_session *handle, gboolean uplink, gboolean 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.
 
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)
 
void(*const destroy_session )(janus_plugin_session *handle, int *error)
 Method to destroy a session/handle for a peer.
 
json_t *(*const query_session )(janus_plugin_session *handle)
 Method to get plugin-specific info of a session/handle.
 

Detailed Description

The plugin session and callbacks interface.

Field Documentation

◆ create_session

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

◆ data_ready

void(*const janus_plugin::data_ready) (janus_plugin_session *handle)

Method to be notified about the fact that the datachannel is ready to be written.

Note
This is not only called when the PeerConnection first becomes available, but also when the SCTP socket becomes writable again, e.g., because the internal buffer is empty.
Parameters
[in]handleThe plugin/gateway session used for this peer

◆ destroy

void(*const janus_plugin::destroy) (void)

Plugin deinitialization/destructor.

◆ destroy_session

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

◆ get_api_compatibility

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.

◆ get_author

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

Informative method to request the author of the plugin.

◆ get_description

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

Informative method to request a description of the plugin.

◆ get_name

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

Informative method to request the name of the plugin.

◆ get_package

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)

◆ get_version

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

Informative method to request the numeric version of the plugin.

◆ get_version_string

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

Informative method to request the string version of the plugin.

◆ handle_admin_message

struct json_t *(*const janus_plugin::handle_admin_message) (json_t *message)

Method to handle an incoming Admin API message/request.

Parameters
[in]messageThe json_t object containing the message/request JSON
Returns
A json_t instance containing the response

◆ handle_message

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.

Note
The Janus core leaves ownership of both the message and jsep json_t objects to plugins. This means that you'll have to decrease your own reference yourself with a json_decref when you're done with them. You'll also have to free transaction with g_free
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

◆ hangup_media

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

◆ incoming_data

void(*const janus_plugin::incoming_data) (janus_plugin_session *handle, janus_plugin_data *packet)

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]packetThe message data and related info

◆ incoming_rtcp

void(*const janus_plugin::incoming_rtcp) (janus_plugin_session *handle, janus_plugin_rtcp *packet)

Method to handle an incoming RTCP packet from a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]packetThe RTP packet and related data

◆ incoming_rtp

void(*const janus_plugin::incoming_rtp) (janus_plugin_session *handle, janus_plugin_rtp *packet)

Method to handle an incoming RTP packet from a peer.

Parameters
[in]handleThe plugin/gateway session used for this peer
[in]packetThe RTP packet and related data

◆ init

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

◆ query_session

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

◆ setup_media

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

◆ slow_link

void(*const janus_plugin::slow_link) (janus_plugin_session *handle, gboolean uplink, gboolean 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: