Backed out 35 changesets (bug 941158, bug 972518, bug 959520, bug 986063, bug 948895...
[gecko.git] / content / media / DecoderTraits.h
blob0f8eb5a310ec8f6866b4af262be203601232ec71
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef DecoderTraits_h_
8 #define DecoderTraits_h_
10 #include "nsCOMPtr.h"
12 class nsAString;
13 class nsACString;
15 namespace mozilla {
17 class AbstractMediaDecoder;
18 class MediaDecoder;
19 class MediaDecoderOwner;
20 class MediaDecoderReader;
22 enum CanPlayStatus {
23 CANPLAY_NO,
24 CANPLAY_MAYBE,
25 CANPLAY_YES
28 class DecoderTraits {
29 public:
30 // Returns the CanPlayStatus indicating if we can handle this
31 // MIME type. The MIME type should not include the codecs parameter.
32 // That parameter should be passed in aCodecs, and will only be
33 // used if whether a given MIME type being handled depends on the
34 // codec that will be used. If the codecs parameter has not been
35 // specified, pass false in aHaveRequestedCodecs.
36 static CanPlayStatus CanHandleMediaType(const char* aMIMEType,
37 bool aHaveRequestedCodecs,
38 const nsAString& aRequestedCodecs);
40 // Returns true if we should handle this MIME type when it appears
41 // as an <object> or as a toplevel page. If, in practice, our support
42 // for the type is more limited than appears in the wild, we should return
43 // false here even if CanHandleMediaType would return true.
44 static bool ShouldHandleMediaType(const char* aMIMEType);
46 // Create a decoder for the given aType. Returns null if we
47 // were unable to create the decoder.
48 static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType,
49 MediaDecoderOwner* aOwner);
51 // Create a reader for thew given MIME type aType. Returns null
52 // if we were unable to create the reader.
53 static MediaDecoderReader* CreateReader(const nsACString& aType,
54 AbstractMediaDecoder* aDecoder);
56 // Returns true if MIME type aType is supported in video documents,
57 // or false otherwise. Not all platforms support all MIME types, and
58 // vice versa.
59 static bool IsSupportedInVideoDocument(const nsACString& aType);
61 // Returns true if we should not start decoder until we receive
62 // OnConnected signal. (currently RTSP only)
63 static bool DecoderWaitsForOnConnected(const nsACString& aType);
68 #endif