ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
getid3_flv Class Reference
+ Collaboration diagram for getid3_flv:

Public Member Functions

 getid3_flv (&$fd, &$ThisFileInfo, $ReturnAllTagData=false)
 FLVaudioFormat ($id)
 FLVaudioRate ($id)
 FLVaudioBitDepth ($id)
 FLVvideoCodec ($id)

Detailed Description

Definition at line 38 of file module.audio-video.flv.php.

Member Function Documentation

getid3_flv::FLVaudioBitDepth (   $id)

Definition at line 230 of file module.audio-video.flv.php.

Referenced by getid3_flv().

{
$FLVaudioBitDepth = array(
0 => 8,
1 => 16,
);
return (@$FLVaudioBitDepth[$id] ? @$FLVaudioBitDepth[$id] : false);
}

+ Here is the caller graph for this function:

getid3_flv::FLVaudioFormat (   $id)

Definition at line 209 of file module.audio-video.flv.php.

Referenced by getid3_flv().

{
$FLVaudioFormat = array(
0 => 'uncompressed',
1 => 'ADPCM',
2 => 'mp3',
5 => 'Nellymoser 8kHz mono',
6 => 'Nellymoser',
);
return (@$FLVaudioFormat[$id] ? @$FLVaudioFormat[$id] : false);
}

+ Here is the caller graph for this function:

getid3_flv::FLVaudioRate (   $id)

Definition at line 220 of file module.audio-video.flv.php.

Referenced by getid3_flv().

{
$FLVaudioRate = array(
0 => 5500,
1 => 11025,
2 => 22050,
3 => 44100,
);
return (@$FLVaudioRate[$id] ? @$FLVaudioRate[$id] : false);
}

+ Here is the caller graph for this function:

getid3_flv::FLVvideoCodec (   $id)

Definition at line 238 of file module.audio-video.flv.php.

References GETID3_FLV_VIDEO_H263, GETID3_FLV_VIDEO_SCREEN, and GETID3_FLV_VIDEO_VP6.

Referenced by getid3_flv().

{
$FLVvideoCodec = array(
GETID3_FLV_VIDEO_H263 => 'Sorenson H.263',
GETID3_FLV_VIDEO_SCREEN => 'Screen video',
GETID3_FLV_VIDEO_VP6 => 'On2 VP6',
);
return (@$FLVvideoCodec[$id] ? @$FLVvideoCodec[$id] : false);
}

+ Here is the caller graph for this function:

getid3_flv::getid3_flv ( $fd,
$ThisFileInfo,
  $ReturnAllTagData = false 
)

Definition at line 41 of file module.audio-video.flv.php.

References $reader, getid3_lib\BigEndian2Int(), FLVaudioBitDepth(), FLVaudioFormat(), FLVaudioRate(), FLVvideoCodec(), GETID3_FLV_TAG_AUDIO, GETID3_FLV_TAG_META, GETID3_FLV_TAG_VIDEO, and GETID3_FLV_VIDEO_VP6.

{
fseek($fd, $ThisFileInfo['avdataoffset'], SEEK_SET);
$FLVdataLength = $ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset'];
$FLVheader = fread($fd, 5);
$ThisFileInfo['fileformat'] = 'flv';
$ThisFileInfo['flv']['header']['signature'] = substr($FLVheader, 0, 3);
$ThisFileInfo['flv']['header']['version'] = getid3_lib::BigEndian2Int(substr($FLVheader, 3, 1));
$TypeFlags = getid3_lib::BigEndian2Int(substr($FLVheader, 4, 1));
if ($ThisFileInfo['flv']['header']['signature'] != 'FLV') {
$ThisFileInfo['error'][] = 'Expecting "FLV" at offset '.$ThisFileInfo['avdataoffset'].', found "'.$ThisFileInfo['flv']['header']['signature'].'"';
unset($ThisFileInfo['flv']);
unset($ThisFileInfo['fileformat']);
return false;
}
$ThisFileInfo['flv']['header']['hasAudio'] = (bool) ($TypeFlags & 0x04);
$ThisFileInfo['flv']['header']['hasVideo'] = (bool) ($TypeFlags & 0x01);
$FrameSizeDataLength = getid3_lib::BigEndian2Int(fread($fd, 4));
$FLVheaderFrameLength = 9;
if ($FrameSizeDataLength > $FLVheaderFrameLength) {
fseek($fd, $FrameSizeDataLength - $FLVheaderFrameLength, SEEK_CUR);
}
$Duration = 0;
while ((ftell($fd) + 1) < $ThisFileInfo['avdataend']) {
//if (!$ThisFileInfo['flv']['header']['hasAudio'] || isset($ThisFileInfo['flv']['audio']['audioFormat'])) {
// if (!$ThisFileInfo['flv']['header']['hasVideo'] || isset($ThisFileInfo['flv']['video']['videoCodec'])) {
// break;
// }
//}
$ThisTagHeader = fread($fd, 16);
$PreviousTagLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 0, 4));
$TagType = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 4, 1));
$DataLength = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 5, 3));
$Timestamp = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 8, 3));
$LastHeaderByte = getid3_lib::BigEndian2Int(substr($ThisTagHeader, 15, 1));
$NextOffset = ftell($fd) - 1 + $DataLength;
switch ($TagType) {
if (!isset($ThisFileInfo['flv']['audio']['audioFormat'])) {
$ThisFileInfo['flv']['audio']['audioFormat'] = $LastHeaderByte & 0x07;
$ThisFileInfo['flv']['audio']['audioRate'] = ($LastHeaderByte & 0x30) / 0x10;
$ThisFileInfo['flv']['audio']['audioSampleSize'] = ($LastHeaderByte & 0x40) / 0x40;
$ThisFileInfo['flv']['audio']['audioType'] = ($LastHeaderByte & 0x80) / 0x80;
}
break;
if (!isset($ThisFileInfo['flv']['video']['videoCodec'])) {
$ThisFileInfo['flv']['video']['videoCodec'] = $LastHeaderByte & 0x07;
$FLVvideoHeader = fread($fd, 11);
if ($ThisFileInfo['flv']['video']['videoCodec'] != GETID3_FLV_VIDEO_VP6) {
$PictureSizeType = (getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 3, 2))) >> 7;
$PictureSizeType = $PictureSizeType & 0x0007;
$ThisFileInfo['flv']['header']['videoSizeType'] = $PictureSizeType;
switch ($PictureSizeType) {
case 0:
$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 2));
$PictureSizeEnc <<= 1;
$ThisFileInfo['video']['resolution_x'] = ($PictureSizeEnc & 0xFF00) >> 8;
$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 6, 2));
$PictureSizeEnc <<= 1;
$ThisFileInfo['video']['resolution_y'] = ($PictureSizeEnc & 0xFF00) >> 8;
break;
case 1:
$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 5, 4));
$PictureSizeEnc <<= 1;
$ThisFileInfo['video']['resolution_x'] = ($PictureSizeEnc & 0xFFFF0000) >> 16;
$PictureSizeEnc = getid3_lib::BigEndian2Int(substr($FLVvideoHeader, 7, 4));
$PictureSizeEnc <<= 1;
$ThisFileInfo['video']['resolution_y'] = ($PictureSizeEnc & 0xFFFF0000) >> 16;
break;
case 2:
$ThisFileInfo['video']['resolution_x'] = 352;
$ThisFileInfo['video']['resolution_y'] = 288;
break;
case 3:
$ThisFileInfo['video']['resolution_x'] = 176;
$ThisFileInfo['video']['resolution_y'] = 144;
break;
case 4:
$ThisFileInfo['video']['resolution_x'] = 128;
$ThisFileInfo['video']['resolution_y'] = 96;
break;
case 5:
$ThisFileInfo['video']['resolution_x'] = 320;
$ThisFileInfo['video']['resolution_y'] = 240;
break;
case 6:
$ThisFileInfo['video']['resolution_x'] = 160;
$ThisFileInfo['video']['resolution_y'] = 120;
break;
default:
$ThisFileInfo['video']['resolution_x'] = 0;
$ThisFileInfo['video']['resolution_y'] = 0;
break;
}
}
}
break;
// Meta tag
fseek($fd, -1, SEEK_CUR);
$reader = new AMFReader(new AMFStream(fread($fd, $DataLength)));
$eventName = $reader->readData();
$ThisFileInfo['meta'][$eventName] = $reader->readData();
unset($reader);
$ThisFileInfo['video']['frame_rate'] = $ThisFileInfo['meta']['onMetaData']['framerate'];
$ThisFileInfo['video']['resolution_x'] = $ThisFileInfo['meta']['onMetaData']['width'];
$ThisFileInfo['video']['resolution_y'] = $ThisFileInfo['meta']['onMetaData']['height'];
break;
default:
// noop
break;
}
if ($Timestamp > $Duration) {
$Duration = $Timestamp;
}
fseek($fd, $NextOffset, SEEK_SET);
}
$ThisFileInfo['playtime_seconds'] = $Duration / 1000;
$ThisFileInfo['bitrate'] = ($ThisFileInfo['avdataend'] - $ThisFileInfo['avdataoffset']) / $ThisFileInfo['playtime_seconds'];
if ($ThisFileInfo['flv']['header']['hasAudio']) {
$ThisFileInfo['audio']['codec'] = $this->FLVaudioFormat($ThisFileInfo['flv']['audio']['audioFormat']);
$ThisFileInfo['audio']['sample_rate'] = $this->FLVaudioRate($ThisFileInfo['flv']['audio']['audioRate']);
$ThisFileInfo['audio']['bits_per_sample'] = $this->FLVaudioBitDepth($ThisFileInfo['flv']['audio']['audioSampleSize']);
$ThisFileInfo['audio']['channels'] = $ThisFileInfo['flv']['audio']['audioType'] + 1; // 0=mono,1=stereo
$ThisFileInfo['audio']['lossless'] = ($ThisFileInfo['flv']['audio']['audioFormat'] ? false : true); // 0=uncompressed
$ThisFileInfo['audio']['dataformat'] = 'flv';
}
if (@$ThisFileInfo['flv']['header']['hasVideo']) {
$ThisFileInfo['video']['codec'] = $this->FLVvideoCodec($ThisFileInfo['flv']['video']['videoCodec']);
$ThisFileInfo['video']['dataformat'] = 'flv';
$ThisFileInfo['video']['lossless'] = false;
}
return true;
}

+ Here is the call graph for this function:


The documentation for this class was generated from the following file: