From 0e8d4f0cc1d3b3aeb4c2479c1f00675c98c62980 Mon Sep 17 00:00:00 2001 From: shikong <919411476@qq.com> Date: Tue, 16 Jan 2024 15:16:11 +0800 Subject: [PATCH] =?UTF-8?q?addFFmpegSource=20=E5=92=8C=20delFFmpegSource?= =?UTF-8?q?=20=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../media/dto/proxy/AddFFmpegSource.java | 41 +++++++++++++++++++ .../media/dto/proxy/AddFFmpegSourceResp.java | 11 +++++ .../media/dto/proxy/DelFFmpegSourceResp.java | 8 ++++ .../media/proxy/ZlmMediaHttpClient.java | 7 ++++ 4 files changed, 67 insertions(+) create mode 100644 zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSource.java create mode 100644 zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSourceResp.java create mode 100644 zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/DelFFmpegSourceResp.java diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSource.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSource.java new file mode 100644 index 0000000..4401bf3 --- /dev/null +++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSource.java @@ -0,0 +1,41 @@ +package cn.skcks.docking.gb28181.media.dto.proxy; + +import com.fasterxml.jackson.databind.PropertyNamingStrategies; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +@JsonNaming(PropertyNamingStrategies.SnakeCaseStrategy.class) +public class AddFFmpegSource { + /** + * FFmpeg 拉流地址,支持任意协议或格式(只要 FFmpeg 支持即可) + */ + private String srcUrl; + /** + * FFmpeg rtmp 推流地址,一般都是推给自己 + *

例如 rtmp://127.0.0.1/live/stream_form_ffmpeg

+ */ + private String dstUrl; + /** + * FFmpeg 推流成功超时时间 + */ + private long timeoutMs; + /** + * 是否开启 hls 录制 + */ + private Boolean enableHls; + /** + * 是否开启 mp4 录制 + */ + private Boolean enableMp4; + /** + * 配置文件中 FFmpeg 命令参数模板 key(非内容),置空则采用默认模板:ffmpeg.cmd + */ + private String ffmpegCmdKey; +} diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSourceResp.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSourceResp.java new file mode 100644 index 0000000..097c650 --- /dev/null +++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/AddFFmpegSourceResp.java @@ -0,0 +1,11 @@ +package cn.skcks.docking.gb28181.media.dto.proxy; + +import lombok.Data; + +@Data +public class AddFFmpegSourceResp { + /** + * 流的唯一标识 + */ + private String key; +} diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/DelFFmpegSourceResp.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/DelFFmpegSourceResp.java new file mode 100644 index 0000000..0685d47 --- /dev/null +++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/dto/proxy/DelFFmpegSourceResp.java @@ -0,0 +1,8 @@ +package cn.skcks.docking.gb28181.media.dto.proxy; + +import lombok.Data; + +@Data +public class DelFFmpegSourceResp { + private Boolean flag; +} diff --git a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpClient.java b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpClient.java index 0ff458d..f5ffcb0 100644 --- a/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpClient.java +++ b/zlmediakit-service/src/main/java/cn/skcks/docking/gb28181/media/proxy/ZlmMediaHttpClient.java @@ -76,4 +76,11 @@ public interface ZlmMediaHttpClient { @GetMapping("/index/api/getRtpInfo") GetRtpInfoResp getRtpInfo(@RequestParam String secret,@RequestParam("stream_id") String streamId); + + @PostMapping("/index/api/addFFmpegSource") + ZlmResponse addFFmpegSource(@RequestParam String secret,@RequestBody AddFFmpegSource params); + + @GetMapping("/index/api/delFFmpegSource") + ZlmResponse delFFmpegSource(@RequestParam String secret, @RequestParam String key); + }