1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/content/media/DecoderTraits.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim:set ts=2 sw=2 sts=2 et cindent: */ 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 + 1.10 +#ifndef DecoderTraits_h_ 1.11 +#define DecoderTraits_h_ 1.12 + 1.13 +#include "nsCOMPtr.h" 1.14 + 1.15 +class nsAString; 1.16 +class nsACString; 1.17 + 1.18 +namespace mozilla { 1.19 + 1.20 +class AbstractMediaDecoder; 1.21 +class MediaDecoder; 1.22 +class MediaDecoderOwner; 1.23 +class MediaDecoderReader; 1.24 + 1.25 +enum CanPlayStatus { 1.26 + CANPLAY_NO, 1.27 + CANPLAY_MAYBE, 1.28 + CANPLAY_YES 1.29 +}; 1.30 + 1.31 +class DecoderTraits { 1.32 +public: 1.33 + // Returns the CanPlayStatus indicating if we can handle this 1.34 + // MIME type. The MIME type should not include the codecs parameter. 1.35 + // That parameter should be passed in aCodecs, and will only be 1.36 + // used if whether a given MIME type being handled depends on the 1.37 + // codec that will be used. If the codecs parameter has not been 1.38 + // specified, pass false in aHaveRequestedCodecs. 1.39 + static CanPlayStatus CanHandleMediaType(const char* aMIMEType, 1.40 + bool aHaveRequestedCodecs, 1.41 + const nsAString& aRequestedCodecs); 1.42 + 1.43 + // Returns true if we should handle this MIME type when it appears 1.44 + // as an <object> or as a toplevel page. If, in practice, our support 1.45 + // for the type is more limited than appears in the wild, we should return 1.46 + // false here even if CanHandleMediaType would return true. 1.47 + static bool ShouldHandleMediaType(const char* aMIMEType); 1.48 + 1.49 + // Create a decoder for the given aType. Returns null if we 1.50 + // were unable to create the decoder. 1.51 + static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType, 1.52 + MediaDecoderOwner* aOwner); 1.53 + 1.54 + // Create a reader for thew given MIME type aType. Returns null 1.55 + // if we were unable to create the reader. 1.56 + static MediaDecoderReader* CreateReader(const nsACString& aType, 1.57 + AbstractMediaDecoder* aDecoder); 1.58 + 1.59 + // Returns true if MIME type aType is supported in video documents, 1.60 + // or false otherwise. Not all platforms support all MIME types, and 1.61 + // vice versa. 1.62 + static bool IsSupportedInVideoDocument(const nsACString& aType); 1.63 + 1.64 + // Returns true if we should not start decoder until we receive 1.65 + // OnConnected signal. (currently RTSP only) 1.66 + static bool DecoderWaitsForOnConnected(const nsACString& aType); 1.67 +}; 1.68 + 1.69 +} 1.70 + 1.71 +#endif 1.72 +