2012-11-22 07:10:41 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef DecoderTraits_h_
|
|
|
|
#define DecoderTraits_h_
|
|
|
|
|
2013-03-05 18:56:34 +04:00
|
|
|
#include "nsCOMPtr.h"
|
2013-09-06 00:25:17 +04:00
|
|
|
|
|
|
|
class nsAString;
|
|
|
|
class nsACString;
|
2012-11-22 07:10:41 +04:00
|
|
|
|
2013-03-05 18:56:35 +04:00
|
|
|
namespace mozilla {
|
2013-03-04 19:24:44 +04:00
|
|
|
|
2013-03-05 18:56:35 +04:00
|
|
|
class AbstractMediaDecoder;
|
2016-04-19 10:36:19 +03:00
|
|
|
class DecoderDoctorDiagnostics;
|
2017-01-18 03:59:03 +03:00
|
|
|
class MediaContainerType;
|
2013-03-05 18:56:34 +04:00
|
|
|
class MediaDecoder;
|
2017-06-07 07:14:11 +03:00
|
|
|
struct MediaDecoderInit;
|
2013-03-05 18:56:34 +04:00
|
|
|
class MediaDecoderOwner;
|
2013-03-05 18:56:35 +04:00
|
|
|
class MediaDecoderReader;
|
2013-03-05 18:56:34 +04:00
|
|
|
|
2012-11-22 07:10:41 +04:00
|
|
|
enum CanPlayStatus {
|
|
|
|
CANPLAY_NO,
|
|
|
|
CANPLAY_MAYBE,
|
|
|
|
CANPLAY_YES
|
|
|
|
};
|
|
|
|
|
|
|
|
class DecoderTraits {
|
|
|
|
public:
|
2017-01-18 03:59:03 +03:00
|
|
|
// Returns the CanPlayStatus indicating if we can handle this container type.
|
|
|
|
static CanPlayStatus CanHandleContainerType(const MediaContainerType& aContainerType,
|
|
|
|
DecoderDoctorDiagnostics* aDiagnostics);
|
2016-09-26 09:43:16 +03:00
|
|
|
|
2012-11-22 07:10:41 +04:00
|
|
|
// Returns true if we should handle this MIME type when it appears
|
|
|
|
// as an <object> or as a toplevel page. If, in practice, our support
|
|
|
|
// for the type is more limited than appears in the wild, we should return
|
|
|
|
// false here even if CanHandleMediaType would return true.
|
2016-04-19 10:36:19 +03:00
|
|
|
static bool ShouldHandleMediaType(const char* aMIMEType,
|
|
|
|
DecoderDoctorDiagnostics* aDiagnostics);
|
2012-11-22 07:10:41 +04:00
|
|
|
|
2013-03-05 18:56:34 +04:00
|
|
|
// Create a decoder for the given aType. Returns null if we
|
|
|
|
// were unable to create the decoder.
|
|
|
|
static already_AddRefed<MediaDecoder> CreateDecoder(const nsACString& aType,
|
2017-06-07 07:14:11 +03:00
|
|
|
MediaDecoderInit& aInit,
|
2016-04-19 10:36:19 +03:00
|
|
|
DecoderDoctorDiagnostics* aDiagnostics);
|
2013-03-05 18:56:35 +04:00
|
|
|
|
2013-03-05 18:56:35 +04:00
|
|
|
// Create a reader for thew given MIME type aType. Returns null
|
|
|
|
// if we were unable to create the reader.
|
2017-01-18 03:59:03 +03:00
|
|
|
static MediaDecoderReader* CreateReader(const MediaContainerType& aType,
|
2013-03-05 18:56:35 +04:00
|
|
|
AbstractMediaDecoder* aDecoder);
|
|
|
|
|
2013-03-05 18:56:35 +04:00
|
|
|
// Returns true if MIME type aType is supported in video documents,
|
|
|
|
// or false otherwise. Not all platforms support all MIME types, and
|
|
|
|
// vice versa.
|
|
|
|
static bool IsSupportedInVideoDocument(const nsACString& aType);
|
2013-09-23 13:53:36 +04:00
|
|
|
|
2017-01-01 04:27:45 +03:00
|
|
|
// Convenience function that returns false if MOZ_FMP4 is not defined,
|
|
|
|
// otherwise defers to MP4Decoder::IsSupportedType().
|
2017-01-18 03:59:03 +03:00
|
|
|
static bool IsMP4SupportedType(const MediaContainerType& aType,
|
2017-01-01 04:27:45 +03:00
|
|
|
DecoderDoctorDiagnostics* aDiagnostics);
|
2012-11-22 07:10:41 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace mozilla
|
2012-11-22 07:10:41 +04:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|