本文整理汇总了PHP中getid3_lib类的典型用法代码示例。如果您正苦于以下问题:PHP getid3_lib类的具体用法?PHP getid3_lib怎么用?PHP getid3_lib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了getid3_lib类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: tag_mp3
function tag_mp3($filename, $songname, $albumname, $artist, $time)
{
$TaggingFormat = 'UTF-8';
// Initialize getID3 engine
$getID3 = new getID3();
$getID3->setOption(array('encoding' => $TaggingFormat));
getid3_lib::IncludeDependency('/var/www/html/getid3/getid3/write.php', __FILE__, true);
// Initialize getID3 tag-writing module
$tagwriter = new getid3_writetags();
$tagwriter->filename = $filename;
$tagwriter->tagformats = array('id3v1', 'id3v2.3');
// set various options (optional)
$tagwriter->overwrite_tags = true;
$tagwriter->tag_encoding = $TaggingFormat;
$tagwriter->remove_other_tags = true;
// populate data array
$TagData['title'][] = $songname;
$TagData['artist'][] = $artist;
$TagData['album'][] = $albumname;
$tagwriter->tag_data = $TagData;
// write tags
if ($tagwriter->WriteTags()) {
echo 'Successfully wrote tags<br>';
if (!empty($tagwriter->warnings)) {
echo 'There were some warnings:<br>' . implode('<br><br>', $tagwriter->warnings);
}
} else {
echo 'Failed to write tags!<br>' . implode('<br><br>', $tagwriter->errors);
}
}
开发者ID:houndbee,项目名称:phqueue,代码行数:30,代码来源:mp3id3write.php
示例2: add
function add($item)
{
global $config;
if ($item['url']) {
// this is a remote file
if ($config['httpStreaming']) {
$lines = file($item['url']);
foreach ($lines as $line) {
if (!empty($line)) {
$this->audioFiles[] = array('url' => $line);
}
}
} else {
// nothing to do
// not tested for Tamburine
}
} else {
// this is a local file
// CHANGED BY BUDDHAFLY 06-02-20
if (!in_array(sotf_File::getExtension($item['path']), $config['skipGetID3FileTypes'])) {
$getID3 = new getID3();
$mp3info = $getID3->analyze($item['path']);
getid3_lib::CopyTagsToComments($mp3info);
} else {
$fileinfo['video'] = true;
}
//$mp3info = GetAllFileInfo($item['path']);
//debug('mp3info', $mp3info);
// CHANGED BY BUDDHAFLY 06-02-20
$bitrate = (string) $mp3info['bitrate'];
if (!$bitrate) {
raiseError("Could not determine bitrate, maybe this audio is temporarily unavailable");
}
$item['bitrate'] = $bitrate;
if ($config['httpStreaming']) {
//$tmpFileName = 'au_' . $item['id'] . '_' . ($item['name'] ? $item['name'] : basename($item['path']));
$tmpFileName = 'au_' . $item['id'] . '_' . basename($item['path']);
$tmpFile = $config['tmpDir'] . "/{$tmpFileName}";
$file = @readlink($tmpFile);
if ($file) {
if (!is_readable($file)) {
logError("Bad symlink: {$tmpFile} to {$file}");
unlink($tmpFile);
$file = false;
}
}
if (!$file) {
if (!symlink($item['path'], $tmpFile)) {
raiseError("symlink failed in tmp dir");
}
}
$item['url'] = $config['tmpUrl'] . "/{$tmpFileName}";
}
$this->totalLength += $mp3info["playtime_seconds"];
$this->audioFiles[] = $item;
}
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:57,代码来源:sotf_PlayList.class.php
示例3: extractDataFromFilename
protected function extractDataFromFilename($filename)
{
if (empty($filename)) {
return null;
}
$id3 = new getID3();
$data = $id3->analyze($filename);
getid3_lib::CopyTagsToComments($data);
return $data;
}
开发者ID:tractorcow,项目名称:silverstripe-mediadata,代码行数:10,代码来源:MediaFileInformation.php
示例4: sotf_AudioFile
/**
* Sets up sotf_AudioFile object
*
* @constructor sotf_AudioFile
* @param string $path Path of the file
*/
function sotf_AudioFile($path)
{
$parent = get_parent_class($this);
parent::$parent($path);
// Call the constructor of the parent class. lk. super()
// CHANGED BY BUDDHAFLY 06-05-12
$getID3 = new getID3();
$fileinfo = $getID3->analyze($this->path);
getid3_lib::CopyTagsToComments($fileinfo);
//$fileinfo = GetAllFileInfo($this->path);
$this->allInfo = $fileInfo;
//if ($audioinfo["fileformat"] == 'mp3' || $audioinfo["fileformat"] == 'ogg') {
//debug("finfo", $fileinfo);
if (isset($fileinfo['audio'])) {
$audioinfo = $fileinfo['audio'];
$this->type = "audio";
$this->format = $fileinfo["fileformat"];
if ($audioinfo["bitrate_mode"] == 'vbr') {
$this->bitrate = "VBR";
}
$this->bitrate = round($audioinfo["bitrate"] / 1000);
$this->average_bitrate = round($audioinfo["bitrate"] / 1000);
$this->samplerate = $audioinfo["sample_rate"];
$this->channels = $audioinfo["channels"];
$this->duration = round($fileinfo["playtime_seconds"]);
$this->mimetype = $this->determineMimeType($this->format);
}
}
开发者ID:BackupTheBerlios,项目名称:sotf-svn,代码行数:34,代码来源:sotf_AudioFile.class.php
示例5: getId3Data
/**
*
*
* @return array
*/
public function getId3Data() : array
{
$reader = new \getID3();
$info = $reader->analyze($this->path);
\getid3_lib::CopyTagsToComments($info);
return $info;
}
开发者ID:Arany,项目名称:music-player,代码行数:12,代码来源:MusicFile.php
示例6: import_show
function import_show($showid, $dir, $type)
{
// Initialize getID3 engine
$getID3 = new getID3();
// Read files and directories
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$full_name = $dir . "/" . $file;
if (is_file($full_name) || $file[0] != '.') {
$ThisFileInfo = $getID3->analyze($full_name);
if ($ThisFileInfo['fileformat'] == "mp3") {
getid3_lib::CopyTagsToComments($ThisFileInfo);
$album = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['album']));
$play_time = mysql_real_escape_string(@$ThisFileInfo['playtime_seconds']);
$title_name = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['title']));
$artist_name = mysql_real_escape_string(@implode(@$ThisFileInfo['comments_html']['artist']));
$full_name = mysql_real_escape_string($full_name);
if ($id = song_non_existant($full_name, $showid)) {
$artist_id = check_or_insert_artist($artist_name);
insert_into_tunes($title_name, $artist_id, $full_name, $album, $play_time, $showid, -1, $type);
} else {
$artist_id = check_or_insert_artist($artist_name);
update_tunes($title_name, $id, $artist_id, $full_name, $album, $play_time);
}
}
}
}
closedir($dh);
}
}
}
开发者ID:houndbee,项目名称:phqueue,代码行数:32,代码来源:mp3info.php
示例7: getId3
/**
* Get ID3 Details
*
* @param string $path
*
* @return array
*/
protected function getId3($path)
{
$getID3 = new \getID3();
$analyze = $getID3->analyze($path);
\getid3_lib::CopyTagsToComments($analyze);
return $analyze;
}
开发者ID:lokamaya,项目名称:mp3,代码行数:14,代码来源:FunctionTrait.php
示例8: readMetadata
public static function readMetadata($file)
{
require_once __DIR__ . '/../vendor/autoload.php';
$getID3 = new \getID3();
$meta = $getID3->analyze($file);
\getid3_lib::CopyTagsToComments($meta);
return $meta;
}
开发者ID:shefik,项目名称:MediaModule,代码行数:8,代码来源:GenericMetadataReader.php
示例9: getID3
public function getID3()
{
require_once PHPWS_SOURCE_DIR . 'lib/vendor/autoload.php';
$getID3 = new getID3();
// File to get info from
$file_location = $this->getPath();
// Get information from the file
$fileinfo = $getID3->analyze($file_location);
getid3_lib::CopyTagsToComments($fileinfo);
return $fileinfo;
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:11,代码来源:Multimedia.php
示例10: Info
/**
* Extract information - only public function
*
* @access public
* @param string file Audio file to extract info from.
*/
function Info($file)
{
// Analyze file
$this->info = $this->getID3->analyze($file);
// Exit here on error
if (isset($this->info['error'])) {
return array('error' => $this->info['error']);
} else {
getid3_lib::CopyTagsToComments($this->info);
}
// Init wrapper object
$this->result = array();
$this->result['format_name'] = (isset($this->info['fileformat']) ? $this->info['fileformat'] : '') . '/' . (isset($this->info['audio']['dataformat']) ? $this->info['audio']['dataformat'] : '') . (isset($this->info['video']['dataformat']) ? '/' . $this->info['video']['dataformat'] : '');
$this->result['encoder_version'] = isset($this->info['audio']['encoder']) ? $this->info['audio']['encoder'] : '';
$this->result['encoder_options'] = isset($this->info['audio']['encoder_options']) ? $this->info['audio']['encoder_options'] : '';
$this->result['bitrate_mode'] = isset($this->info['audio']['bitrate_mode']) ? $this->info['audio']['bitrate_mode'] : '';
$this->result['channels'] = isset($this->info['audio']['channels']) ? $this->info['audio']['channels'] : '';
$this->result['sample_rate'] = isset($this->info['audio']['sample_rate']) ? $this->info['audio']['sample_rate'] : '';
$this->result['bits_per_sample'] = isset($this->info['audio']['bits_per_sample']) ? $this->info['audio']['bits_per_sample'] : '';
$this->result['playing_time'] = isset($this->info['playtime_seconds']) ? $this->info['playtime_seconds'] : '';
$this->result['playtime_string'] = isset($this->info['playtime_string']) ? $this->info['playtime_string'] : '';
$this->result['avg_bit_rate'] = isset($this->info['audio']['bitrate']) ? $this->info['audio']['bitrate'] : '';
$this->result['tags'] = isset($this->info['tags']) ? $this->info['tags'] : '';
$this->result['comments'] = isset($this->info['comments']) ? $this->info['comments'] : '';
$this->result['warning'] = isset($this->info['warning']) ? $this->info['warning'] : '';
$this->result['md5'] = isset($this->info['md5_data']) ? $this->info['md5_data'] : '';
// Post getID3() data handling based on file format
$method = (isset($this->info['fileformat']) ? $this->info['fileformat'] : '') . 'Info';
if ($method && method_exists($this, $method)) {
$this->{$method}();
}
return $this->result;
}
开发者ID:skubij,项目名称:omxplayer-ui,代码行数:39,代码来源:audioinfo.php
示例11: readFileDirectory
function readFileDirectory($path)
{
global $mysql, $getID3, $albumSongs;
foreach (scandir($path) as $currentFile) {
if ($currentFile == "." || $currentFile == "..") {
continue;
}
$fullPath = $path . "/" . $currentFile;
if (is_dir($fullPath)) {
readFileDirectory($fullPath);
} else {
$fileExtension = pathinfo($currentFile, PATHINFO_EXTENSION);
if ($fileExtension == "mp3" || $fileExtension == "wav" || $fileExtension == "ogg") {
$songInfo = $getID3->analyze($fullPath);
getid3_lib::CopyTagsToComments($songInfo);
if (!$songInfo['comments_html']['title'][0]) {
$songInfo['comments_html']['title'][0] = basename($currentFile);
}
if ($songInfo['tags']['id3v2']['album'][0]) {
$albumSongs[escape($songInfo['tags']['id3v2']['album'][0])] = true;
} else {
$albumSongs[escape($songInfo['comments_html']['artist'][0])] = true;
}
$mysql->query("INSERT INTO `songs` (`path`, `title`, `artist`, `album`, `length`) VALUES ('{$fullPath}', '" . escape($songInfo['comments_html']['title'][0]) . "', '" . escape($songInfo['comments_html']['artist'][0]) . "', '" . escape($songInfo['tags']['id3v2']['album'][0]) . "', '" . escape($songInfo['playtime_string']) . "')");
}
}
}
}
开发者ID:andrew4699,项目名称:Media-Center,代码行数:28,代码来源:update.php
示例12: Analyze
public function Analyze()
{
$info =& $this->getid3->info;
$info['fileformat'] = 'rar';
if ($this->option_use_rar_extension === true) {
if (function_exists('rar_open')) {
if ($rp = rar_open($info['filenamepath'])) {
$info['rar']['files'] = array();
$entries = rar_list($rp);
foreach ($entries as $entry) {
$info['rar']['files'] = getid3_lib::array_merge_clobber($info['rar']['files'], getid3_lib::CreateDeepArray($entry->getName(), '/', $entry->getUnpackedSize()));
}
rar_close($rp);
return true;
} else {
$info['error'][] = 'failed to rar_open(' . $info['filename'] . ')';
}
} else {
$info['error'][] = 'RAR support does not appear to be available in this PHP installation';
}
} else {
$info['error'][] = 'PHP-RAR processing has been disabled (set $getid3_rar->option_use_rar_extension=true to enable)';
}
return false;
}
开发者ID:anandsrijan,项目名称:mahariya-001,代码行数:25,代码来源:module.archive.rar.php
示例13: parseSoundFile
public static function parseSoundFile($filename)
{
global $getID3;
// Get sound meta
$id3 = $getID3->analyze($filename);
getid3_lib::CopyTagsToComments($id3);
// Validate
if (!Sounds::validateID3($id3)) {
unlink($filename);
return false;
}
// Make our directory
$artist = @$id3['comments']['artist'][0];
$album = @$id3['comments']['album'][0];
$dir = DOC_ROOT . '/music/' . Sounds::safeDirectory($artist) . '/' . Sounds::safeDirectory($album);
if (!is_dir($dir)) {
mkdir($dir, 0777, true);
}
// Our new filename
$moved = $dir . '/' . basename($filename);
// Already exists! Madness!
if (file_exists($moved)) {
unlink($filename);
return false;
}
// Move
rename($filename, $moved);
// Create and Save
$sound = new Sound(array('filename' => $moved));
$sound->save();
return $sound;
}
开发者ID:jakemdunn,项目名称:node-player,代码行数:32,代码来源:class.sounds.php
示例14: Analyze
function Analyze()
{
$info =& $this->getid3->info;
fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
$DSSheader = fread($this->getid3->fp, 1256);
if (!preg_match('#^(\\x02|\\x03)dss#', $DSSheader)) {
$info['error'][] = 'Expecting "[02-03] 64 73 73" at offset ' . $info['avdataoffset'] . ', found "' . getid3_lib::PrintHexBytes(substr($DSSheader, 0, 4)) . '"';
return false;
}
// some structure information taken from http://cpansearch.perl.org/src/RGIBSON/Audio-DSS-0.02/lib/Audio/DSS.pm
// shortcut
$info['dss'] = array();
$thisfile_dss =& $info['dss'];
$info['fileformat'] = 'dss';
$info['audio']['dataformat'] = 'dss';
$info['audio']['bitrate_mode'] = 'cbr';
//$thisfile_dss['encoding'] = 'ISO-8859-1';
$thisfile_dss['version'] = ord(substr($DSSheader, 0, 1));
$thisfile_dss['date_create'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 38, 12));
$thisfile_dss['date_complete'] = $this->DSSdateStringToUnixDate(substr($DSSheader, 50, 12));
//$thisfile_dss['length'] = intval(substr($DSSheader, 62, 6)); // I thought time was in seconds, it's actually HHMMSS
$thisfile_dss['length'] = intval(substr($DSSheader, 62, 2) * 3600 + substr($DSSheader, 64, 2) * 60 + substr($DSSheader, 66, 2));
$thisfile_dss['priority'] = ord(substr($DSSheader, 793, 1));
$thisfile_dss['comments'] = trim(substr($DSSheader, 798, 100));
//$info['audio']['bits_per_sample'] = ?;
//$info['audio']['sample_rate'] = ?;
$info['audio']['channels'] = 1;
$info['playtime_seconds'] = $thisfile_dss['length'];
$info['audio']['bitrate'] = $info['filesize'] * 8 / $info['playtime_seconds'];
return true;
}
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:31,代码来源:module.audio.dss.php
示例15: getid3_exe
function getid3_exe(&$fd, &$ThisFileInfo)
{
fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
$EXEheader = fread($fd, 28);
if (substr($EXEheader, 0, 2) != 'MZ') {
$ThisFileInfo['error'][] = 'Expecting "MZ" at offset ' . $ThisFileInfo['avdataoffset'] . ', found "' . substr($EXEheader, 0, 2) . '" instead.';
return false;
}
$ThisFileInfo['fileformat'] = 'exe';
$ThisFileInfo['exe']['mz']['magic'] = 'MZ';
$ThisFileInfo['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2));
$ThisFileInfo['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2));
$ThisFileInfo['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2));
$ThisFileInfo['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2));
$ThisFileInfo['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2));
$ThisFileInfo['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2));
$ThisFileInfo['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2));
$ThisFileInfo['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2));
$ThisFileInfo['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2));
$ThisFileInfo['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4));
$ThisFileInfo['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2));
$ThisFileInfo['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2));
$ThisFileInfo['exe']['mz']['byte_size'] = ($ThisFileInfo['exe']['mz']['raw']['page_count'] - 1) * 512 + $ThisFileInfo['exe']['mz']['raw']['last_page_size'];
$ThisFileInfo['exe']['mz']['header_size'] = $ThisFileInfo['exe']['mz']['raw']['header_paragraphs'] * 16;
$ThisFileInfo['exe']['mz']['memory_minimum'] = $ThisFileInfo['exe']['mz']['raw']['min_memory_paragraphs'] * 16;
$ThisFileInfo['exe']['mz']['memory_recommended'] = $ThisFileInfo['exe']['mz']['raw']['max_memory_paragraphs'] * 16;
$ThisFileInfo['error'][] = 'EXE parsing not enabled in this version of getID3()';
return false;
}
开发者ID:ninthlink,项目名称:m2m,代码行数:29,代码来源:module.misc.exe.php
示例16: Analyze
public function Analyze()
{
$info =& $this->getid3->info;
$this->fseek($info['avdataoffset']);
$EXEheader = $this->fread(28);
$magic = 'MZ';
if (substr($EXEheader, 0, 2) != $magic) {
$info['error'][] = 'Expecting "' . getid3_lib::PrintHexBytes($magic) . '" at offset ' . $info['avdataoffset'] . ', found "' . getid3_lib::PrintHexBytes(substr($EXEheader, 0, 2)) . '"';
return false;
}
$info['fileformat'] = 'exe';
$info['exe']['mz']['magic'] = 'MZ';
$info['exe']['mz']['raw']['last_page_size'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 2, 2));
$info['exe']['mz']['raw']['page_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 4, 2));
$info['exe']['mz']['raw']['relocation_count'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 6, 2));
$info['exe']['mz']['raw']['header_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 8, 2));
$info['exe']['mz']['raw']['min_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 10, 2));
$info['exe']['mz']['raw']['max_memory_paragraphs'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 12, 2));
$info['exe']['mz']['raw']['initial_ss'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 14, 2));
$info['exe']['mz']['raw']['initial_sp'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 16, 2));
$info['exe']['mz']['raw']['checksum'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 18, 2));
$info['exe']['mz']['raw']['cs_ip'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 20, 4));
$info['exe']['mz']['raw']['relocation_table_offset'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 24, 2));
$info['exe']['mz']['raw']['overlay_number'] = getid3_lib::LittleEndian2Int(substr($EXEheader, 26, 2));
$info['exe']['mz']['byte_size'] = ($info['exe']['mz']['raw']['page_count'] - 1) * 512 + $info['exe']['mz']['raw']['last_page_size'];
$info['exe']['mz']['header_size'] = $info['exe']['mz']['raw']['header_paragraphs'] * 16;
$info['exe']['mz']['memory_minimum'] = $info['exe']['mz']['raw']['min_memory_paragraphs'] * 16;
$info['exe']['mz']['memory_recommended'] = $info['exe']['mz']['raw']['max_memory_paragraphs'] * 16;
$info['error'][] = 'EXE parsing not enabled in this version of getID3() [' . $this->getid3->version() . ']';
return false;
}
开发者ID:ndurchx,项目名称:music,代码行数:31,代码来源:module.misc.exe.php
示例17: getid3_jpg
function getid3_jpg(&$fd, &$ThisFileInfo)
{
$ThisFileInfo['fileformat'] = 'jpg';
$ThisFileInfo['video']['dataformat'] = 'jpg';
$ThisFileInfo['video']['lossless'] = false;
$ThisFileInfo['video']['bits_per_sample'] = 24;
$ThisFileInfo['video']['pixel_aspect_ratio'] = (double) 1;
fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
list($width, $height, $type) = getid3_lib::GetDataImageSize(fread($fd, $ThisFileInfo['filesize']));
if ($type == 2) {
$ThisFileInfo['video']['resolution_x'] = $width;
$ThisFileInfo['video']['resolution_y'] = $height;
if (version_compare(phpversion(), '4.2.0', '>=')) {
if (function_exists('exif_read_data')) {
ob_start();
$ThisFileInfo['jpg']['exif'] = exif_read_data($ThisFileInfo['filenamepath'], '', true, false);
$errors = ob_get_contents();
if ($errors) {
$ThisFileInfo['error'][] = strip_tags($errors);
unset($ThisFileInfo['jpg']['exif']);
}
ob_end_clean();
} else {
$ThisFileInfo['warning'][] = 'EXIF parsing only available when ' . (GETID3_OS_ISWINDOWS ? 'php_exif.dll enabled' : 'compiled with --enable-exif');
}
} else {
$ThisFileInfo['warning'][] = 'EXIF parsing only available in PHP v4.2.0 and higher compiled with --enable-exif (or php_exif.dll enabled for Windows). You are using PHP v' . phpversion();
}
return true;
}
unset($ThisFileInfo['fileformat']);
return false;
}
开发者ID:ookwudili,项目名称:chisimba,代码行数:33,代码来源:module.graphic.jpg.php
示例18: Analyze
public function Analyze()
{
$getid3 = $this->getid3;
fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
$au_header = fread($getid3->fp, 8);
// Magic bytes: .snd
$getid3->info['au'] = array();
$info_au =& $getid3->info['au'];
$getid3->info['fileformat'] = 'au';
$getid3->info['audio']['dataformat'] = 'au';
$getid3->info['audio']['bitrate_mode'] = 'cbr';
$info_au['encoding'] = 'ISO-8859-1';
$info_au['header_length'] = getid3_lib::BigEndian2Int(substr($au_header, 4, 4));
$au_header .= fread($getid3->fp, $info_au['header_length'] - 8);
$getid3->info['avdataoffset'] += $info_au['header_length'];
getid3_lib::ReadSequence('BigEndian2Int', $info_au, $au_header, 8, array('data_size' => 4, 'data_format_id' => 4, 'sample_rate' => 4, 'channels' => 4));
$info_au['comments']['comment'][] = trim(substr($au_header, 24));
$info_au['data_format'] = getid3_au::AUdataFormatNameLookup($info_au['data_format_id']);
$info_au['used_bits_per_sample'] = getid3_au::AUdataFormatUsedBitsPerSampleLookup($info_au['data_format_id']);
if ($info_au['bits_per_sample'] = getid3_au::AUdataFormatBitsPerSampleLookup($info_au['data_format_id'])) {
$getid3->info['audio']['bits_per_sample'] = $info_au['bits_per_sample'];
} else {
unset($info_au['bits_per_sample']);
}
$getid3->info['audio']['sample_rate'] = $info_au['sample_rate'];
$getid3->info['audio']['channels'] = $info_au['channels'];
if ($getid3->info['avdataoffset'] + $info_au['data_size'] > $getid3->info['avdataend']) {
$getid3->warning('Possible truncated file - expecting "' . $info_au['data_size'] . '" bytes of audio data, only found ' . ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) . ' bytes"');
}
$getid3->info['playtime_seconds'] = $info_au['data_size'] / ($info_au['sample_rate'] * $info_au['channels'] * ($info_au['used_bits_per_sample'] / 8));
$getid3->info['audio']['bitrate'] = $info_au['data_size'] * 8 / $getid3->info['playtime_seconds'];
return true;
}
开发者ID:pheski,项目名称:Scribite,代码行数:33,代码来源:module.audio.au.php
示例19: Analyze
public function Analyze()
{
$getid3 = $this->getid3;
// http://www.uni-jena.de/~pfk/mpp/sv8/header.html
$getid3->info['mpc']['header'] = array();
$info_mpc_header =& $getid3->info['mpc']['header'];
$getid3->info['fileformat'] = 'mpc';
$getid3->info['audio']['dataformat'] = 'mpc';
$getid3->info['audio']['bitrate_mode'] = 'vbr';
$getid3->info['audio']['channels'] = 2;
// the format appears to be hardcoded for stereo only
$getid3->info['audio']['lossless'] = false;
fseek($getid3->fp, $getid3->info['avdataoffset'], SEEK_SET);
$info_mpc_header['size'] = 8;
$getid3->info['avdataoffset'] += $info_mpc_header['size'];
$mpc_header_data = fread($getid3->fp, $info_mpc_header['size']);
// Most of this code adapted from Jurgen Faul's MPEGplus source code - thanks Jurgen! :)
$header_dword[0] = getid3_lib::LittleEndian2Int(substr($mpc_header_data, 0, 4));
$header_dword[1] = getid3_lib::LittleEndian2Int(substr($mpc_header_data, 4, 4));
// DDDD DDDD CCCC CCCC BBBB BBBB AAAA AAAA
// aaaa aaaa abcd dddd dddd deee eeff ffff
//
// a = bitrate = anything
// b = IS = anything
// c = MS = anything
// d = streamversion = 0000000004 or 0000000005 or 0000000006
// e = maxband = anything
// f = blocksize = 000001 for SV5+, anything(?) for SV4
$info_mpc_header['target_bitrate'] = ($header_dword[0] & 4286578688.0) >> 23;
$info_mpc_header['intensity_stereo'] = (bool) (($header_dword[0] & 0x400000) >> 22);
$info_mpc_header['mid-side_stereo'] = (bool) (($header_dword[0] & 0x200000) >> 21);
$info_mpc_header['stream_major_version'] = ($header_dword[0] & 0x1ff800) >> 11;
$info_mpc_header['stream_minor_version'] = 0;
$info_mpc_header['max_band'] = ($header_dword[0] & 0x7c0) >> 6;
// related to lowpass frequency, not sure how it translates exactly
$info_mpc_header['block_size'] = $header_dword[0] & 0x3f;
switch ($info_mpc_header['stream_major_version']) {
case 4:
$info_mpc_header['frame_count'] = $header_dword[1] >> 16;
break;
case 5:
case 6:
$info_mpc_header['frame_count'] = $header_dword[1];
break;
default:
throw new getid3_exception('Expecting 4, 5 or 6 in version field, found ' . $info_mpc_header['stream_major_version'] . ' instead');
}
if ($info_mpc_header['stream_major_version'] > 4 && $info_mpc_header['block_size'] != 1) {
$getid3->warning('Block size expected to be 1, actual value found: ' . $info_mpc_header['block_size']);
}
$info_mpc_header['sample_rate'] = $getid3->info['audio']['sample_rate'] = 44100;
// AB: used by all files up to SV7
$info_mpc_header['samples'] = $info_mpc_header['frame_count'] * 1152 * $getid3->info['audio']['channels'];
$getid3->info['audio']['bitrate_mode'] = $info_mpc_header['target_bitrate'] == 0 ? 'vbr' : 'cbr';
$getid3->info['mpc']['bitrate'] = ($getid3->info['avdataend'] - $getid3->info['avdataoffset']) * 8 * 44100 / $info_mpc_header['frame_count'] / 1152;
$getid3->info['audio']['bitrate'] = $getid3->info['mpc']['bitrate'];
$getid3->info['audio']['encoder'] = 'SV' . $info_mpc_header['stream_major_version'];
return true;
}
开发者ID:ryumaru,项目名称:ryuzinewriter,代码行数:59,代码来源:module.audio.mpc_old.php
示例20: Analyze
function Analyze()
{
$info =& $this->getid3->info;
fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
$SZIPHeader = fread($this->getid3->fp, 6);
if (substr($SZIPHeader, 0, 4) != "SZ\n") {
$info['error'][] = 'Expecting "53 5A 0A 04" at offset ' . $info['avdataoffset'] . ', found "' . getid3_lib::PrintHexBytes(substr($SZIPHeader, 0, 4)) . '"';
return false;
}
$info['fileformat'] = 'szip';
$info['szip']['major_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 4, 1));
$info['szip']['minor_version'] = getid3_lib::BigEndian2Int(substr($SZIPHeader, 5, 1));
while (!feof($this->getid3->fp)) {
$NextBlockID = fread($this->getid3->fp, 2);
switch ($NextBlockID) {
case 'SZ':
// Note that szip files can be concatenated, this has the same effect as
// concatenating the files. this also means that global header blocks
// might be present between directory/data blocks.
fseek($this->getid3->fp, 4, SEEK_CUR);
break;
case 'BH':
$BHheaderbytes = getid3_lib::BigEndian2Int(fread($this->getid3->fp, 3));
$BHheaderdata = fread($this->getid3->fp, $BHheaderbytes);
$BHheaderoffset = 0;
while (strpos($BHheaderdata, "", $BHheaderoffset) > 0) {
//filename as \0 terminated string (empty string indicates end)
//owner as \0 terminated string (empty is same as last file)
//group as \0 terminated string (empty is same as last file)
//3 byte filelength in this block
//2 byte access flags
//4 byte creation time (like in unix)
//4 byte modification time (like in unix)
//4 byte access time (like in unix)
$BHdataArray['filename'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, ""));
$BHheaderoffset += strlen($BHdataArray['filename']) + 1;
$BHdataArray['owner'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, ""));
$BHheaderoffset += strlen($BHdataArray['owner']) + 1;
$BHdataArray['group'] = substr($BHheaderdata, $BHheaderoffset, strcspn($BHheaderdata, ""));
$BHheaderoffset += strlen($BHdataArray['group']) + 1;
$BHdataArray['filelength'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 3));
$BHheaderoffset += 3;
$BHdataArray['access_flags'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 2));
$BHheaderoffset += 2;
$BHdataArray['creation_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
$BHheaderoffset += 4;
$BHdataArray['modification_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
$BHheaderoffset += 4;
$BHdataArray['access_time'] = getid3_lib::BigEndian2Int(substr($BHheaderdata, $BHheaderoffset, 4));
$BHheaderoffset += 4;
$info['szip']['BH'][] = $BHdataArray;
}
break;
default:
break 2;
}
}
return true;
}
开发者ID:thelectronicnub,项目名称:shimmie2,代码行数:59,代码来源:module.archive.szip.php
注:本文中的getid3_lib类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论