當前位置: 首頁>>代碼示例>>PHP>>正文


PHP getid3_lib::Float2String方法代碼示例

本文整理匯總了PHP中getid3_lib::Float2String方法的典型用法代碼示例。如果您正苦於以下問題:PHP getid3_lib::Float2String方法的具體用法?PHP getid3_lib::Float2String怎麽用?PHP getid3_lib::Float2String使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在getid3_lib的用法示例。


在下文中一共展示了getid3_lib::Float2String方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: GenerateID3v2FrameData


//.........這裏部分代碼省略.........
                 }
                 break;
             case 'SEEK':
                 // 4.29  SEEK Seek frame (ID3v2.4+ only)
                 // Minimum offset to next tag       $xx xx xx xx
                 if (!$this->IsWithinBitRange($source_data_array['data'], 32, false)) {
                     $this->errors[] = 'Invalid Minimum Offset in ' . $frame_name . ' (' . $source_data_array['data'] . ') (range = 0 to 4294967295)';
                 } else {
                     $framedata .= getid3_lib::BigEndian2String($source_data_array['data'], 4, false);
                 }
                 break;
             case 'ASPI':
                 // 4.30  ASPI Audio seek point index (ID3v2.4+ only)
                 // Indexed data start (S)         $xx xx xx xx
                 // Indexed data length (L)        $xx xx xx xx
                 // Number of index points (N)     $xx xx
                 // Bits per index point (b)       $xx
                 //   Then for every index point the following data is included:
                 // Fraction at index (Fi)          $xx (xx)
                 if (!$this->IsWithinBitRange($source_data_array['datastart'], 32, false)) {
                     $this->errors[] = 'Invalid Indexed Data Start in ' . $frame_name . ' (' . $source_data_array['datastart'] . ') (range = 0 to 4294967295)';
                 } elseif (!$this->IsWithinBitRange($source_data_array['datalength'], 32, false)) {
                     $this->errors[] = 'Invalid Indexed Data Length in ' . $frame_name . ' (' . $source_data_array['datalength'] . ') (range = 0 to 4294967295)';
                 } elseif (!$this->IsWithinBitRange($source_data_array['indexpoints'], 16, false)) {
                     $this->errors[] = 'Invalid Number Of Index Points in ' . $frame_name . ' (' . $source_data_array['indexpoints'] . ') (range = 0 to 65535)';
                 } elseif (!$this->IsWithinBitRange($source_data_array['bitsperpoint'], 8, false)) {
                     $this->errors[] = 'Invalid Bits Per Index Point in ' . $frame_name . ' (' . $source_data_array['bitsperpoint'] . ') (range = 0 to 255)';
                 } elseif ($source_data_array['indexpoints'] != count($source_data_array['indexes'])) {
                     $this->errors[] = 'Number Of Index Points does not match actual supplied data in ' . $frame_name;
                 } else {
                     $framedata .= getid3_lib::BigEndian2String($source_data_array['datastart'], 4, false);
                     $framedata .= getid3_lib::BigEndian2String($source_data_array['datalength'], 4, false);
                     $framedata .= getid3_lib::BigEndian2String($source_data_array['indexpoints'], 2, false);
                     $framedata .= getid3_lib::BigEndian2String($source_data_array['bitsperpoint'], 1, false);
                     foreach ($source_data_array['indexes'] as $key => $val) {
                         $framedata .= getid3_lib::BigEndian2String($val, ceil($source_data_array['bitsperpoint'] / 8), false);
                     }
                 }
                 break;
             case 'RGAD':
                 //   RGAD Replay Gain Adjustment
                 //   http://privatewww.essex.ac.uk/~djmrob/replaygain/
                 // Peak Amplitude                     $xx $xx $xx $xx
                 // Radio Replay Gain Adjustment        %aaabbbcd %dddddddd
                 // Audiophile Replay Gain Adjustment   %aaabbbcd %dddddddd
                 //   a - name code
                 //   b - originator code
                 //   c - sign bit
                 //   d - replay gain adjustment
                 if ($source_data_array['track_adjustment'] > 51 || $source_data_array['track_adjustment'] < -51) {
                     $this->errors[] = 'Invalid Track Adjustment in ' . $frame_name . ' (' . $source_data_array['track_adjustment'] . ') (range = -51.0 to +51.0)';
                 } elseif ($source_data_array['album_adjustment'] > 51 || $source_data_array['album_adjustment'] < -51) {
                     $this->errors[] = 'Invalid Album Adjustment in ' . $frame_name . ' (' . $source_data_array['album_adjustment'] . ') (range = -51.0 to +51.0)';
                 } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['track_name'])) {
                     $this->errors[] = 'Invalid Track Name Code in ' . $frame_name . ' (' . $source_data_array['raw']['track_name'] . ') (range = 0 to 2)';
                 } elseif (!$this->ID3v2IsValidRGADname($source_data_array['raw']['album_name'])) {
                     $this->errors[] = 'Invalid Album Name Code in ' . $frame_name . ' (' . $source_data_array['raw']['album_name'] . ') (range = 0 to 2)';
                 } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['track_originator'])) {
                     $this->errors[] = 'Invalid Track Originator Code in ' . $frame_name . ' (' . $source_data_array['raw']['track_originator'] . ') (range = 0 to 3)';
                 } elseif (!$this->ID3v2IsValidRGADoriginator($source_data_array['raw']['album_originator'])) {
                     $this->errors[] = 'Invalid Album Originator Code in ' . $frame_name . ' (' . $source_data_array['raw']['album_originator'] . ') (range = 0 to 3)';
                 } else {
                     $framedata .= getid3_lib::Float2String($source_data_array['peakamplitude'], 32);
                     $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['track_name'], $source_data_array['raw']['track_originator'], $source_data_array['track_adjustment']);
                     $framedata .= getid3_lib::RGADgainString($source_data_array['raw']['album_name'], $source_data_array['raw']['album_originator'], $source_data_array['album_adjustment']);
                 }
                 break;
             default:
                 if ($frame_name[0] == 'T') {
                     // 4.2. T???  Text information frames
                     // Text encoding                $xx
                     // Information                  <text string(s) according to encoding>
                     $source_data_array['encodingid'] = isset($source_data_array['encodingid']) ? $source_data_array['encodingid'] : $this->id3v2_default_encodingid;
                     if (!$this->ID3v2IsValidTextEncoding($source_data_array['encodingid'])) {
                         $this->errors[] = 'Invalid Text Encoding in ' . $frame_name . ' (' . $source_data_array['encodingid'] . ') for ID3v2.' . $this->majorversion;
                     } else {
                         $framedata .= chr($source_data_array['encodingid']);
                         $framedata .= $source_data_array['data'];
                     }
                 } elseif ($frame_name[0] == 'W') {
                     // 4.3. W???  URL link frames
                     // URL              <text string>
                     if (!$this->IsValidURL($source_data_array['data'], false, false)) {
                         //$this->errors[] = 'Invalid URL in '.$frame_name.' ('.$source_data_array['data'].')';
                         // probably should be an error, need to rewrite IsValidURL() to handle other encodings
                         $this->warnings[] = 'Invalid URL in ' . $frame_name . ' (' . $source_data_array['data'] . ')';
                     } else {
                         $framedata .= $source_data_array['data'];
                     }
                 } else {
                     $this->errors[] = $frame_name . ' not yet supported in $this->GenerateID3v2FrameData()';
                 }
                 break;
         }
     }
     if (!empty($this->errors)) {
         return false;
     }
     return $framedata;
 }
開發者ID:BackupTheBerlios,項目名稱:oos-svn,代碼行數:101,代碼來源:write.id3v2.php


注:本文中的getid3_lib::Float2String方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。