/* Autogenerated with Kurento Idl */
/*
* (C) Copyright 2013-2015 Kurento (http://kurento.org/)
*
* 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 ChecktypeError = kurentoClient.checkType.ChecktypeError;
var Transaction = kurentoClient.TransactionsManager.Transaction;
var Filter = require('kurento-client-core').abstracts.Filter;
function noop(error, result) {
if (error) console.trace(error);
return result
};
/**
* Create a {@link module:filters.GStreamerFilter GStreamerFilter}
*
* @classdesc
* This is a generic filter interface, that creates GStreamer filters in the
* media server.
*
* @extends module:core/abstracts.Filter
*
* @constructor module:filters.GStreamerFilter
*/
function GStreamerFilter(){
GStreamerFilter.super_.call(this);
};
inherits(GStreamerFilter, Filter);
//
// Public properties
//
/**
* GStreamer command.
*
* @alias module:filters.GStreamerFilter#getCommand
*
* @param {module:filters.GStreamerFilter~getCommandCallback} [callback]
*
* @return {external:Promise}
*/
GStreamerFilter.prototype.getCommand = 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)
return disguise(this._invoke(transaction, 'getCommand', callback), this)
};
/**
* @callback module:filters.GStreamerFilter~getCommandCallback
* @param {external:Error} error
* @param {external:String} result
*/
/**
* @alias module:filters.GStreamerFilter.constructorParams
*
* @property {external:String} command
* command that would be used to instantiate the filter, as in `gst-launch
* <http://rpm.pbone.net/index.php3/stat/45/idpl/19531544/numer/1/nazwa/gst-launch-1.0>`__
*
* @property {external:FilterType} [filterType]
* Filter type that define if the filter is set as audio, video or autodetect
*
* @property {module:core.MediaPipeline} mediaPipeline
* the {@link module:core.MediaPipeline MediaPipeline} to which the filter
* belongs
*/
GStreamerFilter.constructorParams = {
command: {
type: 'String',
required: true
},
filterType: {
type: 'kurento.FilterType' },
mediaPipeline: {
type: 'kurento.MediaPipeline',
required: true
}
};
/**
* @alias module:filters.GStreamerFilter.events
*
* @extends module:core/abstracts.Filter.events
*/
GStreamerFilter.events = Filter.events;
/**
* Checker for {@link module:filters.GStreamerFilter}
*
* @memberof module:filters
*
* @param {external:String} key
* @param {module:filters.GStreamerFilter} value
*/
function checkGStreamerFilter(key, value)
{
if(!(value instanceof GStreamerFilter))
throw ChecktypeError(key, GStreamerFilter, value);
};
module.exports = GStreamerFilter;
GStreamerFilter.check = checkGStreamerFilter;