Ejemplo n.º 1
0
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     //No need for 'global' check, each engine can check for itself
     //		if(parent::CheckConstraints($source, $target, $errors, $warnings)==true)
     //			return true;
     if ($this->_id == KDLTranscoders::FFMPEG_AUX) {
         $transcoder = new KDLOperatorFfmpeg($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::FFMPEG) {
         $transcoder = new KDLOperatorFfmpeg2_2($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::MENCODER) {
         $transcoder = new KDLOperatorMencoder($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::ON2) {
         $transcoder = new KDLOperatorOn2($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     /*
      * Remove encoding.com for DAR<>PAR
      */
     if ($this->_id == KDLTranscoders::ENCODING_COM && $source->_video && $source->_video->_dar && abs($source->_video->GetPAR() - $source->_video->_dar) > 0.01) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderFormat, $this->_id, "non square pixels");
         return true;
     }
     /*
      * Prevent invalid copy attempts, that might erronously end up with 'false-positive' result
      */
     if (isset($target->_video) && $target->_video->_id == KDLVideoTarget::COPY || isset($target->_audio) && $target->_audio->_id == KDLAudioTarget::COPY) {
         if ($target->_container->_id == KDLContainerTarget::FLV) {
             $rvArr = $source->ToTags(array("web"));
             if (count($rvArr) == 0) {
                 $errStr = "Copy to Target format:FLV, Source:" . $source->ToString();
                 $target->_errors[KDLConstants::ContainerIndex][] = KDLErrors::ToString(KDLErrors::InvalidRequest, $errStr);
                 return true;
             }
         }
     }
     return false;
 }
 public function CheckConstraints(KDLMediaDataSet $source, KDLFlavor $target, array &$errors = null, array &$warnings = null)
 {
     if (parent::CheckConstraints($source, $target, $errors, $warnings) == true) {
         return true;
     }
     if ($this->_id == KDLTranscoders::FFMPEG_AUX) {
         $transcoder = new KDLOperatorFfmpeg($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::FFMPEG) {
         $transcoder = new KDLOperatorFfmpeg0_10($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::MENCODER) {
         $transcoder = new KDLOperatorMencoder($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     if ($this->_id == KDLTranscoders::ON2) {
         $transcoder = new KDLOperatorOn2($this->_id);
         if ($transcoder->CheckConstraints($source, $target, $errors, $warnings) == true) {
             return true;
         }
     }
     /*
      * Remove encoding.com for DAR<>PAR
      */
     if ($this->_id == KDLTranscoders::ENCODING_COM && $source->_video && $source->_video->_dar && abs($source->_video->GetPAR() - $source->_video->_dar) > 0.01) {
         $warnings[KDLConstants::VideoIndex][] = KDLWarnings::ToString(KDLWarnings::TranscoderFormat, $this->_id, "non square pixels");
         return true;
     }
     return false;
 }