Upstream version 7.36.149.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     DOMString codecName;
28
29     // Synchronization source identifier.
30     long ssrc;
31
32     long feedbackSsrc;
33
34     long? clockRate;
35
36     // Minimum bitrate in kilobits per second.
37     long? minBitrate;
38
39     // Maximum bitrate in kilobits per second.
40     long? maxBitrate;
41
42     // The number of channels.
43     long? channels;
44
45     // Video width in pixels.
46     long? width;
47
48     // Video height in pixels.
49     long? height;
50
51     // 32 bytes hex-encoded AES key.
52     DOMString? aesKey;
53
54     // 32 bytes hex-encoded AES IV (Initialization vector) mask.
55     DOMString? aesIvMask;
56
57     // A list of codec specific params.
58     CodecSpecificParams[] codecSpecificParams;
59   };
60
61   // Cast RTP parameters.
62   dictionary RtpParams {
63     // RTP payload params.
64     RtpPayloadParams payload;
65
66     DOMString[] rtcpFeatures;
67   };
68
69   // Callback from the <code>create</code> method.
70   // |id| : The ID for the RTP stream.
71   callback CreateCallback = void (long streamId);
72
73   // Callback from the <code>getRawEvents</code> method.
74   // |rawEvents|: compressed serialized raw bytes containing raw events
75   //              recorded for a stream.
76   // The compression is in gzip format.
77   // The serialization format can be found at 
78   // media/cast/logging/log_serializer.cc.
79   callback GetRawEventsCallback = void (ArrayBuffer rawEvents);
80   
81   // Callback from the <code>getStats</code> method.
82   // |rawEvents|: dictionary object containing stats recorded for a stream.
83   // The format can be found at 
84   // media/cast/logging/stats_converter.cc.
85   callback GetStatsCallback = void (object stats);
86
87   interface Functions {
88     // Destroys a Cast RTP stream.
89     // |streamId| : The RTP stream ID.
90     [nocompile] static void destroy(long streamId);
91
92     // Returns an array of supported parameters with default values.
93     // This includes a list of supported codecs on this platform and
94     // corresponding encoding and RTP parameters.
95     // |streamId| : The RTP stream ID.
96     [nocompile] static RtpParams[] getSupportedParams(long streamId);
97
98     // Activates the RTP stream by providing the parameters.
99     // |streamId| : The RTP stream ID.
100     // |params| : Parameters set for this stream.
101     [nocompile] static void start(long streamId, RtpParams params);
102
103     // Stops activity on the specified stream.
104     // |streamId| : The RTP stream ID.
105     [nocompile] static void stop(long streamId);
106
107     // Enables / disables logging for a stream.
108     // |enable|: If true, enables logging. Otherwise disables logging.
109     [nocompile] static void toggleLogging(long streamId, boolean enable);
110     
111     // Get raw events for a stream in the current session.
112     // |streamId|: Stream to get events for.
113     // |callback|: Called with the raw events.
114     [nocompile] static void getRawEvents(
115         long streamId, GetRawEventsCallback callback);
116     
117     // Get stats for a stream in the current session.
118     // |streamId|: Stream to get stats for.
119     // |callback|: Called with the stats.
120     [nocompile] static void getStats(
121         long streamId, GetStatsCallback callback);
122   };
123
124   interface Events {
125     // Event fired when a Cast RTP stream has started.
126     // |streamId| : The ID of the RTP stream.
127     static void onStarted(long streamId);
128
129     // Event fired when a Cast RTP stream has stopped.
130     // |streamId| : The ID of the RTP stream.
131     static void onStopped(long streamId);
132
133     // Event fired when a Cast RTP stream has error.
134     // |streamId| : The ID of the RTP stream.
135     // |errorString| : The error info.
136     static void onError(long streamId, DOMString errorString);
137   };
138 };