Skip to content

Commit

Permalink
Sync files with autogenerated ones
Browse files Browse the repository at this point in the history
Change-Id: Iaab1e8994cb41ffd8022d369378dff64524f2f5d
  • Loading branch information
piranna committed Jul 16, 2014
1 parent 03576ac commit 54084ab
Show file tree
Hide file tree
Showing 8 changed files with 284 additions and 19 deletions.
35 changes: 33 additions & 2 deletions lib/KwsMedia.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ var abstracts =
UriEndpoint: require('./endpoints/UriEndpoint')
};

var registered = {};


/**
* Serialize objects using their id
Expand All @@ -98,8 +100,8 @@ function serializeParams(params)
*/
function getConstructor(type)
{
return core[type] || endpoints[type] || filters[type] || hubs[type]
|| abstracts[type] || MediaObject;
return registered[type] || core[type] || endpoints[type] || filters[type]
|| hubs[type] || abstracts[type] || MediaObject;
};

function createConstructor(item)
Expand Down Expand Up @@ -502,6 +504,33 @@ KwsMedia.prototype.connect = function(media, callback)
};


KwsMedia.register = function(name, constructor)
{
if(typeof name != 'string')
{
constructor = name;
name = constructor.name;

if(name == undefined)
throw new Error("Can't register an anonymous module");
};

registered[name] = constructor;
};


KwsMedia.require = function(name)
{
var module = require(name)

if(module instanceof Function)
KwsMedia.register(module)
else
for(var name in module)
KwsMedia.register(name, module[name])
};


/**
* The built in number object.
* @external Number
Expand All @@ -523,3 +552,5 @@ KwsMedia.prototype.connect = function(media, callback)


module.exports = KwsMedia;

KwsMedia.Filter = require('./core/Filter');
4 changes: 2 additions & 2 deletions lib/complexTypes/RegionOfInterest.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ var checkType = require('../checkType');
*/
function checkRegionOfInterest(key, value)
{
checkType('Point', key+'.points', value.points, true);
checkType('RelativePoint', key+'.points', value.points, true);
checkType('RegionOfInterestConfig', key+'.regionOfInterestConfig', value.regionOfInterestConfig, true);
checkType('String', key+'.id', value.id, true);
};
Expand All @@ -46,7 +46,7 @@ function checkRegionOfInterest(key, value)
* @typedef KwsMedia/complexTypes~RegionOfInterest
*
* @type {Object}
* @property {Point} points - list of points delimiting the region of interest
* @property {RelativePoint} points - list of points delimiting the region of interest
* @property {RegionOfInterestConfig} regionOfInterestConfig - data structure for configuration of CrowdDetector regions of interest
* @property {String} id - identifier of the region of interest. The string used for the id must begin
with a letter followed by an alphanumeric character included (/-_.:+)
Expand Down
53 changes: 53 additions & 0 deletions lib/complexTypes/RelativePoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/* Autogenerated with Kurento Idl */

/*
* (C) Copyright 2013-2014 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/

var checkType = require('../checkType');

/**
* Media API for the Kurento Web SDK
*
* @module KwsMedia/complexTypes
*
* @copyright 2014 Kurento (http://kurento.org/)
* @license LGPL
*/

/**
* Checker for {@link KwsMedia/complexTypes~RelativePoint}
*
* @param {String} key
* @param {KwsMedia/complexTypes~RelativePoint} value
*/
function checkRelativePoint(key, value)
{
checkType('float', key+'.x', value.x, true);
checkType('float', key+'.y', value.y, true);
};


/**
* Relative points in a physical screen, values are a percentage relative to the image dimensions. X left to right and Y top to down.
*
* @typedef KwsMedia/complexTypes~RelativePoint
*
* @type {Object}
* @property {float} x - Percentage relative to the image width to calculate the X coordinate of the point [0..1]
* @property {float} y - Percentage relative to the image height to calculate the Y coordinate of the point [0..1]
*/


module.exports = checkRelativePoint;
2 changes: 2 additions & 0 deletions lib/complexTypes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var Point = require('./Point');
var PointerDetectorWindowMediaParam = require('./PointerDetectorWindowMediaParam');
var RegionOfInterest = require('./RegionOfInterest');
var RegionOfInterestConfig = require('./RegionOfInterestConfig');
var RelativePoint = require('./RelativePoint');
var WindowParam = require('./WindowParam');


Expand All @@ -37,4 +38,5 @@ exports.Point = Point;
exports.PointerDetectorWindowMediaParam = PointerDetectorWindowMediaParam;
exports.RegionOfInterest = RegionOfInterest;
exports.RegionOfInterestConfig = RegionOfInterestConfig;
exports.RelativePoint = RelativePoint;
exports.WindowParam = WindowParam;
52 changes: 38 additions & 14 deletions lib/core/MediaObject.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

var inherits = require('inherits');

var checkType = require('../checkType');


/**
* Media API for the Kurento Web SDK
Expand Down Expand Up @@ -50,9 +48,9 @@ inherits(MediaObject, _MediaObject);


/**
* Returns the pipeline to which this MediaObject belong, or the pipeline itself if invoked over a :rom:cls:`MediaPipeline`
* :rom:cls:`MediaPipeline` to which this MediaObject belong, or the pipeline itself if invoked over a :rom:cls:`MediaPipeline`
*
* @param {module:kwsMediaApi/core~MediaObject.getMediaPipelineCallback} [callback]
* @param {module:kwsMediaApi/core~MediaObject.mediaPipelineCallback} [callback]
*
* @return {module:kwsMediaApi/core~MediaObject}
* The own media object
Expand All @@ -64,19 +62,12 @@ MediaObject.prototype.getMediaPipeline = function(callback){
* @callback MediaObject~getMediaPipelineCallback
* @param {Error} error
* @param {MediaPipeline} result
* the MediaPipeline this MediaObject belongs to.
If called on a :rom:cls:`MediaPipeline` it will return ``this``.
*/

/**
* Returns the parent of this media object. The type of the parent depends on the type of the element that this method is called upon:
The parent of a :rom:cls:`MediaPad` is its :rom:cls:`MediaElement`; the parent of a :rom:cls:`MediaMixer` or a :rom:cls:`MediaElement` is its :rom:cls:`MediaPipeline`.
A :rom:cls:`MediaPipeline` has no parent, i.e. the method returns null
* parent of this media object. The type of the parent depends on the type of the element. The parent of a :rom:cls:`MediaPad` is its :rom:cls:`MediaElement`; the parent of a :rom:cls:`Hub` or a :rom:cls:`MediaElement` is its :rom:cls:`MediaPipeline`. A :rom:cls:`MediaPipeline` has no parent, i.e. the property is null
*
* @param {module:kwsMediaApi/core~MediaObject.getParentCallback} [callback]
* @param {module:kwsMediaApi/core~MediaObject.parentCallback} [callback]
*
* @return {module:kwsMediaApi/core~MediaObject}
* The own media object
Expand All @@ -88,7 +79,40 @@ MediaObject.prototype.getParent = function(callback){
* @callback MediaObject~getParentCallback
* @param {Error} error
* @param {MediaObject} result
* the parent of this MediaObject or null if called on a MediaPipeline
*/

/**
* To test read/write property
*
* @param {module:kwsMediaApi/core~MediaObject.readWriteCallback} [callback]
*
* @return {module:kwsMediaApi/core~MediaObject}
* The own media object
*/
MediaObject.prototype.getReadWrite = function(callback){
return this.invoke('getReadWrite', callback);
};
/**
* @callback MediaObject~getReadWriteCallback
* @param {Error} error
* @param {boolean} result
*/

/**
* To test readOnly property
*
* @param {module:kwsMediaApi/core~MediaObject.testReadOnlyCallback} [callback]
*
* @return {module:kwsMediaApi/core~MediaObject}
* The own media object
*/
MediaObject.prototype.getTestReadOnly = function(callback){
return this.invoke('getTestReadOnly', callback);
};
/**
* @callback MediaObject~getTestReadOnlyCallback
* @param {Error} error
* @param {String} result
*/


Expand Down
153 changes: 153 additions & 0 deletions lib/hubs/Mixer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
/*
* (C) Copyright 2013-2014 Kurento (http://kurento.org/)
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the GNU Lesser General Public License
* (LGPL) version 2.1 which accompanies this distribution, and is available at
* http://www.gnu.org/licenses/lgpl-2.1.html
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
*/

var inherits = require('inherits');

var checkType = require('../checkType');


/**
* Media API for the Kurento Web SDK
*
* @module kwsMediaApi/hubs
*
* @copyright 2013-2014 Kurento (http://kurento.org/)
* @license LGPL
*/

var Hub = require('../core/Hub');


/**
* A :rom:cls:`Hub` that allows routing of video between arbitrary port pairs and mixing of audio among several ports
*
* @class module:kwsMediaApi/hubs~Mixer
* @extends module:kwsMediaApi~Hub
*/

/**
* Create a :rom:cls:`Mixer` belonging to the given pipeline.
*
* @constructor
*
* @param {string} id
*/
function Mixer(id)
{
Hub.call(this, id);
};
inherits(Mixer, Hub);


/**
* Connects each corresponding :rom:enum:`MediaType` of the given source port with the sink port.
*
* @param {MediaType} media
* The sort of media stream to be connected
*
* @param {HubPort} source
* Video source port to be connected
*
* @param {HubPort} sink
* Video sink port to be connected
*
* @param {module:kwsMediaApi/hubs~Mixer.connectCallback} [callback]
*
* @return {module:kwsMediaApi/hubs~Mixer}
* The own media object
*/
Mixer.prototype.connect = function(media, source, sink, callback){
checkType('MediaType', 'media', media, {required: true});
checkType('HubPort', 'source', source, {required: true});
checkType('HubPort', 'sink', sink, {required: true});

var params = {
media: media,
source: source,
sink: sink,
};

return this.invoke('connect', params, callback);
};
/**
* @callback Mixer~connectCallback
* @param {Error} error
*/

/**
* Disonnects each corresponding :rom:enum:`MediaType` of the given source port from the sink port.
*
* @param {MediaType} media
* The sort of media stream to be disconnected
*
* @param {HubPort} source
* Audio source port to be disconnected
*
* @param {HubPort} sink
* Audio sink port to be disconnected
*
* @param {module:kwsMediaApi/hubs~Mixer.disconnectCallback} [callback]
*
* @return {module:kwsMediaApi/hubs~Mixer}
* The own media object
*/
Mixer.prototype.disconnect = function(media, source, sink, callback){
checkType('MediaType', 'media', media, {required: true});
checkType('HubPort', 'source', source, {required: true});
checkType('HubPort', 'sink', sink, {required: true});

var params = {
media: media,
source: source,
sink: sink,
};

return this.invoke('disconnect', params, callback);
};
/**
* @callback Mixer~disconnectCallback
* @param {Error} error
*/


/**
* @type module:kwsMediaApi/hubs~Mixer.constructorParams
*
* @property {MediaPipeline} mediaPipeline
* the :rom:cls:`MediaPipeline` to which the Mixer belongs
*/
Mixer.constructorParams = {
mediaPipeline: {
type: 'MediaPipeline',
required: true
},
};

/**
* @type module:kwsMediaApi/hubs~Mixer.events
* @extend module:kwsMediaApi~Hub.events
*/
Mixer.events = [];
Mixer.events.concat(Hub.events);


module.exports = Mixer;


Mixer.check = function(key, value)
{
if(!(value instanceof Mixer))
throw SyntaxError(key+' param should be a Mixer, not '+typeof value);
};
2 changes: 2 additions & 0 deletions lib/hubs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@
var Composite = require('./Composite');
var Dispatcher = require('./Dispatcher');
var DispatcherOneToMany = require('./DispatcherOneToMany');
var Mixer = require('./Mixer');


exports.Composite = Composite;
exports.Dispatcher = Dispatcher;
exports.DispatcherOneToMany = DispatcherOneToMany;
exports.Mixer = Mixer;
Loading

0 comments on commit 54084ab

Please sign in to comment.