|
@@ -4,17 +4,14 @@ import com.aizuda.zlm4j.core.ZLMApi;
|
|
|
import com.aizuda.zlm4j.structure.MK_EVENTS;
|
|
import com.aizuda.zlm4j.structure.MK_EVENTS;
|
|
|
import com.aizuda.zlm4j.structure.MK_INI;
|
|
import com.aizuda.zlm4j.structure.MK_INI;
|
|
|
import com.sun.jna.Native;
|
|
import com.sun.jna.Native;
|
|
|
-import jakarta.annotation.PostConstruct;
|
|
|
|
|
-import jakarta.annotation.PreDestroy;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* @author xucaiqin
|
|
* @author xucaiqin
|
|
|
* @date 2025-07-09 13:01:48
|
|
* @date 2025-07-09 13:01:48
|
|
|
*/
|
|
*/
|
|
|
@Slf4j
|
|
@Slf4j
|
|
|
-@Component
|
|
|
|
|
|
|
+//@Component
|
|
|
public class StreamService {
|
|
public class StreamService {
|
|
|
//动态链接库放在/resource/win32-x86-64&/resource/linux-x86-64下JNA会自动查找目录
|
|
//动态链接库放在/resource/win32-x86-64&/resource/linux-x86-64下JNA会自动查找目录
|
|
|
public static ZLMApi ZLM_API = Native.load("mk_api", ZLMApi.class);
|
|
public static ZLMApi ZLM_API = Native.load("mk_api", ZLMApi.class);
|
|
@@ -28,7 +25,7 @@ public class StreamService {
|
|
|
return osName.contains("linux");
|
|
return osName.contains("linux");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PostConstruct
|
|
|
|
|
|
|
+// @PostConstruct
|
|
|
public void start() {
|
|
public void start() {
|
|
|
//初始化sdk配置
|
|
//初始化sdk配置
|
|
|
ZLM_API.mk_env_init2(1, 1, 1, null, 0, 0, null, 0, null, null);
|
|
ZLM_API.mk_env_init2(1, 1, 1, null, 0, 0, null, 0, null, null);
|
|
@@ -112,7 +109,7 @@ public class StreamService {
|
|
|
short rtc_server_port = ZLM_API.mk_rtc_server_start((short) 8000);
|
|
short rtc_server_port = ZLM_API.mk_rtc_server_start((short) 8000);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- @PreDestroy
|
|
|
|
|
|
|
+// @PreDestroy
|
|
|
public void stop() {
|
|
public void stop() {
|
|
|
log.info("ZLMediaKit 服务关闭中...");
|
|
log.info("ZLMediaKit 服务关闭中...");
|
|
|
ZLM_API.mk_stop_all_server();
|
|
ZLM_API.mk_stop_all_server();
|