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 file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef MEDIA_CONDUIT_ABSTRACTION_ michael@0: #define MEDIA_CONDUIT_ABSTRACTION_ michael@0: michael@0: #include "nsISupportsImpl.h" michael@0: #include "nsXPCOM.h" michael@0: #include "nsDOMNavigationTiming.h" michael@0: #include "mozilla/RefPtr.h" michael@0: #include "CodecConfig.h" michael@0: #include "VideoTypes.h" michael@0: #include "MediaConduitErrors.h" michael@0: michael@0: #include "ImageContainer.h" michael@0: michael@0: #include michael@0: michael@0: namespace mozilla { michael@0: /** michael@0: * Abstract Interface for transporting RTP packets - audio/vidoeo michael@0: * The consumers of this interface are responsible for passing in michael@0: * the RTPfied media packets michael@0: */ michael@0: class TransportInterface michael@0: { michael@0: public: michael@0: virtual ~TransportInterface() {} michael@0: michael@0: /** michael@0: * RTP Transport Function to be implemented by concrete transport implementation michael@0: * @param data : RTP Packet (audio/video) to be transported michael@0: * @param len : Length of the media packet michael@0: * @result : NS_OK on success, NS_ERROR_FAILURE otherwise michael@0: */ michael@0: virtual nsresult SendRtpPacket(const void* data, int len) = 0; michael@0: michael@0: /** michael@0: * RTCP Transport Function to be implemented by concrete transport implementation michael@0: * @param data : RTCP Packet to be transported michael@0: * @param len : Length of the RTCP packet michael@0: * @result : NS_OK on success, NS_ERROR_FAILURE otherwise michael@0: */ michael@0: virtual nsresult SendRtcpPacket(const void* data, int len) = 0; michael@0: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TransportInterface) michael@0: }; michael@0: michael@0: /** michael@0: * This class wraps image object for VideoRenderer::RenderVideoFrame() michael@0: * callback implementation to use for rendering. michael@0: */ michael@0: class ImageHandle michael@0: { michael@0: public: michael@0: ImageHandle(layers::Image* image) : mImage(image) {} michael@0: michael@0: const RefPtr& GetImage() const { return mImage; } michael@0: michael@0: private: michael@0: RefPtr mImage; michael@0: }; michael@0: michael@0: /** michael@0: * 1. Abstract renderer for video data michael@0: * 2. This class acts as abstract interface between the video-engine and michael@0: * video-engine agnostic renderer implementation. michael@0: * 3. Concrete implementation of this interface is responsible for michael@0: * processing and/or rendering the obtained raw video frame to appropriate michael@0: * output , say,