LCOV - code coverage report
Current view: top level - dom/media/mp3 - MP3Decoder.cpp (source / functions) Hit Total Coverage
Test: output.info Lines: 0 19 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 6 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : 
       2             : /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       3             : /* vim:set ts=2 sw=2 sts=2 et cindent: */
       4             : /* This Source Code Form is subject to the terms of the Mozilla Public
       5             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       6             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       7             : 
       8             : #include "MP3Decoder.h"
       9             : 
      10             : #include "MediaContainerType.h"
      11             : #include "MediaDecoderStateMachine.h"
      12             : #include "MediaFormatReader.h"
      13             : #include "MP3Demuxer.h"
      14             : #include "PDMFactory.h"
      15             : 
      16             : namespace mozilla {
      17             : 
      18             : ChannelMediaDecoder*
      19           0 : MP3Decoder::Clone(MediaDecoderInit& aInit)
      20             : {
      21           0 :   if (!IsEnabled()) {
      22           0 :     return nullptr;
      23             :   }
      24           0 :   return new MP3Decoder(aInit);
      25             : }
      26             : 
      27             : MediaDecoderStateMachine*
      28           0 : MP3Decoder::CreateStateMachine() {
      29           0 :   MediaDecoderReaderInit init(this);
      30           0 :   mReader = new MediaFormatReader(init, new MP3Demuxer(mResource));
      31           0 :   return new MediaDecoderStateMachine(this, mReader);
      32             : }
      33             : 
      34             : /* static */
      35             : bool
      36           0 : MP3Decoder::IsEnabled() {
      37           0 :   RefPtr<PDMFactory> platform = new PDMFactory();
      38           0 :   return platform->SupportsMimeType(NS_LITERAL_CSTRING("audio/mpeg"),
      39           0 :                                     /* DecoderDoctorDiagnostics* */ nullptr);
      40             : }
      41             : 
      42             : /* static */
      43           0 : bool MP3Decoder::IsSupportedType(const MediaContainerType& aContainerType)
      44             : {
      45           0 :   if (aContainerType.Type() == MEDIAMIMETYPE("audio/mp3")
      46           0 :       || aContainerType.Type() == MEDIAMIMETYPE("audio/mpeg")) {
      47             :     return
      48           0 :       IsEnabled()
      49           0 :       && (aContainerType.ExtendedType().Codecs().IsEmpty()
      50           0 :           || aContainerType.ExtendedType().Codecs() == "mp3");
      51             :   }
      52           0 :   return false;
      53             : }
      54             : 
      55             : } // namespace mozilla

Generated by: LCOV version 1.13