michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set sw=4 ts=4 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: interface nsIURI; michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: %{C++ michael@0: #define MEDIASTREAM_FRAMETYPE_NORMAL 0x00000001 michael@0: #define MEDIASTREAM_FRAMETYPE_DISCONTINUITY 0x00000002 michael@0: %} michael@0: michael@0: /** michael@0: * Metadata of the media stream. michael@0: */ michael@0: [uuid(294adb30-856c-11e2-9e96-0800200c9a66)] michael@0: interface nsIStreamingProtocolMetaData : nsISupports michael@0: { michael@0: /** michael@0: * Frame type. michael@0: */ michael@0: attribute uint32_t frameType; michael@0: michael@0: /** michael@0: * The total tracks for the given media stream session. michael@0: */ michael@0: attribute uint32_t totalTracks; michael@0: michael@0: /** michael@0: * The mime type of the track. michael@0: */ michael@0: attribute ACString mimeType; michael@0: michael@0: /** michael@0: * The width of the resolution. michael@0: */ michael@0: attribute unsigned long width; michael@0: michael@0: /** michael@0: * The height of the resolution. michael@0: */ michael@0: attribute unsigned long height; michael@0: michael@0: /** michael@0: * The duration of the media stream. michael@0: */ michael@0: attribute unsigned long long duration; michael@0: michael@0: /** michael@0: * The sample rate of the media stream. michael@0: */ michael@0: attribute unsigned long sampleRate; michael@0: michael@0: /** michael@0: * The timestamp indicates the stream absolute position michael@0: * relative to the beginning of the presentation. michael@0: */ michael@0: attribute unsigned long long timeStamp; michael@0: michael@0: /** michael@0: * The total number of audio channels in the media stream. michael@0: */ michael@0: attribute unsigned long channelCount; michael@0: michael@0: /** michael@0: * The AAC audio codec specific data. michael@0: */ michael@0: attribute ACString esdsData; michael@0: michael@0: /** michael@0: * The AVCC format extradata of H.264 stream. michael@0: */ michael@0: attribute ACString avccData; michael@0: }; michael@0: michael@0: /** michael@0: * nsIStreamingProtocolListener michael@0: */ michael@0: [scriptable, uuid(c4f6b660-892e-11e2-9e96-0800200c9a66)] michael@0: interface nsIStreamingProtocolListener : nsISupports michael@0: { michael@0: /** michael@0: * Called when the data may be read without blocking the calling thread. michael@0: * @param index The track number of the media stream. michael@0: * @param data Raw data of the media stream on given track number. michael@0: * @param length The length of the raw data. michael@0: * @param offset The offset in the data stream from the start of the media michael@0: * presentation in bytes. michael@0: * @param meta The meta data of the frame. michael@0: */ michael@0: void onMediaDataAvailable(in uint8_t index, michael@0: in ACString data, michael@0: in uint32_t length, michael@0: in uint32_t offset, michael@0: in nsIStreamingProtocolMetaData meta); michael@0: michael@0: /** michael@0: * Called when the meta data for a given session is available. michael@0: * @param index The track number of the media stream. michael@0: * @param meta The meta data of the media stream. michael@0: */ michael@0: void onConnected(in uint8_t index, in nsIStreamingProtocolMetaData meta); michael@0: michael@0: /** michael@0: * Called when the Rtsp session is closed. michael@0: * @param index Track number of the media stream. michael@0: * @param reason The reason of disconnection. michael@0: */ michael@0: void onDisconnected(in uint8_t index, in nsresult reason); michael@0: }; michael@0: michael@0: /** michael@0: * Media stream controller API: control and retrieve meta data from media stream. michael@0: */ michael@0: [uuid(a9bdd4b0-8559-11e2-9e96-0800200c9a66)] michael@0: interface nsIStreamingProtocolController : nsISupports michael@0: { michael@0: /** michael@0: * Preprare the URI before we can start the connection. michael@0: * @param aUri The URI of the media stream. michael@0: */ michael@0: void init(in nsIURI aUri); michael@0: michael@0: /** michael@0: * Asynchronously open this controller. Data is fed to the specified michael@0: * media stream listener as it becomes available. If asyncOpen returns michael@0: * successfully, the controller is responsible for keeping itself alive michael@0: * until it has called onStopRequest on aListener. michael@0: * michael@0: * @param aListener The nsIStreamingProtocolListener implementation michael@0: */ michael@0: void asyncOpen(in nsIStreamingProtocolListener aListener); michael@0: michael@0: /* michael@0: * Get the metadata of a track. michael@0: * @param index Index of a track. michael@0: * @return A nsIStreamingProtocolMetaData. michael@0: */ michael@0: nsIStreamingProtocolMetaData getTrackMetaData(in octet index); michael@0: michael@0: /* michael@0: * Tell the streaming server to start sending media data. michael@0: */ michael@0: void play(); michael@0: michael@0: /* michael@0: * Tell the streaming server to pause sending media data. michael@0: */ michael@0: void pause(); michael@0: michael@0: /* michael@0: * Tell the streaming server to resume the suspended media stream. michael@0: */ michael@0: void resume(); michael@0: michael@0: /* michael@0: * Tell the streaming server to suspend the media stream. michael@0: */ michael@0: void suspend(); michael@0: michael@0: /* michael@0: * Tell the streaming server to send media data in specific time. michael@0: * @param seekTimeUs Start time of the media stream in microseconds. michael@0: */ michael@0: void seek(in unsigned long long seekTimeUs); michael@0: michael@0: /* michael@0: * Tell the streaming server to stop the michael@0: * media stream and close the connection. michael@0: */ michael@0: void stop(); michael@0: michael@0: /** michael@0: * Total number of audio/video tracks. michael@0: */ michael@0: readonly attribute octet totalTracks; michael@0: };