Skip to content

Commit

Permalink
Fixes after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
StudioMaX committed May 26, 2019
1 parent fd98ac1 commit abe783f
Show file tree
Hide file tree
Showing 35 changed files with 231 additions and 192 deletions.
1 change: 0 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
"require-dev": {
"phpunit/phpunit": "^4.8|^5.0",
"jakub-onderka/php-parallel-lint": "^0.9 || ^1.0"
"phpstan/phpstan": "^0.9"
},
"scripts": {
"lint": "parallel-lint --exclude vendor .",
Expand Down
14 changes: 9 additions & 5 deletions demos/demo.dirscan.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,19 @@

require __DIR__ . "/../vendor/autoload.php";

/////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
// available at https://github.com/JamesHeinrich/getID3 //
// or https://www.getid3.org //
// or http://getid3.sourceforge.net //
/////////////////////////////////////////////////////////////////////////////////
/// //
// demo.dirscan.php - tool for batch media file processing with getID3() //
// ///
// //
// /demo/demo.dirscan.php - part of getID3() //
// Directory Scanning and Caching CLI tool for batch media //
// file processing with getID3() //
// by Karl G. Holz <newaeonØmac*com> //
// ///
/////////////////////////////////////////////////////////////////

/**
* This is a directory scanning and caching cli tool for getID3().
*
Expand Down
2 changes: 1 addition & 1 deletion demos/demo.zip.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
function UnzipFileContents($filename, &$errors) {
$errors = array();
$DecompressedFileContents = array();
$getid3 = new GetID3\GetID3;
$getid3 = new GetID3\GetID3();
$getid3->info['filesize'] = filesize($filename);
ob_start();
if ($getid3->fp = fopen($filename, 'rb')) {
Expand Down
2 changes: 1 addition & 1 deletion docs/External-Issues.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Known Bugs/Issues in other programs
===================================

<http://www.getid3.org/phpBB3/viewtopic.php?t=25>
<https://www.getid3.org/phpBB3/viewtopic.php?t=25>

* Windows Media Player (up to v11) and iTunes (up to v10+) do
not correctly handle ID3v2.3 tags with UTF-16BE+BOM
Expand Down
2 changes: 1 addition & 1 deletion docs/Known-Issues.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Known Bugs/Issues in getID3() that cannot be fixed
==================================================

<http://www.getid3.org/phpBB3/viewtopic.php?t=25>
<https://www.getid3.org/phpBB3/viewtopic.php?t=25>

* 32-bit PHP installations only:
Files larger than 2GB cannot always be parsed fully by getID3()
Expand Down
2 changes: 1 addition & 1 deletion docs/Outstanding-Issues.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Known Bugs/Issues in getID3() that may be fixed eventually
==========================================================

<http://www.getid3.org/phpBB3/viewtopic.php?t=25>
<https://www.getid3.org/phpBB3/viewtopic.php?t=25>

* Cannot determine bitrate for MPEG video with VBR video data
(need documentation)
Expand Down
10 changes: 5 additions & 5 deletions docs/TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Future Plans
============

<http://www.getid3.org/phpBB3/viewforum.php?f=7>
<https://www.getid3.org/phpBB3/viewforum.php?f=7>

* Better support for MP4 container format
* Scan for appended ID3v2 tag at end of file per ID3v2.4 specs (Section 5.0)
Expand Down Expand Up @@ -43,11 +43,11 @@ Future Plans
* Optional scan-through-frames for AVI verification
(thanks rockcohenØmassive-interactive*nl)
* Support for TTF (thanks infoØbutterflyx*com)
* Support for DSS (http://www.getid3.org/phpBB3/viewtopic.php?t=171)
* Support for DSS (https://www.getid3.org/phpBB3/viewtopic.php?t=171)
* Support for SMAF (http://smaf-yamaha.com/what/demo.html)
http://www.getid3.org/phpBB3/viewtopic.php?t=182
* Support for AMR (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
* Support for 3gpp (http://www.getid3.org/phpBB3/viewtopic.php?t=195)
https://www.getid3.org/phpBB3/viewtopic.php?t=182
* Support for AMR (https://www.getid3.org/phpBB3/viewtopic.php?t=195)
* Support for 3gpp (https://www.getid3.org/phpBB3/viewtopic.php?t=195)
* Support for ID4 (http://www.wackysoft.cjb.net grizlyY2KØhotmail*com)
* Parse XML data returned in Ogg comments
* Parse XML data from Quicktime SMIL metafiles (klausrathØmac*com)
Expand Down
27 changes: 27 additions & 0 deletions docs/Upgrading.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,33 @@ getid3_write_real Write\Real
getid3_write_vorbiscomment Write\VorbisComment
```

```php
Old constant New constant
GETID3_MIDI_MAGIC_MTHD JamesHeinrich\GetID3\Module\Audio\Midi::MAGIC_MTHD
GETID3_MIDI_MAGIC_MTRK JamesHeinrich\GetID3\Module\Audio\Midi::MAGIC_MTRK
GETID3_MP3_VALID_CHECK_FRAMES JamesHeinrich\GetID3\Module\Audio\Mp3::VALID_CHECK_FRAMES
GETID3_FLV_TAG_AUDIO JamesHeinrich\GetID3\Module\AudioVideo\Flv::TAG_AUDIO
GETID3_FLV_TAG_VIDEO JamesHeinrich\GetID3\Module\AudioVideo\Flv::TAG_VIDEO
GETID3_FLV_TAG_META JamesHeinrich\GetID3\Module\AudioVideo\Flv::TAG_META
GETID3_FLV_VIDEO_H263 JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_H263
GETID3_FLV_VIDEO_SCREEN JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_SCREEN
GETID3_FLV_VIDEO_VP6FLV JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_VP6FLV
GETID3_FLV_VIDEO_VP6FLV_ALPHA JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_VP6FLV_ALPHA
GETID3_FLV_VIDEO_SCREENV2 JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_SCREENV2
GETID3_FLV_VIDEO_H264 JamesHeinrich\GetID3\Module\AudioVideo\Flv::VIDEO_H264
H264_AVC_SEQUENCE_HEADER JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_AVC_SEQUENCE_HEADER
H264_PROFILE_BASELINE JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_BASELINE
H264_PROFILE_MAIN JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_MAIN
H264_PROFILE_EXTENDED JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_EXTENDED
H264_PROFILE_HIGH JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_HIGH
H264_PROFILE_HIGH10 JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_HIGH10
H264_PROFILE_HIGH422 JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_HIGH422
H264_PROFILE_HIGH444 JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_HIGH444
H264_PROFILE_HIGH444_PREDICTIVE JamesHeinrich\GetID3\Module\AudioVideo\Flv::H264_PROFILE_HIGH444_PREDICTIVE
EBML_ID_* JamesHeinrich\GetID3\Module\AudioVideo\Matroska::ID_*

```


__Temp Directory__
Previously the temp directory could be set by defining a global constant called GETID3_TEMP_DIR
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Dbm.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ public function clear_cache() {
*
* @return mixed
*/
public function analyze($filename, $filesize=null, $original_filename='') {
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {

if (file_exists($filename)) {

Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ public function clear_cache() {
*
* @return mixed
*/
public function analyze($filename, $filesize=null, $original_filename='') {
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {

$filetime = 0;
if (file_exists($filename)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Mysqli.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ public function migrate_db_structure() {
*
* @return mixed
*/
public function analyze($filename, $filesize=null, $original_filename='') {
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {

$filetime = 0;
if (file_exists($filename)) {
Expand Down
2 changes: 1 addition & 1 deletion src/Cache/Sqlite3.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private function clear_cache() {
*
* @return mixed|false
*/
public function analyze($filename, $filesize=null, $original_filename='') {
public function analyze($filename, $filesize=null, $original_filename='', $fp=null) {
if (!file_exists($filename)) {
return false;
}
Expand Down
3 changes: 1 addition & 2 deletions src/GetID3.php
Original file line number Diff line number Diff line change
Expand Up @@ -1050,8 +1050,7 @@ public function GetFileFormatArray() {
// XZ - data - XZ compressed data
'xz' => array(
'pattern' => '^\\xFD7zXZ\\x00',
'group' => 'archive',
'module' => 'xz',
'module' => 'Archive\\Xz',
'mime_type' => 'application/x-xz',
'fail_id3' => 'ERROR',
'fail_ape' => 'ERROR',
Expand Down
4 changes: 2 additions & 2 deletions src/Module/Archive/Gzip.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function Analyze() {

// determine format
$formattest = substr($inflated, 0, 32774);
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$determined_format = $getid3_temp->GetFileFormat($formattest);
unset($getid3_temp);

Expand All @@ -233,7 +233,7 @@ public function Analyze() {
if ($fp_temp_tar = fopen($temp_tar_filename, 'w+b')) {
fwrite($fp_temp_tar, $inflated);
fclose($fp_temp_tar);
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($temp_tar_filename);
$getid3_tar = new Tar($getid3_temp);
$getid3_tar->Analyze();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?php

namespace JamesHeinrich\GetID3\Module\Archive;

use JamesHeinrich\GetID3\Module\Handler;
use JamesHeinrich\GetID3\Utils;

/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
// available at https://github.com/JamesHeinrich/getID3 //
Expand All @@ -10,14 +15,11 @@
// //
// module.archive.xz.php //
// module for analyzing XZ files //
// dependencies: NONE //
// ///
/////////////////////////////////////////////////////////////////


class getid3_xz extends getid3_handler
class Xz extends Handler
{

/**
* @return bool
*/
Expand All @@ -30,7 +32,7 @@ public function Analyze() {
// https://tukaani.org/xz/xz-file-format-1.0.4.txt
$info['xz']['stream_header']['magic'] = substr($xzheader, 0, 6);
if ($info['xz']['stream_header']['magic'] != "\xFD".'7zXZ'."\x00") {
$this->error('Invalid XZ stream header magic (expecting FD 37 7A 58 5A 00, found '.getid3_lib::PrintHexBytes($info['xz']['stream_header']['magic']).') at offset '.$info['avdataoffset']);
$this->error('Invalid XZ stream header magic (expecting FD 37 7A 58 5A 00, found '.Utils::PrintHexBytes($info['xz']['stream_header']['magic']).') at offset '.$info['avdataoffset']);
return false;
}
$info['fileformat'] = 'xz';
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Audio/Avr.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function Analyze() {
$info['avr']['raw']['magic'] = substr($AVRheader, 0, 4);
$magic = '2BIT';
if ($info['avr']['raw']['magic'] != $magic) {
$this->error($info['error'][] = 'Expecting "'.Utils::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.Utils::PrintHexBytes($info['avr']['raw']['magic']).'"');
$this->error('Expecting "'.Utils::PrintHexBytes($magic).'" at offset '.$info['avdataoffset'].', found "'.Utils::PrintHexBytes($info['avr']['raw']['magic']).'"');
unset($info['fileformat']);
unset($info['avr']);
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Audio/Bonk.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function HandleBonkTags($BonkTagName) {
case ' ID3':
$info['audio']['encoder'] = 'Extended BONK v0.9+';

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_id3v2 = new ID3v2($getid3_temp);
$getid3_id3v2->StartingOffset = $info['bonk'][' ID3']['offset'] + 2;
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Audio/La.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public function Analyze() {
fwrite($RIFF_fp, $RIFFdata, strlen($RIFFdata));
fclose($RIFF_fp);

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($RIFFtempfilename);
$getid3_riff = new Riff($getid3_temp);
$getid3_riff->Analyze();
Expand Down
2 changes: 1 addition & 1 deletion src/Module/Audio/Lpac.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function Analyze() {
break;
}

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info = $info;
$getid3_riff = new Riff($getid3_temp);
Expand Down
8 changes: 4 additions & 4 deletions src/Module/Audio/Ogg.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,14 +274,14 @@ public function Analyze() {

$info['ogg']['flac']['header']['version_major'] = ord(substr($filedata, 5, 1));
$info['ogg']['flac']['header']['version_minor'] = ord(substr($filedata, 6, 1));
$info['ogg']['flac']['header']['header_packets'] = getid3_lib::BigEndian2Int(substr($filedata, 7, 2)) + 1; // "A two-byte, big-endian binary number signifying the number of header (non-audio) packets, not including this one. This number may be zero (0x0000) to signify 'unknown' but be aware that some decoders may not be able to handle such streams."
$info['ogg']['flac']['header']['header_packets'] = Utils::BigEndian2Int(substr($filedata, 7, 2)) + 1; // "A two-byte, big-endian binary number signifying the number of header (non-audio) packets, not including this one. This number may be zero (0x0000) to signify 'unknown' but be aware that some decoders may not be able to handle such streams."
$info['ogg']['flac']['header']['magic'] = substr($filedata, 9, 4);
if ($info['ogg']['flac']['header']['magic'] != 'fLaC') {
$this->error('Ogg-FLAC expecting "fLaC", found "'.$info['ogg']['flac']['header']['magic'].'" ('.trim(getid3_lib::PrintHexBytes($info['ogg']['flac']['header']['magic'])).')');
$this->error('Ogg-FLAC expecting "fLaC", found "'.$info['ogg']['flac']['header']['magic'].'" ('.trim(Utils::PrintHexBytes($info['ogg']['flac']['header']['magic'])).')');
return false;
}
$info['ogg']['flac']['header']['STREAMINFO_bytes'] = getid3_lib::BigEndian2Int(substr($filedata, 13, 4));
$info['flac']['STREAMINFO'] = getid3_flac::parseSTREAMINFOdata(substr($filedata, 17, 34));
$info['ogg']['flac']['header']['STREAMINFO_bytes'] = Utils::BigEndian2Int(substr($filedata, 13, 4));
$info['flac']['STREAMINFO'] = Flac::parseSTREAMINFOdata(substr($filedata, 17, 34));
if (!empty($info['flac']['STREAMINFO']['sample_rate'])) {
$info['audio']['bitrate_mode'] = 'vbr';
$info['audio']['sample_rate'] = $info['flac']['STREAMINFO']['sample_rate'];
Expand Down
4 changes: 2 additions & 2 deletions src/Module/Audio/OptimFrog.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function ParseOptimFROGheader42() {
// to skip over the data chunk
$RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
$getid3_temp->info['avdataend'] = $info['avdataend'];
Expand Down Expand Up @@ -310,7 +310,7 @@ public function ParseOptimFROGheader45() {
// to skip over the data chunk
$RIFFdata = substr($RIFFdata, 0, 36).substr($RIFFdata, 44).substr($RIFFdata, 36, 8);

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info['avdataoffset'] = $info['avdataoffset'];
$getid3_temp->info['avdataend'] = $info['avdataend'];
Expand Down
4 changes: 2 additions & 2 deletions src/Module/Audio/WavPack.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public function Analyze() {
case 0x21: // ID_RIFF_HEADER
$original_wav_filesize = Utils::LittleEndian2Int(substr($metablock['data'], 4, 4));

$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_riff = new Riff($getid3_temp);
$getid3_riff->ParseRIFFdata($metablock['data']);
Expand All @@ -245,7 +245,7 @@ public function Analyze() {
$metablockRIFFfooter = isset($metablockRIFFheader) ? $metablockRIFFheader : ''.$metablock['data'];

$startoffset = $metablock['offset'] + ($metablock['large_block'] ? 4 : 2);
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info['avdataend'] = $info['avdataend'];
//$getid3_temp->info['fileformat'] = 'riff';
Expand Down
13 changes: 6 additions & 7 deletions src/Module/AudioVideo/Matroska.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

/////////////////////////////////////////////////////////////////
/// getID3() by James Heinrich <info@getid3.org> //
// available at http://getid3.sourceforge.net //
// or http://www.getid3.org //
// also https://github.com/JamesHeinrich/getID3 //
/////////////////////////////////////////////////////////////////
// See readme.txt for more details //
// available at https://github.com/JamesHeinrich/getID3 //
// or https://www.getid3.org //
// or http://getid3.sourceforge.net //
// see readme.txt for more details //
/////////////////////////////////////////////////////////////////
// //
// module.audio-video.matriska.php //
Expand Down Expand Up @@ -367,7 +366,7 @@ public function Analyze()
}

// create temp instance
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
if ($track_info['dataformat'] != 'flac') {
$getid3_temp->openfile($this->getid3->filename);
}
Expand Down Expand Up @@ -433,7 +432,7 @@ public function Analyze()
$vorbis_offset -= 1;

// create temp instance
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();

// analyze
$getid3_ogg = new Ogg($getid3_temp);
Expand Down
2 changes: 1 addition & 1 deletion src/Module/AudioVideo/Mpeg.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ public function Analyze() {
$info['mpeg']['packed_elementary_streams'][$PackedElementaryStream['stream_type']][$PackedElementaryStream['stream_id']][] = $PackedElementaryStream;
*/
$getid3_temp = new GetID3;
$getid3_temp = new GetID3();
$getid3_temp->openfile($this->getid3->filename);
$getid3_temp->info = $info;
$getid3_mp3 = new Mp3($getid3_temp);
Expand Down
Loading

0 comments on commit abe783f

Please sign in to comment.