Fri, 16 Jan 2015 04:50:19 +0100
Replace accessor implementation with direct member state manipulation, by
request https://trac.torproject.org/projects/tor/ticket/9701#comment:32
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ |
michael@0 | 2 | /* vim:set ts=2 sw=2 sts=2 et cindent: */ |
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 | |
michael@0 | 7 | #ifndef DecoderTraits_h_ |
michael@0 | 8 | #define DecoderTraits_h_ |
michael@0 | 9 | |
michael@0 | 10 | #include "nsCOMPtr.h" |
michael@0 | 11 | |
michael@0 | 12 | class nsAString; |
michael@0 | 13 | class nsACString; |
michael@0 | 14 | |
michael@0 | 15 | namespace mozilla { |
michael@0 | 16 | |
michael@0 | 17 | class AbstractMediaDecoder; |
michael@0 | 18 | class MediaDecoder; |
michael@0 | 19 | class MediaDecoderOwner; |
michael@0 | 20 | class MediaDecoderReader; |
michael@0 | 21 | |
michael@0 | 22 | enum CanPlayStatus { |
michael@0 | 23 | CANPLAY_NO, |
michael@0 | 24 | CANPLAY_MAYBE, |
michael@0 | 25 | CANPLAY_YES |
michael@0 | 26 | }; |
michael@0 | 27 | |
michael@0 | 28 | class DecoderTraits { |
michael@0 | 29 | public: |
michael@0 | 30 | // Returns the CanPlayStatus indicating if we can handle this |
michael@0 | 31 | // MIME type. The MIME type should not include the codecs parameter. |
michael@0 | 32 | // That parameter should be passed in aCodecs, and will only be |
michael@0 | 33 | // used if whether a given MIME type being handled depends on the |
michael@0 | 34 | // codec that will be used. If the codecs parameter has not been |
michael@0 | 35 | // specified, pass false in aHaveRequestedCodecs. |
michael@0 | 36 | static CanPlayStatus CanHandleMediaType(const char* aMIMEType, |
michael@0 | 37 | bool aHaveRequestedCodecs, |
michael@0 | 38 | const nsAString& aRequestedCodecs); |
michael@0 | 39 | |
michael@0 | 40 | // Returns true if we should handle this MIME type when it appears |
michael@0 | 41 | // as an <object> or as a toplevel page. If, in practice, our support |
michael@0 | 42 | // for the type is more limited than appears in the wild, we should return |
michael@0 | 43 | // false here even if CanHandleMediaType would return true. |
michael@0 | 44 | static bool ShouldHandleMediaType(const char* aMIMEType); |
michael@0 | 45 | |
michael@0 | 46 | // Create a decoder for the given aType. Returns null if we |
michael@0 | 47 | // were unable to create the decoder. |
michael@0 | 48 | static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType, |
michael@0 | 49 | MediaDecoderOwner* aOwner); |
michael@0 | 50 | |
michael@0 | 51 | // Create a reader for thew given MIME type aType. Returns null |
michael@0 | 52 | // if we were unable to create the reader. |
michael@0 | 53 | static MediaDecoderReader* CreateReader(const nsACString& aType, |
michael@0 | 54 | AbstractMediaDecoder* aDecoder); |
michael@0 | 55 | |
michael@0 | 56 | // Returns true if MIME type aType is supported in video documents, |
michael@0 | 57 | // or false otherwise. Not all platforms support all MIME types, and |
michael@0 | 58 | // vice versa. |
michael@0 | 59 | static bool IsSupportedInVideoDocument(const nsACString& aType); |
michael@0 | 60 | |
michael@0 | 61 | // Returns true if we should not start decoder until we receive |
michael@0 | 62 | // OnConnected signal. (currently RTSP only) |
michael@0 | 63 | static bool DecoderWaitsForOnConnected(const nsACString& aType); |
michael@0 | 64 | }; |
michael@0 | 65 | |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | #endif |
michael@0 | 69 |