netwerk/base/public/nsIStreamingProtocolController.idl

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial