| | |
| | | package com.genersoft.iot.vmp.storager.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.genersoft.iot.vmp.common.StreamInfo; |
| | | import com.genersoft.iot.vmp.common.VideoManagerConstants; |
| | | import com.genersoft.iot.vmp.conf.MediaServerConfig; |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.storager.IRedisCatchStorage; |
| | | import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper; |
| | |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.*; |
| | | |
| | | @SuppressWarnings("rawtypes") |
| | |
| | | @Autowired |
| | | private DeviceChannelMapper deviceChannelMapper; |
| | | |
| | | private SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
| | | |
| | | /** |
| | | * 开始播放时将流存入redis |
| | |
| | | channelId)); |
| | | if (playLeys == null || playLeys.size() == 0) return null; |
| | | return (StreamInfo)redis.get(playLeys.get(0).toString()); |
| | | } |
| | | |
| | | /** |
| | | * 更新流媒体信息 |
| | | * @param mediaServerConfig |
| | | * @return |
| | | */ |
| | | @Override |
| | | public boolean updateMediaInfo(MediaServerConfig mediaServerConfig) { |
| | | mediaServerConfig.setUpdateTime(System.currentTimeMillis()); |
| | | return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX,mediaServerConfig); |
| | | } |
| | | |
| | | /** |
| | | * 获取流媒体信息 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public MediaServerConfig getMediaInfo() { |
| | | return (MediaServerConfig)redis.get(VideoManagerConstants.MEDIA_SERVER_PREFIX); |
| | | } |
| | | |
| | | @Override |
| | |
| | | return (SendRtpItem)redis.get(key); |
| | | } |
| | | |
| | | @Override |
| | | public List<SendRtpItem> querySendRTPServer(String platformGbId) { |
| | | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + platformGbId + "_*"; |
| | | List<Object> queryResult = redis.scan(key); |
| | | List<SendRtpItem> result= new ArrayList<>(); |
| | | |
| | | for (int i = 0; i < queryResult.size(); i++) { |
| | | String keyItem = (String) queryResult.get(i); |
| | | result.add((SendRtpItem)redis.get(keyItem)); |
| | | } |
| | | |
| | | return result; |
| | | } |
| | | |
| | | /** |
| | | * 删除RTP推送信息缓存 |
| | | * @param platformGbId |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void outlineForAll() { |
| | | List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + "*" ); |
| | | for (int i = 0; i < onlineDevices.size(); i++) { |
| | | String key = (String) onlineDevices.get(i); |
| | | redis.del(key); |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public List<String> getOnlineForAll() { |
| | | List<String> result = new ArrayList<>(); |
| | | List<Object> onlineDevices = redis.scan(VideoManagerConstants.KEEPLIVEKEY_PREFIX + "*" ); |
| | | for (int i = 0; i < onlineDevices.size(); i++) { |
| | | String key = (String) onlineDevices.get(i); |
| | | result.add((String) redis.get(key)); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void updateWVPInfo(JSONObject jsonObject) { |
| | | |
| | | } |
| | | |
| | | } |