合并分支

pull/1581/head
648540858 2024-08-07 10:41:54 +08:00
parent ea396c902c
commit c88681c7ad
2 changed files with 29 additions and 0 deletions

View File

@ -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.media.zlm.dto.hook.OnStreamChangedHookParam;
import com.genersoft.iot.vmp.vmanager.bean.StreamContent; 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.setSchema(hookParam.getSchema()); mediaArrivalEvent.setSchema(hookParam.getSchema());
mediaArrivalEvent.setHookParam(hookParam); mediaArrivalEvent.setHookParam(hookParam);
mediaArrivalEvent.setParamMap(hookParam.getParamMap());
return mediaArrivalEvent; return mediaArrivalEvent;
} }
@ -33,6 +36,8 @@ public class MediaArrivalEvent extends MediaEvent {
private StreamContent streamInfo; private StreamContent streamInfo;
private Map<String, String> paramMap;
public MediaInfo getMediaInfo() { public MediaInfo getMediaInfo() {
return mediaInfo; return mediaInfo;
} }
@ -65,4 +70,13 @@ public class MediaArrivalEvent extends MediaEvent {
public void setStreamInfo(StreamContent streamInfo) { public void setStreamInfo(StreamContent streamInfo) {
this.streamInfo = streamInfo; this.streamInfo = streamInfo;
} }
public Map<String, String> getParamMap() {
return paramMap;
}
public void setParamMap(Map<String, String> paramMap) {
this.paramMap = paramMap;
}
} }

View File

@ -36,6 +36,9 @@ import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
@ -218,6 +221,18 @@ public class ZLMHttpHookListener {
if (param.getSchema().equalsIgnoreCase("rtsp")) { if (param.getSchema().equalsIgnoreCase("rtsp")) {
if (param.isRegist()) { if (param.isRegist()) {
logger.info("[ZLM HOOK] 流注册, {}->{}->{}/{}", param.getMediaServerId(), param.getSchema(), param.getApp(), param.getStream()); 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); MediaArrivalEvent mediaArrivalEvent = MediaArrivalEvent.getInstance(this, param, mediaServer);
applicationEventPublisher.publishEvent(mediaArrivalEvent); applicationEventPublisher.publishEvent(mediaArrivalEvent);
} else { } else {