Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 


Quelle  GMPEncoderModule.cpp   Sprache: C

 
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:set ts=2 sw=2 sts=2 et cindent: */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */


#include "GMPEncoderModule.h"

#include "GMPService.h"
#include "GMPUtils.h"
#include "GMPVideoEncoder.h"
#include "MediaDataEncoderProxy.h"
#include "MP4Decoder.h"

namespace mozilla {

already_AddRefed<MediaDataEncoder> GMPEncoderModule::CreateVideoEncoder(
    const EncoderConfig& aConfig, const RefPtr<TaskQueue>& aTaskQueue) const {
  if (!Supports(aConfig)) {
    return nullptr;
  }

  RefPtr<gmp::GeckoMediaPluginService> s(
      gmp::GeckoMediaPluginService::GetGeckoMediaPluginService());
  if (NS_WARN_IF(!s)) {
    return nullptr;
  }

  nsCOMPtr<nsISerialEventTarget> thread(s->GetGMPThread());
  if (NS_WARN_IF(!thread)) {
    return nullptr;
  }

  RefPtr<MediaDataEncoder> encoder(new GMPVideoEncoder(aConfig));
  return do_AddRef(
      new MediaDataEncoderProxy(encoder.forget(), thread.forget()));
}

bool GMPEncoderModule::Supports(const EncoderConfig& aConfig) const {
  if (!CanLikelyEncode(aConfig)) {
    return false;
  }
  if (aConfig.mCodec != CodecType::H264) {
    return false;
  }
  if (aConfig.mHardwarePreference == HardwarePreference::RequireHardware) {
    return false;
  }
  if (aConfig.mCodecSpecific && aConfig.mCodecSpecific->is<H264Specific>()) {
    const auto& codecSpecific = aConfig.mCodecSpecific->as<H264Specific>();
    if (codecSpecific.mFormat != H264BitStreamFormat::ANNEXB) {
      return false;
    }
    if (codecSpecific.mProfile != H264_PROFILE_UNKNOWN &&
        codecSpecific.mProfile != H264_PROFILE_BASE &&
        !HaveGMPFor("encode-video"_ns, {"moz-h264-advanced"_ns})) {
      return false;
    }
  }
  if (aConfig.mScalabilityMode != ScalabilityMode::None &&
      !HaveGMPFor("encode-video"_ns, {"moz-h264-temporal-svc"_ns})) {
    return false;
  }
  return HaveGMPFor("encode-video"_ns, {"h264"_ns});
}

bool GMPEncoderModule::SupportsCodec(CodecType aCodecType) const {
  if (aCodecType != CodecType::H264) {
    return false;
  }
  return HaveGMPFor("encode-video"_ns, {"h264"_ns});
}

}  // namespace mozilla

Messung V0.5
C=94 H=98 G=95

¤ Dauer der Verarbeitung: 0.0 Sekunden  (vorverarbeitet)  ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge