From ce950dea4aef933a12e78e4fe1f535ba9a83c3df Mon Sep 17 00:00:00 2001
From: leesam <leesam@leesam.cn>
Date: 星期三, 10 四月 2024 22:18:40 +0800
Subject: [PATCH] Merge branch 'refs/heads/master' into develop-add-api-key

---
 src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java |  122 +++++++++++++++++++++++++++++++++++++++-
 1 files changed, 119 insertions(+), 3 deletions(-)

diff --git a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
index d808772..f1c3d58 100644
--- a/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
+++ b/src/main/java/com/genersoft/iot/vmp/media/bean/MediaInfo.java
@@ -12,6 +12,15 @@
  */
 @Schema(description = "瑙嗛淇℃伅")
 public class MediaInfo {
+    @Schema(description = "搴旂敤鍚�")
+    private String app;
+    @Schema(description = "娴両D")
+    private String stream;
+    @Schema(description = "娴佸獟浣撹妭鐐�")
+    private MediaServer mediaServer;
+    @Schema(description = "鍗忚")
+    private String schema;
+
     @Schema(description = "瑙傜湅浜烘暟")
     private Integer readerCount;
     @Schema(description = "瑙嗛缂栫爜绫诲瀷")
@@ -28,12 +37,43 @@
     private Integer audioSampleRate;
     @Schema(description = "闊抽閲囨牱鐜�")
     private Long duration;
+    @Schema(description = "鍦ㄧ嚎")
+    private Boolean online;
+    @Schema(description = "unknown = 0,rtmp_push=1,rtsp_push=2,rtp_push=3,pull=4,ffmpeg_pull=5,mp4_vod=6,device_chn=7")
+    private Integer originType;
+    @Schema(description = "瀛樻椿鏃堕棿锛屽崟浣嶇")
+    private Long aliveSecond;
+    @Schema(description = "鏁版嵁浜х敓閫熷害锛屽崟浣峛yte/s")
+    private Long bytesSpeed;
 
-    public static MediaInfo getInstance(JSONObject jsonObject) {
+    public static MediaInfo getInstance(JSONObject jsonObject, MediaServer mediaServer) {
         MediaInfo mediaInfo = new MediaInfo();
+        mediaInfo.setMediaServer(mediaServer);
+        String app = jsonObject.getString("app");
+        mediaInfo.setApp(app);
+        String stream = jsonObject.getString("stream");
+        mediaInfo.setStream(stream);
+        String schema = jsonObject.getString("schema");
+        mediaInfo.setSchema(schema);
         Integer totalReaderCount = jsonObject.getInteger("totalReaderCount");
+        Boolean online = jsonObject.getBoolean("online");
+        Integer originType = jsonObject.getInteger("originType");
+        Long aliveSecond = jsonObject.getLong("aliveSecond");
+        Long bytesSpeed = jsonObject.getLong("bytesSpeed");
         if (totalReaderCount != null) {
             mediaInfo.setReaderCount(totalReaderCount);
+        }
+        if (online != null) {
+            mediaInfo.setOnline(online);
+        }
+        if (originType != null) {
+            mediaInfo.setOriginType(originType);
+        }
+        if (aliveSecond != null) {
+            mediaInfo.setAliveSecond(aliveSecond);
+        }
+        if (bytesSpeed != null) {
+            mediaInfo.setBytesSpeed(bytesSpeed);
         }
         JSONArray jsonArray = jsonObject.getJSONArray("tracks");
         if (jsonArray.isEmpty()) {
@@ -86,10 +126,22 @@
         return mediaInfo;
     }
 
-    public static MediaInfo getInstance(OnStreamChangedHookParam param) {
-        List<OnStreamChangedHookParam.MediaTrack> tracks = param.getTracks();
+    public static MediaInfo getInstance(OnStreamChangedHookParam param, MediaServer mediaServer) {
+
         MediaInfo mediaInfo = new MediaInfo();
+        mediaInfo.setApp(param.getApp());
+        mediaInfo.setStream(param.getStream());
+        mediaInfo.setSchema(param.getSchema());
+        mediaInfo.setMediaServer(mediaServer);
         mediaInfo.setReaderCount(param.getTotalReaderCount());
+        mediaInfo.setOnline(param.isRegist());
+        mediaInfo.setOriginType(param.getOriginType());
+        mediaInfo.setAliveSecond(param.getAliveSecond());
+        mediaInfo.setBytesSpeed(param.getBytesSpeed());
+        List<OnStreamChangedHookParam.MediaTrack> tracks = param.getTracks();
+        if (tracks == null || tracks.isEmpty()) {
+            return mediaInfo;
+        }
         for (OnStreamChangedHookParam.MediaTrack mediaTrack : tracks) {
             switch (mediaTrack.getCodec_id()) {
                 case 0:
@@ -187,4 +239,68 @@
     public void setDuration(Long duration) {
         this.duration = duration;
     }
+
+    public Boolean getOnline() {
+        return online;
+    }
+
+    public void setOnline(Boolean online) {
+        this.online = online;
+    }
+
+    public Integer getOriginType() {
+        return originType;
+    }
+
+    public void setOriginType(Integer originType) {
+        this.originType = originType;
+    }
+
+    public Long getAliveSecond() {
+        return aliveSecond;
+    }
+
+    public void setAliveSecond(Long aliveSecond) {
+        this.aliveSecond = aliveSecond;
+    }
+
+    public Long getBytesSpeed() {
+        return bytesSpeed;
+    }
+
+    public void setBytesSpeed(Long bytesSpeed) {
+        this.bytesSpeed = bytesSpeed;
+    }
+
+    public String getApp() {
+        return app;
+    }
+
+    public void setApp(String app) {
+        this.app = app;
+    }
+
+    public String getStream() {
+        return stream;
+    }
+
+    public void setStream(String stream) {
+        this.stream = stream;
+    }
+
+    public MediaServer getMediaServer() {
+        return mediaServer;
+    }
+
+    public void setMediaServer(MediaServer mediaServer) {
+        this.mediaServer = mediaServer;
+    }
+
+    public String getSchema() {
+        return schema;
+    }
+
+    public void setSchema(String schema) {
+        this.schema = schema;
+    }
 }

--
Gitblit v1.8.0