新增JT1078 Template支持
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
package com.genersoft.iot.vmp.jt1078.config;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
||||
import com.genersoft.iot.vmp.jt1078.proc.response.J9101;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.WVPResult;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
/**
|
||||
* curl http://localhost:18080/api/jt1078/start/live/18864197066/1
|
||||
*
|
||||
* @author QingtaiJiang
|
||||
* @date 2023/4/27 18:12
|
||||
* @email qingtaij@163.com
|
||||
*/
|
||||
@ConditionalOnProperty(value = "jt1078.enable", havingValue = "true")
|
||||
@RestController
|
||||
@RequestMapping("/api/jt1078")
|
||||
public class JT1078Controller {
|
||||
|
||||
@Resource
|
||||
JT1078Template jt1078Template;
|
||||
|
||||
@GetMapping("/start/live/{deviceId}/{channelId}")
|
||||
public WVPResult<?> startLive(@PathVariable String deviceId, @PathVariable String channelId) {
|
||||
J9101 j9101 = new J9101();
|
||||
j9101.setChannel(Integer.valueOf(channelId));
|
||||
j9101.setIp("192.168.1.1");
|
||||
j9101.setRate(1);
|
||||
j9101.setTcpPort(7618);
|
||||
j9101.setUdpPort(7618);
|
||||
j9101.setType(0);
|
||||
|
||||
String s = jt1078Template.startLive(deviceId, j9101, 6);
|
||||
WVPResult<String> wvpResult = new WVPResult<>();
|
||||
wvpResult.setCode(200);
|
||||
wvpResult.setData(String.format("http://192.168.1.1/rtp/%s_%s.live.mp4", deviceId, channelId));
|
||||
return wvpResult;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.genersoft.iot.vmp.jt1078.config;
|
||||
|
||||
import com.genersoft.iot.vmp.jt1078.cmd.JT1078Template;
|
||||
import com.genersoft.iot.vmp.jt1078.codec.netty.TcpServer;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.core.annotation.Order;
|
||||
|
||||
/**
|
||||
* @author QingtaiJiang
|
||||
* @date 2023/4/27 19:35
|
||||
* @email qingtaij@163.com
|
||||
*/
|
||||
@Order(Integer.MIN_VALUE)
|
||||
@Configuration
|
||||
@ConditionalOnProperty(value = "jt1078.enable", havingValue = "true")
|
||||
public class TcpAutoConfiguration {
|
||||
|
||||
@Bean(initMethod = "start", destroyMethod = "stop")
|
||||
public TcpServer jt1078Server(@Value("${jt1078.port}") Integer port) {
|
||||
return new TcpServer(port);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public JT1078Template jt1078Template() {
|
||||
return new JT1078Template();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user