getid3_asf::Analyze() –

You appear to be a bot. Output may be restricted

Description

Usage

$bool = getid3_asf::Analyze();

Parameters

Returns

bool

Source

File name: wordpress/wp-includes/ID3/module.audio-video.asf.php


Lines:

1 to 100 of 1413
  public function Analyze() {
    $info = &$this->getid3->info;

    // Shortcuts
    $thisfile_audio = &$info['audio'];
    $thisfile_video = &$info['video'];
    $info['asf']  = array();
    $thisfile_asf = &$info['asf'];
    $thisfile_asf['comments'] = array();
    $thisfile_asf_comments    = &$thisfile_asf['comments'];
    $thisfile_asf['header_object'] = array();
    $thisfile_asf_headerobject     = &$thisfile_asf['header_object'];


    // ASF structure:
    // * Header Object [required]
    //   * File Properties Object [required]   (global file attributes)
    //   * Stream Properties Object [required] (defines media stream & characteristics)
    //   * Header Extension Object [required]  (additional functionality)
    //   * Content Description Object          (bibliographic information)
    //   * Script Command Object               (commands for during playback)
    //   * Marker Object                       (named jumped points within the file)
    // * Data Object [required]
    //   * Data Packets
    // * Index Object

    // Header Object: (mandatory, one only)
    // Field Name                   Field Type   Size (bits)
    // Object ID                    GUID         128             // GUID for header object - GETID3_ASF_Header_Object
    // Object Size                  QWORD        64              // size of header object, including 30 bytes of Header Object header
    // Number of Header Objects     DWORD        32              // number of objects in header object
    // Reserved1                    BYTE         8               // hardcoded: 0x01
    // Reserved2                    BYTE         8               // hardcoded: 0x02

    $info['fileformat'] = 'asf';

    $this->fseek($info['avdataoffset']);
    $HeaderObjectData = $this->fread(30);

    $thisfile_asf_headerobject['objectid']      = substr($HeaderObjectData, 0, 16);
    $thisfile_asf_headerobject['objectid_guid'] = $this->getid3_asf::BytestringToGUID($thisfile_asf_headerobject['objectid']);
    if ($thisfile_asf_headerobject['objectid'] != GETID3_ASF_Header_Object) {
      unset($info['fileformat'], $info['asf']);
      return $this->error('ASF header GUID {'.$this->getid3_asf::BytestringToGUID($thisfile_asf_headerobject['objectid']).'} does not match expected "GETID3_ASF_Header_Object" GUID {'.$this->getid3_asf::BytestringToGUID(GETID3_ASF_Header_Object).'}');
    }
    $thisfile_asf_headerobject['objectsize']    = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 16, 8));
    $thisfile_asf_headerobject['headerobjects'] = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 24, 4));
    $thisfile_asf_headerobject['reserved1']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 28, 1));
    $thisfile_asf_headerobject['reserved2']     = getid3_lib::LittleEndian2Int(substr($HeaderObjectData, 29, 1));

    $NextObjectOffset = $this->ftell();
    $ASFHeaderData = $this->fread($thisfile_asf_headerobject['objectsize'] - 30);
    $offset = 0;
    $thisfile_asf_streambitratepropertiesobject = array();
    $thisfile_asf_codeclistobject = array();
    $StreamPropertiesObjectData = array();

    for ($HeaderObjectsCounter = 0; $HeaderObjectsCounter < $thisfile_asf_headerobject['headerobjects']; $HeaderObjectsCounter++) {
      $NextObjectGUID = substr($ASFHeaderData, $offset, 16);
      $offset += 16;
      $NextObjectGUIDtext = $this->getid3_asf::BytestringToGUID($NextObjectGUID);
      $NextObjectSize = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
      $offset += 8;
      switch ($NextObjectGUID) {

        case GETID3_ASF_File_Properties_Object:
          // File Properties Object: (mandatory, one only)
          // Field Name                   Field Type   Size (bits)
          // Object ID                    GUID         128             // GUID for file properties object - GETID3_ASF_File_Properties_Object
          // Object Size                  QWORD        64              // size of file properties object, including 104 bytes of File Properties Object header
          // File ID                      GUID         128             // unique ID - identical to File ID in Data Object
          // File Size                    QWORD        64              // entire file in bytes. Invalid if Broadcast Flag == 1
          // Creation Date                QWORD        64              // date & time of file creation. Maybe invalid if Broadcast Flag == 1
          // Data Packets Count           QWORD        64              // number of data packets in Data Object. Invalid if Broadcast Flag == 1
          // Play Duration                QWORD        64              // playtime, in 100-nanosecond units. Invalid if Broadcast Flag == 1
          // Send Duration                QWORD        64              // time needed to send file, in 100-nanosecond units. Players can ignore this value. Invalid if Broadcast Flag == 1
          // Preroll                      QWORD        64              // time to buffer data before starting to play file, in 1-millisecond units. If <> 0, PlayDuration and PresentationTime have been offset by this amount
          // Flags                        DWORD        32              //
          // * Broadcast Flag             bits         1  (0x01)       // file is currently being written, some header values are invalid
          // * Seekable Flag              bits         1  (0x02)       // is file seekable
          // * Reserved                   bits         30 (0xFFFFFFFC) // reserved - set to zero
          // Minimum Data Packet Size     DWORD        32              // in bytes. should be same as Maximum Data Packet Size. Invalid if Broadcast Flag == 1
          // Maximum Data Packet Size     DWORD        32              // in bytes. should be same as Minimum Data Packet Size. Invalid if Broadcast Flag == 1
          // Maximum Bitrate              DWORD        32              // maximum instantaneous bitrate in bits per second for entire file, including all data streams and ASF overhead

          // shortcut
          $thisfile_asf['file_properties_object'] = array();
          $thisfile_asf_filepropertiesobject      = &$thisfile_asf['file_properties_object'];

          $thisfile_asf_filepropertiesobject['offset']             = $NextObjectOffset + $offset;
          $thisfile_asf_filepropertiesobject['objectid']           = $NextObjectGUID;
          $thisfile_asf_filepropertiesobject['objectid_guid']      = $NextObjectGUIDtext;
          $thisfile_asf_filepropertiesobject['objectsize']         = $NextObjectSize;
          $thisfile_asf_filepropertiesobject['fileid']             = substr($ASFHeaderData, $offset, 16);
          $offset += 16;
          $thisfile_asf_filepropertiesobject['fileid_guid']        = $this->getid3_asf::BytestringToGUID($thisfile_asf_filepropertiesobject['fileid']);
          $thisfile_asf_filepropertiesobject['filesize']           = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
          $offset += 8;
          $thisfile_asf_filepropertiesobject['creation_date']      = getid3_lib::LittleEndian2Int(substr($ASFHeaderData, $offset, 8));
          $thisfile_asf_filepropertiesobject['creation_date_unix'] = $this->getid3_asf::FILETIMEtoUNIXtime($thisfile_asf_filepropertiesobject['creation_date']);

 View on GitHub View on Trac