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