优化倍速播放参数
parent
20082441ef
commit
08c45876df
|
@ -140,7 +140,7 @@ public interface ISIPCommander {
|
||||||
/**
|
/**
|
||||||
* 回放倍速播放
|
* 回放倍速播放
|
||||||
*/
|
*/
|
||||||
void playSpeedCmd(Device device, StreamInfo streamInfo, String speed);
|
void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 语音广播
|
* 语音广播
|
||||||
|
|
|
@ -1630,12 +1630,12 @@ public class SIPCommander implements ISIPCommander {
|
||||||
* 回放倍速播放
|
* 回放倍速播放
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void playSpeedCmd(Device device, StreamInfo streamInfo, String speed) {
|
public void playSpeedCmd(Device device, StreamInfo streamInfo, Double speed) {
|
||||||
try {
|
try {
|
||||||
StringBuffer content = new StringBuffer(200);
|
StringBuffer content = new StringBuffer(200);
|
||||||
content.append("PLAY RTSP/1.0\r\n");
|
content.append("PLAY RTSP/1.0\r\n");
|
||||||
content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
content.append("CSeq: " + InfoCseqCache.CSEQCACHE.get(streamInfo.getStreamId()) + "\r\n");
|
||||||
content.append("Scale: " + speed + ".000000\r\n");
|
content.append("Scale: " + String.format("%.1f",speed) + "\r\n");
|
||||||
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
Request request = headerProvider.createInfoRequest(device, streamInfo, content.toString());
|
||||||
logger.info(request.toString());
|
logger.info(request.toString());
|
||||||
ClientTransaction clientTransaction = null;
|
ClientTransaction clientTransaction = null;
|
||||||
|
|
|
@ -221,10 +221,10 @@ public class PlaybackController {
|
||||||
@ApiOperation("回放倍速播放")
|
@ApiOperation("回放倍速播放")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "streamId", value = "回放流ID", dataTypeClass = String.class),
|
||||||
@ApiImplicitParam(name = "speed", value = "倍速 1、2、4", dataTypeClass = String.class),
|
@ApiImplicitParam(name = "speed", value = "倍速0.25 0.5 1、2、4", dataTypeClass = Double.class),
|
||||||
})
|
})
|
||||||
@GetMapping("/speed/{streamId}/{speed}")
|
@GetMapping("/speed/{streamId}/{speed}")
|
||||||
public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable String speed) {
|
public ResponseEntity<String> playSpeed(@PathVariable String streamId, @PathVariable Double speed) {
|
||||||
logger.info("playSpeed: "+streamId+", "+speed);
|
logger.info("playSpeed: "+streamId+", "+speed);
|
||||||
JSONObject json = new JSONObject();
|
JSONObject json = new JSONObject();
|
||||||
StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
|
StreamInfo streamInfo = redisCatchStorage.queryPlaybackByStreamId(streamId);
|
||||||
|
@ -233,6 +233,11 @@ public class PlaybackController {
|
||||||
logger.warn("streamId不存在!");
|
logger.warn("streamId不存在!");
|
||||||
return new ResponseEntity<String>(json.toString(), HttpStatus.BAD_REQUEST);
|
return new ResponseEntity<String>(json.toString(), HttpStatus.BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
if(speed != 0.25 && speed != 0.5 && speed != 1 && speed != 2.0 && speed != 4.0) {
|
||||||
|
json.put("msg", "不支持的speed(0.25 0.5 1、2、4)");
|
||||||
|
logger.warn("不支持的speed: " + speed);
|
||||||
|
return new ResponseEntity<String>(json.toString(), HttpStatus.BAD_REQUEST);
|
||||||
|
}
|
||||||
setCseq(streamId);
|
setCseq(streamId);
|
||||||
Device device = storager.queryVideoDevice(streamInfo.getDeviceID());
|
Device device = storager.queryVideoDevice(streamInfo.getDeviceID());
|
||||||
cmder.playSpeedCmd(device, streamInfo, speed);
|
cmder.playSpeedCmd(device, streamInfo, speed);
|
||||||
|
|
Loading…
Reference in New Issue