michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* vim:set ts=2 sw=2 sts=2 et cindent: */ 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: michael@0: #ifndef DecoderTraits_h_ michael@0: #define DecoderTraits_h_ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: michael@0: class nsAString; michael@0: class nsACString; michael@0: michael@0: namespace mozilla { michael@0: michael@0: class AbstractMediaDecoder; michael@0: class MediaDecoder; michael@0: class MediaDecoderOwner; michael@0: class MediaDecoderReader; michael@0: michael@0: enum CanPlayStatus { michael@0: CANPLAY_NO, michael@0: CANPLAY_MAYBE, michael@0: CANPLAY_YES michael@0: }; michael@0: michael@0: class DecoderTraits { michael@0: public: michael@0: // Returns the CanPlayStatus indicating if we can handle this michael@0: // MIME type. The MIME type should not include the codecs parameter. michael@0: // That parameter should be passed in aCodecs, and will only be michael@0: // used if whether a given MIME type being handled depends on the michael@0: // codec that will be used. If the codecs parameter has not been michael@0: // specified, pass false in aHaveRequestedCodecs. michael@0: static CanPlayStatus CanHandleMediaType(const char* aMIMEType, michael@0: bool aHaveRequestedCodecs, michael@0: const nsAString& aRequestedCodecs); michael@0: michael@0: // Returns true if we should handle this MIME type when it appears michael@0: // as an or as a toplevel page. If, in practice, our support michael@0: // for the type is more limited than appears in the wild, we should return michael@0: // false here even if CanHandleMediaType would return true. michael@0: static bool ShouldHandleMediaType(const char* aMIMEType); michael@0: michael@0: // Create a decoder for the given aType. Returns null if we michael@0: // were unable to create the decoder. michael@0: static already_AddRefed CreateDecoder(const nsACString& aType, michael@0: MediaDecoderOwner* aOwner); michael@0: michael@0: // Create a reader for thew given MIME type aType. Returns null michael@0: // if we were unable to create the reader. michael@0: static MediaDecoderReader* CreateReader(const nsACString& aType, michael@0: AbstractMediaDecoder* aDecoder); michael@0: michael@0: // Returns true if MIME type aType is supported in video documents, michael@0: // or false otherwise. Not all platforms support all MIME types, and michael@0: // vice versa. michael@0: static bool IsSupportedInVideoDocument(const nsACString& aType); michael@0: michael@0: // Returns true if we should not start decoder until we receive michael@0: // OnConnected signal. (currently RTSP only) michael@0: static bool DecoderWaitsForOnConnected(const nsACString& aType); michael@0: }; michael@0: michael@0: } michael@0: michael@0: #endif michael@0: