|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.alibaba.fastjson.JSONObject; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.common.StreamInfo; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.conf.UserSetup; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.conf.UserSetting; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.Device; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.callback.DeferredResultHolder; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.transmit.cmd.impl.SIPCommander; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.service.IPlayService; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IVideoManagerStorager; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IVideoManagerStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.vmanager.gb28181.play.bean.PlayResult; | 
|---|
|  |  |  | import org.slf4j.Logger; | 
|---|
|  |  |  | import org.slf4j.LoggerFactory; | 
|---|
|  |  |  | 
|---|
|  |  |  | private SIPCommander cmder; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IVideoManagerStorager storager; | 
|---|
|  |  |  | private IVideoManagerStorage storager; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private UserSetup userSetup; | 
|---|
|  |  |  | private UserSetting userSetting; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private IRedisCatchStorage redisCatchStorage; | 
|---|
|  |  |  | 
|---|
|  |  |  | @RequestParam(required = false)String timeout | 
|---|
|  |  |  |  | 
|---|
|  |  |  | ){ | 
|---|
|  |  |  | DeferredResult<JSONObject> resultDeferredResult = new DeferredResult<>(userSetup.getPlayTimeout() + 10); | 
|---|
|  |  |  | DeferredResult<JSONObject> resultDeferredResult = new DeferredResult<>(userSetting.getPlayTimeout().longValue() + 10); | 
|---|
|  |  |  | Device device = storager.queryVideoDevice(serial); | 
|---|
|  |  |  | if (device == null ) { | 
|---|
|  |  |  | JSONObject result = new JSONObject(); | 
|---|
|  |  |  | 
|---|
|  |  |  | JSONObject result = new JSONObject(); | 
|---|
|  |  |  | result.put("error", "channel[ " + code + " ] " + eventResult.msg); | 
|---|
|  |  |  | resultDeferredResult.setResult(result); | 
|---|
|  |  |  | }); | 
|---|
|  |  |  | }, null); | 
|---|
|  |  |  | return resultDeferredResult; | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | result.put("error","未找到流信息"); | 
|---|
|  |  |  | return result; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | cmder.streamByeCmd(serial, code, streamInfo.getStream()); | 
|---|
|  |  |  | cmder.streamByeCmd(serial, code, streamInfo.getStream(), null); | 
|---|
|  |  |  | redisCatchStorage.stopPlay(streamInfo); | 
|---|
|  |  |  | storager.stopPlay(streamInfo.getDeviceID(), streamInfo.getChannelId()); | 
|---|
|  |  |  | return null; | 
|---|