From fc901e8c65b6a2ec3c19e60534202114970fccbe Mon Sep 17 00:00:00 2001 From: 648540858 <648540858@qq.com> Date: 星期五, 25 九月 2020 17:41:02 +0800 Subject: [PATCH] 更新readme --- src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java | 75 ++++++++++++++++++++++--------------- 1 files changed, 45 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java index b349db0..2f5766a 100644 --- a/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java +++ b/src/main/java/com/genersoft/iot/vmp/media/zlm/ZLMHttpHookListener.java @@ -1,7 +1,13 @@ package com.genersoft.iot.vmp.media.zlm; import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; +import com.genersoft.iot.vmp.conf.MediaServerConfig; +import com.genersoft.iot.vmp.storager.IVideoManagerStorager; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -29,6 +35,9 @@ @Autowired private SIPCommander cmder; + + @Autowired + private IVideoManagerStorager storager; /** * 娴侀噺缁熻浜嬩欢锛屾挱鏀惧櫒鎴栨帹娴佸櫒鏂紑鏃跺苟涓旇�楃敤娴侀噺瓒呰繃鐗瑰畾闃堝�兼椂浼氳Е鍙戞浜嬩欢锛岄槇鍊奸�氳繃閰嶇疆鏂囦欢general.flowThreshold閰嶇疆锛涙浜嬩欢瀵瑰洖澶嶄笉鏁忔劅銆� @@ -45,8 +54,8 @@ JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -64,10 +73,10 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("err", ""); - json.put("path", ""); - json.put("second", 600); + ret.put("code", 0); + ret.put("err", ""); + ret.put("path", ""); + ret.put("second", 600); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -85,8 +94,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -104,11 +113,11 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); - json.put("enableHls", true); - json.put("enableMP4", false); - json.put("enableRtxp", true); + ret.put("code", 0); + ret.put("msg", "success"); + ret.put("enableHls", true); + ret.put("enableMP4", false); + ret.put("enableRtxp", true); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -126,8 +135,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -145,8 +154,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("realm", ""); + ret.put("code", 0); + ret.put("realm", ""); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -165,9 +174,9 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("encrypted", false); - json.put("passwd", "test"); + ret.put("code", 0); + ret.put("encrypted", false); + ret.put("passwd", "test"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -185,8 +194,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -204,8 +213,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -228,8 +237,8 @@ cmder.streamByeCmd(ssrc); JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("close", true); + ret.put("code", 0); + ret.put("close", true); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -247,8 +256,8 @@ // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } @@ -263,11 +272,17 @@ if (logger.isDebugEnabled()) { logger.debug("ZLM HOOK on_server_started API璋冪敤锛屽弬鏁帮細" + json.toString()); } + +// String data = json.getString("data"); +// List<MediaServerConfig> mediaServerConfigs = JSON.parseArray(JSON.toJSONString(json), MediaServerConfig.class); +// MediaServerConfig mediaServerConfig = mediaServerConfigs.get(0); + MediaServerConfig mediaServerConfig = JSON.toJavaObject(json, MediaServerConfig.class); + storager.updateMediaInfo(mediaServerConfig); // TODO Auto-generated method stub JSONObject ret = new JSONObject(); - json.put("code", 0); - json.put("msg", "success"); + ret.put("code", 0); + ret.put("msg", "success"); return new ResponseEntity<String>(ret.toString(),HttpStatus.OK); } } -- Gitblit v1.8.0