This commit is contained in:
shikong 2023-08-17 16:13:26 +08:00
parent c1b0cb9b7e
commit f52771d85e
6 changed files with 46 additions and 2 deletions

View File

@ -55,4 +55,9 @@ public class JsonResponse<T> {
public static <T> JsonResponse<T> build(T data, int status, String msg) {
return new JsonResponse<>(status, msg, data);
}
@Override
public String toString(){
return JsonUtils.toJson(this);
}
}

View File

@ -0,0 +1,11 @@
package cn.skcks.docking.gb28181.media.dto.config;
import lombok.Data;
@Data
public class GeneralConfig {
private Integer enableVhost;
private Integer flowThreshold;
private Integer maxStreamWaitMS;
private Integer streamNoneReaderDelayMS;
}

View File

@ -0,0 +1,11 @@
package cn.skcks.docking.gb28181.media.dto.config;
import lombok.Data;
@Data
public class HlsConfig {
private Integer fileBufSize;
private String filePath;
private Integer segDur;
private Integer segNum;
}

View File

@ -11,4 +11,10 @@ public class ServerConfig {
@JsonUnwrapped(prefix = "ffmpeg.")
private FFMpegConfig ffmpeg;
@JsonUnwrapped(prefix = "general.")
private GeneralConfig general;
@JsonUnwrapped(prefix = "hls.")
private HlsConfig hls;
}

View File

@ -2,6 +2,7 @@ package cn.skcks.docking.gb28181.media.proxy;
import cn.skcks.docking.gb28181.common.json.JsonResponse;
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.service.annotation.GetExchange;
import org.springframework.web.service.annotation.HttpExchange;
@ -13,4 +14,7 @@ public interface ZlmMediaHttpService {
@GetExchange("/index/api/getServerConfig")
JsonResponse<List<ServerConfig>> getServerConfig(@RequestParam String secret);
@GetExchange("/index/api/getServerConfig")
ResponseEntity<String> getServerConfigResponseEntity(@RequestParam String secret);
}

View File

@ -1,6 +1,8 @@
package cn.skcks.docking.gb28181.test;
import cn.skcks.docking.gb28181.common.json.JsonResponse;
import cn.skcks.docking.gb28181.media.config.ZlmMediaConfig;
import cn.skcks.docking.gb28181.media.dto.config.ServerConfig;
import cn.skcks.docking.gb28181.media.proxy.ZlmMediaHttpService;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
@ -9,8 +11,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.List;
@Slf4j
@SpringBootTest
@ -25,7 +29,10 @@ public class MediaServiceTest {
@Test
void context(){
var test = zlMediaHttpService.getServerConfig(config.getSecret());
log.info("{}", test);
ResponseEntity<String> entity = zlMediaHttpService.getServerConfigResponseEntity(config.getSecret());
log.info("{}", entity.getBody());
JsonResponse<List<ServerConfig>> test = zlMediaHttpService.getServerConfig(config.getSecret());
log.info("{}", test);
}
}