leesam
2024-04-10 16b7e4a7ef473a6af29ec78aeb2f471fa398efdd
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
package com.genersoft.iot.vmp.media.zlm.dto;
 
import com.genersoft.iot.vmp.media.event.media.MediaArrivalEvent;
 
/**
 * 流的鉴权信息
 * @author lin
 */
public class StreamAuthorityInfo {
 
    private String id;
    private String app;
    private String stream;
 
    /**
     * 产生源类型,
     * unknown = 0,
     * rtmp_push=1,
     * rtsp_push=2,
     * rtp_push=3,
     * pull=4,
     * ffmpeg_pull=5,
     * mp4_vod=6,
     * device_chn=7
     */
    private int originType;
 
    /**
     * 产生源类型的字符串描述
     */
    private String originTypeStr;
 
    /**
     * 推流时自定义的播放鉴权ID
     */
    private String callId;
 
    /**
     * 推流的鉴权签名
     */
    private String sign;
 
    public String getId() {
        return id;
    }
 
    public void setId(String id) {
        this.id = id;
    }
 
    public String getApp() {
        return app;
    }
 
    public void setApp(String app) {
        this.app = app;
    }
 
    public String getStream() {
        return stream;
    }
 
    public void setStream(String stream) {
        this.stream = stream;
    }
 
    public int getOriginType() {
        return originType;
    }
 
    public void setOriginType(int originType) {
        this.originType = originType;
    }
 
    public String getOriginTypeStr() {
        return originTypeStr;
    }
 
    public void setOriginTypeStr(String originTypeStr) {
        this.originTypeStr = originTypeStr;
    }
 
    public String getCallId() {
        return callId;
    }
 
    public void setCallId(String callId) {
        this.callId = callId;
    }
 
    public String getSign() {
        return sign;
    }
 
    public void setSign(String sign) {
        this.sign = sign;
    }
 
    public static StreamAuthorityInfo getInstanceByHook(String app, String stream, String id) {
        StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo();
        streamAuthorityInfo.setApp(app);
        streamAuthorityInfo.setStream(stream);
        streamAuthorityInfo.setId(id);
        return streamAuthorityInfo;
    }
 
    public static StreamAuthorityInfo getInstanceByHook(MediaArrivalEvent event) {
        StreamAuthorityInfo streamAuthorityInfo = new StreamAuthorityInfo();
        streamAuthorityInfo.setApp(event.getApp());
        streamAuthorityInfo.setStream(event.getStream());
        streamAuthorityInfo.setId(event.getMediaServer().getId());
        if (event.getMediaInfo() != null) {
            streamAuthorityInfo.setOriginType(event.getMediaInfo().getOriginType());
        }
 
        return streamAuthorityInfo;
    }
}