Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-inclu.../ID3
File: module.audio-video.riff.php
$thisfile_audio_dataformat = 'cda';
[1000] Fix | Delete
[1001] Fix | Delete
$info['avdataoffset'] = 44;
[1002] Fix | Delete
[1003] Fix | Delete
if (isset($thisfile_riff['CDDA']['fmt '][0]['data'])) {
[1004] Fix | Delete
// shortcut
[1005] Fix | Delete
$thisfile_riff_CDDA_fmt_0 = &$thisfile_riff['CDDA']['fmt '][0];
[1006] Fix | Delete
[1007] Fix | Delete
$thisfile_riff_CDDA_fmt_0['unknown1'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 0, 2));
[1008] Fix | Delete
$thisfile_riff_CDDA_fmt_0['track_num'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 2, 2));
[1009] Fix | Delete
$thisfile_riff_CDDA_fmt_0['disc_id'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 4, 4));
[1010] Fix | Delete
$thisfile_riff_CDDA_fmt_0['start_offset_frame'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 8, 4));
[1011] Fix | Delete
$thisfile_riff_CDDA_fmt_0['playtime_frames'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 12, 4));
[1012] Fix | Delete
$thisfile_riff_CDDA_fmt_0['unknown6'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 16, 4));
[1013] Fix | Delete
$thisfile_riff_CDDA_fmt_0['unknown7'] = $this->EitherEndian2Int(substr($thisfile_riff_CDDA_fmt_0['data'], 20, 4));
[1014] Fix | Delete
[1015] Fix | Delete
$thisfile_riff_CDDA_fmt_0['start_offset_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['start_offset_frame'] / 75;
[1016] Fix | Delete
$thisfile_riff_CDDA_fmt_0['playtime_seconds'] = (float) $thisfile_riff_CDDA_fmt_0['playtime_frames'] / 75;
[1017] Fix | Delete
$info['comments']['track_number'] = $thisfile_riff_CDDA_fmt_0['track_num'];
[1018] Fix | Delete
$info['playtime_seconds'] = $thisfile_riff_CDDA_fmt_0['playtime_seconds'];
[1019] Fix | Delete
[1020] Fix | Delete
// hardcoded data for CD-audio
[1021] Fix | Delete
$thisfile_audio['lossless'] = true;
[1022] Fix | Delete
$thisfile_audio['sample_rate'] = 44100;
[1023] Fix | Delete
$thisfile_audio['channels'] = 2;
[1024] Fix | Delete
$thisfile_audio['bits_per_sample'] = 16;
[1025] Fix | Delete
$thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $thisfile_audio['channels'] * $thisfile_audio['bits_per_sample'];
[1026] Fix | Delete
$thisfile_audio['bitrate_mode'] = 'cbr';
[1027] Fix | Delete
}
[1028] Fix | Delete
break;
[1029] Fix | Delete
[1030] Fix | Delete
// http://en.wikipedia.org/wiki/AIFF
[1031] Fix | Delete
case 'AIFF':
[1032] Fix | Delete
case 'AIFC':
[1033] Fix | Delete
$info['fileformat'] = 'aiff';
[1034] Fix | Delete
$info['mime_type'] = 'audio/x-aiff';
[1035] Fix | Delete
[1036] Fix | Delete
$thisfile_audio['bitrate_mode'] = 'cbr';
[1037] Fix | Delete
$thisfile_audio_dataformat = 'aiff';
[1038] Fix | Delete
$thisfile_audio['lossless'] = true;
[1039] Fix | Delete
[1040] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'])) {
[1041] Fix | Delete
$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['SSND'][0]['offset'] + 8;
[1042] Fix | Delete
$info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['SSND'][0]['size'];
[1043] Fix | Delete
if ($info['avdataend'] > $info['filesize']) {
[1044] Fix | Delete
if (($info['avdataend'] == ($info['filesize'] + 1)) && (($info['filesize'] % 2) == 1)) {
[1045] Fix | Delete
// structures rounded to 2-byte boundary, but dumb encoders
[1046] Fix | Delete
// forget to pad end of file to make this actually work
[1047] Fix | Delete
} else {
[1048] Fix | Delete
$this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['SSND'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found');
[1049] Fix | Delete
}
[1050] Fix | Delete
$info['avdataend'] = $info['filesize'];
[1051] Fix | Delete
}
[1052] Fix | Delete
}
[1053] Fix | Delete
[1054] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['COMM'][0]['data'])) {
[1055] Fix | Delete
[1056] Fix | Delete
// shortcut
[1057] Fix | Delete
$thisfile_riff_RIFFsubtype_COMM_0_data = &$thisfile_riff[$RIFFsubtype]['COMM'][0]['data'];
[1058] Fix | Delete
[1059] Fix | Delete
$thisfile_riff_audio['channels'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 0, 2), true);
[1060] Fix | Delete
$thisfile_riff_audio['total_samples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 2, 4), false);
[1061] Fix | Delete
$thisfile_riff_audio['bits_per_sample'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 6, 2), true);
[1062] Fix | Delete
$thisfile_riff_audio['sample_rate'] = (int) getid3_lib::BigEndian2Float(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 8, 10));
[1063] Fix | Delete
[1064] Fix | Delete
if ($thisfile_riff[$RIFFsubtype]['COMM'][0]['size'] > 18) {
[1065] Fix | Delete
$thisfile_riff_audio['codec_fourcc'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 18, 4);
[1066] Fix | Delete
$CodecNameSize = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_COMM_0_data, 22, 1), false);
[1067] Fix | Delete
$thisfile_riff_audio['codec_name'] = substr($thisfile_riff_RIFFsubtype_COMM_0_data, 23, $CodecNameSize);
[1068] Fix | Delete
switch ($thisfile_riff_audio['codec_name']) {
[1069] Fix | Delete
case 'NONE':
[1070] Fix | Delete
$thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
[1071] Fix | Delete
$thisfile_audio['lossless'] = true;
[1072] Fix | Delete
break;
[1073] Fix | Delete
[1074] Fix | Delete
case '':
[1075] Fix | Delete
switch ($thisfile_riff_audio['codec_fourcc']) {
[1076] Fix | Delete
// http://developer.apple.com/qa/snd/snd07.html
[1077] Fix | Delete
case 'sowt':
[1078] Fix | Delete
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Little-Endian PCM';
[1079] Fix | Delete
$thisfile_audio['lossless'] = true;
[1080] Fix | Delete
break;
[1081] Fix | Delete
[1082] Fix | Delete
case 'twos':
[1083] Fix | Delete
$thisfile_riff_audio['codec_name'] = 'Two\'s Compliment Big-Endian PCM';
[1084] Fix | Delete
$thisfile_audio['lossless'] = true;
[1085] Fix | Delete
break;
[1086] Fix | Delete
[1087] Fix | Delete
default:
[1088] Fix | Delete
break;
[1089] Fix | Delete
}
[1090] Fix | Delete
break;
[1091] Fix | Delete
[1092] Fix | Delete
default:
[1093] Fix | Delete
$thisfile_audio['codec'] = $thisfile_riff_audio['codec_name'];
[1094] Fix | Delete
$thisfile_audio['lossless'] = false;
[1095] Fix | Delete
break;
[1096] Fix | Delete
}
[1097] Fix | Delete
}
[1098] Fix | Delete
[1099] Fix | Delete
$thisfile_audio['channels'] = $thisfile_riff_audio['channels'];
[1100] Fix | Delete
if ($thisfile_riff_audio['bits_per_sample'] > 0) {
[1101] Fix | Delete
$thisfile_audio['bits_per_sample'] = $thisfile_riff_audio['bits_per_sample'];
[1102] Fix | Delete
}
[1103] Fix | Delete
$thisfile_audio['sample_rate'] = $thisfile_riff_audio['sample_rate'];
[1104] Fix | Delete
if ($thisfile_audio['sample_rate'] == 0) {
[1105] Fix | Delete
$this->error('Corrupted AIFF file: sample_rate == zero');
[1106] Fix | Delete
return false;
[1107] Fix | Delete
}
[1108] Fix | Delete
$info['playtime_seconds'] = $thisfile_riff_audio['total_samples'] / $thisfile_audio['sample_rate'];
[1109] Fix | Delete
}
[1110] Fix | Delete
[1111] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['COMT'])) {
[1112] Fix | Delete
$offset = 0;
[1113] Fix | Delete
$CommentCount = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
[1114] Fix | Delete
$offset += 2;
[1115] Fix | Delete
for ($i = 0; $i < $CommentCount; $i++) {
[1116] Fix | Delete
$info['comments_raw'][$i]['timestamp'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 4), false);
[1117] Fix | Delete
$offset += 4;
[1118] Fix | Delete
$info['comments_raw'][$i]['marker_id'] = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), true);
[1119] Fix | Delete
$offset += 2;
[1120] Fix | Delete
$CommentLength = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, 2), false);
[1121] Fix | Delete
$offset += 2;
[1122] Fix | Delete
$info['comments_raw'][$i]['comment'] = substr($thisfile_riff[$RIFFsubtype]['COMT'][0]['data'], $offset, $CommentLength);
[1123] Fix | Delete
$offset += $CommentLength;
[1124] Fix | Delete
[1125] Fix | Delete
$info['comments_raw'][$i]['timestamp_unix'] = getid3_lib::DateMac2Unix($info['comments_raw'][$i]['timestamp']);
[1126] Fix | Delete
$thisfile_riff['comments']['comment'][] = $info['comments_raw'][$i]['comment'];
[1127] Fix | Delete
}
[1128] Fix | Delete
}
[1129] Fix | Delete
[1130] Fix | Delete
$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
[1131] Fix | Delete
foreach ($CommentsChunkNames as $key => $value) {
[1132] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
[1133] Fix | Delete
$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
[1134] Fix | Delete
}
[1135] Fix | Delete
}
[1136] Fix | Delete
/*
[1137] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['ID3 '])) {
[1138] Fix | Delete
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
[1139] Fix | Delete
$getid3_temp = new getID3();
[1140] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1141] Fix | Delete
$getid3_id3v2 = new getid3_id3v2($getid3_temp);
[1142] Fix | Delete
$getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['ID3 '][0]['offset'] + 8;
[1143] Fix | Delete
if ($thisfile_riff[$RIFFsubtype]['ID3 '][0]['valid'] = $getid3_id3v2->Analyze()) {
[1144] Fix | Delete
$info['id3v2'] = $getid3_temp->info['id3v2'];
[1145] Fix | Delete
}
[1146] Fix | Delete
unset($getid3_temp, $getid3_id3v2);
[1147] Fix | Delete
}
[1148] Fix | Delete
*/
[1149] Fix | Delete
break;
[1150] Fix | Delete
[1151] Fix | Delete
// http://en.wikipedia.org/wiki/8SVX
[1152] Fix | Delete
case '8SVX':
[1153] Fix | Delete
$info['fileformat'] = '8svx';
[1154] Fix | Delete
$info['mime_type'] = 'audio/8svx';
[1155] Fix | Delete
[1156] Fix | Delete
$thisfile_audio['bitrate_mode'] = 'cbr';
[1157] Fix | Delete
$thisfile_audio_dataformat = '8svx';
[1158] Fix | Delete
$thisfile_audio['bits_per_sample'] = 8;
[1159] Fix | Delete
$thisfile_audio['channels'] = 1; // overridden below, if need be
[1160] Fix | Delete
$ActualBitsPerSample = 0;
[1161] Fix | Delete
[1162] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'])) {
[1163] Fix | Delete
$info['avdataoffset'] = $thisfile_riff[$RIFFsubtype]['BODY'][0]['offset'] + 8;
[1164] Fix | Delete
$info['avdataend'] = $info['avdataoffset'] + $thisfile_riff[$RIFFsubtype]['BODY'][0]['size'];
[1165] Fix | Delete
if ($info['avdataend'] > $info['filesize']) {
[1166] Fix | Delete
$this->warning('Probable truncated AIFF file: expecting '.$thisfile_riff[$RIFFsubtype]['BODY'][0]['size'].' bytes of audio data, only '.($info['filesize'] - $info['avdataoffset']).' bytes found');
[1167] Fix | Delete
}
[1168] Fix | Delete
}
[1169] Fix | Delete
[1170] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['VHDR'][0]['offset'])) {
[1171] Fix | Delete
// shortcut
[1172] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0 = &$thisfile_riff[$RIFFsubtype]['VHDR'][0];
[1173] Fix | Delete
[1174] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['oneShotHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 0, 4));
[1175] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['repeatHiSamples'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 4, 4));
[1176] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['samplesPerHiCycle'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 8, 4));
[1177] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 12, 2));
[1178] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['ctOctave'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 14, 1));
[1179] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['sCompression'] = getid3_lib::BigEndian2Int(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 15, 1));
[1180] Fix | Delete
$thisfile_riff_RIFFsubtype_VHDR_0['Volume'] = getid3_lib::FixedPoint16_16(substr($thisfile_riff_RIFFsubtype_VHDR_0['data'], 16, 4));
[1181] Fix | Delete
[1182] Fix | Delete
$thisfile_audio['sample_rate'] = $thisfile_riff_RIFFsubtype_VHDR_0['samplesPerSec'];
[1183] Fix | Delete
[1184] Fix | Delete
switch ($thisfile_riff_RIFFsubtype_VHDR_0['sCompression']) {
[1185] Fix | Delete
case 0:
[1186] Fix | Delete
$thisfile_audio['codec'] = 'Pulse Code Modulation (PCM)';
[1187] Fix | Delete
$thisfile_audio['lossless'] = true;
[1188] Fix | Delete
$ActualBitsPerSample = 8;
[1189] Fix | Delete
break;
[1190] Fix | Delete
[1191] Fix | Delete
case 1:
[1192] Fix | Delete
$thisfile_audio['codec'] = 'Fibonacci-delta encoding';
[1193] Fix | Delete
$thisfile_audio['lossless'] = false;
[1194] Fix | Delete
$ActualBitsPerSample = 4;
[1195] Fix | Delete
break;
[1196] Fix | Delete
[1197] Fix | Delete
default:
[1198] Fix | Delete
$this->warning('Unexpected sCompression value in 8SVX.VHDR chunk - expecting 0 or 1, found "'.$thisfile_riff_RIFFsubtype_VHDR_0['sCompression'].'"');
[1199] Fix | Delete
break;
[1200] Fix | Delete
}
[1201] Fix | Delete
}
[1202] Fix | Delete
[1203] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'])) {
[1204] Fix | Delete
$ChannelsIndex = getid3_lib::BigEndian2Int(substr($thisfile_riff[$RIFFsubtype]['CHAN'][0]['data'], 0, 4));
[1205] Fix | Delete
switch ($ChannelsIndex) {
[1206] Fix | Delete
case 6: // Stereo
[1207] Fix | Delete
$thisfile_audio['channels'] = 2;
[1208] Fix | Delete
break;
[1209] Fix | Delete
[1210] Fix | Delete
case 2: // Left channel only
[1211] Fix | Delete
case 4: // Right channel only
[1212] Fix | Delete
$thisfile_audio['channels'] = 1;
[1213] Fix | Delete
break;
[1214] Fix | Delete
[1215] Fix | Delete
default:
[1216] Fix | Delete
$this->warning('Unexpected value in 8SVX.CHAN chunk - expecting 2 or 4 or 6, found "'.$ChannelsIndex.'"');
[1217] Fix | Delete
break;
[1218] Fix | Delete
}
[1219] Fix | Delete
[1220] Fix | Delete
}
[1221] Fix | Delete
[1222] Fix | Delete
$CommentsChunkNames = array('NAME'=>'title', 'author'=>'artist', '(c) '=>'copyright', 'ANNO'=>'comment');
[1223] Fix | Delete
foreach ($CommentsChunkNames as $key => $value) {
[1224] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype][$key][0]['data'])) {
[1225] Fix | Delete
$thisfile_riff['comments'][$value][] = $thisfile_riff[$RIFFsubtype][$key][0]['data'];
[1226] Fix | Delete
}
[1227] Fix | Delete
}
[1228] Fix | Delete
[1229] Fix | Delete
$thisfile_audio['bitrate'] = $thisfile_audio['sample_rate'] * $ActualBitsPerSample * $thisfile_audio['channels'];
[1230] Fix | Delete
if (!empty($thisfile_audio['bitrate'])) {
[1231] Fix | Delete
$info['playtime_seconds'] = ($info['avdataend'] - $info['avdataoffset']) / ($thisfile_audio['bitrate'] / 8);
[1232] Fix | Delete
}
[1233] Fix | Delete
break;
[1234] Fix | Delete
[1235] Fix | Delete
case 'CDXA':
[1236] Fix | Delete
$info['fileformat'] = 'vcd'; // Asume Video CD
[1237] Fix | Delete
$info['mime_type'] = 'video/mpeg';
[1238] Fix | Delete
[1239] Fix | Delete
if (!empty($thisfile_riff['CDXA']['data'][0]['size'])) {
[1240] Fix | Delete
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.audio-video.mpeg.php', __FILE__, true);
[1241] Fix | Delete
[1242] Fix | Delete
$getid3_temp = new getID3();
[1243] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1244] Fix | Delete
$getid3_mpeg = new getid3_mpeg($getid3_temp);
[1245] Fix | Delete
$getid3_mpeg->Analyze();
[1246] Fix | Delete
if (empty($getid3_temp->info['error'])) {
[1247] Fix | Delete
$info['audio'] = $getid3_temp->info['audio'];
[1248] Fix | Delete
$info['video'] = $getid3_temp->info['video'];
[1249] Fix | Delete
$info['mpeg'] = $getid3_temp->info['mpeg'];
[1250] Fix | Delete
$info['warning'] = $getid3_temp->info['warning'];
[1251] Fix | Delete
}
[1252] Fix | Delete
unset($getid3_temp, $getid3_mpeg);
[1253] Fix | Delete
}
[1254] Fix | Delete
break;
[1255] Fix | Delete
[1256] Fix | Delete
case 'WEBP':
[1257] Fix | Delete
// https://developers.google.com/speed/webp/docs/riff_container
[1258] Fix | Delete
// https://tools.ietf.org/html/rfc6386
[1259] Fix | Delete
// https://chromium.googlesource.com/webm/libwebp/+/master/doc/webp-lossless-bitstream-spec.txt
[1260] Fix | Delete
$info['fileformat'] = 'webp';
[1261] Fix | Delete
$info['mime_type'] = 'image/webp';
[1262] Fix | Delete
[1263] Fix | Delete
if (!empty($thisfile_riff['WEBP']['VP8 '][0]['size'])) {
[1264] Fix | Delete
$old_offset = $this->ftell();
[1265] Fix | Delete
$this->fseek($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8); // 4 bytes "VP8 " + 4 bytes chunk size
[1266] Fix | Delete
$WEBP_VP8_header = $this->fread(10);
[1267] Fix | Delete
$this->fseek($old_offset);
[1268] Fix | Delete
if (substr($WEBP_VP8_header, 3, 3) == "\x9D\x01\x2A") {
[1269] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['keyframe'] = !(getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x800000);
[1270] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['version'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x700000) >> 20;
[1271] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['show_frame'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x080000);
[1272] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['data_bytes'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 0, 3)) & 0x07FFFF) >> 0;
[1273] Fix | Delete
[1274] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['scale_x'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0xC000) >> 14;
[1275] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['width'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 6, 2)) & 0x3FFF);
[1276] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['scale_y'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0xC000) >> 14;
[1277] Fix | Delete
$thisfile_riff['WEBP']['VP8 '][0]['height'] = (getid3_lib::LittleEndian2Int(substr($WEBP_VP8_header, 8, 2)) & 0x3FFF);
[1278] Fix | Delete
[1279] Fix | Delete
$info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8 '][0]['width'];
[1280] Fix | Delete
$info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8 '][0]['height'];
[1281] Fix | Delete
} else {
[1282] Fix | Delete
$this->error('Expecting 9D 01 2A at offset '.($thisfile_riff['WEBP']['VP8 '][0]['offset'] + 8 + 3).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8_header, 3, 3)).'"');
[1283] Fix | Delete
}
[1284] Fix | Delete
[1285] Fix | Delete
}
[1286] Fix | Delete
if (!empty($thisfile_riff['WEBP']['VP8L'][0]['size'])) {
[1287] Fix | Delete
$old_offset = $this->ftell();
[1288] Fix | Delete
$this->fseek($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8); // 4 bytes "VP8L" + 4 bytes chunk size
[1289] Fix | Delete
$WEBP_VP8L_header = $this->fread(10);
[1290] Fix | Delete
$this->fseek($old_offset);
[1291] Fix | Delete
if (substr($WEBP_VP8L_header, 0, 1) == "\x2F") {
[1292] Fix | Delete
$width_height_flags = getid3_lib::LittleEndian2Bin(substr($WEBP_VP8L_header, 1, 4));
[1293] Fix | Delete
$thisfile_riff['WEBP']['VP8L'][0]['width'] = bindec(substr($width_height_flags, 18, 14)) + 1;
[1294] Fix | Delete
$thisfile_riff['WEBP']['VP8L'][0]['height'] = bindec(substr($width_height_flags, 4, 14)) + 1;
[1295] Fix | Delete
$thisfile_riff['WEBP']['VP8L'][0]['alpha_is_used'] = (bool) bindec(substr($width_height_flags, 3, 1));
[1296] Fix | Delete
$thisfile_riff['WEBP']['VP8L'][0]['version'] = bindec(substr($width_height_flags, 0, 3));
[1297] Fix | Delete
[1298] Fix | Delete
$info['video']['resolution_x'] = $thisfile_riff['WEBP']['VP8L'][0]['width'];
[1299] Fix | Delete
$info['video']['resolution_y'] = $thisfile_riff['WEBP']['VP8L'][0]['height'];
[1300] Fix | Delete
} else {
[1301] Fix | Delete
$this->error('Expecting 2F at offset '.($thisfile_riff['WEBP']['VP8L'][0]['offset'] + 8).', found "'.getid3_lib::PrintHexBytes(substr($WEBP_VP8L_header, 0, 1)).'"');
[1302] Fix | Delete
}
[1303] Fix | Delete
[1304] Fix | Delete
}
[1305] Fix | Delete
break;
[1306] Fix | Delete
[1307] Fix | Delete
default:
[1308] Fix | Delete
$this->error('Unknown RIFF type: expecting one of (WAVE|RMP3|AVI |CDDA|AIFF|AIFC|8SVX|CDXA|WEBP), found "'.$RIFFsubtype.'" instead');
[1309] Fix | Delete
//unset($info['fileformat']);
[1310] Fix | Delete
}
[1311] Fix | Delete
[1312] Fix | Delete
switch ($RIFFsubtype) {
[1313] Fix | Delete
case 'WAVE':
[1314] Fix | Delete
case 'AIFF':
[1315] Fix | Delete
case 'AIFC':
[1316] Fix | Delete
$ID3v2_key_good = 'id3 ';
[1317] Fix | Delete
$ID3v2_keys_bad = array('ID3 ', 'tag ');
[1318] Fix | Delete
foreach ($ID3v2_keys_bad as $ID3v2_key_bad) {
[1319] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype][$ID3v2_key_bad]) && !array_key_exists($ID3v2_key_good, $thisfile_riff[$RIFFsubtype])) {
[1320] Fix | Delete
$thisfile_riff[$RIFFsubtype][$ID3v2_key_good] = $thisfile_riff[$RIFFsubtype][$ID3v2_key_bad];
[1321] Fix | Delete
$this->warning('mapping "'.$ID3v2_key_bad.'" chunk to "'.$ID3v2_key_good.'"');
[1322] Fix | Delete
}
[1323] Fix | Delete
}
[1324] Fix | Delete
[1325] Fix | Delete
if (isset($thisfile_riff[$RIFFsubtype]['id3 '])) {
[1326] Fix | Delete
getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'module.tag.id3v2.php', __FILE__, true);
[1327] Fix | Delete
[1328] Fix | Delete
$getid3_temp = new getID3();
[1329] Fix | Delete
$getid3_temp->openfile($this->getid3->filename, $this->getid3->info['filesize'], $this->getid3->fp);
[1330] Fix | Delete
$getid3_id3v2 = new getid3_id3v2($getid3_temp);
[1331] Fix | Delete
$getid3_id3v2->StartingOffset = $thisfile_riff[$RIFFsubtype]['id3 '][0]['offset'] + 8;
[1332] Fix | Delete
if ($thisfile_riff[$RIFFsubtype]['id3 '][0]['valid'] = $getid3_id3v2->Analyze()) {
[1333] Fix | Delete
$info['id3v2'] = $getid3_temp->info['id3v2'];
[1334] Fix | Delete
}
[1335] Fix | Delete
unset($getid3_temp, $getid3_id3v2);
[1336] Fix | Delete
}
[1337] Fix | Delete
break;
[1338] Fix | Delete
}
[1339] Fix | Delete
[1340] Fix | Delete
if (isset($thisfile_riff_WAVE['DISP']) && is_array($thisfile_riff_WAVE['DISP'])) {
[1341] Fix | Delete
$thisfile_riff['comments']['title'][] = trim(substr($thisfile_riff_WAVE['DISP'][count($thisfile_riff_WAVE['DISP']) - 1]['data'], 4));
[1342] Fix | Delete
}
[1343] Fix | Delete
if (isset($thisfile_riff_WAVE['INFO']) && is_array($thisfile_riff_WAVE['INFO'])) {
[1344] Fix | Delete
self::parseComments($thisfile_riff_WAVE['INFO'], $thisfile_riff['comments']);
[1345] Fix | Delete
}
[1346] Fix | Delete
if (isset($thisfile_riff['AVI ']['INFO']) && is_array($thisfile_riff['AVI ']['INFO'])) {
[1347] Fix | Delete
self::parseComments($thisfile_riff['AVI ']['INFO'], $thisfile_riff['comments']);
[1348] Fix | Delete
}
[1349] Fix | Delete
[1350] Fix | Delete
if (empty($thisfile_audio['encoder']) && !empty($info['mpeg']['audio']['LAME']['short_version'])) {
[1351] Fix | Delete
$thisfile_audio['encoder'] = $info['mpeg']['audio']['LAME']['short_version'];
[1352] Fix | Delete
}
[1353] Fix | Delete
[1354] Fix | Delete
if (!isset($info['playtime_seconds'])) {
[1355] Fix | Delete
$info['playtime_seconds'] = 0;
[1356] Fix | Delete
}
[1357] Fix | Delete
if (isset($thisfile_riff_raw['strh'][0]['dwLength']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { // @phpstan-ignore-line
[1358] Fix | Delete
// needed for >2GB AVIs where 'avih' chunk only lists number of frames in that chunk, not entire movie
[1359] Fix | Delete
$info['playtime_seconds'] = $thisfile_riff_raw['strh'][0]['dwLength'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
[1360] Fix | Delete
} elseif (isset($thisfile_riff_raw['avih']['dwTotalFrames']) && isset($thisfile_riff_raw['avih']['dwMicroSecPerFrame'])) { // @phpstan-ignore-line
[1361] Fix | Delete
$info['playtime_seconds'] = $thisfile_riff_raw['avih']['dwTotalFrames'] * ($thisfile_riff_raw['avih']['dwMicroSecPerFrame'] / 1000000);
[1362] Fix | Delete
}
[1363] Fix | Delete
[1364] Fix | Delete
if ($info['playtime_seconds'] > 0) {
[1365] Fix | Delete
if (isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
[1366] Fix | Delete
[1367] Fix | Delete
if (!isset($info['bitrate'])) {
[1368] Fix | Delete
$info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
[1369] Fix | Delete
}
[1370] Fix | Delete
[1371] Fix | Delete
} elseif (isset($thisfile_riff_audio) && !isset($thisfile_riff_video)) {
[1372] Fix | Delete
[1373] Fix | Delete
if (!isset($thisfile_audio['bitrate'])) {
[1374] Fix | Delete
$thisfile_audio['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
[1375] Fix | Delete
}
[1376] Fix | Delete
[1377] Fix | Delete
} elseif (!isset($thisfile_riff_audio) && isset($thisfile_riff_video)) {
[1378] Fix | Delete
[1379] Fix | Delete
if (!isset($thisfile_video['bitrate'])) {
[1380] Fix | Delete
$thisfile_video['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
[1381] Fix | Delete
}
[1382] Fix | Delete
[1383] Fix | Delete
}
[1384] Fix | Delete
}
[1385] Fix | Delete
[1386] Fix | Delete
[1387] Fix | Delete
if (isset($thisfile_riff_video) && isset($thisfile_audio['bitrate']) && ($thisfile_audio['bitrate'] > 0) && ($info['playtime_seconds'] > 0)) {
[1388] Fix | Delete
[1389] Fix | Delete
$info['bitrate'] = ((($info['avdataend'] - $info['avdataoffset']) / $info['playtime_seconds']) * 8);
[1390] Fix | Delete
$thisfile_audio['bitrate'] = 0;
[1391] Fix | Delete
$thisfile_video['bitrate'] = $info['bitrate'];
[1392] Fix | Delete
foreach ($thisfile_riff_audio as $channelnumber => $audioinfoarray) {
[1393] Fix | Delete
$thisfile_video['bitrate'] -= $audioinfoarray['bitrate'];
[1394] Fix | Delete
$thisfile_audio['bitrate'] += $audioinfoarray['bitrate'];
[1395] Fix | Delete
}
[1396] Fix | Delete
if ($thisfile_video['bitrate'] <= 0) {
[1397] Fix | Delete
unset($thisfile_video['bitrate']);
[1398] Fix | Delete
}
[1399] Fix | Delete
if ($thisfile_audio['bitrate'] <= 0) {
[1400] Fix | Delete
unset($thisfile_audio['bitrate']);
[1401] Fix | Delete
}
[1402] Fix | Delete
}
[1403] Fix | Delete
[1404] Fix | Delete
if (isset($info['mpeg']['audio'])) {
[1405] Fix | Delete
$thisfile_audio_dataformat = 'mp'.$info['mpeg']['audio']['layer'];
[1406] Fix | Delete
$thisfile_audio['sample_rate'] = $info['mpeg']['audio']['sample_rate'];
[1407] Fix | Delete
$thisfile_audio['channels'] = $info['mpeg']['audio']['channels'];
[1408] Fix | Delete
$thisfile_audio['bitrate'] = $info['mpeg']['audio']['bitrate'];
[1409] Fix | Delete
$thisfile_audio['bitrate_mode'] = strtolower($info['mpeg']['audio']['bitrate_mode']);
[1410] Fix | Delete
if (!empty($info['mpeg']['audio']['codec'])) {
[1411] Fix | Delete
$thisfile_audio['codec'] = $info['mpeg']['audio']['codec'].' '.$thisfile_audio['codec'];
[1412] Fix | Delete
}
[1413] Fix | Delete
if (!empty($thisfile_audio['streams'])) {
[1414] Fix | Delete
foreach ($thisfile_audio['streams'] as $streamnumber => $streamdata) {
[1415] Fix | Delete
if ($streamdata['dataformat'] == $thisfile_audio_dataformat) {
[1416] Fix | Delete
$thisfile_audio['streams'][$streamnumber]['sample_rate'] = $thisfile_audio['sample_rate'];
[1417] Fix | Delete
$thisfile_audio['streams'][$streamnumber]['channels'] = $thisfile_audio['channels'];
[1418] Fix | Delete
$thisfile_audio['streams'][$streamnumber]['bitrate'] = $thisfile_audio['bitrate'];
[1419] Fix | Delete
$thisfile_audio['streams'][$streamnumber]['bitrate_mode'] = $thisfile_audio['bitrate_mode'];
[1420] Fix | Delete
$thisfile_audio['streams'][$streamnumber]['codec'] = $thisfile_audio['codec'];
[1421] Fix | Delete
}
[1422] Fix | Delete
}
[1423] Fix | Delete
}
[1424] Fix | Delete
$getid3_mp3 = new getid3_mp3($this->getid3);
[1425] Fix | Delete
$thisfile_audio['encoder_options'] = $getid3_mp3->GuessEncoderOptions();
[1426] Fix | Delete
unset($getid3_mp3);
[1427] Fix | Delete
}
[1428] Fix | Delete
[1429] Fix | Delete
[1430] Fix | Delete
if (!empty($thisfile_riff_raw['fmt ']['wBitsPerSample']) && ($thisfile_riff_raw['fmt ']['wBitsPerSample'] > 0)) {
[1431] Fix | Delete
switch ($thisfile_audio_dataformat) {
[1432] Fix | Delete
case 'ac3':
[1433] Fix | Delete
// ignore bits_per_sample
[1434] Fix | Delete
break;
[1435] Fix | Delete
[1436] Fix | Delete
default:
[1437] Fix | Delete
$thisfile_audio['bits_per_sample'] = $thisfile_riff_raw['fmt ']['wBitsPerSample'];
[1438] Fix | Delete
break;
[1439] Fix | Delete
}
[1440] Fix | Delete
}
[1441] Fix | Delete
[1442] Fix | Delete
[1443] Fix | Delete
if (empty($thisfile_riff_raw)) {
[1444] Fix | Delete
unset($thisfile_riff['raw']);
[1445] Fix | Delete
}
[1446] Fix | Delete
if (empty($thisfile_riff_audio)) {
[1447] Fix | Delete
unset($thisfile_riff['audio']);
[1448] Fix | Delete
}
[1449] Fix | Delete
if (empty($thisfile_riff_video)) {
[1450] Fix | Delete
unset($thisfile_riff['video']);
[1451] Fix | Delete
}
[1452] Fix | Delete
[1453] Fix | Delete
return true;
[1454] Fix | Delete
}
[1455] Fix | Delete
[1456] Fix | Delete
/**
[1457] Fix | Delete
* @param int $startoffset
[1458] Fix | Delete
* @param int $maxoffset
[1459] Fix | Delete
*
[1460] Fix | Delete
* @return array|false
[1461] Fix | Delete
*
[1462] Fix | Delete
* @throws Exception
[1463] Fix | Delete
* @throws getid3_exception
[1464] Fix | Delete
*/
[1465] Fix | Delete
public function ParseRIFFAMV($startoffset, $maxoffset) {
[1466] Fix | Delete
// AMV files are RIFF-AVI files with parts of the spec deliberately broken, such as chunk size fields hardcoded to zero (because players known in hardware that these fields are always a certain size
[1467] Fix | Delete
[1468] Fix | Delete
// https://code.google.com/p/amv-codec-tools/wiki/AmvDocumentation
[1469] Fix | Delete
//typedef struct _amvmainheader {
[1470] Fix | Delete
//FOURCC fcc; // 'amvh'
[1471] Fix | Delete
//DWORD cb;
[1472] Fix | Delete
//DWORD dwMicroSecPerFrame;
[1473] Fix | Delete
//BYTE reserve[28];
[1474] Fix | Delete
//DWORD dwWidth;
[1475] Fix | Delete
//DWORD dwHeight;
[1476] Fix | Delete
//DWORD dwSpeed;
[1477] Fix | Delete
//DWORD reserve0;
[1478] Fix | Delete
//DWORD reserve1;
[1479] Fix | Delete
//BYTE bTimeSec;
[1480] Fix | Delete
//BYTE bTimeMin;
[1481] Fix | Delete
//WORD wTimeHour;
[1482] Fix | Delete
//} AMVMAINHEADER;
[1483] Fix | Delete
[1484] Fix | Delete
$info = &$this->getid3->info;
[1485] Fix | Delete
$RIFFchunk = false;
[1486] Fix | Delete
[1487] Fix | Delete
try {
[1488] Fix | Delete
[1489] Fix | Delete
$this->fseek($startoffset);
[1490] Fix | Delete
$maxoffset = min($maxoffset, $info['avdataend']);
[1491] Fix | Delete
$AMVheader = $this->fread(284);
[1492] Fix | Delete
if (substr($AMVheader, 0, 8) != 'hdrlamvh') {
[1493] Fix | Delete
throw new Exception('expecting "hdrlamv" at offset '.($startoffset + 0).', found "'.substr($AMVheader, 0, 8).'"');
[1494] Fix | Delete
}
[1495] Fix | Delete
if (substr($AMVheader, 8, 4) != "\x38\x00\x00\x00") { // "amvh" chunk size, hardcoded to 0x38 = 56 bytes
[1496] Fix | Delete
throw new Exception('expecting "0x38000000" at offset '.($startoffset + 8).', found "'.getid3_lib::PrintHexBytes(substr($AMVheader, 8, 4)).'"');
[1497] Fix | Delete
}
[1498] Fix | Delete
$RIFFchunk = array();
[1499] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function