Author: ygrego Date: 2015-03-10 17:00:18 +0000 (Tue, 10 Mar 2015) New Revision: 924 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/924 Log: Implementation of method "stop" and "release". But also of "createChannelObject", this one is separated in two parts (each part is delegated to one method). The first part about channel with identifier type : ID_DVB_SI_DIRECT have been achieved by the mehod "_createDvbSiChannelObject". The other part will be affected to method "_createAnyDvbChannelObject". The usage of those methods, result in the fact that the javascript language don't specify ?\194?\171?\194?\160method overloading?\194?\160?\194?\187. Modified: oipf/js/impl/VideoBroadcastObject.js Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-03-10 13:01:05 UTC (rev 923) +++ oipf/js/impl/VideoBroadcastObject.js 2015-03-10 17:00:18 UTC (rev 924) @@ -26,6 +26,7 @@ * allocationMethod property SHALL be set to DYNAMIC_ALLOCATION . */ var VideoBroadcastObject = Class.extend({ + /* * Description: * The width of the area used for rendering the video object. This property is only writable if property @@ -34,7 +35,13 @@ * the DOM Level 2 Style interfaces (i.e. CSS2Properties interface style.width ), at least for values * specified in pixels. */ - width: null, + get width () { + return null; + }, + + set width (val) { + + }, /* * Description: * The height of the area used for rendering the video object. This property is only writable if property @@ -44,12 +51,14 @@ * specified in pixels. */ heigth: null, + /* * Description: * Returns true if this video object is in full-screen mode, false otherwise. The default value is false . * Visibilité Type: readonly Boolean */ fullScreen: null, + /* * Description: * Setting the value of the data property SHALL have no effect on the video/broadcast object. If this property @@ -57,6 +66,7 @@ * Type: String */ data: null, + /*! * Description: * Visibility Type: readonly Integer @@ -85,6 +95,7 @@ * be obtained from the currentChannel property on the ApplicationPrivateData object which is the same as that on the video/broadcast object under most normal * conditions. */ playstate: null, + /* * Description: * The list of media formats that are supported by the object. Each item SHALL contain a format label according @@ -94,6 +105,7 @@ * Visibilité Type: readonly StringCollection */ playerCapabilities: null, + /* * Description: * Returns the resource allocation method currently in use by the object. Valid values as defined in section 7.14.13.1 are: @@ -104,6 +116,7 @@ * Visibilité Type: readonly Integer */ allocationMethod: null, + /* * Description: * The channel currently being presented by this embedded object if the user has given permission to share this @@ -122,9 +135,11 @@ * Visibility Type: readonly Channel */ currentChannel: null, + createdCallback: function() { console.log("[INFO] createdCallback called."); }, + init: function (requiredCapabilities) { console.log("[INFO] constructor of VideoBroadcast class called."); this.playstate = 0; @@ -139,6 +154,7 @@ this.allocationMethod = DYNAMIC_ALLOCATION_VIDEOBROADCAST; } }, + /*! * Description: * The function that is called when a request to switch a tuner to another channel resulted in an error preventing @@ -189,6 +205,7 @@ * --------------------------------------------------------------------------------------------------------------------------------------------------------------- */ onChannelChangeError: null, + /*! * Description: * The function that is called when the play state of the video/broadcast object changes. This function may @@ -203,6 +220,7 @@ * • Number error – if the state has changed due to an error, this field contains an error code detailing the type of error. See the definition of * onChannelChangeError above for valid values. If no error has occurred, this argument SHALL take the value undefined . */ onPlayStateChange: null, + /* * Description: * The function that is called when a request to switch a tuner to another channel has successfully completed. @@ -213,6 +231,7 @@ * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). */ onChannelChangeSucceeded: null, + /* * Description: * The function that is called when the value of fullScreen changes. @@ -220,6 +239,7 @@ onFullScreenChange: function() { }, + /* * Description: * The function that is called when the video object gains focus. @@ -227,6 +247,7 @@ onfocus: function() { }, + /* * Description: * The function that is called when the video object loses focus. @@ -234,6 +255,7 @@ onblur: function() { }, + /* * * Description: @@ -244,6 +266,7 @@ getChannelConfig: function() { return oipfObjectFactory.createChannelConfig(); }, + /* * Description: * If the video/broadcast object is in the unrealized state and video from exactly one @@ -307,20 +330,178 @@ } return this.currentChannel; }, + /* * Description: - * The function that is called when a request to switch a tuner to another channel has successfully completed. - * This function may be called either in response to a channel change initiated by the application, or a channel - * change initiated by the OITF (see section 7.13.1.1). The specified function is called with argument channel, - * which is defined as follows: + * Creates a Channel object of the specified idType . This method is typically used to create a + * Channel object of type ID_DVB_SI_DIRECT or any other type. The Channel object can subsequently be + * used by the setChannel() method to switch a tuner to this channel, which may or may not + * be part of the channel list in the OITF. The resulting Channel object represents a locally + * defined channel which, if not already present there, does not get added to the channel list + * accessed through the ChannelConfig class (see section 7.13.9). + * + * If the channel of the given type cannot be created or the delivery system descriptor is not + * valid, the method SHALL return null . + * + * If the channel of the given type (ID_DVB_SI_DIRECT) can be created and the delivery system descriptor is valid, + * the method SHALL return a Channel object whereby at a minimum the properties with the + * same names (i.e. idType , dsd and sid ) are given the same value as argument idType , + * dsd and sid of the createChannelObject method. + * + * Else, if the channel of the given type can be created and arguments are considered valid and + * complete, then either: + * + * 1. If the channel is in the channel list then a new object of the same type and with + * properties with the same values SHALL be returned as would be returned by calling + * getChannelWithTriplet() with the same parameters as this method. + * + * 2. Otherwise, the method SHALL return a Channel object whereby at a minimum the + * properties with the same names are given the same value as the given arguments of + * the createChannelObject() method. The values specified for the remaining + * properties of the Channel object are set to undefined . * - * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). + * Arguments: + * + * Either (if idType ID_DVB_SI_DIRECT): + * - idType: The type of channel, as indicated by one of the ID_* constants defined in + * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For + * other values this behaviour is not specified. + * + * - dsd: The delivery system descriptor (tuning parameters) represented as a string + * whose characters shall be restricted to the ISO Latin-1 character set. Each + * character in the dsd represents a byte of a delivery system descriptor as defined + * by DVB-SI [EN 300 468] section 6.2.13, such that a byte at position "i" in the + * delivery system descriptor is equal the Latin-1 character code of the character at + * position "i" in the dsd. + * + * - sid: The service ID, which must be within the range of 1 to 65535. + * + * Or (Any other type): + * - idType : The type of channel, as indicated by one of the ID_* constants defined in + * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For + * other values this behaviour is not specified. + * + * - onid : The original network ID. Optional argument that SHALL be specified + * when the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , + * or ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - tsid : The transport stream ID. Optional argument that MAY be specified when + * the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or + * ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - sid : The service ID. Optional argument that SHALL be specified when the + * idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or + * ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - sourceID : The source_ID. Optional argument that SHALL be specified when the + * idType specifies a channel of type ID_ATSC_T and SHALL otherwise be + * gnored by the OITF. + * + * - ipBroadcastID : The DVB textual service identifier of the IP broadcast service, specified in + * the format “ ServiceName.DomainName ” when idType specifies a + * channel of type ID_IPTV_SDS , or the URI of the IP broadcast service + * when idType specifies a channel of type ID_IPTV_URI . Optional + * argument that SHALL be specified when the idType specifies a channel + * of type ID_IPTV_SDS or ID_IPTV_URI and SHALL otherwise be ignored + * by the OITF. */ - createChannelObject: function(idType, dsd, sid) { + createChannelObject: function() { + + if (arguments.length == 3 && arguments[0] == 13) { + this._createDvbSiChannelObject(arguments[0], arguments[1], arguments[2]); + } else { + if (arguments.length >= 2) { // Some argments can be optional but a minimum of 2 is required. + this._createAnyDvbChannelObject(arguments[0], arguments[1], arguments[2], arguments[3], arguments[4], arguments[5]); + } + } + return null; + }, + + _createDvbSiDirectChannelObject: function(idType, dsd, sid) { + + if (idType == 13) { //Identify a channel of identifier type : ID_DVB_SI_DIRECT. + if (CHANNEL_CREATION[idType]) { //Verify a channel of this idType (ID_DVB_SI_DIRECT = 13). + + var channelTools = new ChannelTools(); + + if (channelTools.isAValidTerrestrialDsd(dsd)) { //Verify the dsd validity. + + if ((sid >= 1) && (sid <= 65535)) { //Verify the rigth range of service id. + + var newChannel = new Channel("localChannel" + createUUID(), "TYPE_TV", idType, dsd, sid); + var channelConfig = this.getChannelConfig(); + channelTools = new ChannelTools(); + + if (!channelTools.getChannelByDsd(channelConfig.channelList, dsd)) { + + /* Normally channelList is readonly but the method documentation say + * that the channel must be add if it not already present. + */ + channelConfig.channelList.push(newChannel); + } + + return newChannel; + + } + } + } + } + }, + /* * Description: + * Creates a Channel object of the specified idType . This method is typically used to create a + * Channel object of type ID_DVB_SI_DIRECT . The Channel object can subsequently be + * used by the setChannel() method to switch a tuner to this channel, which may or may not + * be part of the channel list in the OITF. The resulting Channel object represents a locally + * defined channel which, if not already present there, does not get added to the channel list + * accessed through the ChannelConfig class (see section 7.13.9). + * Valid value for idType include : ID_DVB_SI_DIRECT . For other values this behaviour is not + * specified. + * If the channel of the given type cannot be created or the delivery system descriptor is not + * valid, the method SHALL return null . + * If the channel of the given type can be created and the delivery system descriptor is valid, + * the method SHALL return a Channel object whereby at a minimum the properties with the + * same names (i.e. idType , dsd and sid ) are given the same value as argument idType , + * dsd and sid of the createChannelObject method. + * + * Arguments: + * - idType : The type of channel, as indicated by one of the ID_* constants defined in + * section 7.13.11.1. Valid values for idType include : ID_DVB_SI_DIRECT . For + * other values this behaviour is not specified. + * + * - onid : The original network ID. Optional argument that SHALL be specified + * when the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , + * or ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - tsid : The transport stream ID. Optional argument that MAY be specified when + * the idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or + * ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - sid : The service ID. Optional argument that SHALL be specified when the + * idType specifies a channel of type ID_DVB_* , ID_IPTV_URI , or + * ID_ISDB_* and SHALL otherwise be ignored by the OITF. + * + * - sourceID : The source_ID. Optional argument that SHALL be specified when the + * idType specifies a channel of type ID_ATSC_T and SHALL otherwise be + * gnored by the OITF. + * + * - ipBroadcastID : The DVB textual service identifier of the IP broadcast service, specified in + * the format “ ServiceName.DomainName ” when idType specifies a + * channel of type ID_IPTV_SDS , or the URI of the IP broadcast service + * when idType specifies a channel of type ID_IPTV_URI . Optional + * argument that SHALL be specified when the idType specifies a channel + * of type ID_IPTV_SDS or ID_IPTV_URI and SHALL otherwise be ignored + * by the OITF. + */ + _createAnyDvbChannelObject: function(idType, onid, tsid, sid, sourceID, ipBroadcastID) { + + }, + + /* + * Description: * The function that is called when a request to switch a tuner to another channel has successfully completed. * This function may be called either in response to a channel change initiated by the application, or a channel * change initiated by the OITF (see section 7.13.1.1). The specified function is called with argument channel, @@ -328,21 +509,9 @@ * * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). */ - createChannelObject: function(idType, onid, tsid, sid, sourceID, ipBroadcastID) { - + setChannel: function(channel, trickplay, contentAccessDescriptorURL) { }, - /* - * Description: - * The function that is called when a request to switch a tuner to another channel has successfully completed. - * This function may be called either in response to a channel change initiated by the application, or a channel - * change initiated by the OITF (see section 7.13.1.1). The specified function is called with argument channel, - * which is defined as follows: - * - * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). - */ - setChannel: function(channel, trickplay, contentAccessDescriptorURL) { - }, /* * Description: * Requests the OITF to switch the tuner that is currently in use by the video/broadcast @@ -378,6 +547,7 @@ prevChannel: function() { this._channelSwitch(this, -1); }, + /* * Description: * Requests the OITF to switch the tuner that is currently in use by the video/broadcast @@ -413,14 +583,16 @@ nextChannel: function() { this._channelSwitch(this, 1); }, + /* * Description: - * The function that is called when a request to switch a tuner to another channel has successfully completed. - * This function may be called either in response to a channel change initiated by the application, or a channel - * change initiated by the OITF (see section 7.13.1.1). The specified function is called with argument channel, - * which is defined as follows: - * - * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). + * Sets the rendering of the video content to full-screen ( fullscreen = true ) or windowed + * ( fullscreen = false ) mode (as per [Req. 5.7.1.c] of [CEA-2014-A]). If this indicates a + * change in mode, this SHALL result in a change of the value of property fullScreen . + * Changing the mode SHALL NOT affect the z-index of the video object. + * + * Arguments: + * - fullScreen : Boolean to indicate whether video content should be rendered full-screen or not. */ setFullScreen: function(fullscreen) { }, @@ -443,35 +615,30 @@ * * Arguments: * - volume: Integer value between 0 up to and including 100 to indicate volume level. + * + * Actually the norm don't talk about the way to obtain the current master volume for the main + * audio output mixer; So we'll base on the system volume. */ setVolume: function(volume) { - try{ - if (!Number.isInteger(volume)) { - - return false; - - } else { - - if (volume == 0) { - - var configurationObject = oipfObjectFactory.createConfigurationObject(); - configurationObject.localSystem.volume = volume; - return true; - } - if ((volume > 0) && (volume < 100)) { - - } - if (volume) { - - } + if (!Number.isInteger(volume)) { + + return false; + + } else { + + if (volume == 0) { + //Muted the sound + return true; } - - } catch (e) { - - console.log("{In setVolume}[INFO] "+e.message); - } - + if ((volume > 0) && (volume < 100)) { + + } + if (volume == 100) { + configurationObject = oipfObjectFactory.createConfigurationObject(); + + } + } }, /* @@ -485,15 +652,26 @@ /* * Description: - * The function that is called when a request to switch a tuner to another channel has successfully completed. - * This function may be called either in response to a channel change initiated by the application, or a channel - * change initiated by the OITF (see section 7.13.1.1). The specified function is called with argument channel, - * which is defined as follows: - * - * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). + * Releases the decoder/tuner used for displaying the video broadcast inside the + * video/broadcast object, stopping any form of visualization of the video inside the + * video/broadcast object and releasing any other associated resources. + * If the object was created with an allocationMethod of STATIC_ALLOCATION , + * the releasing of resources shall change this to DYNAMIC_ALLOCATION . */ release: function() { + if ((this.playstate >= 1) && (this.playstate <= 3)) { + /* Call method to : + * - release tuner used by this video/broadcast object. + * - stop visualization of the video. + * - and scarce ressources loaded previously. + */ + this.playstate = 0; + this.currentChannel = null; + this.allocationMethod = (this.allocationMethod == STATIC_ALLOCATION_VIDEOBROADCAST) ? DYNAMIC_ALLOCATION_VIDEOBROADCAST : this.allocationMethod; + this.onPlayStateChange && this.onPlayStateChange(0); + } }, + /* * Description: * Stop presenting broadcast video. If the video/broadcast object is in any state other than the @@ -503,9 +681,17 @@ * Calling this method from the unrealized state SHALL have no effect. * See section 7.13.1.1 for more information of its usage. * - * • Channel channel – the channel to which the tuner switched. This object SHALL have the same properties with the same values as the currentChannel object (see * section 7.13.7). */ stop: function() { + if ((this.playstate >= 1) && (this.playstate <= 2)) { + /* Call method to : + * - stop the presentation of the video and audio. + * - and scarce ressources loaded previously. + */ + this.playstate = 3; + this.release(); + this.onPlayStateChange && this.onPlayStateChange(3); + } }, _channelSwitch: function(object, step) { @@ -532,7 +718,6 @@ }, 0); } } else { - /* * The norm affirm that the value "undefined" for the property "currentFavouriteList" * means no current favourite list is activating. @@ -569,4 +754,6 @@ }, 0); } } + + }); \ No newline at end of file