User:Shellylin/InputPort: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
(→‎Contributors: Add contributirs)
 
(25 intermediate revisions by the same user not shown)
Line 3: Line 3:


== Contributors ==
== Contributors ==
Shih-Chiang Chien, Shelly Lin, James Cheng


== Status ==
== Status ==
Line 8: Line 9:


== Features ==
== Features ==
* Enumerate available input ports on the current device. Supported types of input ports include A/V, VGA and HDMI.
* Enumerate available input ports on the current device. Supported types of input ports include A/V, DisplayPort and HDMI.
* Retrieve media content from an input port, provided by its source provider. Presented as a MediaStream object.
* Retrieve media content from an input port, provided by its source provider. Presented as a MediaStream object.
* Read and write the attributes of a selected input port.
* Support hot-plug detection on each input port.
** Examples of input port attributes: frame rate, color system, aspect ratio...etc.
* Support hotplug detection on each input port.


== Proposed API ==
== Proposed API ==
=== Basic Port Interface ===
=== Basic Port Interface ===
   enum InputPortType { “av”, "hdmi", "displayport" };
   enum InputPortType { "av", "displayport", "hdmi" };


   interface InputPort {
   interface InputPort : EventTarget {
     readonly attribute DOMString name;
     readonly attribute DOMString id;
    readonly attribute DOMString uuid;
     readonly attribute InputPortType type;
     readonly attribute InputPortType type;
     readonly attribute MediaStream stream;
     readonly attribute MediaStream stream;
     readonly attribute DOMString resolution;
     readonly attribute boolean connected;
    readonly attribute DOMString aspect;
             attribute EventHandler onconnect;
             attribute EventHandler onconnect;
             attribute EventHandler ondisconnect;
             attribute EventHandler ondisconnect;
   };
   };


'''name''' of type DOMString, readonly<br />
'''id''' of type DOMString, readonly<br />
The name of this input port, e.g. "HDMI1", "HDMI2".
The unique id for the represented input port.<br />
Input port identifier MUST be unique to the application, and persistent between application sessions.
 
''This idea is referenced from the attribute [http://w3c.github.io/mediacapture-main/getusermedia.html#dictionary-mediadeviceinfo-members deviceId] of MediaDevice.''


'''type''' of type InputPortType, readonly<br />
'''type''' of type InputPortType, readonly<br />
Line 36: Line 36:


'''stream''' of type MediaStream, readonly<br />
'''stream''' of type MediaStream, readonly<br />
The stream represents the media content provided by this input port.
The media content of this input port, represented as a MediaStream object.<br />
The reference of this object remains unchanged during the life time of its belonging InputPort; Dispatch of connect or disconnect event responses to the state of hardware connection, isolating to the fact of whether the media content is playable or not; Behaviour of stream with non-playable content should be the same as behavior of muted media tracks, described in section "[http://w3c.github.io/mediacapture-main/getusermedia.html#life-cycle-and-media-flow Life-cycle and Media Flow]".


'''resolution''' of type DOMString, readonly<br />
'''connected''' of type boolean, readonly<br />
The video resolution of this input port, e.g. "480i", "1080p", "VGA".
True if this input port is connected to a source provider, and vice versa.


'''aspect''' of type DOMString, readonly<br />
'''onconnect''' of type EventHandler,<br />
The recommended aspect ratio of this input port, e.g. "16:9", "4:3".
'''ondisconnect''' of type EventHandler,<br />
Whenever the hardware detects a connection/disconnection of this input port, UA must queue a task to fire a simple event name connect/disconnect at its InputPort object.


=== Specific Port Interfaces ===
=== Specific Port Interfaces ===
==== A/V ====
==== A/V ====
  enum AVVideoType { "composite", "component", "scart-rgb" };
 
''In reality, a specific input port has its specific attributes and methods, our goal is to collect those "common" cases as much as possible. However, with limit information, we will not focus on implementing hardware dependent attributes and methods in this draft.''


   interface AVInputPort : InputPort {
   interface AVInputPort : InputPort {
     sequence<AVVideoType> getSupportedVideoTypes ();
     // Possible hardware-dependent attributes.
    attribute AVVideoTypeEnum currentVideoType;
   };
   }


==== HDMI/DisplayPort ====
==== HDMI/DisplayPort ====
  enum HDMIPictureQuality { "xvycc", "colorymetory", "photo-graphics" };
  enum HDMIConnectedSourceType { "hdmi", "dvi" }
  enum HDMIAudioType { "digital", "analog" };
   interface HDMIInputPort : InputPort {
   interface HDMIInputPort : InputPort {
     sequence<AVVideoType> getSupportedAudioTypes ();
     // Possible hardware-dependent attributes.
    readonly attribute HDMIPictureQuality? pictureQuality;
   };
    readonly attribute HDMIConnectedSourceType connectedSourceType;
            attribute HDMIAudioType currentAudioType;
   }


   interface DisplayPortInputPort : HDMIInputPort {
   interface DisplayPortInputPort : InputPort {
   }
    // Possible hardware-dependent attributes.
   };


=== InputPortManager ===
=== InputPortManager ===
Line 72: Line 68:
This will be an object in <code>window.navigator</code> named <code>InputPortManager</code> with the following interface:
This will be an object in <code>window.navigator</code> named <code>InputPortManager</code> with the following interface:


  [AvailableIn=CertifiedApps]
   partial interface Navigator {
   partial interface Navigator {
     readonly attribute InputPortManager inputPortManager;
     readonly attribute InputPortManager inputPortManager;
Line 77: Line 74:


   interface InputPortManager {
   interface InputPortManager {
     sequence<InputPort> getInputPorts();
     Promise<sequence<InputPort>> getInputPorts ();
   };
   };
'''getInputPorts'''<br />
This method makes a request to retrieve all the available input ports on a device. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of InputPort elements belong to the InputPortManager.


== Examples ==
== Examples ==

Latest revision as of 03:05, 13 April 2015

Goals

Provide DOM API access to the input ports of devices. With InputPort API, application developers are able to browse available input ports of the current device, retrieve media content provided by a particular port, detect whether an input port has connected to a source provider.

Contributors

Shih-Chiang Chien, Shelly Lin, James Cheng

Status

Features

  • Enumerate available input ports on the current device. Supported types of input ports include A/V, DisplayPort and HDMI.
  • Retrieve media content from an input port, provided by its source provider. Presented as a MediaStream object.
  • Support hot-plug detection on each input port.

Proposed API

Basic Port Interface

 enum InputPortType { "av", "displayport", "hdmi" };
 interface InputPort : EventTarget {
   readonly attribute DOMString id;
   readonly attribute InputPortType type;
   readonly attribute MediaStream stream;
   readonly attribute boolean connected;
            attribute EventHandler onconnect;
            attribute EventHandler ondisconnect;
 };

id of type DOMString, readonly
The unique id for the represented input port.
Input port identifier MUST be unique to the application, and persistent between application sessions.

This idea is referenced from the attribute deviceId of MediaDevice.

type of type InputPortType, readonly
The type of this input port, value must be defined in the enum of InputPortType, e.g. "av", "displayport".

stream of type MediaStream, readonly
The media content of this input port, represented as a MediaStream object.
The reference of this object remains unchanged during the life time of its belonging InputPort; Dispatch of connect or disconnect event responses to the state of hardware connection, isolating to the fact of whether the media content is playable or not; Behaviour of stream with non-playable content should be the same as behavior of muted media tracks, described in section "Life-cycle and Media Flow".

connected of type boolean, readonly
True if this input port is connected to a source provider, and vice versa.

onconnect of type EventHandler,
ondisconnect of type EventHandler,
Whenever the hardware detects a connection/disconnection of this input port, UA must queue a task to fire a simple event name connect/disconnect at its InputPort object.

Specific Port Interfaces

A/V

In reality, a specific input port has its specific attributes and methods, our goal is to collect those "common" cases as much as possible. However, with limit information, we will not focus on implementing hardware dependent attributes and methods in this draft.

 interface AVInputPort : InputPort {
   // Possible hardware-dependent attributes.
 };

HDMI/DisplayPort

 interface HDMIInputPort : InputPort {
   // Possible hardware-dependent attributes.
 };
 interface DisplayPortInputPort : InputPort {
   // Possible hardware-dependent attributes.
 };

InputPortManager

This will be an object in window.navigator named InputPortManager with the following interface:

 [AvailableIn=CertifiedApps]
 partial interface Navigator {
   readonly attribute InputPortManager inputPortManager;
 };
 interface InputPortManager {
   Promise<sequence<InputPort>> getInputPorts ();
 };

getInputPorts
This method makes a request to retrieve all the available input ports on a device. It returns a new Promise that will be used to notify the caller about the result of the operation, which is an array of InputPort elements belong to the InputPortManager.

Examples