sheave_core

Module messages

Source
Expand description

§The RTMP Messages

After handshake, both are required to negosiate what are needed for sending/receiving. It consists of following steps:

  1. connect
  2. releaseStream
  3. FCPublish
  4. createStream
  5. publish

§connect

Exchanges informations about their applications each other. In this case, next format is required:

FieldAMF TypeValue
Command NameString"connect"
Transaction IDNumber1
Command ObjectObjectSee Command Object.

In the command message, we negotiate by using the Action Message Format (v0).

Command Object

The Command Object is written detailed informations of both applications. Concretely, several of following pair is exchanged:

KeyAMF TypeDescription
appStringServer application name.
flashVerStringEither a flash player version(client) or an FLV encoder version(server).
swfUrlStringThe source SWF file URL.
tcURLStringThe URL to connect server as the TCP. app value is included in this value.
fpadBooleanWhether a proxy is used.
audioCodecsNumberSupported audio codecs.
videoCodecsNumberSupported video codecs.
videoFunctionsNumberSupported video functions.
pageUrlStringThe URL of web page which SWF file is loaded.
objectEncodingNumberA version of the Action Message Format.

Note: Something not in above can be exchanged.

Against, the result for connect request is required to be next format:

FieldAMF TypeValue
Command NameString"_result" or "_error"
Transaction IDNumberSame as the connect request
PropertiesObjecte.g. server-side informations.
InformationObjectContents for describing its response.

§releaseStream

Tells “Play Path” to the parter. In this case, next format is required:

FieldAMF TypeValue
Command NameString"releaseStream"
Transaction IDNumberA number which is next of the connect.
NullNothing but an AMF’s type marker is in.
Play PathStringAny string is in if it is specified.

For example, Play Path is defined as some file name in FFmpeg.

Against, the result for releaseStream request is required to be next format:

FieldAMF TypeValue
Command NameString"_result" or "_error"
Transaction IDNumberSame as the releaseStream request.
NullNothing but an AMF’s type marker is in.

§FCPublish

Tells to the partner what is same as the releaseStream request. In this case, next format is required:

FieldAMF TypeValue
Command NameString"FCPublish"
Transaction IDNumberA number which is next of the releaseStream.
NullNothing but an AMF’s type marker is in.
Play PathString(Probably) Same as the releaseStream request.

Against, the result for FCPublish request is required to be next format:

FieldAMF TypeValue
Command NameString"onFCPublish"

§createStream

Requests to create a new Message Stream ID to the partner. In this case, next format is required:

FieldAMF TypeValue
Command NameString"createStream"
Transaction IDNumberA number which is next of the FCPublish.
NullNothing but an AMF’s type marker is in.

Against, the result for createStream request is required to be next format:

FieldAMF TypeValue
Command NameString"_result" or "_error"
Transaction IDNumberSame as the createStream request.
NullNothing but an AMF’s type marker is in.
Message IDNumberA Message Stream ID which is assigned by the partner.

§publish

Tells to the partner what is an way to publish its stream. In this case, next format is required:

FieldAMF TypeValue
Command NameString"publish"
Transaction IDNumberA number which is next of the createStream.
NullNothing but an AMF’s type marker is in.
Publishing NameStringA name for publishing its stream to the partner.
Publishing TypeStringEither "live", "record" or "append". See Publishing Type.

Against, results for publish request are required to be next format:

  1. Stream Begin
  2. onStatus

§Stream Begin

This is an event message of the User Control Message. This has following data:

  1. Event Type (2 bytes / 0)
  2. A Message ID (4 bytes.)

§onStatus

FieldAMF TypeValue
Command NameString"onStatus"
Transaction IDNumber0
NullNothing but an AMF’s type marker is in.
Info ObjectObjectSimilar to the information of connect result.

Publishing Type

The publish command requires you to specify one of “Publishing Type” in its request. Publishing Type means:

  • "live"

Only streaming. Media data will never be stored.

  • "record"

Media data will be stored. If publishing name duplicated, it is rewritten as a new file.

  • "append"

Same as "record" excepts is appended media data if publishing name duplicated.

Every chunk has the chunk headers. See sheave_core::messages::headers about them.

After negotiation, the server receives actual audio/video data from clients. However also FLV metadata is received as the AMF (v0). The message what contains FLV metadata is called SetDataFrame.

§SetDataFrame

FieldAMF TypeValue
Command Name (Probably)String"@setDataFrame"
Data NameString"onMetaData"
DataEcmaArraye.g. "audiocodecid", "videocodecid"

Modules§

  • The Action Message Formats
  • The Chunk Headers

Structs§

  • The message to tell that some message length has exceeded the server-side bandwidth range. Note this must be input the total message length in receiving. (it’s not bytes received.)
  • Tells a size to chunk its stream to the partner.
  • The command to tell the information that where connects from/to.
  • The response message for Connect requests.
  • The command to request emitting a message ID to a server.
  • The response message for CreateStream requests.
  • The command to request to delete its message ID.
  • The command to tell the playpath. Typically, this becomes same as the releaseStream’s one.
  • This command is same as FcPublish except this requests to delete the playpath.
  • An error means that some command name differs you expect.
  • An error means that some event type differs you expect.
  • An error that some publishing type differs you expect.
  • An error that some chunk size is negative.
  • The response message for FcPublish requests.
  • The response message for Publish requests.
  • The message to tell the client-side bandwidth. This has 2 ways of comparision by which field you specifies.
  • The command to tell publishing information.
  • An error that publishing has failed by something cause.
  • The command to tell the Play Path (e.g. something file name).
  • The response message for ReleaseStream requests.
  • The message to handle something data.
  • The event to tell that the stream is ready to a client.
  • The message to tell the server-side bandwidth. Almost RTMP tools are specifying it 2500000 in bits as their defaults.

Enums§

  • The IDs which are assigned every roles of chunks. This is mainly used for the BasicHeader’s chunk ID.
  • The IDs which are types of user control messages.

Traits§

  • Uniforms chunk data by a channel numbers and a message type.
  • Uniforms user control messages by an event type.

Functions§