添加推流列表和拉流代理,下一步与国标关联
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.storager;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.RealVideo;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.conf.MediaServerConfig;
|
||||
@@ -116,5 +117,5 @@ public interface IRedisCatchStorage {
|
||||
* 获取当前媒体流列表
|
||||
* @return List<RealVideo>
|
||||
*/
|
||||
List<Object> getMediaList(int start, int end);
|
||||
JSONObject getMediaList(int start, int end);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.List;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.Device;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyDto;
|
||||
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -261,4 +262,49 @@ public interface IVideoManagerStorager {
|
||||
* @param deviceId
|
||||
*/
|
||||
public int clearMobilePositionsByDeviceId(String deviceId);
|
||||
|
||||
/**
|
||||
* 新增代理流
|
||||
* @param streamProxyDto
|
||||
* @return
|
||||
*/
|
||||
public int addStreamProxy(StreamProxyDto streamProxyDto);
|
||||
|
||||
/**
|
||||
* 更新代理流
|
||||
* @param streamProxyDto
|
||||
* @return
|
||||
*/
|
||||
public int updateStreamProxy(StreamProxyDto streamProxyDto);
|
||||
|
||||
/**
|
||||
* 移除代理流
|
||||
* @param app
|
||||
* @param stream
|
||||
* @return
|
||||
*/
|
||||
public int deleteStreamProxy(String app, String stream);
|
||||
|
||||
/**
|
||||
* 按照是否启用获取代理流
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
public List<StreamProxyDto> getStreamProxyListForEnable(boolean enable);
|
||||
|
||||
/**
|
||||
* 按照是app和stream获取代理流
|
||||
* @param app
|
||||
* @param stream
|
||||
* @return
|
||||
*/
|
||||
public StreamProxyDto queryStreamProxy(String app, String stream);
|
||||
|
||||
/**
|
||||
* 获取代理流
|
||||
* @param page
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StreamProxyDto> queryStreamProxyList(Integer page, Integer count);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.genersoft.iot.vmp.storager.dao;
|
||||
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyDto;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
@Repository
|
||||
public interface StreamProxyMapper {
|
||||
|
||||
@Insert("INSERT INTO stream_proxy (type, app, stream, url, src_url, dst_url, " +
|
||||
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_hls, enable_mp4, enable) VALUES" +
|
||||
"('${type}','${app}', '${stream}', '${url}', '${src_url}', '${dst_url}', " +
|
||||
"'${timeout_ms}', '${ffmpeg_cmd_key}', '${rtp_type}', ${enable_hls}, ${enable_mp4}, ${enable} )")
|
||||
int add(StreamProxyDto streamProxyDto);
|
||||
|
||||
@Update("UPDATE stream_proxy " +
|
||||
"SET type=#{type}, " +
|
||||
"app=#{app}," +
|
||||
"stream=#{stream}," +
|
||||
"url=#{url}, " +
|
||||
"src_url=#{src_url}," +
|
||||
"dst_url=#{dst_url}, " +
|
||||
"timeout_ms=#{timeout_ms}, " +
|
||||
"ffmpeg_cmd_key=#{ffmpeg_cmd_key}, " +
|
||||
"rtp_type=#{rtp_type}, " +
|
||||
"enable_hls=#{enable_hls}, " +
|
||||
"enable=#{enable}, " +
|
||||
"enable_mp4=#{enable_mp4} " +
|
||||
"WHERE app=#{app} AND stream=#{stream}")
|
||||
int update(StreamProxyDto streamProxyDto);
|
||||
|
||||
@Delete("DELETE FROM stream_proxy WHERE app=#{app} AND stream=#{stream}")
|
||||
int del(String app, String stream);
|
||||
|
||||
@Select("SELECT * FROM stream_proxy")
|
||||
List<StreamProxyDto> selectAll();
|
||||
|
||||
@Select("SELECT * FROM stream_proxy WHERE enable=${enable}")
|
||||
List<StreamProxyDto> selectForEnable(boolean enable);
|
||||
|
||||
@Select("SELECT * FROM stream_proxy WHERE app=#{app} AND stream=#{stream}")
|
||||
StreamProxyDto selectOne(String app, String stream);
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.genersoft.iot.vmp.storager.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.genersoft.iot.vmp.common.RealVideo;
|
||||
import com.genersoft.iot.vmp.common.StreamInfo;
|
||||
import com.genersoft.iot.vmp.common.VideoManagerConstants;
|
||||
@@ -92,6 +93,7 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
*/
|
||||
@Override
|
||||
public boolean updateMediaInfo(MediaServerConfig mediaServerConfig) {
|
||||
mediaServerConfig.setUpdateTime(System.currentTimeMillis());
|
||||
return redis.set(VideoManagerConstants.MEDIA_SERVER_PREFIX,mediaServerConfig);
|
||||
}
|
||||
|
||||
@@ -280,9 +282,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
|
||||
* @return List<RealVideo>
|
||||
*/
|
||||
@Override
|
||||
public List<Object> getMediaList(int start, int end) {
|
||||
public JSONObject getMediaList(int start, int end) {
|
||||
String key = VideoManagerConstants.MEDIA_STREAM_PREFIX;
|
||||
Set<Object> realVideos = redis.ZRange(key, start, end);
|
||||
return new ArrayList(realVideos);
|
||||
JSONObject jsonObject = new JSONObject();
|
||||
jsonObject.put("list", new ArrayList(realVideos));
|
||||
jsonObject.put("total", redis.zSize(key));
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,11 @@ import java.util.*;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.DeviceChannel;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatform;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.ParentPlatformCatch;
|
||||
import com.genersoft.iot.vmp.media.zlm.dto.StreamProxyDto;
|
||||
import com.genersoft.iot.vmp.storager.IRedisCatchStorage;
|
||||
import com.genersoft.iot.vmp.gb28181.bean.MobilePosition;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceChannelMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.ParentPlatformMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.PatformChannelMapper;
|
||||
import com.genersoft.iot.vmp.storager.dao.*;
|
||||
import com.genersoft.iot.vmp.vmanager.platform.bean.ChannelReduce;
|
||||
import com.genersoft.iot.vmp.storager.dao.DeviceMobilePositionMapper;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -49,6 +46,9 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
@Autowired
|
||||
private PatformChannelMapper patformChannelMapper;
|
||||
|
||||
@Autowired
|
||||
private StreamProxyMapper streamProxyMapper;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
|
||||
/**
|
||||
* 添加Mobile Position设备移动位置
|
||||
* @param MobilePosition
|
||||
* @param mobilePosition
|
||||
*/
|
||||
@Override
|
||||
public synchronized boolean insertMobilePosition(MobilePosition mobilePosition) {
|
||||
@@ -388,4 +388,68 @@ public class VideoManagerStoragerImpl implements IVideoManagerStorager {
|
||||
return deviceMobilePositionMapper.clearMobilePositionsByDeviceId(deviceId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增代理流
|
||||
* @param streamProxyDto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int addStreamProxy(StreamProxyDto streamProxyDto) {
|
||||
return streamProxyMapper.add(streamProxyDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新代理流
|
||||
* @param streamProxyDto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int updateStreamProxy(StreamProxyDto streamProxyDto) {
|
||||
return streamProxyMapper.update(streamProxyDto);
|
||||
}
|
||||
|
||||
/**
|
||||
* 移除代理流
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public int deleteStreamProxy(String app, String stream) {
|
||||
return streamProxyMapper.del(app, stream);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据是否启用获取代理流列表
|
||||
* @param enable
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<StreamProxyDto> getStreamProxyListForEnable(boolean enable) {
|
||||
return streamProxyMapper.selectForEnable(enable);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询代理流列表
|
||||
* @param page
|
||||
* @param count
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StreamProxyDto> queryStreamProxyList(Integer page, Integer count) {
|
||||
PageHelper.startPage(page, count);
|
||||
List<StreamProxyDto> all = streamProxyMapper.selectAll();
|
||||
return new PageInfo<>(all);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 按照是app和stream获取代理流
|
||||
* @param app
|
||||
* @param stream
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public StreamProxyDto queryStreamProxy(String app, String stream){
|
||||
return streamProxyMapper.selectOne(app, stream);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user