Upstream version 10.39.225.0
[platform/framework/web/crosswalk.git] / src / chrome / common / extensions / api / cast_streaming_rtp_stream.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.cast.streaming.rtpStream</code> API allows configuration
6 // of encoding parameters and RTP parameters used in a Cast streaming
7 // session.
8 //
9 // Valid stream IDs are positive and non-zero.
10 namespace cast.streaming.rtpStream {
11   // Params for audio and video codec.
12   dictionary CodecSpecificParams {
13     DOMString key;
14     DOMString value;
15   };
16
17   // RTP payload param.
18   dictionary RtpPayloadParams {
19     long payloadType;
20
21     // Maximum latency in milliseconds. This parameter controls the logic
22     // of flow control. Implementation can adjust latency adaptively and
23     // tries to keep it under this threshold. A larger value allows smoother
24     // playback at the cost of higher latency.
25     long maxLatency;
26
27     // Minimum latency in milliseconds. Defaults to |maxLatency|.
28     long? minLatency;
29
30     DOMString codecName;
31
32     // Synchronization source identifier.
33     long ssrc;
34
35     long feedbackSsrc;
36
37     long? clockRate;
38
39     // Minimum bitrate in kilobits per second.
40     long? minBitrate;
41
42     // Maximum bitrate in kilobits per second.
43     long? maxBitrate;
44
45     // The number of channels.
46     long? channels;
47
48     // The maximum frame rate.
49     double? maxFrameRate;
50
51     // Video width in pixels.
52     long? width;
53
54     // Video height in pixels.
55     long? height;
56
57     // 32 bytes hex-encoded AES key.
58     DOMString? aesKey;
59
60     // 32 bytes hex-encoded AES IV (Initialization vector) mask.
61     DOMString? aesIvMask;
62
63     // A list of codec specific params.
64     CodecSpecificParams[] codecSpecificParams;
65   };
66
67   // Cast RTP parameters.
68   dictionary RtpParams {
69     // RTP payload params.
70     RtpPayloadParams payload;
71
72     DOMString[] rtcpFeatures;
73   };
74
75   // Callback from the <code>create</code> method.
76   // |id| : The ID for the RTP stream.
77   callback CreateCallback = void (long streamId);
78
79   // Callback from the <code>getRawEvents</code> method.
80   // |rawEvents|: compressed serialized raw bytes containing raw events
81   //              recorded for a stream.
82   // The compression is in gzip format.
83   // The serialization format can be found at 
84   // media/cast/logging/log_serializer.cc.
85   callback GetRawEventsCallback = void (ArrayBuffer rawEvents);
86   
87   // Callback from the <code>getStats</code> method.
88   // |rawEvents|: dictionary object containing stats recorded for a stream.
89   // The format can be found at 
90   // media/cast/logging/stats_event_subscriber.cc.
91   callback GetStatsCallback = void (object stats);
92
93   interface Functions {
94     // Destroys a Cast RTP stream.
95     // |streamId| : The RTP stream ID.
96     [nocompile] static void destroy(long streamId);
97
98     // Returns an array of supported parameters with default values.
99     // This includes a list of supported codecs on this platform and
100     // corresponding encoding and RTP parameters.
101     // |streamId| : The RTP stream ID.
102     [nocompile] static RtpParams[] getSupportedParams(long streamId);
103
104     // Activates the RTP stream by providing the parameters.
105     // |streamId| : The RTP stream ID.
106     // |params| : Parameters set for this stream.
107     [nocompile] static void start(long streamId, RtpParams params);
108
109     // Stops activity on the specified stream.
110     // |streamId| : The RTP stream ID.
111     [nocompile] static void stop(long streamId);
112
113     // Enables / disables logging for a stream.
114     // |enable|: If true, enables logging. Otherwise disables logging.
115     [nocompile] static void toggleLogging(long streamId, boolean enable);
116     
117     // Get raw events for a stream in the current session.
118     // |streamId|: Stream to get events for.
119     // |extraData|: Extra data to attach to the log, e.g. system info or
120     //              experiment tags, in key-value JSON string format.
121     // |callback|: Called with the raw events.
122     [nocompile] static void getRawEvents(
123         long streamId, optional DOMString extraData,
124         GetRawEventsCallback callback);
125     
126     // Get stats for a stream in the current session.
127     // |streamId|: Stream to get stats for.
128     // |callback|: Called with the stats.
129     [nocompile] static void getStats(
130         long streamId, GetStatsCallback callback);
131   };
132
133   interface Events {
134     // Event fired when a Cast RTP stream has started.
135     // |streamId| : The ID of the RTP stream.
136     static void onStarted(long streamId);
137
138     // Event fired when a Cast RTP stream has stopped.
139     // |streamId| : The ID of the RTP stream.
140     static void onStopped(long streamId);
141
142     // Event fired when a Cast RTP stream has error.
143     // |streamId| : The ID of the RTP stream.
144     // |errorString| : The error info.
145     static void onError(long streamId, DOMString errorString);
146   };
147 };