scuffle_rtmp/user_control_messages/mod.rs
1//! User control messages.
2//!
3//! Defined by:
4//! - Legacy RTMP spec, 6.2
5
6pub mod writer;
7
8nutype_enum::nutype_enum! {
9 /// The type of user control message event.
10 pub enum EventType(u16) {
11 /// > The server sends this event to notify the client
12 /// > that a stream has become functional and can be
13 /// > used for communication. By default, this event
14 /// > is sent on ID 0 after the application connect
15 /// > command is successfully received from the
16 /// > client. The event data is 4-byte and represents
17 /// > the stream ID of the stream that became
18 /// > functional.
19 StreamBegin = 0,
20 /// > The server sends this event to notify the client
21 /// > that the playback of data is over as requested
22 /// > on this stream. No more data is sent without
23 /// > issuing additional commands. The client discards
24 /// > the messages received for the stream. The
25 /// > 4 bytes of event data represent the ID of the
26 /// > stream on which playback has ended.
27 StreamEOF = 1,
28 /// > The server sends this event to notify the client
29 /// > that there is no more data on the stream. If the
30 /// > server does not detect any message for a time
31 /// > period, it can notify the subscribed clients
32 /// > that the stream is dry. The 4 bytes of event
33 /// > data represent the stream ID of the dry stream.
34 StreamDry = 2,
35 /// > The client sends this event to inform the server
36 /// > of the buffer size (in milliseconds) that is
37 /// > used to buffer any data coming over a stream.
38 /// > This event is sent before the server starts
39 /// > processing the stream. The first 4 bytes of the
40 /// > event data represent the stream ID and the next
41 /// > 4 bytes represent the buffer length, in milliseconds.
42 SetBufferLength = 3,
43 /// > The server sends this event to notify the client
44 /// > that the stream is a recorded stream. The
45 /// > 4 bytes event data represent the stream ID of
46 /// > the recorded stream.
47 StreamIsRecorded = 4,
48 /// > The server sends this event to test whether the
49 /// > client is reachable. Event data is a 4-byte
50 /// > timestamp, representing the local server time
51 /// > when the server dispatched the command. The
52 /// > client responds with PingResponse on receiving
53 /// > MsgPingRequest.
54 PingRequest = 6,
55 /// > The client sends this event to the server in
56 /// > response to the ping request. The event data is
57 /// > a 4-byte timestamp, which was received with the
58 /// > PingRequest request.
59 PingResponse = 7,
60 }
61}
62
63/// > The server sends this event to notify the client
64/// > that a stream has become functional and can be
65/// > used for communication. By default, this event
66/// > is sent on ID 0 after the application connect
67/// > command is successfully received from the
68/// > client. The event data is 4-byte and represents
69/// > the stream ID of the stream that became
70/// > functional.
71pub struct EventMessageStreamBegin {
72 /// The stream ID of the stream that became functional.
73 pub stream_id: u32,
74}