|
|
|
@ -3,6 +3,7 @@ package com.inspect.ivs.controller; |
|
|
|
import com.inspect.base.core.domain.Response; |
|
|
|
import com.inspect.base.core.utils.StringUtils; |
|
|
|
import com.inspect.base.core.utils.uuid.UUID; |
|
|
|
import com.inspect.base.redis.service.RedisService; |
|
|
|
import com.inspect.ivs.constant.IvsConst; |
|
|
|
import com.inspect.ivs.enums.RtspType; |
|
|
|
import com.inspect.ivs.service.IvsCommonService; |
|
|
|
@ -19,6 +20,8 @@ import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
import org.springframework.web.bind.annotation.RestController; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
|
|
|
|
@RestController |
|
|
|
@RequestMapping({"/api/v1/stream"}) |
|
|
|
public class IvsStreamController { |
|
|
|
@ -34,6 +37,9 @@ public class IvsStreamController { |
|
|
|
private final ZlMediaComponent zlMediaComponent; |
|
|
|
private final XinTongComponent xinTongComponent; |
|
|
|
|
|
|
|
@Resource |
|
|
|
private RedisService redisService; |
|
|
|
|
|
|
|
public IvsStreamController(IvsCommonService ivsCommonService, ZlMediaComponent zlMediaComponent, XinTongComponent xinTongComponent) { |
|
|
|
this.ivsCommonService = ivsCommonService; |
|
|
|
this.zlMediaComponent = zlMediaComponent; |
|
|
|
@ -63,17 +69,18 @@ public class IvsStreamController { |
|
|
|
} |
|
|
|
|
|
|
|
log.debug("[IVS] {}", ivsVideoRtspView); |
|
|
|
String handle = UUID.randomUUID().toString(); |
|
|
|
log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}", rtspType, rtspType.ordinal()); |
|
|
|
String streamId = UUID.randomUUID().toString(); |
|
|
|
redisService.setCacheObject(String.format(IvsConst.IVS_STREAM_ID, streamId), ivsVideoRtspVo.getCameraCode()); |
|
|
|
log.debug("[IVS] => => rtspType: {}, rtspType.ordinal: {}, streamId: {}", rtspType, rtspType.ordinal(), streamId); |
|
|
|
switch (rtspType.ordinal()) { |
|
|
|
case 0: |
|
|
|
zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView); |
|
|
|
zlMediaComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView); |
|
|
|
break; |
|
|
|
case 1: |
|
|
|
xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), handle, ivsVideoRtspView); |
|
|
|
xinTongComponent.convert(ivsVideoRtspView.getRtspURL(), streamId, ivsVideoRtspView); |
|
|
|
} |
|
|
|
|
|
|
|
IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(handle, ivsVideoRtspView); |
|
|
|
IvsStreamStartView ivsStreamStartView = new IvsStreamStartView(streamId, ivsVideoRtspView); |
|
|
|
log.debug("[IVS] {}", ivsStreamStartView); |
|
|
|
log.debug("[IVS] end"); |
|
|
|
return ivsStreamStartView; |
|
|
|
|