合并分支
parent
ea396c902c
commit
c88681c7ad
|
@ -5,6 +5,8 @@ import com.genersoft.iot.vmp.media.bean.MediaServer;
|
|||
import com.genersoft.iot.vmp.media.zlm.dto.hook.OnStreamChangedHookParam;
|
||||
import com.genersoft.iot.vmp.vmanager.bean.StreamContent;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流到来事件
|
||||
*/
|
||||
|
@ -22,6 +24,7 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
mediaArrivalEvent.setSchema(hookParam.getSchema());
|
||||
mediaArrivalEvent.setSchema(hookParam.getSchema());
|
||||
mediaArrivalEvent.setHookParam(hookParam);
|
||||
mediaArrivalEvent.setParamMap(hookParam.getParamMap());
|
||||
return mediaArrivalEvent;
|
||||
}
|
||||
|
||||
|
@ -33,6 +36,8 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
|
||||
private StreamContent streamInfo;
|
||||
|
||||
private Map<String, String> paramMap;
|
||||
|
||||
public MediaInfo getMediaInfo() {
|
||||
return mediaInfo;
|
||||
}
|
||||
|
@ -65,4 +70,13 @@ public class MediaArrivalEvent extends MediaEvent {
|
|||
public void setStreamInfo(StreamContent streamInfo) {
|
||||
this.streamInfo = streamInfo;
|
||||
}
|
||||
|
||||
|
||||
public Map<String, String> getParamMap() {
|
||||
return paramMap;
|
||||
}
|
||||
|
||||
public void setParamMap(Map<String, String> paramMap) {
|
||||
this.paramMap = paramMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,6 +36,9 @@ import org.springframework.util.ObjectUtils;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -218,6 +221,18 @@ public class ZLMHttpHookListener {
|
|||
if (param.getSchema().equalsIgnoreCase("rtsp")) {
|
||||
if (param.isRegist()) {
|
||||
logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream());
|
||||
String queryParams = param.getParams();
|
||||
if (queryParams == null) {
|
||||
try {
|
||||
URL url = new URL("http" + param.getOriginUrl().substring(4));
|
||||
queryParams = url.getQuery();
|
||||
}catch (MalformedURLException ignored) {}
|
||||
}
|
||||
if (queryParams != null) {
|
||||
param.setParamMap(MediaServerUtils.urlParamToMap(queryParams));
|
||||
}else {
|
||||
param.setParamMap(new HashMap<>());
|
||||
}
|
||||
MediaArrivalEvent mediaArrivalEvent = MediaArrivalEvent.getInstance(this, param, mediaServer);
|
||||
applicationEventPublisher.publishEvent(mediaArrivalEvent);
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue