23 $info = &$this->getid3->info;
25 $info[
'fileformat'] =
'swf';
26 $info[
'video'][
'dataformat'] =
'swf';
32 $SWFfileData = $this->
fread(
$info[
'avdataend'] -
$info[
'avdataoffset']);
34 $info[
'swf'][
'header'][
'signature'] = substr($SWFfileData, 0, 3);
35 switch (
$info[
'swf'][
'header'][
'signature']) {
37 $info[
'swf'][
'header'][
'compressed'] =
false;
41 $info[
'swf'][
'header'][
'compressed'] =
true;
47 unset(
$info[
'fileformat']);
54 if (
$info[
'swf'][
'header'][
'compressed']) {
55 $SWFHead = substr($SWFfileData, 0, 8);
56 $SWFfileData = substr($SWFfileData, 8);
57 if ($decompressed = @gzuncompress($SWFfileData)) {
58 $SWFfileData = $SWFHead.$decompressed;
60 $this->
error(
'Error decompressing compressed SWF data ('.strlen($SWFfileData).
' bytes compressed, should be '.(
$info[
'swf'][
'header'][
'length'] - 8).
' bytes uncompressed)');
65 $FrameSizeBitsPerValue = (ord(substr($SWFfileData, 8, 1)) & 0xF8) >> 3;
66 $FrameSizeDataLength = ceil((5 + (4 * $FrameSizeBitsPerValue)) / 8);
67 $FrameSizeDataString = str_pad(decbin(ord(substr($SWFfileData, 8, 1)) & 0x07), 3,
'0', STR_PAD_LEFT);
68 for (
$i = 1;
$i < $FrameSizeDataLength;
$i++) {
69 $FrameSizeDataString .= str_pad(decbin(ord(substr($SWFfileData, 8 +
$i, 1))), 8,
'0', STR_PAD_LEFT);
71 list($X1, $X2, $Y1, $Y2) = explode(
"\n", wordwrap($FrameSizeDataString, $FrameSizeBitsPerValue,
"\n", 1));
85 $info[
'video'][
'frame_rate'] =
$info[
'swf'][
'header'][
'frame_rate'];
86 $info[
'video'][
'resolution_x'] = intval(round(
$info[
'swf'][
'header'][
'frame_width'] / 20));
87 $info[
'video'][
'resolution_y'] = intval(round(
$info[
'swf'][
'header'][
'frame_height'] / 20));
88 $info[
'video'][
'pixel_aspect_ratio'] = (float) 1;
90 if ((
$info[
'swf'][
'header'][
'frame_count'] > 0) && (
$info[
'swf'][
'header'][
'frame_rate'] > 0)) {
91 $info[
'playtime_seconds'] =
$info[
'swf'][
'header'][
'frame_count'] /
$info[
'swf'][
'header'][
'frame_rate'];
98 $CurrentOffset = 12 + $FrameSizeDataLength;
99 $SWFdataLength = strlen($SWFfileData);
101 while ($CurrentOffset < $SWFdataLength) {
105 $TagID = ($TagIDTagLength & 0xFFFC) >> 6;
106 $TagLength = ($TagIDTagLength & 0x003F);
108 if ($TagLength == 0x3F) {
114 $TagData[
'offset'] = $CurrentOffset;
115 $TagData[
'size'] = $TagLength;
116 $TagData[
'id'] = $TagID;
117 $TagData[
'data'] = substr($SWFfileData, $CurrentOffset, $TagLength);
128 if ($this->ReturnAllTagData) {
129 $info[
'swf'][
'tags'][] = $TagData;
134 $CurrentOffset += $TagLength;
static Bin2Dec($binstring, $signed=false)
static LittleEndian2Int($byteword, $signed=false)
static PrintHexBytes($string, $hex=true, $spaces=true, $htmlencoding='UTF-8')
getID3() by James Heinrich info@getid3.org //
fseek($bytes, $whence=SEEK_SET)
static BigEndian2Int($byteword, $synchsafe=false, $signed=false)