- add sources.
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / webrtc_cast_send_transport.idl
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // The <code>chrome.webrtc.castSendTransport</code> API takes a track as
6 // a source of media, and sends that media on the inner transport according to
7 // the given RtpParams.
8 namespace webrtc.castSendTransport {
9   // Params for audio and video codec.
10   dictionary CodecSpecificParam {
11     DOMString key;
12     DOMString value;
13   };
14
15   // RTP payload param.
16   dictionary RtpPayloadParam {
17     long payloadType;
18
19     DOMString codecName;
20
21     // Synchronization source identifier.
22     long? ssrc;
23
24     long? clockRate;
25
26     long? minBitrate;
27
28     long? maxBitrate;
29
30     // The number of channels.
31     long? channels;
32
33     // Video width in pixels.
34     long? width;
35
36     // Video height in pixels.
37     long? height;
38
39     // A list of codec specific params.
40     CodecSpecificParam[] codecSpecficParams;
41   };
42
43   // Cast transport capabilities
44   dictionary CastTransportCaps {
45     // RTP payload params.
46     RtpPayloadParam[] payloads;
47
48     DOMString[] rtcpFeatures;
49
50     DOMString[] fecMechanisms;
51   };
52
53   // Cast transport params.
54   dictionary CastTransportParams {
55     // RTP payload params.
56     RtpPayloadParam[] payloads;
57
58     DOMString[] rtcpFeatures;
59
60     DOMString[] fecMechanisms;
61   };
62
63   // Result of <code>create</code> call.
64   dictionary CreateInfo {
65     // The ID of the newly created transport.
66     long transportId;
67   };
68
69   // Callback from the <code>create</code> method.
70   // |id| : The transport id.
71   callback CreateCallback = void (CreateInfo info);
72
73   // Callback from the <code>createParams</code> method.
74   // |params| : The cast transport params.
75   callback CreateParamsCallback = void (CastTransportParams params);
76
77   // Callback from the <code>getCaps</code> method.
78   // |caps| : Capabilities of the cast transport.
79   callback GetCapsCallback = void (CastTransportCaps caps);
80
81   interface Functions {
82     // Creates a cast send transport.
83     // |track| : the media track encoded by this transport.
84     // |innerTransportId| : the ID of the inner transport. The transport to be
85     //   created will send data on the inner transport.
86     // |callback| : Called when the transport has been created.
87     [nocompile] static void create(
88         [instanceOf=MediaStreamTrack] object track,
89         long innerTransportId,
90         CreateCallback callback);
91
92     // Destroys a cast send transport.
93     // |transportId| : The transport ID.
94     [nocompile] static void destroy(long transportId);
95
96     // Creates suitable params given the capabilities.
97     // |caps| : the capabilities.
98     // |callback| : Called when the params have been created.
99     [nocompile] static void getCaps(long transportId,
100         GetCapsCallback callback);
101
102     // Creates suitable params given the capabilities.
103     // |transportId| : The transport ID.
104     // |remoteCaps| : Capabilities of remote peer.
105     // |callback| : Called when the params has been created.
106     [nocompile] static void createParams(
107         long transportId,
108         CastTransportCaps remoteCaps,
109         CreateParamsCallback callback);
110
111     // Starts to use the transport by providing remote params info.
112     // |transportId| : The transport ID.
113     // |params| : Parameters set for this transport.
114     [nocompile] static void start(long transportId,
115         CastTransportParams params);
116
117     // Stops using the transport.
118     // |transportId| : The transport ID.
119     [nocompile] static void stop(long transportId);
120   };
121
122   interface Events {
123     // Event fired when a cast send transport has started.
124     // |transportId| : The ID of the transport.
125     static void onStarted(long transportId);
126
127     // Event fired when a cast send transport has connected.
128     // After this event, the transport is ready to send the track.
129     // |transportId| : The ID of the transport.
130     static void onConnected(long transportId);
131
132     // Event fired when a cast send transport has stopped.
133     // |transportId| : The ID of the transport.
134     static void onStopped(long transportId);
135
136     // Event fired when a cast send transport has timeout.
137     // This happens when network has been congested for a while, or one side
138     // left.
139     // |transportId| : The ID of the transport.
140     static void onTimeout(long transportId);
141
142     // Event fired when a cast send transport has error.
143     // |transportId| : The ID of the transport.
144     // |errorString| : The error info.
145     static void onError(long transportId, DOMString errorString);
146   };
147 };
148