📄 module.audio-video.quicktime.php
字号:
// video atom $atomstructure['sample_description_table'][$i]['video_temporal_quality'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 8, 4)); $atomstructure['sample_description_table'][$i]['video_spatial_quality'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 12, 4)); $atomstructure['sample_description_table'][$i]['video_frame_width'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 16, 2)); $atomstructure['sample_description_table'][$i]['video_frame_height'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 18, 2)); $atomstructure['sample_description_table'][$i]['video_resolution_x'] = getid3_lib::FixedPoint16_16(substr($atomstructure['sample_description_table'][$i]['data'], 20, 4)); $atomstructure['sample_description_table'][$i]['video_resolution_y'] = getid3_lib::FixedPoint16_16(substr($atomstructure['sample_description_table'][$i]['data'], 24, 4)); $atomstructure['sample_description_table'][$i]['video_data_size'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 28, 4)); $atomstructure['sample_description_table'][$i]['video_frame_count'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 32, 2)); $atomstructure['sample_description_table'][$i]['video_encoder_name_len'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 34, 1)); $atomstructure['sample_description_table'][$i]['video_encoder_name'] = substr($atomstructure['sample_description_table'][$i]['data'], 35, $atomstructure['sample_description_table'][$i]['video_encoder_name_len']); $atomstructure['sample_description_table'][$i]['video_pixel_color_depth'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 66, 2)); $atomstructure['sample_description_table'][$i]['video_color_table_id'] = getid3_lib::BigEndian2Int(substr($atomstructure['sample_description_table'][$i]['data'], 68, 2)); $atomstructure['sample_description_table'][$i]['video_pixel_color_type'] = (($atomstructure['sample_description_table'][$i]['video_pixel_color_depth'] > 32) ? 'grayscale' : 'color'); $atomstructure['sample_description_table'][$i]['video_pixel_color_name'] = $this->QuicktimeColorNameLookup($atomstructure['sample_description_table'][$i]['video_pixel_color_depth']); if ($atomstructure['sample_description_table'][$i]['video_pixel_color_name'] != 'invalid') { $ThisFileInfo['quicktime']['video']['codec_fourcc'] = $atomstructure['sample_description_table'][$i]['data_format']; $ThisFileInfo['quicktime']['video']['codec_fourcc_lookup'] = $this->QuicktimeVideoCodecLookup($atomstructure['sample_description_table'][$i]['data_format']); $ThisFileInfo['quicktime']['video']['codec'] = $atomstructure['sample_description_table'][$i]['video_encoder_name']; $ThisFileInfo['quicktime']['video']['color_depth'] = $atomstructure['sample_description_table'][$i]['video_pixel_color_depth']; $ThisFileInfo['quicktime']['video']['color_depth_name'] = $atomstructure['sample_description_table'][$i]['video_pixel_color_name']; $ThisFileInfo['video']['codec'] = $ThisFileInfo['quicktime']['video']['codec']; $ThisFileInfo['video']['bits_per_sample'] = $ThisFileInfo['quicktime']['video']['color_depth']; } $ThisFileInfo['video']['lossless'] = false; $ThisFileInfo['video']['pixel_aspect_ratio'] = (float) 1; break; } break; } switch (strtolower($atomstructure['sample_description_table'][$i]['data_format'])) { case 'mp4a': $ThisFileInfo['audio']['dataformat'] = 'mp4'; $ThisFileInfo['quicktime']['audio']['codec'] = 'mp4'; break; case '3ivx': case '3iv1': case '3iv2': $ThisFileInfo['video']['dataformat'] = '3ivx'; break; case 'xvid': $ThisFileInfo['video']['dataformat'] = 'xvid'; break; case 'mp4v': $ThisFileInfo['video']['dataformat'] = 'mpeg4'; break; case 'divx': case 'div1': case 'div2': case 'div3': case 'div4': case 'div5': case 'div6': $TDIVXileInfo['video']['dataformat'] = 'divx'; break; default: // do nothing break; } unset($atomstructure['sample_description_table'][$i]['data']); } break; case 'stts': // Sample Table Time-to-Sample atom //if ($ParseAllPossibleAtoms) { $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $sttsEntriesDataOffset = 8; $FrameRateCalculatorArray = array(); for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['time_to_sample_table'][$i]['sample_count'] = getid3_lib::BigEndian2Int(substr($atomdata, $sttsEntriesDataOffset, 4)); $sttsEntriesDataOffset += 4; $atomstructure['time_to_sample_table'][$i]['sample_duration'] = getid3_lib::BigEndian2Int(substr($atomdata, $sttsEntriesDataOffset, 4)); $sttsEntriesDataOffset += 4; if (!empty($ThisFileInfo['quicktime']['time_scale'])) { $stts_new_framerate = $ThisFileInfo['quicktime']['time_scale'] / $atomstructure['time_to_sample_table'][$i]['sample_duration']; if ($stts_new_framerate <= 60) { // some atoms have durations of "1" giving a very large framerate, which probably is not right $ThisFileInfo['video']['frame_rate'] = max(@$ThisFileInfo['video']['frame_rate'], $stts_new_framerate); } } //@$FrameRateCalculatorArray[($ThisFileInfo['quicktime']['time_scale'] / $atomstructure['time_to_sample_table'][$i]['sample_duration'])] += $atomstructure['time_to_sample_table'][$i]['sample_count']; } //$sttsFramesTotal = 0; //$sttsSecondsTotal = 0; //foreach ($FrameRateCalculatorArray as $frames_per_second => $frame_count) { // if (($frames_per_second > 60) || ($frames_per_second < 1)) { // // not video FPS information, probably audio information // $sttsFramesTotal = 0; // $sttsSecondsTotal = 0; // break; // } // $sttsFramesTotal += $frame_count; // $sttsSecondsTotal += $frame_count / $frames_per_second; //} //if (($sttsFramesTotal > 0) && ($sttsSecondsTotal > 0)) { // if (($sttsFramesTotal / $sttsSecondsTotal) > @$ThisFileInfo['video']['frame_rate']) { // $ThisFileInfo['video']['frame_rate'] = $sttsFramesTotal / $sttsSecondsTotal; // } //} //} break; case 'stss': // Sample Table Sync Sample (key frames) atom if ($ParseAllPossibleAtoms) { $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $stssEntriesDataOffset = 8; for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['time_to_sample_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stssEntriesDataOffset, 4)); $stssEntriesDataOffset += 4; } } break; case 'stsc': // Sample Table Sample-to-Chunk atom if ($ParseAllPossibleAtoms) { $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $stscEntriesDataOffset = 8; for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['sample_to_chunk_table'][$i]['first_chunk'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; $atomstructure['sample_to_chunk_table'][$i]['samples_per_chunk'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; $atomstructure['sample_to_chunk_table'][$i]['sample_description'] = getid3_lib::BigEndian2Int(substr($atomdata, $stscEntriesDataOffset, 4)); $stscEntriesDataOffset += 4; } } break; case 'stsz': // Sample Table SiZe atom if ($ParseAllPossibleAtoms) { $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['sample_size'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 4)); $stszEntriesDataOffset = 12; if ($atomstructure['sample_size'] == 0) { for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['sample_size_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stszEntriesDataOffset, 4)); $stszEntriesDataOffset += 4; } } } break; case 'stco': // Sample Table Chunk Offset atom if ($ParseAllPossibleAtoms) { $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $stcoEntriesDataOffset = 8; for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['chunk_offset_table'][$i] = getid3_lib::BigEndian2Int(substr($atomdata, $stcoEntriesDataOffset, 4)); $stcoEntriesDataOffset += 4; } } break; case 'dref': // Data REFerence atom $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['number_entries'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 4)); $drefDataOffset = 8; for ($i = 0; $i < $atomstructure['number_entries']; $i++) { $atomstructure['data_references'][$i]['size'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 4)); $drefDataOffset += 4; $atomstructure['data_references'][$i]['type'] = substr($atomdata, $drefDataOffset, 4); $drefDataOffset += 4; $atomstructure['data_references'][$i]['version'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 1)); $drefDataOffset += 1; $atomstructure['data_references'][$i]['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, $drefDataOffset, 3)); // hardcoded: 0x0000 $drefDataOffset += 3; $atomstructure['data_references'][$i]['data'] = substr($atomdata, $drefDataOffset, ($atomstructure['data_references'][$i]['size'] - 4 - 4 - 1 - 3)); $drefDataOffset += ($atomstructure['data_references'][$i]['size'] - 4 - 4 - 1 - 3); $atomstructure['data_references'][$i]['flags']['self_reference'] = (bool) ($atomstructure['data_references'][$i]['flags_raw'] & 0x001); } break; case 'gmin': // base Media INformation atom $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['graphics_mode'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); $atomstructure['opcolor_red'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)); $atomstructure['opcolor_green'] = getid3_lib::BigEndian2Int(substr($atomdata, 8, 2)); $atomstructure['opcolor_blue'] = getid3_lib::BigEndian2Int(substr($atomdata, 10, 2)); $atomstructure['balance'] = getid3_lib::BigEndian2Int(substr($atomdata, 12, 2)); $atomstructure['reserved'] = getid3_lib::BigEndian2Int(substr($atomdata, 14, 2)); break; case 'smhd': // Sound Media information HeaDer atom $atomstructure['version'] = getid3_lib::BigEndian2Int(substr($atomdata, 0, 1)); $atomstructure['flags_raw'] = getid3_lib::BigEndian2Int(substr($atomdata, 1, 3)); // hardcoded: 0x0000 $atomstructure['balance'] = getid3_lib::BigEndian2Int(substr($atomdata, 4, 2)); $atomstructure['reserved'] = getid3_lib::BigEndian2Int(substr($atomdata, 6, 2)); break;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -