sheave_core::messages::amf

Module v0

Source
Expand description

§The AMF Data Types (version 0).

These are data types which are defined in the Action Message Format version 0 specification. Currently the RTMP uses following types:

MarkerAMF Data TypeDescription
0NumberThe IEEE 754 double precision floating point number.
1BooleanThe boolean that is represented as a 1 byte data. (C-like)
2AmfStringThe string that is limited its length the range of 2 bytes.
3ObjectThe key/value-paired object that its value type is flexible.
5NullOnly the marker. Any value doesn’t contain.
8EcmaArraySame as the Object except this has its length.
9Object EndIndicates a stream of object terminaites there.

These are checked whether matched its marker with an actual data, by the receiver-side. Therefore any stream which contains any unmatched marker will be considered it’s invalid. Note that a marker of the Object End must appear only in AMF’s Object. Following descriptions are the actual formats of AMF.

§Number

  1. Marker (1 byte)
  2. An IEEE 754 double precision value (8 bytes)

§Boolean

  1. Marker (1 byte)
  2. A boolean value (1 byte)

§String

  1. Marker (1 byte)
  2. Length (2 bytes)
  3. UTF-8 characters (variable)

§Object

  1. Marker (1 byte)
  2. Arbitrary number key-value pairs (variable)
  3. The Object End marker that is associated with an empty string.

Note keys are without markers of the AMF String. To be exact, these aren’t defined as the AMF String in the specification, that is, these are just strings with lengths (within 2 bytes) at the beginning.

Next, values are limited just in the AMF data types. Currently, following AMF data types to be used in the RTMP are allowed to insert into the AMF Object type:

§Null

  1. Marker (1 byte)

§EcmaArray

  1. Marker (1 byte)
  2. Length (4 bytes)
  3. Arbitrary number key-value pairs (variable)
  4. The Object End marker that is associated with an empty string.

Structs§

  • The UTF-8 string of AMF data types.
  • The boolean representation of AMF data types. This uses 1 byte integer as a boolean value. Usually, 0 is treated as false, else is true.
  • The sized object type of AMF. This consists of:
  • The value to mean that has no content.
  • The IEEE 754 double precision floating point number of AMF data types.
  • The anonymous object type of AMF. This consists of pairs of string keys and any AMF data types.

Enums§

  • Representation of markers of the AMF data types.