Line data Source code
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/. */
6 : #if !defined(MP4Decoder_h_)
7 : #define MP4Decoder_h_
8 :
9 : #include "ChannelMediaDecoder.h"
10 : #include "MediaFormatReader.h"
11 : #include "mozilla/dom/Promise.h"
12 : #include "mozilla/layers/KnowsCompositor.h"
13 :
14 : namespace mozilla {
15 :
16 : class MediaContainerType;
17 :
18 : // Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4.
19 0 : class MP4Decoder : public ChannelMediaDecoder
20 : {
21 : public:
22 : explicit MP4Decoder(MediaDecoderInit& aInit);
23 :
24 0 : ChannelMediaDecoder* Clone(MediaDecoderInit& aInit) override
25 : {
26 0 : if (!IsEnabled()) {
27 0 : return nullptr;
28 : }
29 0 : return new MP4Decoder(aInit);
30 : }
31 :
32 : MediaDecoderStateMachine* CreateStateMachine() override;
33 :
34 : // Returns true if aContainerType is an MP4 type that we think we can render
35 : // with the a platform decoder backend.
36 : // If provided, codecs are checked for support.
37 : static bool IsSupportedType(const MediaContainerType& aContainerType,
38 : DecoderDoctorDiagnostics* aDiagnostics);
39 :
40 : // Return true if aMimeType is a one of the strings used by our demuxers to
41 : // identify H264. Does not parse general content type strings, i.e. white
42 : // space matters.
43 : static bool IsH264(const nsACString& aMimeType);
44 :
45 : // Return true if aMimeType is a one of the strings used by our demuxers to
46 : // identify AAC. Does not parse general content type strings, i.e. white
47 : // space matters.
48 : static bool IsAAC(const nsACString& aMimeType);
49 :
50 : // Returns true if the MP4 backend is preffed on.
51 : static bool IsEnabled();
52 :
53 : static already_AddRefed<dom::Promise>
54 : IsVideoAccelerated(layers::KnowsCompositor* aKnowsCompositor, nsIGlobalObject* aParent);
55 :
56 : void GetMozDebugReaderData(nsACString& aString) override;
57 : };
58 :
59 : } // namespace mozilla
60 :
61 : #endif
|