Skip to content

Commit 2e3e253

Browse files
committed
update getid3 to v1.9.23 & Sortable.js to v1.15.1
1 parent 6bcca88 commit 2e3e253

42 files changed

Lines changed: 1207 additions & 1510 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

external/ExtPrograms.csv

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ Program,Version,URL,Avail version,Exponent Customization Notes:
22
Swiftmailer,5.4.12/6.3.0,github.com/swiftmailer/swiftmailer,6.3.0,we add eDebugLogger & eDebugHtmlReporter plugins & fix php 5.6 ssl issue
33
Doctrine Lexer,2.1.0,github.com/doctrine/lexer,2.1.0/3.0.0,needed by swiftmailer v6
44
Doctrine Deprecations,1.1.2,github.com/doctrine/deprecations,1.1.2,needed by Doctrine Lexer v2
5-
EmailValidator,3.2.6,github.com/egulias/EmailValidator,3.2.6/4.0.1,needed by swiftmailer v6; change folder structure and add autoloader to main file
5+
EmailValidator,3.2.6,github.com/egulias/EmailValidator,3.2.6/4.0.2,needed by swiftmailer v6; change folder structure and add autoloader to main file
66
ups-php,0.2,github.com/sanbornm/ups-php,0.2,"updated/fixed xml, etc to work"
77
fedex-php,31.0.0,www.fedex.com/wpor/web/jsp/drclinks.jsp?links=wss/getstarted.html,31.0.0,copy/edit RateAvailableServicesWebServiceClient.php into fedexshippingcalculator->getRates()
88
Smarty,3.1.27/4.3.4,smarty.net,4.3.4,
99
phpthumb,1.7.22exp,github.com/JamesHeinrich/phpThumb,1.7.22,phpThumb.config.php - we also allow &amp in parsing and err command
10-
getid3,1.9.22,github.com/JamesHeinrich/getID3,1.9.22,
11-
minify,2.3.3,github.com/mrclay/minify,2.3.3/3.0.14,modify config.php
10+
getid3,1.9.22,github.com/JamesHeinrich/getID3,1.9.23,
11+
minify,2.3.3,github.com/mrclay/minify,2.3.3/3.0.4,modify config.php
1212
YUI2,2.9.0,developer.yahoo.com/yui/2,2.9.0,
1313
YUI3,3.18.1,github.com/yui/yui3,3.18.1,
1414
yui2in3,0.3,github.com/yui/2in3,0.3,
@@ -29,7 +29,7 @@ Twitter-Bootstrap2,2.3.2,github.com/twbs/bootstrap,2.3.2,"patched bootstrap.less
2929
Bootstrap3,3.4.1,github.com/twbs/bootstrap,3.4.1,patched bootstrap.less includes swatches & exp variables
3030
Bootstrap4,4.6.2,github.com/twbs/bootstrap,4.6.2,"patched bootstrap.scss includes swatches & exp variables, remove @page"
3131
Bootstrap5,5.3.2,github.com/twbs/bootstrap,5.3.2,patched bootstrap.scss includes swatches & exp variables
32-
popper.js/floating-ui,1.16.1,github.com/FezVrasta/popper.js,1.16.1/2.11.7,needed by BS4/BS5 (umd)
32+
popper.js/floating-ui,1.16.1,github.com/FezVrasta/popper.js,1.16.1/2.11.8,needed by BS4/BS5 (umd)
3333
Bootswatch2,2.3.2,bootswatch.com,2.3.2,
3434
Bootswatch3,3.4.1+1,bootswatch.com,3.4.1+1,change 1st line variables.less comment to output to .css file
3535
Bootswatch4,4.6.2,bootswatch.com,4.6.2,change 1st line variables.scss comment to output to .css file
@@ -39,7 +39,7 @@ Font-Awesome4,4.7.0,fontawesome.github.com/Font-Awesome,4.7.0,
3939
Font-Awesome5,5.15.4,fontawesome.com,5.15.4,add import all 'fonts' sheets into main sheet
4040
Font-Awesome6,6.5.1,fontawesome.com,6.5.1,add import all 'fonts' sheets into main sheet
4141
Bootstrap-Icons,1.11.2,icons.getbootstrap.com,1.11.2,"patched bootstrap-icons.scss for custom folder structure, includes animation & size variables"
42-
Adminer,4.8.1exp,www.adminer.org,4.8.1,"customized plugins: tinymce, ckeditor, previewSerialized, edit-textarea & edit-calendar; edit sql tweak"
42+
Adminer,4.8.1exp,www.adminer.org,4.8.3,"customized plugins: tinymce, ckeditor, previewSerialized, edit-textarea & edit-calendar; edit sql tweak"
4343
SimpleAjaxUploader,2.6.7,github.com/LPology/Simple-Ajax-Uploader,2.6.7,also converted to yui module 2.5.3
4444
normalize.css,8.0.1,necolas.github.com/normalize.css,8.0.1,auto included in bootstrap 3
4545
MediaElement.js,7.0.2,mediaelementjs.com,7.0.2,
@@ -79,10 +79,10 @@ Searcher,0.3.0,github.com/lloiser/jquery-searcher,0.3.0,
7979
DateTimePicker,2.5.21exp,github.com/xdan/datetimepicker,2.5.21,rename .full version; we add .js auto-close on inline date select and extra 'reset' work & remove .css z-index issue
8080
Bootstrap DateTimePicker,4.17.49,github.com/Eonasdan/bootstrap-datetimepicker,4.17.49,"patch for 'today' button in side-by-side view, modded version placed in bootstrap4theme & bootstrap5theme to help yadcf"
8181
Tempus Dominus Bootstrap 4,5.39.0,github.com/tempusdominus/bootstrap-4,5.39.0,
82-
Tempus Dominus Bootstrap 5,6.7.16,github.com/Eonasdan/tempus-dominus,6.7.19,added .inline z-index style; scss change @use color
82+
Tempus Dominus Bootstrap 5,6.7.16,github.com/Eonasdan/tempus-dominus,6.9.4,added .inline z-index style; scss change @use color
8383
moment.js,2.29.4,github.com/moment/moment,2.29.4,needed for Bootstrap DateTimePicker; min/moment-with-locales.js renamed
8484
strength-meter,1.1.4,github.com/kartik-v/strength-meter,1.1.4,
85-
Sortable,1.15.0,github.com/SortableJS/Sortable,1.15.0,
85+
Sortable,1.15.0,github.com/SortableJS/Sortable,1.15.1,
8686
jstree,3.3.16,github.com/vakata/jstree,3.3.16,added nav menu icons to stylesheet
8787
bootstrap3-dialog,1.35.4,github.com/nakupanda/bootstrap3-dialog,1.35.4,use /src .less file and add our .less variable imports; w/ bs4 fixes
8888
impromptu,6.2.3,trentrichardson.com/Impromptu,6.2.3,add some colors to .css
@@ -115,7 +115,7 @@ FPDI,2.3.6,github.com/Setasign/FPDI,2.6.0,"optional, required by mPDF v7+"
115115
HTML2PDF,5.2.7/4.6.1,github.com/spipu/html2pdf,5.2.8,"optional, we tweak tcpdfConfig.php"
116116
TCPDF,6.6.2,sourceforge.net/projects/tcpdf,6.6.5,"optional, used by HTML2PDF"
117117
iLess,2.2.0,github.com/mishal/iless,2.2.0,"optional, has issues with bootstrap v2"
118-
Kint,1.1/2.2/5.0.7,github.com/kint-php/kint,5.0.7,"optional, for formatted edebug output"
118+
Kint,1.1/2.2/5.0.7,github.com/kint-php/kint,5.1.0,"optional, for formatted edebug output"
119119
,,,,
120120
Not included yet,,,,
121121
DataTables Buttons,,www.datatables.net,2.4.2,

external/getid3/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ getID3() is released under multiple licenses. You may choose from the following
2222

2323
**getID3 Commercial License:**
2424

25-
* [gCL](https://www.getid3.org/#gCL) (payment required)
25+
* [gCL](https://www.getid3.org/#gCL) (no longer available, existing licenses remain valid)
2626

2727
* * *
2828
Copies of each of the above licenses are included in the `licenses/`
@@ -125,7 +125,7 @@ Reads & parses (to varying degrees):
125125
* SWF (Flash)
126126
* PhotoCD
127127

128-
+ data:
128+
+ data:
129129
* ISO-9660 CD-ROM image (directory structure)
130130
* SZIP (limited support)
131131
* ZIP (directory structure)
@@ -297,7 +297,7 @@ could essentially write it today with a one-line function:
297297

298298
``` php
299299
function getID3($filename) { return unpack('a3TAG/a30title/a30artist/a30album/a4year/a28comment/c1track/c1genreid', substr(file_get_contents($filename), -128)); }
300-
300+
301301
```
302302

303303

external/getid3/changelog.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,19 @@
1818
Version History
1919
===============
2020

21+
1.9.23: [2023-10-19] James Heinrich :: 1.9.23-202310190849
22+
» add detection support for 7-zip archives
23+
* #424 RIFF Undefined index "data"
24+
* #421 tag.xmp remove GLOBALS
25+
* #419 Quicktime Undefined index "time_scale"
26+
* #418 tag.xmp zero-length fread
27+
* #414 Quicktime bitrate for mp4 audio
28+
* #413 Quicktime audio metadata
29+
* #410 MPEG-1 pixel aspect ratio
30+
* #407 PHP 8.1 compatibility
31+
* #404 guard against division by zero
32+
* #402 remove utf8_encode/utf8_decode
33+
2134
1.9.22: [2022-09-29] James Heinrich :: 1.9.22-202207161647
2235
* bugfix #387 fails to detect h265 video codec (QuickTime)
2336
* bugfix #385 Quicktime extended atom size

external/getid3/getid3/getid3.lib.php

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -127,14 +127,26 @@ public static function intValueSupported($num) {
127127
return false;
128128
}
129129

130+
/**
131+
* Perform a division, guarding against division by zero
132+
*
133+
* @param float|int $numerator
134+
* @param float|int $denominator
135+
* @param float|int $fallback
136+
* @return float|int
137+
*/
138+
public static function SafeDiv($numerator, $denominator, $fallback = 0) {
139+
return $denominator ? $numerator / $denominator : $fallback;
140+
}
141+
130142
/**
131143
* @param string $fraction
132144
*
133145
* @return float
134146
*/
135147
public static function DecimalizeFraction($fraction) {
136148
list($numerator, $denominator) = explode('/', $fraction);
137-
return $numerator / ($denominator ? $denominator : 1);
149+
return (int) $numerator / ($denominator ? $denominator : 1);
138150
}
139151

140152
/**
@@ -871,10 +883,6 @@ public static function iconv_fallback_int_utf8($charval) {
871883
* @return string
872884
*/
873885
public static function iconv_fallback_iso88591_utf8($string, $bom=false) {
874-
if (function_exists('utf8_encode')) {
875-
return utf8_encode($string);
876-
}
877-
// utf8_encode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
878886
$newcharstring = '';
879887
if ($bom) {
880888
$newcharstring .= "\xEF\xBB\xBF";
@@ -943,10 +951,6 @@ public static function iconv_fallback_iso88591_utf16($string) {
943951
* @return string
944952
*/
945953
public static function iconv_fallback_utf8_iso88591($string) {
946-
if (function_exists('utf8_decode')) {
947-
return utf8_decode($string);
948-
}
949-
// utf8_decode() unavailable, use getID3()'s iconv_fallback() conversions (possibly PHP is compiled without XML support)
950954
$newcharstring = '';
951955
$offset = 0;
952956
$stringlength = strlen($string);

external/getid3/getid3/getid3.php

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class getID3
387387
*/
388388
protected $startup_warning = '';
389389

390-
const VERSION = '1.9.22-202207161647';
390+
const VERSION = '1.9.23-202310190849';
391391
const FREAD_BUFFER_SIZE = 32768;
392392

393393
const ATTACHMENTS_NONE = false;
@@ -436,17 +436,17 @@ public function __construct() {
436436
$this->startup_error .= 'WARNING: php.ini contains "mbstring.func_overload = '.ini_get('mbstring.func_overload').'", getID3 cannot run with this setting (bitmask 2 (string functions) cannot be set). Recommended to disable entirely.'."\n";
437437
}
438438

439-
// check for magic quotes in PHP < 7.4.0 (when these functions became deprecated)
440-
if (version_compare(PHP_VERSION, '7.4.0', '<')) {
439+
// check for magic quotes in PHP < 5.4.0 (when these options were removed and getters always return false)
440+
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
441441
// Check for magic_quotes_runtime
442442
if (function_exists('get_magic_quotes_runtime')) {
443-
if (get_magic_quotes_runtime()) {
443+
if (get_magic_quotes_runtime()) { // @phpstan-ignore-line
444444
$this->startup_error .= 'magic_quotes_runtime must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_runtime(0) and set_magic_quotes_runtime(1).'."\n";
445445
}
446446
}
447447
// Check for magic_quotes_gpc
448448
if (function_exists('get_magic_quotes_gpc')) {
449-
if (get_magic_quotes_gpc()) {
449+
if (get_magic_quotes_gpc()) { // @phpstan-ignore-line
450450
$this->startup_error .= 'magic_quotes_gpc must be disabled before running getID3(). Surround getid3 block by set_magic_quotes_gpc(0) and set_magic_quotes_gpc(1).'."\n";
451451
}
452452
}
@@ -1464,6 +1464,16 @@ public function GetFileFormatArray() {
14641464
'fail_ape' => 'ERROR',
14651465
),
14661466

1467+
// XZ - data - XZ compressed data
1468+
'7zip' => array(
1469+
'pattern' => '^7z\\xBC\\xAF\\x27\\x1C',
1470+
'group' => 'archive',
1471+
'module' => '7zip',
1472+
'mime_type' => 'application/x-7z-compressed',
1473+
'fail_id3' => 'ERROR',
1474+
'fail_ape' => 'ERROR',
1475+
),
1476+
14671477

14681478
// Misc other formats
14691479

@@ -1977,7 +1987,7 @@ public function CalculateCompressionRatioVideo() {
19771987
}
19781988
$BitrateUncompressed = $this->info['video']['resolution_x'] * $this->info['video']['resolution_y'] * $this->info['video']['bits_per_sample'] * $FrameRate;
19791989

1980-
$this->info['video']['compression_ratio'] = $BitrateCompressed / $BitrateUncompressed;
1990+
$this->info['video']['compression_ratio'] = getid3_lib::SafeDiv($BitrateCompressed, $BitrateUncompressed, 1);
19811991
return true;
19821992
}
19831993

@@ -2183,6 +2193,8 @@ public function setStringMode($string) {
21832193
}
21842194

21852195
/**
2196+
* @phpstan-impure
2197+
*
21862198
* @return int|bool
21872199
*/
21882200
protected function ftell() {
@@ -2195,6 +2207,8 @@ protected function ftell() {
21952207
/**
21962208
* @param int $bytes
21972209
*
2210+
* @phpstan-impure
2211+
*
21982212
* @return string|false
21992213
*
22002214
* @throws getid3_exception
@@ -2240,6 +2254,8 @@ protected function fread($bytes) {
22402254
* @param int $bytes
22412255
* @param int $whence
22422256
*
2257+
* @phpstan-impure
2258+
*
22432259
* @return int
22442260
*
22452261
* @throws getid3_exception
@@ -2281,6 +2297,8 @@ protected function fseek($bytes, $whence=SEEK_SET) {
22812297
}
22822298

22832299
/**
2300+
* @phpstan-impure
2301+
*
22842302
* @return string|false
22852303
*
22862304
* @throws getid3_exception
@@ -2336,6 +2354,8 @@ protected function fgets() {
23362354
}
23372355

23382356
/**
2357+
* @phpstan-impure
2358+
*
23392359
* @return bool
23402360
*/
23412361
protected function feof() {

external/getid3/getid3/module.archive.hpk.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function Analyze() {
4343
$info['hpk']['header']['fragmented_filesystem_offset'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 28, 4));
4444
$info['hpk']['header']['fragmented_filesystem_length'] = getid3_lib::LittleEndian2Int(substr($HPKheader, 32, 4));
4545

46-
$info['hpk']['header']['filesystem_entries'] = $info['hpk']['header']['fragmented_filesystem_length'] / ($info['hpk']['header']['fragments_per_file'] * 8);
46+
$info['hpk']['header']['filesystem_entries'] = getid3_lib::SafeDiv($info['hpk']['header']['fragmented_filesystem_length'], $info['hpk']['header']['fragments_per_file'] * 8);
4747
$this->fseek($info['hpk']['header']['fragmented_filesystem_offset']);
4848
for ($i = 0; $i < $info['hpk']['header']['filesystem_entries']; $i++) {
4949
$offset = getid3_lib::LittleEndian2Int($this->fread(4));

external/getid3/getid3/module.audio-video.asf.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function Analyze() {
193193
$info['playtime_seconds'] = ($thisfile_asf_filepropertiesobject['play_duration'] / 10000000) - ($thisfile_asf_filepropertiesobject['preroll'] / 1000);
194194

195195
//$info['bitrate'] = $thisfile_asf_filepropertiesobject['max_bitrate'];
196-
$info['bitrate'] = ((isset($thisfile_asf_filepropertiesobject['filesize']) ? $thisfile_asf_filepropertiesobject['filesize'] : $info['filesize']) * 8) / $info['playtime_seconds'];
196+
$info['bitrate'] = getid3_lib::SafeDiv($thisfile_asf_filepropertiesobject['filesize'] * 8, $info['playtime_seconds']);
197197
}
198198
break;
199199

@@ -1066,7 +1066,7 @@ public function Analyze() {
10661066
break;
10671067
}
10681068

1069-
if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1069+
if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line
10701070
foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
10711071
if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
10721072
$thisfile_asf_audiomedia_currentstream['bitrate'] = $dataarray['bitrate'];
@@ -1152,7 +1152,7 @@ public function Analyze() {
11521152
$videomediaoffset += 4;
11531153
$thisfile_asf_videomedia_currentstream['format_data']['codec_data'] = substr($streamdata['type_specific_data'], $videomediaoffset);
11541154

1155-
if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) {
1155+
if (!empty($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'])) { // @phpstan-ignore-line
11561156
foreach ($thisfile_asf['stream_bitrate_properties_object']['bitrate_records'] as $dummy => $dataarray) {
11571157
if (isset($dataarray['flags']['stream_number']) && ($dataarray['flags']['stream_number'] == $streamnumber)) {
11581158
$thisfile_asf_videomedia_currentstream['bitrate'] = $dataarray['bitrate'];

external/getid3/getid3/module.audio-video.ivf.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function Analyze() {
4545
$info['ivf']['header']['frame_count'] = getid3_lib::LittleEndian2Int(substr($IVFheader, 24, 4));
4646
//$info['ivf']['header']['reserved'] = substr($IVFheader, 28, 4);
4747

48-
$info['ivf']['header']['frame_rate'] = (float) $info['ivf']['header']['timebase_numerator'] / $info['ivf']['header']['timebase_denominator'];
48+
$info['ivf']['header']['frame_rate'] = (float)getid3_lib::SafeDiv($info['ivf']['header']['timebase_numerator'], $info['ivf']['header']['timebase_denominator']);
4949

5050
if ($info['ivf']['header']['version'] > 0) {
5151
$this->warning('Expecting IVF header version 0, found version '.$info['ivf']['header']['version'].', results may not be accurate');
@@ -65,7 +65,7 @@ public function Analyze() {
6565
$info['ivf']['frame_count']++;
6666
}
6767
}
68-
if ($info['ivf']['frame_count']) {
68+
if ($info['ivf']['frame_count'] && $info['playtime_seconds']) {
6969
$info['playtime_seconds'] = $timestamp / 100000;
7070
$info['video']['frame_rate'] = (float) $info['ivf']['frame_count'] / $info['playtime_seconds'];
7171
}

external/getid3/getid3/module.audio-video.matroska.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,12 @@ public function Analyze()
292292
$track_info['display_x'] = (isset($trackarray['DisplayWidth']) ? $trackarray['DisplayWidth'] : $trackarray['PixelWidth']);
293293
$track_info['display_y'] = (isset($trackarray['DisplayHeight']) ? $trackarray['DisplayHeight'] : $trackarray['PixelHeight']);
294294

295-
if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
296-
if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; }
297-
if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; }
298-
if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; }
299-
if (isset($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); }
300-
if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
295+
if (isset($trackarray['PixelCropBottom'])) { $track_info['crop_bottom'] = $trackarray['PixelCropBottom']; }
296+
if (isset($trackarray['PixelCropTop'])) { $track_info['crop_top'] = $trackarray['PixelCropTop']; }
297+
if (isset($trackarray['PixelCropLeft'])) { $track_info['crop_left'] = $trackarray['PixelCropLeft']; }
298+
if (isset($trackarray['PixelCropRight'])) { $track_info['crop_right'] = $trackarray['PixelCropRight']; }
299+
if (!empty($trackarray['DefaultDuration'])) { $track_info['frame_rate'] = round(1000000000 / $trackarray['DefaultDuration'], 3); }
300+
if (isset($trackarray['CodecName'])) { $track_info['codec'] = $trackarray['CodecName']; }
301301

302302
switch ($trackarray['CodecID']) {
303303
case 'V_MS/VFW/FOURCC':

external/getid3/getid3/module.audio-video.mpeg.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -505,9 +505,9 @@ public function Analyze() {
505505
$last_GOP_id = max(array_keys($FramesByGOP));
506506
$frames_in_last_GOP = count($FramesByGOP[$last_GOP_id]);
507507
$gopdata = &$info['mpeg']['group_of_pictures'][$last_GOP_id];
508-
$info['playtime_seconds'] = ($gopdata['time_code_hours'] * 3600) + ($gopdata['time_code_minutes'] * 60) + $gopdata['time_code_seconds'] + (($gopdata['time_code_pictures'] + $frames_in_last_GOP + 1) / $info['mpeg']['video']['frame_rate']);
508+
$info['playtime_seconds'] = ($gopdata['time_code_hours'] * 3600) + ($gopdata['time_code_minutes'] * 60) + $gopdata['time_code_seconds'] + getid3_lib::SafeDiv($gopdata['time_code_pictures'] + $frames_in_last_GOP + 1, $info['mpeg']['video']['frame_rate']);
509509
if (!isset($info['video']['bitrate'])) {
510-
$overall_bitrate = ($info['avdataend'] - $info['avdataoffset']) * 8 / $info['playtime_seconds'];
510+
$overall_bitrate = getid3_lib::SafeDiv($info['avdataend'] - $info['avdataoffset'] * 8, $info['playtime_seconds']);
511511
$info['video']['bitrate'] = $overall_bitrate - (isset($info['audio']['bitrate']) ? $info['audio']['bitrate'] : 0);
512512
}
513513
unset($info['mpeg']['group_of_pictures']);
@@ -610,14 +610,20 @@ public static function videoFramerateLookup($rawframerate) {
610610
* @return float
611611
*/
612612
public static function videoAspectRatioLookup($rawaspectratio, $mpeg_version=1, $width=0, $height=0) {
613+
// Per http://forum.doom9.org/archive/index.php/t-84400.html
614+
// 0.9157 is commonly accepted to mean 11/12 or .9166, the reciprocal of 12/11 (1.091) and,
615+
// 1.0950 is commonly accepted to mean 11/10 or 1.1, the reciprocal of 10/11 (0.909)
613616
$lookup = array(
614-
1 => array(0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 0.9157, 0.9815, 1.0255, 1.0695, 1.0950, 1.1575, 1.2015, 0),
617+
1 => array(0, 1, 0.6735, 0.7031, 0.7615, 0.8055, 0.8437, 0.8935, 11/12, 0.9815, 1.0255, 1.0695, 11/10, 1.1575, 1.2015, 0),
615618
2 => array(0, 1, 1.3333, 1.7778, 2.2100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
616619
);
617620
$ratio = (float) (isset($lookup[$mpeg_version][$rawaspectratio]) ? $lookup[$mpeg_version][$rawaspectratio] : 0);
618621
if ($mpeg_version == 2 && $ratio != 1 && $width != 0) {
619622
// Calculate pixel aspect ratio from MPEG-2 display aspect ratio
620623
$ratio = $ratio * $height / $width;
624+
} else if ($mpeg_version == 1 && $ratio !== 0.0) {
625+
// The MPEG-1 tables store the reciprocal of the pixel aspect ratio.
626+
$ratio = 1.0 / $ratio;
621627
}
622628
return $ratio;
623629
}

0 commit comments

Comments
 (0)