MP4Decoder.h (2016B)
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 "mozilla/UniquePtr.h" 10 # include "nsStringFwd.h" 11 # include "nsTArray.h" 12 13 namespace mozilla { 14 15 class MediaContainerType; 16 class MediaResult; 17 class DecoderDoctorDiagnostics; 18 class TrackInfo; 19 20 // Decoder that uses a bundled MP4 demuxer and platform decoders to play MP4. 21 class MP4Decoder { 22 public: 23 // Returns true if aContainerType is an MP4 type that we think we can render 24 // with the a platform decoder backend. 25 // If provided, codecs are checked for support. 26 static bool IsSupportedType(const MediaContainerType& aContainerType, 27 DecoderDoctorDiagnostics* aDiagnostics); 28 29 // Return true if aMimeType is a one of the strings used by our demuxers to 30 // identify H264. Does not parse general content type strings, i.e. white 31 // space matters. 32 static bool IsH264(const nsACString& aMimeType); 33 34 // Return true if aMimeType is a one of the strings used by our demuxers to 35 // identify AAC. Does not parse general content type strings, i.e. white 36 // space matters. 37 static bool IsAAC(const nsACString& aMimeType); 38 39 // Return true if aMimeType is a one of the strings used by our demuxers to 40 // identify HEVC. Does not parse general content type strings, i.e. white 41 // space matters. 42 static bool IsHEVC(const nsACString& aMimeType); 43 44 // Returns true if the MP4 backend is preffed on. 45 static bool IsEnabled(); 46 47 static nsTArray<UniquePtr<TrackInfo>> GetTracksInfo( 48 const MediaContainerType& aType); 49 50 private: 51 static nsTArray<UniquePtr<TrackInfo>> GetTracksInfo( 52 const MediaContainerType& aType, MediaResult& aError); 53 }; 54 55 } // namespace mozilla 56 57 #endif