Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* vim: set sw=4 ts=4 et tw=80 : */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 interface nsIURI;
8 #include "nsISupports.idl"
10 %{C++
11 #define MEDIASTREAM_FRAMETYPE_NORMAL 0x00000001
12 #define MEDIASTREAM_FRAMETYPE_DISCONTINUITY 0x00000002
13 %}
15 /**
16 * Metadata of the media stream.
17 */
18 [uuid(294adb30-856c-11e2-9e96-0800200c9a66)]
19 interface nsIStreamingProtocolMetaData : nsISupports
20 {
21 /**
22 * Frame type.
23 */
24 attribute uint32_t frameType;
26 /**
27 * The total tracks for the given media stream session.
28 */
29 attribute uint32_t totalTracks;
31 /**
32 * The mime type of the track.
33 */
34 attribute ACString mimeType;
36 /**
37 * The width of the resolution.
38 */
39 attribute unsigned long width;
41 /**
42 * The height of the resolution.
43 */
44 attribute unsigned long height;
46 /**
47 * The duration of the media stream.
48 */
49 attribute unsigned long long duration;
51 /**
52 * The sample rate of the media stream.
53 */
54 attribute unsigned long sampleRate;
56 /**
57 * The timestamp indicates the stream absolute position
58 * relative to the beginning of the presentation.
59 */
60 attribute unsigned long long timeStamp;
62 /**
63 * The total number of audio channels in the media stream.
64 */
65 attribute unsigned long channelCount;
67 /**
68 * The AAC audio codec specific data.
69 */
70 attribute ACString esdsData;
72 /**
73 * The AVCC format extradata of H.264 stream.
74 */
75 attribute ACString avccData;
76 };
78 /**
79 * nsIStreamingProtocolListener
80 */
81 [scriptable, uuid(c4f6b660-892e-11e2-9e96-0800200c9a66)]
82 interface nsIStreamingProtocolListener : nsISupports
83 {
84 /**
85 * Called when the data may be read without blocking the calling thread.
86 * @param index The track number of the media stream.
87 * @param data Raw data of the media stream on given track number.
88 * @param length The length of the raw data.
89 * @param offset The offset in the data stream from the start of the media
90 * presentation in bytes.
91 * @param meta The meta data of the frame.
92 */
93 void onMediaDataAvailable(in uint8_t index,
94 in ACString data,
95 in uint32_t length,
96 in uint32_t offset,
97 in nsIStreamingProtocolMetaData meta);
99 /**
100 * Called when the meta data for a given session is available.
101 * @param index The track number of the media stream.
102 * @param meta The meta data of the media stream.
103 */
104 void onConnected(in uint8_t index, in nsIStreamingProtocolMetaData meta);
106 /**
107 * Called when the Rtsp session is closed.
108 * @param index Track number of the media stream.
109 * @param reason The reason of disconnection.
110 */
111 void onDisconnected(in uint8_t index, in nsresult reason);
112 };
114 /**
115 * Media stream controller API: control and retrieve meta data from media stream.
116 */
117 [uuid(a9bdd4b0-8559-11e2-9e96-0800200c9a66)]
118 interface nsIStreamingProtocolController : nsISupports
119 {
120 /**
121 * Preprare the URI before we can start the connection.
122 * @param aUri The URI of the media stream.
123 */
124 void init(in nsIURI aUri);
126 /**
127 * Asynchronously open this controller. Data is fed to the specified
128 * media stream listener as it becomes available. If asyncOpen returns
129 * successfully, the controller is responsible for keeping itself alive
130 * until it has called onStopRequest on aListener.
131 *
132 * @param aListener The nsIStreamingProtocolListener implementation
133 */
134 void asyncOpen(in nsIStreamingProtocolListener aListener);
136 /*
137 * Get the metadata of a track.
138 * @param index Index of a track.
139 * @return A nsIStreamingProtocolMetaData.
140 */
141 nsIStreamingProtocolMetaData getTrackMetaData(in octet index);
143 /*
144 * Tell the streaming server to start sending media data.
145 */
146 void play();
148 /*
149 * Tell the streaming server to pause sending media data.
150 */
151 void pause();
153 /*
154 * Tell the streaming server to resume the suspended media stream.
155 */
156 void resume();
158 /*
159 * Tell the streaming server to suspend the media stream.
160 */
161 void suspend();
163 /*
164 * Tell the streaming server to send media data in specific time.
165 * @param seekTimeUs Start time of the media stream in microseconds.
166 */
167 void seek(in unsigned long long seekTimeUs);
169 /*
170 * Tell the streaming server to stop the
171 * media stream and close the connection.
172 */
173 void stop();
175 /**
176 * Total number of audio/video tracks.
177 */
178 readonly attribute octet totalTracks;
179 };