forked from SObS/php-rtmp-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RtmpOperation.php
62 lines (51 loc) · 1.28 KB
/
RtmpOperation.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
class RtmpOperation {
private $chunkStreamID;
private $call;
private $response;
private $handler;
public function __construct(RtmpMessage $call = null, $handler = null) {
if ($call) {
$this->call = $call;
$call->encode();
$this->chunkStreamID = $call->getPacket()->chunkStreamId;
}
$this->handler = $handler;
}
public function getChunkStreamID() {
return $this->chunkStreamID;
}
/**
* getCall
*
* @return RtmpMessage
*/
public function getCall() {
return $this->call;
}
/**
* getResponse
*
* @return RtmpMessage
*/
public function getResponse() {
return $this->response;
}
public function clearResponse() {
$this->response = null;
}
/**
* Create response from packet
*
* @param RtmpPacket $packet
*/
public function createResponse(RtmpPacket $packet) {
$this->response = new RtmpMessage();
$this->response->setPacket($packet);
}
public function invokeHandler() {
if (is_callable($this->handler)) {
call_user_func($this->handler, $this);
}
}
}