public function __get( $property )
 {
     if ( $property == 'fileCharset' )
     {
         $finfo = new finfo( FILEINFO_MIME_ENCODING );
         $encoding = strtoupper( $finfo->file( (string)$this->inputFile ) );
         // assume iso by default
         if ( $encoding == 'UNKNOWN-8BIT' )
             $encoding = "ISO-8859-1";
         elseif ( $encoding == 'BINARY' )
             $encoding = "UTF-8";
         return $encoding;
     }
     else
     {
         return parent::__get( $property );
     }
 }
Exemplo n.º 2
0
    /**
     * Adds the input file $file to the command
     * @param MKVMergeSourceFile $file
     * @return MKVMergeCommandTrackSet The added track set
     */
    public function addInputFile( MKVMergeInputFile $inputFile )
    {
        // local track set we will return at the end
        $trackSet = new MKVMergeCommandTrackSet();

        // media file: analyze and add found tracks
        if ( $inputFile instanceof MKVMergeMediaInputFile )
        {
            $analyzer = $this->getAnalyzer( $inputFile );
            foreach( $analyzer->getResult() as $analysisResult )
            {
                $trackSet[] = MKVMergeCommandTrack::fromAnalysisResult( $analysisResult, $inputFile );
            }
        }
        // subtitle file: add as is
        elseif ( $inputFile instanceof MKVMergeSubtitleInputFile )
        {
            $trackSet[] = new MKVmergeCommandSubtitleTrack( $inputFile );
        }
        $this->inputFiles[] = $inputFile;
        $this->trackSets[] = $trackSet;

        return $trackSet;
    }