tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

OmxDecoderModule.cpp (1724B)


      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 
      7 #include "OmxDecoderModule.h"
      8 
      9 #include "OmxDataDecoder.h"
     10 #include "OmxPlatformLayer.h"
     11 
     12 #ifdef MOZ_OMX
     13 #  include "PureOmxPlatformLayer.h"
     14 #endif
     15 
     16 namespace mozilla {
     17 
     18 /* static */
     19 bool OmxDecoderModule::Init() {
     20 #ifdef MOZ_OMX
     21  return PureOmxPlatformLayer::Init();
     22 #endif
     23  return false;
     24 }
     25 
     26 OmxDecoderModule* OmxDecoderModule::Create() {
     27 #ifdef MOZ_OMX
     28  if (Init()) {
     29    return new OmxDecoderModule();
     30  }
     31 #endif
     32  return nullptr;
     33 }
     34 
     35 already_AddRefed<MediaDataDecoder> OmxDecoderModule::CreateVideoDecoder(
     36    const CreateDecoderParams& aParams) {
     37  RefPtr<OmxDataDecoder> decoder = new OmxDataDecoder(
     38      aParams.mConfig, aParams.mImageContainer, aParams.mTrackingId);
     39  return decoder.forget();
     40 }
     41 
     42 already_AddRefed<MediaDataDecoder> OmxDecoderModule::CreateAudioDecoder(
     43    const CreateDecoderParams& aParams) {
     44  RefPtr<OmxDataDecoder> decoder =
     45      new OmxDataDecoder(aParams.mConfig, nullptr, aParams.mTrackingId);
     46  return decoder.forget();
     47 }
     48 
     49 media::DecodeSupportSet OmxDecoderModule::SupportsMimeType(
     50    const nsACString& aMimeType, DecoderDoctorDiagnostics* aDiagnostics) const {
     51  if (OmxPlatformLayer::SupportsMimeType(aMimeType)) {
     52    // TODO: Note that we do not yet distinguish between SW/HW decode support.
     53    //       Will be done in bug 1754239.
     54    return media::DecodeSupport::SoftwareDecode;
     55  }
     56  return media::DecodeSupportSet{};
     57 }
     58 
     59 }  // namespace mozilla