1
zhanghua
2024-09-26 c775c6953d9759e70f08acbfa8f6d7490aaae3d1
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
package com.netsdk.demo.customize.courseRecord.modules;
 
import com.netsdk.lib.NetSDKLib;
import com.netsdk.lib.ToolKits;
import com.netsdk.lib.structure.*;
 
/**
 * 录播主机通道号、属性等信息的获取函数
 *
 * @author : 47040
 * @since : Created in 2020/9/18 9:11
 */
public class CourseChannelModule {
 
    // The constant net sdk
    public static final NetSDKLib netsdk = NetSDKLib.NETSDK_INSTANCE;
 
    // The constant config sdk.
    public static final NetSDKLib configsdk = NetSDKLib.CONFIG_INSTANCE;
 
    /**
     * 获取逻辑通道对应的真实预览通道号
     *
     * @param lLoginID 登录句柄
     * @param stuIn    入参
     * @param stuOut   出参
     * @param waitTime 超时时间
     * @return 是否成功
     */
    public static boolean GetRealPreviewChannel(NetSDKLib.LLong lLoginID,
                                                NET_IN_GET_REAL_PREVIEW_CHANNEL stuIn,
                                                NET_OUT_GET_REAL_PREVIEW_CHANNEL stuOut,
                                                int waitTime) {
        stuIn.write();
        stuOut.write();
        boolean ret = netsdk.CLIENT_GetRealPreviewChannel(lLoginID, stuIn.getPointer(), stuOut.getPointer(), waitTime);
        if (!ret) {
            System.err.println("Get Real Preview Channel failed!" + ToolKits.getErrorCode());
            return false;
        }
        stuOut.read();
        System.out.println("Get Real Preview Channel succeed!");
        return true;
    }
 
 
    /**
     * 获取当前摄像机绑定的逻辑通道
     *
     * @param lLoginID 登录句柄
     * @param stuIn    入参
     * @param stuOut   出参
     * @param waitTime 超时时间
     * @return 是否成功
     */
    public static boolean GetLogicChannel(NetSDKLib.LLong lLoginID,
                                          NET_IN_GET_COURSE_LOGIC_CHANNEL stuIn,
                                          NET_OUT_GET_COURSE_LOGIC_CHANNEL stuOut,
                                          int waitTime) {
        stuIn.write();
        stuOut.write();
        boolean ret = netsdk.CLIENT_GetLogicChannel(lLoginID, stuIn.getPointer(), stuOut.getPointer(), waitTime);
        if (!ret) {
            System.err.println("Get Logic Channel failed!" + ToolKits.getErrorCode());
            return false;
        }
        stuOut.read();
        System.out.println("Get Logic Channel succeed!");
        return true;
    }
 
    /**
     * 获取录播主机默认真实通道号
     *
     * @param lLoginID 登录句柄
     * @param stuIn    入参
     * @param stuOut   出参
     * @param waitTime 超时时间
     * @return 是否成功
     */
    public static boolean GetDefaultRealChannel(NetSDKLib.LLong lLoginID,
                                                NET_IN_GET_DEFAULT_REAL_CHANNEL stuIn,
                                                NET_OUT_GET_DEFAULT_REAL_CHANNEL stuOut,
                                                int waitTime) {
        stuIn.write();
        stuOut.write();
        boolean ret = netsdk.CLIENT_GetDefaultRealChannel(lLoginID, stuIn.getPointer(), stuOut.getPointer(), waitTime);
        if (!ret) {
            System.err.println("Get Default Real Channel failed!" + ToolKits.getErrorCode());
            return false;
        }
        stuOut.read();
        System.out.println("Get Default Real Channel succeed!");
        return true;
    }
 
    /**
     * 设置逻辑通道号和真实通道号的绑定关系
     *
     * @param lLoginID 登录句柄
     * @param stuIn    入参
     * @param stuOut   出参
     * @param waitTime 超时时间
     * @return 是否成功
     */
    public static boolean SetBlindRealChannel(NetSDKLib.LLong lLoginID,
                                              NET_IN_SET_BLIND_REAL_CHANNEL stuIn,
                                              NET_OUT_SET_BLIND_REAL_CHANNEL stuOut,
                                              int waitTime) {
        stuIn.write();
        stuOut.write();
        boolean ret = netsdk.CLIENT_SetBlindRealChannel(lLoginID, stuIn.getPointer(), stuOut.getPointer(), waitTime);
        if (!ret) {
            System.err.println("Set Blind Real Channel failed!" + ToolKits.getErrorCode());
            return false;
        }
        stuOut.read();
        System.out.println("Set Blind Real Channel succeed!");
        return true;
    }
 
    /**
     * 获取录播主机通道输入媒体介质
     *
     * @param lLoginID 登录句柄
     * @param stuIn    入参
     * @param stuOut   出参
     * @param waitTime 超时时间
     * @return 是否成功
     */
    public static boolean GetInputChannelMedia(NetSDKLib.LLong lLoginID,
                                               NET_IN_GET_INPUT_CHANNEL_MEDIA stuIn,
                                               NET_OUT_GET_INPUT_CHANNEL_MEDIA stuOut,
                                               int waitTime) {
 
        stuIn.write();
        stuOut.write();
        boolean ret = netsdk.CLIENT_GetInputChannelMedia(lLoginID, stuIn.getPointer(), stuOut.getPointer(), waitTime);
        if (!ret) {
            System.err.println("Get Input Channel Media failed!" + ToolKits.getErrorCode());
            return false;
        }
        stuOut.read();
        System.out.println("Get Input Channel Media succeed!");
        return true;
    }
}