UNPKG

kurento-client-core

Version:

JavaScript Client API for Kurento Media Server

262 lines (207 loc) 6.28 kB
/* Autogenerated with Kurento Idl */ /* * (C) Copyright 2013-2015 Kurento (https://kurento.openvidu.io/) * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var inherits = require('inherits'); var kurentoClient = require('kurento-client'); var disguise = kurentoClient.disguise; var checkType = kurentoClient.checkType; var ChecktypeError = checkType.ChecktypeError; var Transaction = kurentoClient.TransactionsManager.Transaction; var HubPort = require('../HubPort'); var MediaObject = require('./MediaObject'); function noop(error, result) { if (error) console.trace(error); return result }; /** * @classdesc * A Hub is a routing {@link MediaObject}. * It connects several {@link Endpoint endpoints } together * * @abstract * @extends module:core/abstracts.MediaObject * * @constructor module:core/abstracts.Hub */ function Hub(){ Hub.super_.call(this); }; inherits(Hub, MediaObject); // // Public methods // /** * If GST_DEBUG_DUMP_DOT_DIR environment variable is defined dumps in that * directoy a file with the GStreamer dot of the Hub. * <p>The element can be queried for certain type of data:</p> * <ul> * <li>SHOW_ALL: default value</li> * <li>SHOW_CAPS_DETAILS</li> * <li>SHOW_FULL_PARAMS</li> * <li>SHOW_MEDIA_TYPE</li> * <li>SHOW_NON_DEFAULT_PARAMS</li> * <li>SHOW_STATES</li> * <li>SHOW_VERBOSE</li> * </ul> * * @alias module:core/abstracts.Hub.dumpGstreamerDot * * @param {module:core/complexTypes.GstreamerDotDetails} [details] * Details of graph * * @param {module:core/abstracts.Hub~dumpGstreamerDotCallback} [callback] * * @return {external:Promise} */ Hub.prototype.dumpGstreamerDot = function(details, callback){ var transaction = (arguments[0] instanceof Transaction) ? Array.prototype.shift.apply(arguments) : undefined; callback = arguments[arguments.length-1] instanceof Function ? Array.prototype.pop.call(arguments) : undefined; switch(arguments.length){ case 0: details = undefined; break; case 1: break; default: var error = new RangeError('Number of params ('+arguments.length+') not in range [0-1]'); error.length = arguments.length; error.min = 0; error.max = 1; throw error; } // // checkType('GstreamerDotDetails', 'details', details); // var params = { details: details }; callback = (callback || noop).bind(this) return disguise(this._invoke(transaction, 'dumpGstreamerDot', params, callback), this) }; /** * @callback module:core/abstracts.Hub~dumpGstreamerDotCallback * @param {external:Error} error */ /** * Returns a string in dot (graphviz) format that represents the gstreamer * elements inside the pipeline * * @alias module:core/abstracts.Hub.getGstreamerDot * * @param {module:core/complexTypes.GstreamerDotDetails} [details] * Details of graph * * @param {module:core/abstracts.Hub~getGstreamerDotCallback} [callback] * * @return {external:Promise} */ Hub.prototype.getGstreamerDot = function(details, callback){ var transaction = (arguments[0] instanceof Transaction) ? Array.prototype.shift.apply(arguments) : undefined; callback = arguments[arguments.length-1] instanceof Function ? Array.prototype.pop.call(arguments) : undefined; switch(arguments.length){ case 0: details = undefined; break; case 1: break; default: var error = new RangeError('Number of params ('+arguments.length+') not in range [0-1]'); error.length = arguments.length; error.min = 0; error.max = 1; throw error; } // // checkType('GstreamerDotDetails', 'details', details); // var params = { details: details }; callback = (callback || noop).bind(this) return disguise(this._invoke(transaction, 'getGstreamerDot', params, callback), this) }; /** * @callback module:core/abstracts.Hub~getGstreamerDotCallback * @param {external:Error} error * @param {external:String} result * The dot graph. */ /** * Create a new instance of a {module:core~HubPort} attached to this {module:core~Hub} * * @param {module:core/abstract.Hub~createHubCallback} callback * * @return {external:Promise} */ Hub.prototype.createHubPort = function(callback){ var transaction = (arguments[0] instanceof Transaction) ? Array.prototype.shift.apply(arguments) : undefined; var usePromise = false; if (callback == undefined) { usePromise = true; } if(!arguments.length) callback = undefined; callback = (callback || noop).bind(this) var mediaObject = new HubPort() mediaObject.on('_rpc', this.emit.bind(this, '_rpc')); var params = { type: 'HubPort', constructorParams: {hub: this} }; Object.defineProperty(params, 'object', {value: mediaObject}); this.emit('_create', transaction, params, callback); return mediaObject }; /** * @callback core/abstract.Hub~createHubCallback * @param {external:Error} error * @param {module:core/abstract.HubPort} result * The created HubPort */ /** * @alias module:core/abstracts.Hub.constructorParams */ Hub.constructorParams = { }; /** * @alias module:core/abstracts.Hub.events * * @extends module:core/abstracts.MediaObject.events */ Hub.events = MediaObject.events; /** * Checker for {@link module:core/abstracts.Hub} * * @memberof module:core/abstracts * * @param {external:String} key * @param {module:core/abstracts.Hub} value */ function checkHub(key, value) { if(!(value instanceof Hub)) throw ChecktypeError(key, Hub, value); }; module.exports = Hub; Hub.check = checkHub;