1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/base/public/nsIStreamingProtocolController.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,179 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ 1.5 +/* vim: set sw=4 ts=4 et tw=80 : */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 +interface nsIURI; 1.10 + 1.11 +#include "nsISupports.idl" 1.12 + 1.13 +%{C++ 1.14 +#define MEDIASTREAM_FRAMETYPE_NORMAL 0x00000001 1.15 +#define MEDIASTREAM_FRAMETYPE_DISCONTINUITY 0x00000002 1.16 +%} 1.17 + 1.18 +/** 1.19 + * Metadata of the media stream. 1.20 + */ 1.21 +[uuid(294adb30-856c-11e2-9e96-0800200c9a66)] 1.22 +interface nsIStreamingProtocolMetaData : nsISupports 1.23 +{ 1.24 + /** 1.25 + * Frame type. 1.26 + */ 1.27 + attribute uint32_t frameType; 1.28 + 1.29 + /** 1.30 + * The total tracks for the given media stream session. 1.31 + */ 1.32 + attribute uint32_t totalTracks; 1.33 + 1.34 + /** 1.35 + * The mime type of the track. 1.36 + */ 1.37 + attribute ACString mimeType; 1.38 + 1.39 + /** 1.40 + * The width of the resolution. 1.41 + */ 1.42 + attribute unsigned long width; 1.43 + 1.44 + /** 1.45 + * The height of the resolution. 1.46 + */ 1.47 + attribute unsigned long height; 1.48 + 1.49 + /** 1.50 + * The duration of the media stream. 1.51 + */ 1.52 + attribute unsigned long long duration; 1.53 + 1.54 + /** 1.55 + * The sample rate of the media stream. 1.56 + */ 1.57 + attribute unsigned long sampleRate; 1.58 + 1.59 + /** 1.60 + * The timestamp indicates the stream absolute position 1.61 + * relative to the beginning of the presentation. 1.62 + */ 1.63 + attribute unsigned long long timeStamp; 1.64 + 1.65 + /** 1.66 + * The total number of audio channels in the media stream. 1.67 + */ 1.68 + attribute unsigned long channelCount; 1.69 + 1.70 + /** 1.71 + * The AAC audio codec specific data. 1.72 + */ 1.73 + attribute ACString esdsData; 1.74 + 1.75 + /** 1.76 + * The AVCC format extradata of H.264 stream. 1.77 + */ 1.78 + attribute ACString avccData; 1.79 +}; 1.80 + 1.81 +/** 1.82 + * nsIStreamingProtocolListener 1.83 + */ 1.84 +[scriptable, uuid(c4f6b660-892e-11e2-9e96-0800200c9a66)] 1.85 +interface nsIStreamingProtocolListener : nsISupports 1.86 +{ 1.87 + /** 1.88 + * Called when the data may be read without blocking the calling thread. 1.89 + * @param index The track number of the media stream. 1.90 + * @param data Raw data of the media stream on given track number. 1.91 + * @param length The length of the raw data. 1.92 + * @param offset The offset in the data stream from the start of the media 1.93 + * presentation in bytes. 1.94 + * @param meta The meta data of the frame. 1.95 + */ 1.96 + void onMediaDataAvailable(in uint8_t index, 1.97 + in ACString data, 1.98 + in uint32_t length, 1.99 + in uint32_t offset, 1.100 + in nsIStreamingProtocolMetaData meta); 1.101 + 1.102 + /** 1.103 + * Called when the meta data for a given session is available. 1.104 + * @param index The track number of the media stream. 1.105 + * @param meta The meta data of the media stream. 1.106 + */ 1.107 + void onConnected(in uint8_t index, in nsIStreamingProtocolMetaData meta); 1.108 + 1.109 + /** 1.110 + * Called when the Rtsp session is closed. 1.111 + * @param index Track number of the media stream. 1.112 + * @param reason The reason of disconnection. 1.113 + */ 1.114 + void onDisconnected(in uint8_t index, in nsresult reason); 1.115 +}; 1.116 + 1.117 +/** 1.118 + * Media stream controller API: control and retrieve meta data from media stream. 1.119 + */ 1.120 +[uuid(a9bdd4b0-8559-11e2-9e96-0800200c9a66)] 1.121 +interface nsIStreamingProtocolController : nsISupports 1.122 +{ 1.123 + /** 1.124 + * Preprare the URI before we can start the connection. 1.125 + * @param aUri The URI of the media stream. 1.126 + */ 1.127 + void init(in nsIURI aUri); 1.128 + 1.129 + /** 1.130 + * Asynchronously open this controller. Data is fed to the specified 1.131 + * media stream listener as it becomes available. If asyncOpen returns 1.132 + * successfully, the controller is responsible for keeping itself alive 1.133 + * until it has called onStopRequest on aListener. 1.134 + * 1.135 + * @param aListener The nsIStreamingProtocolListener implementation 1.136 + */ 1.137 + void asyncOpen(in nsIStreamingProtocolListener aListener); 1.138 + 1.139 + /* 1.140 + * Get the metadata of a track. 1.141 + * @param index Index of a track. 1.142 + * @return A nsIStreamingProtocolMetaData. 1.143 + */ 1.144 + nsIStreamingProtocolMetaData getTrackMetaData(in octet index); 1.145 + 1.146 + /* 1.147 + * Tell the streaming server to start sending media data. 1.148 + */ 1.149 + void play(); 1.150 + 1.151 + /* 1.152 + * Tell the streaming server to pause sending media data. 1.153 + */ 1.154 + void pause(); 1.155 + 1.156 + /* 1.157 + * Tell the streaming server to resume the suspended media stream. 1.158 + */ 1.159 + void resume(); 1.160 + 1.161 + /* 1.162 + * Tell the streaming server to suspend the media stream. 1.163 + */ 1.164 + void suspend(); 1.165 + 1.166 + /* 1.167 + * Tell the streaming server to send media data in specific time. 1.168 + * @param seekTimeUs Start time of the media stream in microseconds. 1.169 + */ 1.170 + void seek(in unsigned long long seekTimeUs); 1.171 + 1.172 + /* 1.173 + * Tell the streaming server to stop the 1.174 + * media stream and close the connection. 1.175 + */ 1.176 + void stop(); 1.177 + 1.178 + /** 1.179 + * Total number of audio/video tracks. 1.180 + */ 1.181 + readonly attribute octet totalTracks; 1.182 +};