| | |
| | | import com.genersoft.iot.vmp.gb28181.bean.*; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.MediaServerItem; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.OnPublishHookParam; |
| | | import com.genersoft.iot.vmp.media.zlm.dto.StreamAuthorityInfo; |
| | | import com.genersoft.iot.vmp.service.bean.GPSMsgInfo; |
| | | import com.genersoft.iot.vmp.service.bean.MessageForPushChannel; |
| | | import com.genersoft.iot.vmp.service.bean.ThirdPartyGB; |
| | |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Component; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.*; |
| | | |
| | |
| | | |
| | | @Override |
| | | public void addStream(MediaServerItem mediaServerItem, String type, String app, String streamId, MediaItem mediaItem) { |
| | | // 查找是否使用了callID |
| | | StreamAuthorityInfo streamAuthorityInfo = getStreamAuthorityInfo(app, streamId); |
| | | String key = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_" + type + "_" + app + "_" + streamId + "_" + mediaServerItem.getId(); |
| | | if (streamAuthorityInfo != null) { |
| | | mediaItem.setCallId(streamAuthorityInfo.getCallId()); |
| | | } |
| | | redis.set(key, mediaItem); |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public void updateStreamAuthorityInfo(String app, String stream, StreamAuthorityInfo streamAuthorityInfo) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream; |
| | | redis.set(key, streamAuthorityInfo); |
| | | } |
| | | |
| | | @Override |
| | | public void removeStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | redis.del(key); |
| | | } |
| | | |
| | | @Override |
| | | public StreamAuthorityInfo getStreamAuthorityInfo(String app, String stream) { |
| | | String key = VideoManagerConstants.MEDIA_STREAM_AUTHORITY + userSetting.getServerId() + "_" + app+ "_" + stream ; |
| | | return (StreamAuthorityInfo) redis.get(key); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public MediaItem getStreamInfo(String app, String streamId, String mediaServerId) { |
| | | String scanKey = VideoManagerConstants.WVP_SERVER_STREAM_PREFIX + userSetting.getServerId() + "_*_" + app + "_" + streamId + "_" + mediaServerId; |
| | | |
| | |
| | | public boolean deviceIsOnline(String deviceId) { |
| | | return getDevice(deviceId).getOnline() == 1; |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void sendStreamPushRequestedMsgForStatus() { |
| | | String key = VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED; |
| | | logger.info("[redis 通知]获取所有推流设备的状态"); |
| | | JSONObject jsonObject = new JSONObject(); |
| | | jsonObject.put(key, key); |
| | | redis.convertAndSend(key, jsonObject); |
| | | } |
| | | } |