修复拉流代理的ffmpeg代理方式

This commit is contained in:
648540858 2023-06-05 10:28:11 +08:00
parent b7d85a270e
commit 2ef4111297
4 changed files with 83 additions and 94 deletions

View File

@ -16,32 +16,30 @@ public class StreamProxyItem extends GbStream {
@Schema(description = "流ID")
private String stream;
@Schema(description = "流媒体服务ID")
private String media_server_id;
private String mediaServerId;
@Schema(description = "拉流地址")
private String url;
@Schema(description = "拉流地址")
private String src_url;
private String srcUrl;
@Schema(description = "目标地址")
private String dst_url;
private String dstUrl;
@Schema(description = "超时时间")
private int timeout_ms;
private int timeoutMs;
@Schema(description = "ffmpeg模板KEY")
private String ffmpeg_cmd_key;
private String ffmpegCmdKey;
@Schema(description = "rtsp拉流时拉流方式0tcp1udp2组播")
private String rtp_type;
private String rtpType;
@Schema(description = "是否启用")
private boolean enable;
@Schema(description = "是否启用音频")
private boolean enable_audio;
private boolean enableAudio;
@Schema(description = "是否启用MP4")
private boolean enable_mp4;
private boolean enableMp4;
@Schema(description = "是否 无人观看时删除")
private boolean enable_remove_none_reader;
private boolean enableRemoveNoneReader;
@Schema(description = "是否 无人观看时自动停用")
private boolean enable_disable_none_reader;
@Schema(description = "创建时间")
private String create_time;
private boolean enableDisableNoneReader;
public String getType() {
return type;
@ -73,12 +71,12 @@ public class StreamProxyItem extends GbStream {
@Override
public String getMediaServerId() {
return media_server_id;
return mediaServerId;
}
@Override
public void setMediaServerId(String mediaServerId) {
this.media_server_id = mediaServerId;
this.mediaServerId = mediaServerId;
}
public String getUrl() {
@ -90,43 +88,43 @@ public class StreamProxyItem extends GbStream {
}
public String getSrcUrl() {
return src_url;
return srcUrl;
}
public void setSrcUrl(String src_url) {
this.src_url = src_url;
this.srcUrl = src_url;
}
public String getDstUrl() {
return dst_url;
return dstUrl;
}
public void setDstUrl(String dst_url) {
this.dst_url = dst_url;
this.dstUrl = dst_url;
}
public int getTimeoutMs() {
return timeout_ms;
return timeoutMs;
}
public void setTimeoutMs(int timeout_ms) {
this.timeout_ms = timeout_ms;
this.timeoutMs = timeout_ms;
}
public String getFfmpegCmdKey() {
return ffmpeg_cmd_key;
return ffmpegCmdKey;
}
public void setFfmpegCmdKey(String ffmpeg_cmd_key) {
this.ffmpeg_cmd_key = ffmpeg_cmd_key;
this.ffmpegCmdKey = ffmpeg_cmd_key;
}
public String getRtpType() {
return rtp_type;
return rtpType;
}
public void setRtpType(String rtp_type) {
this.rtp_type = rtp_type;
this.rtpType = rtp_type;
}
public boolean isEnable() {
@ -138,44 +136,36 @@ public class StreamProxyItem extends GbStream {
}
public boolean isEnableMp4() {
return enable_mp4;
return enableMp4;
}
public void setEnableMp4(boolean enable_mp4) {
this.enable_mp4 = enable_mp4;
}
@Override
public String getCreateTime() {
return create_time;
}
@Override
public void setCreateTime(String create_time) {
this.create_time = create_time;
this.enableMp4 = enable_mp4;
}
public boolean isEnableRemoveNoneReader() {
return enable_remove_none_reader;
return enableRemoveNoneReader;
}
public void setEnableRemoveNoneReader(boolean enable_remove_none_reader) {
this.enable_remove_none_reader = enable_remove_none_reader;
this.enableRemoveNoneReader = enable_remove_none_reader;
}
public boolean isEnableDisableNoneReader() {
return enable_disable_none_reader;
return enableDisableNoneReader;
}
public void setEnableDisableNoneReader(boolean enable_disable_none_reader) {
this.enable_disable_none_reader = enable_disable_none_reader;
this.enableDisableNoneReader = enable_disable_none_reader;
}
public boolean isEnableAudio() {
return enable_audio;
return enableAudio;
}
public void setEnableAudio(boolean enable_audio) {
this.enable_audio = enable_audio;
this.enableAudio = enable_audio;
}
}

View File

@ -13,9 +13,9 @@ public interface StreamProxyMapper {
@Insert("INSERT INTO wvp_stream_proxy (type, name, app, stream,media_server_id, url, src_url, dst_url, " +
"timeout_ms, ffmpeg_cmd_key, rtp_type, enable_audio, enable_mp4, enable, status, enable_remove_none_reader, enable_disable_none_reader, create_time) VALUES" +
"(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{src_url}, #{dst_url}, " +
"#{timeout_ms}, #{ffmpeg_cmd_key}, #{rtp_type}, #{enable_audio}, #{enable_mp4}, #{enable}, #{status}, " +
"#{enable_remove_none_reader}, #{enable_disable_none_reader}, #{createTime} )")
"(#{type}, #{name}, #{app}, #{stream}, #{mediaServerId}, #{url}, #{srcUrl}, #{dstUrl}, " +
"#{timeoutMs}, #{ffmpegCmdKey}, #{rtpType}, #{enableAudio}, #{enableMp4}, #{enable}, #{status}, " +
"#{enableRemoveNoneReader}, #{enableDisableNoneReader}, #{createTime} )")
int add(StreamProxyItem streamProxyDto);
@Update("UPDATE wvp_stream_proxy " +
@ -25,17 +25,17 @@ public interface StreamProxyMapper {
"stream=#{stream}," +
"url=#{url}, " +
"media_server_id=#{mediaServerId}, " +
"src_url=#{src_url}," +
"dst_url=#{dst_url}, " +
"timeout_ms=#{timeout_ms}, " +
"ffmpeg_cmd_key=#{ffmpeg_cmd_key}, " +
"rtp_type=#{rtp_type}, " +
"enable_audio=#{enable_audio}, " +
"src_url=#{srcUrl}," +
"dst_url=#{dstUrl}, " +
"timeout_ms=#{timeoutMs}, " +
"ffmpeg_cmd_key=#{ffmpegCmdKey}, " +
"rtp_type=#{rtpType}, " +
"enable_audio=#{enableAudio}, " +
"enable=#{enable}, " +
"status=#{status}, " +
"enable_remove_none_reader=#{enable_remove_none_reader}, " +
"enable_disable_none_reader=#{enable_disable_none_reader}, " +
"enable_mp4=#{enable_mp4} " +
"enable_remove_none_reader=#{enableRemoveNoneReader}, " +
"enable_disable_none_reader=#{enableDisableNoneReader}, " +
"enable_mp4=#{enableMp4} " +
"WHERE app=#{app} AND stream=#{stream}")
int update(StreamProxyItem streamProxyDto);

View File

@ -22,8 +22,8 @@
{{scope.row.url}}
</el-tag>
<el-tag size="medium" v-if="scope.row.type != 'default'">
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="scope.row.src_url" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
{{scope.row.src_url}}
<i class="cpoy-btn el-icon-document-copy" title="点击拷贝" v-clipboard="scope.row.srcUrl" @success="$message({type:'success', message:'成功拷贝到粘贴板'})"></i>
{{scope.row.srcUrl}}
</el-tag>
</div>
</template>
@ -197,7 +197,7 @@
this.$refs.onvifEdit.openDialog(res.data.data, (url)=>{
if (url != null) {
this.$refs.onvifEdit.close();
this.$refs.streamProxyEdit.openDialog({type: "default", url: url, src_url: url}, this.initData())
this.$refs.streamProxyEdit.openDialog({type: "default", url: url, srcUrl: url}, this.initData())
}
})
}else {

View File

@ -33,13 +33,13 @@
<el-form-item label="拉流地址" prop="url" v-if="proxyParam.type=='default'">
<el-input v-model="proxyParam.url" clearable></el-input>
</el-form-item>
<el-form-item label="拉流地址" prop="src_url" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.src_url" clearable></el-input>
<el-form-item label="拉流地址" prop="srcUrl" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.srcUrl" clearable></el-input>
</el-form-item>
<el-form-item label="超时时间:毫秒" prop="timeout_ms" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.timeout_ms" clearable></el-input>
<el-form-item label="超时时间:毫秒" prop="timeoutMs" v-if="proxyParam.type=='ffmpeg'">
<el-input v-model="proxyParam.timeoutMs" clearable></el-input>
</el-form-item>
<el-form-item label="节点选择" prop="rtp_type">
<el-form-item label="节点选择" prop="rtpType">
<el-select
v-model="proxyParam.mediaServerId"
@change="mediaServerIdChange"
@ -54,10 +54,9 @@
</el-option>
</el-select>
</el-form-item>
<el-form-item label="FFmpeg命令模板" prop="ffmpeg_cmd_key" v-if="proxyParam.type=='ffmpeg'">
<!-- <el-input v-model="proxyParam.ffmpeg_cmd_key" clearable></el-input>-->
<el-form-item label="FFmpeg命令模板" prop="ffmpegCmdKey" v-if="proxyParam.type=='ffmpeg'">
<el-select
v-model="proxyParam.ffmpeg_cmd_key"
v-model="proxyParam.ffmpegCmdKey"
style="width: 100%"
placeholder="请选择FFmpeg命令模板"
>
@ -72,9 +71,9 @@
<el-form-item label="国标编码" prop="gbId">
<el-input v-model="proxyParam.gbId" placeholder="设置国标编码可推送到国标" clearable></el-input>
</el-form-item>
<el-form-item label="拉流方式" prop="rtp_type" v-if="proxyParam.type=='default'">
<el-form-item label="拉流方式" prop="rtpType" v-if="proxyParam.type=='default'">
<el-select
v-model="proxyParam.rtp_type"
v-model="proxyParam.rtpType"
style="width: 100%"
placeholder="请选择拉流方式"
>
@ -83,10 +82,10 @@
<el-option label="组播" value="2"></el-option>
</el-select>
</el-form-item>
<el-form-item label="无人观看" prop="rtp_type" >
<el-form-item label="无人观看" prop="rtpType" >
<el-select
@change="noneReaderHandler"
v-model="proxyParam.none_reader"
v-model="proxyParam.noneReader"
style="width: 100%"
placeholder="请选择无人观看的处理方式"
>
@ -98,8 +97,8 @@
<el-form-item label="其他选项">
<div style="float: left;">
<el-checkbox label="启用" v-model="proxyParam.enable" ></el-checkbox>
<el-checkbox label="开启音频" v-model="proxyParam.enable_audio" ></el-checkbox>
<el-checkbox label="录制" v-model="proxyParam.enable_mp4" ></el-checkbox>
<el-checkbox label="开启音频" v-model="proxyParam.enableAudio" ></el-checkbox>
<el-checkbox label="录制" v-model="proxyParam.enableMp4" ></el-checkbox>
</div>
</el-form-item>
@ -155,17 +154,17 @@ export default {
app: null,
stream: null,
url: "",
src_url: null,
timeout_ms: null,
ffmpeg_cmd_key: null,
srcUrl: null,
timeoutMs: null,
ffmpegCmdKey: null,
gbId: null,
rtp_type: null,
rtpType: null,
enable: true,
enable_audio: true,
enable_mp4: false,
none_reader: null,
enable_remove_none_reader: false,
enable_disable_none_reader: false,
enableAudio: true,
enableMp4: false,
noneReader: null,
enableRemoveNoneReader: false,
enableDisableNoneReader: false,
platformGbId: null,
mediaServerId: null,
},
@ -177,9 +176,9 @@ export default {
app: [{ required: true, message: "请输入应用名", trigger: "blur" }],
stream: [{ required: true, message: "请输入流ID", trigger: "blur" }],
url: [{ required: true, message: "请输入要代理的流", trigger: "blur" }],
src_url: [{ required: true, message: "请输入要代理的流", trigger: "blur" }],
timeout_ms: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }],
ffmpeg_cmd_key: [{ required: false, message: "请输入FFmpeg命令参数模板可选", trigger: "blur" }],
srcUrl: [{ required: true, message: "请输入要代理的流", trigger: "blur" }],
timeoutMs: [{ required: true, message: "请输入FFmpeg推流成功超时时间", trigger: "blur" }],
ffmpegCmdKey: [{ required: false, message: "请输入FFmpeg命令参数模板可选", trigger: "blur" }],
},
};
},
@ -189,7 +188,7 @@ export default {
this.listChangeCallback = callback;
if (proxyParam != null) {
this.proxyParam = proxyParam;
this.proxyParam.none_reader = null;
this.proxyParam.noneReader = null;
}
let that = this;
@ -218,7 +217,7 @@ export default {
}
}).then(function (res) {
that.ffmpegCmdList = res.data.data;
that.proxyParam.ffmpeg_cmd_key = Object.keys(res.data.data)[0];
that.proxyParam.ffmpegCmdKey = Object.keys(res.data.data)[0];
}).catch(function (error) {
console.log(error);
});
@ -275,15 +274,15 @@ export default {
}
},
noneReaderHandler: function() {
if (this.proxyParam.none_reader === null || this.proxyParam.none_reader === "0") {
this.proxyParam.enable_disable_none_reader = false;
this.proxyParam.enable_remove_none_reader = false;
}else if (this.proxyParam.none_reader === "1"){
this.proxyParam.enable_disable_none_reader = true;
this.proxyParam.enable_remove_none_reader = false;
}else if (this.proxyParam.none_reader ==="2"){
this.proxyParam.enable_disable_none_reader = false;
this.proxyParam.enable_remove_none_reader = true;
if (this.proxyParam.noneReader === null || this.proxyParam.noneReader === "0") {
this.proxyParam.enableDisableNoneReader = false;
this.proxyParam.enableRemoveNoneReader = false;
}else if (this.proxyParam.noneReader === "1"){
this.proxyParam.enableDisableNoneReader = true;
this.proxyParam.enableRemoveNoneReader = false;
}else if (this.proxyParam.noneReader ==="2"){
this.proxyParam.enableDisableNoneReader = false;
this.proxyParam.enableRemoveNoneReader = true;
}
},
},