Public Member Functions | Data Fields

AMFReader Class Reference

Public Member Functions

 AMFReader (&$stream)
 readData ()
 readDouble ()
 readBoolean ()
 readString ()
 readObject ()
 readMixedArray ()
 readArray ()
 readDate ()
 readLongString ()
 readXML ()
 readTypedObject ()

Data Fields

 $stream

Detailed Description

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


Member Function Documentation

AMFReader::AMFReader ( &$  stream  ) 

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

References $stream.

                                     {
                $this->stream =& $stream;
        }

AMFReader::readArray (  ) 

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

References $data, and readData().

Referenced by readData().

                             {
                $length = $this->stream->readLong();

                $data = array();

                for ($i = 0; $i < count($length); $i++) {
                        $data[] = $this->readData();
                }

                return $data;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

AMFReader::readBoolean (  ) 

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

Referenced by readData().

                               {
                return $this->stream->readByte() == 1;
        }

Here is the caller graph for this function:

AMFReader::readData (  ) 

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

References readArray(), readBoolean(), readDate(), readDouble(), readLongString(), readMixedArray(), readObject(), readString(), readTypedObject(), and readXML().

Referenced by readArray(), readMixedArray(), and readObject().

                            {
                $value = null;

                $type = $this->stream->readByte();

                switch($type) {
                        // Double
                        case 0:
                                $value = $this->readDouble();
                        break;

                        // Boolean
                        case 1:
                                $value = $this->readBoolean();
                                break;

                        // String
                        case 2:
                                $value = $this->readString();
                                break;

                        // Object
                        case 3:
                                $value = $this->readObject();
                                break;

                        // null
                        case 6:
                                return null;
                                break;

                        // Mixed array
                        case 8:
                                $value = $this->readMixedArray();
                                break;

                        // Array
                        case 10:
                                $value = $this->readArray();
                                break;

                        // Date
                        case 11:
                                $value = $this->readDate();
                                break;

                        // Long string
                        case 13:
                                $value = $this->readLongString();
                                break;

                        // XML (handled as string)
                        case 15:
                                $value = $this->readXML();
                                break;

                        // Typed object (handled as object)
                        case 16:
                                $value = $this->readTypedObject();
                                break;

                        // Long string
                        default:
                                $value = '(unknown or unsupported data type)';
                        break;
                }

                return $value;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

AMFReader::readDate (  ) 

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

References $timestamp.

Referenced by readData().

                            {
                $timestamp = $this->stream->readDouble();
                $timezone = $this->stream->readInt();
                return $timestamp;
        }

Here is the caller graph for this function:

AMFReader::readDouble (  ) 

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

Referenced by readData().

                              {
                return $this->stream->readDouble();
        }

Here is the caller graph for this function:

AMFReader::readLongString (  ) 

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

Referenced by readData().

                                  {
                return $this->stream->readLongUTF();
        }

Here is the caller graph for this function:

AMFReader::readMixedArray (  ) 

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

References $data, and readData().

Referenced by readData().

                                  {
                // Get highest numerical index - ignored
                $highestIndex = $this->stream->readLong();

                $data = array();

                while ($key = $this->stream->readUTF()) {
                        // Mixed array record ends with empty string (0x00 0x00) and 0x09
                        if (($key == '') && ($this->stream->peekByte() == 0x09)) {
                                // Consume byte
                                $this->stream->readByte();
                                break;
                        }

                        if (is_numeric($key)) {
                                $key = (float) $key;
                        }

                        $data[$key] = $this->readData();
                }

                return $data;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

AMFReader::readObject (  ) 

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

References $data, and readData().

Referenced by readData(), and readTypedObject().

                              {
                // Get highest numerical index - ignored
                $highestIndex = $this->stream->readLong();

                $data = array();

                while ($key = $this->stream->readUTF()) {
                        // Mixed array record ends with empty string (0x00 0x00) and 0x09
                        if (($key == '') && ($this->stream->peekByte() == 0x09)) {
                                // Consume byte
                                $this->stream->readByte();
                                break;
                        }

                        $data[$key] = $this->readData();
                }

                return $data;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

AMFReader::readString (  ) 

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

Referenced by readData().

                              {
                return $this->stream->readUTF();
        }

Here is the caller graph for this function:

AMFReader::readTypedObject (  ) 

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

References readObject().

Referenced by readData().

                                   {
                $className = $this->stream->readUTF();
                return $this->readObject();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

AMFReader::readXML (  ) 

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

Referenced by readData().

                           {
                return $this->stream->readLongUTF();
        }

Here is the caller graph for this function:


Field Documentation

AMFReader::$stream

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

Referenced by AMFReader().


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