|  |  |  | 
|---|
|  |  |  | import com.genersoft.iot.vmp.common.StreamInfo; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.common.VideoManagerConstants; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.gb28181.bean.*; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; | 
|---|
|  |  |  | import com.genersoft.iot.vmp.utils.redis.RedisUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  | streamInfo.getChannelId())); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public StreamInfo queryPlayByStreamId(String steamId) { | 
|---|
|  |  |  | List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, steamId)); | 
|---|
|  |  |  | public StreamInfo queryPlayByStreamId(String streamId) { | 
|---|
|  |  |  | List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAYER_PREFIX, streamId)); | 
|---|
|  |  |  | if (playLeys == null || playLeys.size() == 0) return null; | 
|---|
|  |  |  | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public StreamInfo queryPlaybackByStreamId(String steamId) { | 
|---|
|  |  |  | List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAY_BLACK_PREFIX, steamId)); | 
|---|
|  |  |  | public StreamInfo queryPlaybackByStreamId(String streamId) { | 
|---|
|  |  |  | List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.PLAY_BLACK_PREFIX, streamId)); | 
|---|
|  |  |  | if (playLeys == null || playLeys.size() == 0) return null; | 
|---|
|  |  |  | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean startPlayback(StreamInfo stream) { | 
|---|
|  |  |  | return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(),stream.getDeviceID(), stream.getChannelId()), | 
|---|
|  |  |  | stream); | 
|---|
|  |  |  | return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.PLAY_BLACK_PREFIX, stream.getStreamId(), | 
|---|
|  |  |  | stream.getDeviceID(), stream.getChannelId()), stream); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean startDownload(StreamInfo streamInfo) { | 
|---|
|  |  |  | return redis.set(String.format("%S_%s_%s_%s", VideoManagerConstants.DOWNLOAD_PREFIX, streamInfo.getStreamId(), | 
|---|
|  |  |  | streamInfo.getDeviceID(), streamInfo.getChannelId()), streamInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public boolean stopPlayback(StreamInfo streamInfo) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void updateWVPInfo(JSONObject jsonObject) { | 
|---|
|  |  |  |  | 
|---|
|  |  |  | public void updateWVPInfo(String id, JSONObject jsonObject, int time) { | 
|---|
|  |  |  | String key = VideoManagerConstants.WVP_SERVER_PREFIX + id; | 
|---|
|  |  |  | redis.set(key, jsonObject, time); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void sendStreamChangeMsg(JSONObject jsonObject) { | 
|---|
|  |  |  | String key = VideoManagerConstants.WVP_MSG_STREAM_PUSH_CHANGE_PREFIX; | 
|---|
|  |  |  | redis.convertAndSend(key, jsonObject); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void addPushStream(MediaServerItem mediaServerItem, String app, String streamId, StreamInfo streamInfo) { | 
|---|
|  |  |  | String key = VideoManagerConstants.WVP_SERVER_STREAM_PUSH_PREFIX + app + "_" + streamId + "_" + mediaServerItem.getId(); | 
|---|
|  |  |  | redis.set(key, streamInfo); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public void removePushStream(MediaServerItem mediaServerItem, String app, String streamId) { | 
|---|
|  |  |  | String key = VideoManagerConstants.WVP_SERVER_STREAM_PUSH_PREFIX + app + "_" + streamId + "_" + mediaServerItem.getId(); | 
|---|
|  |  |  | redis.del(key); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @Override | 
|---|
|  |  |  | public StreamInfo queryDownloadByStreamId(String streamId) { | 
|---|
|  |  |  | List<Object> playLeys = redis.scan(String.format("%S_%s_*", VideoManagerConstants.DOWNLOAD_PREFIX, streamId)); | 
|---|
|  |  |  | if (playLeys == null || playLeys.size() == 0) return null; | 
|---|
|  |  |  | return (StreamInfo)redis.get(playLeys.get(0).toString()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|