[1078] 增加音视频属性查询

This commit is contained in:
lin 2025-07-22 20:51:03 +08:00
parent 79ee116174
commit c0ab010475
13 changed files with 170 additions and 78 deletions

View File

@ -1029,8 +1029,7 @@ public class JT1078Controller {
@Operation(summary = "JT-查询终端音视频属性", security = @SecurityRequirement(name = JwtUtils.HEADER))
@Parameter(name = "phoneNumber", description = "设备手机号", required = true)
@GetMapping("/media/attribute")
public JTMediaAttribute queryMediaAttribute(HttpServletRequest request,
@Parameter(required = true) String phoneNumber
public JTMediaAttribute queryMediaAttribute( @Parameter(required = true) String phoneNumber
) {
return service.queryMediaAttribute(phoneNumber);
}

View File

@ -59,6 +59,8 @@ public class JT1078TerminalController {
@PostMapping("/add")
public void addDevice(JTDevice device){
assert device.getPhoneNumber() != null;
String phoneNumber = device.getPhoneNumber().replaceFirst("^0*", "");
device.setPhoneNumber(phoneNumber);
service.addDevice(device);
}
@Operation(summary = "删除设备", security = @SecurityRequirement(name = JwtUtils.HEADER))

View File

@ -1,12 +1,14 @@
package com.genersoft.iot.vmp.jt1078.proc.entity;
import com.genersoft.iot.vmp.jt1078.proc.response.Rs;
import lombok.Data;
/**
* @author QingtaiJiang
* @date 2023/4/27 18:23
* @email qingtaij@163.com
*/
@Data
public class Cmd {
String phoneNumber;
Long packageNo;
@ -25,46 +27,6 @@ public class Cmd {
this.rs = builder.rs;
}
public String getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Long getPackageNo() {
return packageNo;
}
public void setPackageNo(Long packageNo) {
this.packageNo = packageNo;
}
public String getMsgId() {
return msgId;
}
public void setMsgId(String msgId) {
this.msgId = msgId;
}
public String getRespId() {
return respId;
}
public void setRespId(String respId) {
this.respId = respId;
}
public Rs getRs() {
return rs;
}
public void setRs(Rs rs) {
this.rs = rs;
}
public static class Builder {
String phoneNumber;
Long packageNo;

View File

@ -23,18 +23,9 @@ import java.nio.charset.Charset;
@MsgId(id = "0107")
public class J0107 extends Re {
private final static Logger logger = LoggerFactory.getLogger(J0107.class);
Integer respNo;
Integer paramLength;
@Override
protected Rs decode0(ByteBuf buf, Header header, Session session) {
// respNo = buf.readUnsignedShort();
// paramLength = (int) buf.readUnsignedByte();
// if (paramLength <= 0) {
// return null;
// }
JTDeviceAttribute deviceAttribute = new JTDeviceAttribute();
deviceAttribute.setType(JTDeviceType.getInstance(buf.readUnsignedShort()));

View File

@ -33,20 +33,20 @@ public class J0801 extends Re {
protected Rs decode0(ByteBuf buf, Header header, Session session) {
JTMediaEventInfo mediaEventInfo = JTMediaEventInfo.decode(buf);
log.info("[JT-多媒体数据上传]: {}", mediaEventInfo);
try {
if (mediaEventInfo.getMediaData() != null) {
File file = new File("/home/lin/source.jpg");
if (file.exists()) {
file.delete();
}
FileOutputStream fileOutputStream = new FileOutputStream(file);
fileOutputStream.write(mediaEventInfo.getMediaData());
fileOutputStream.flush();
fileOutputStream.close();
}
}catch (Exception e) {
log.error("[JT-多媒体数据上传] 写入文件异常", e);
}
// try {
// if (mediaEventInfo.getMediaData() != null) {
// File file = new File("/home/lin/source.jpg");
// if (file.exists()) {
// file.delete();
// }
// FileOutputStream fileOutputStream = new FileOutputStream(file);
// fileOutputStream.write(mediaEventInfo.getMediaData());
// fileOutputStream.flush();
// fileOutputStream.close();
// }
// }catch (Exception e) {
// log.error("[JT-多媒体数据上传] 写入文件异常", e);
// }
SessionManager.INSTANCE.response(header.getPhoneNumber(), "0801", null, mediaEventInfo);
return null;
}

View File

@ -781,6 +781,8 @@ public class jt1078ServiceImpl implements Ijt1078Service {
j8801.setCommand(shootingCommand);
log.info("[JT-抓图] 设备编号: {} 通道编号: {}", phoneNumber, channelId);
// 监听文件上传 存在设备不回复抓图请求或者回复通用回复导致缺少抓图编号但是直接上传文件的此处通过监听文件上传直接获取文件
@SuppressWarnings("unchecked")
List<Long> ids = (List<Long>) jt1078Template.shooting(phoneNumber, j8801, 300);
log.info("[JT-抓图] 抓图编号: {} 设备编号: {} 通道编号: {}", ids.get(0), phoneNumber, channelId);

View File

@ -56,7 +56,7 @@ public enum SessionManager {
* @param clientId 设备ID
* @param newSession session
*/
protected void put(Object clientId, Session newSession) {
void put(Object clientId, Session newSession) {
sessionMap.put(clientId, newSession);
}

View File

@ -322,7 +322,7 @@ public class ABLRESTfulUtils {
// 3 XHB (一家公司的打包格式) 只支持视频音频不能加入打包
// 4 Jt10782016版本码流接入
param.put("RtpPayloadDataType", 4);
param.put("jtt1078_version", "2016");
param.put("jtt1078_version", "2019");
}
if (port != null) {
param.put("port", port);

View File

@ -317,5 +317,14 @@ export function controlDoor({ phoneNumber, open}) {
}
})
}
export function queryMediaAttribute(phoneNumber) {
return request({
method: 'get',
url: '/api/jt1078/media/attribute',
params: {
phoneNumber: phoneNumber
}
})
}

View File

@ -1,13 +1,35 @@
import {
add,
addChannel, connection, controlDoor, controlPlayback, deleteDevice, factoryReset,
fillLight, getRecordTempUrl, linkDetection,
play, ptz, queryAttribute,
queryChannels, queryConfig,
addChannel,
connection,
controlDoor,
controlPlayback,
deleteDevice,
factoryReset,
fillLight,
getRecordTempUrl,
linkDetection,
play,
ptz,
queryAttribute,
queryChannels,
queryConfig,
queryDeviceById,
queryDevices, queryDriverInfo, queryPosition, queryRecordList, reset, sendTextMessage, setConfig, startPlayback,
stopPlay, stopPlayback, telephoneCallback, update,
updateChannel, wiper
queryDevices,
queryDriverInfo,
queryMediaAttribute,
queryPosition,
queryRecordList,
reset,
sendTextMessage,
setConfig,
startPlayback,
stopPlay,
stopPlayback,
telephoneCallback,
update,
updateChannel,
wiper
} from '@/api/jtDevice'
const actions = {
@ -310,6 +332,16 @@ const actions = {
reject(error)
})
})
},
queryMediaAttribute({ commit }, phoneNumber) {
return new Promise((resolve, reject) => {
queryMediaAttribute(phoneNumber).then(response => {
const { data } = response
resolve(data)
}).catch(error => {
reject(error)
})
})
}
}

View File

@ -330,14 +330,16 @@ export default {
//
const baseUrl = window.baseUrl ? window.baseUrl : ''
const fileUrl = ((process.env.NODE_ENV === 'development') ? process.env.VUE_APP_BASE_API : baseUrl) + `/api/jt1078/snap?phoneNumber=${this.device.phoneNumber}&channelId=${row.channelId}`
let controller = new AbortController()
let signal = controller.signal
//
const headers = new Headers()
headers.append('access-token', this.$store.getters.token) // YourAccessToken访
//
fetch(fileUrl, {
method: 'GET',
headers: headers
headers: headers,
signal: signal
})
.then(response => response.blob())
.then(blob => {
@ -353,6 +355,11 @@ export default {
document.body.removeChild(link)
})
.catch(error => console.error('下载失败:', error))
setTimeout(() => {
this.$message.error('等待截图超时', { closed: true })
controller.abort('timeout')
}, 15000)
}
}
}

View File

@ -0,0 +1,75 @@
<template>
<div id="configInfo">
<el-dialog
v-el-drag-dialog
title="音视频属性"
width="=80%"
top="2rem"
:close-on-click-modal="false"
:visible.sync="showDialog"
:destroy-on-close="true"
@close="close()"
>
<div id="shared">
<el-descriptions title="音频" :column="2" v-if="attributeData" style="margin-bottom: 1rem;">
<el-descriptions-item label="编码">{{ audioEncoderEnum[attributeData.audioEncoder - 1] }}</el-descriptions-item>
<el-descriptions-item label="声道数">{{ attributeData.audioChannels }}</el-descriptions-item>
<el-descriptions-item label="采样率">{{ audioSamplingRateEnum[attributeData.audioSamplingRate] }}</el-descriptions-item>
<el-descriptions-item label="采样位数">{{ audioSamplingBitsEnum[attributeData.audioSamplingBits] }}</el-descriptions-item>
<el-descriptions-item label="帧长度">{{ attributeData.audioFrameLength }}</el-descriptions-item>
<el-descriptions-item label="音频输出">{{ attributeData.audioOutputEnable === 0 ? '不支持':'支持' }}</el-descriptions-item>
<el-descriptions-item label="最大物理通道数量">{{ attributeData.audioChannelMax === 0 ? '不支持':'支持' }}</el-descriptions-item>
</el-descriptions>
<el-descriptions title="视频" :column="2" style="margin-bottom: 1rem;">
<el-descriptions-item label="编码方式">{{ videoEncoderEnum[attributeData.videoEncoder] }}</el-descriptions-item>
<el-descriptions-item label="最大物理通道数量">{{ attributeData.videoChannelMax }}</el-descriptions-item>
</el-descriptions>
</div>
</el-dialog>
</div>
</template>
<script>
import elDragDialog from '@/directive/el-drag-dialog'
export default {
name: 'ConfigInfo',
directives: { elDragDialog },
props: {},
data() {
return {
showDialog: false,
attributeData: null,
audioEncoderEnum: [
'G.721', 'G.722', 'G.723', 'G.728', 'G.729', 'G.711A', 'G.711U', 'G.726', 'G.729A', 'DVI4_3', 'DVI4_4', 'DVI4_8K'
, 'DVI4_16K', 'LPC', 'S16BE_STEREO', 'S16BE_MONO', 'MPEGAUDIO', 'LPCM', 'AAC', 'WMA9STD', 'HEAAC', 'PCM_VOICE'
, 'PCM_AUDIO', 'AACLC', 'MP3', 'ADPCMA', 'MP4AUDIO', 'AMR'
],
audioSamplingRateEnum: [
'8kHz', '22.05kHz', '44.1kHz', '48kHz'
],
audioSamplingBitsEnum: [
'8位', '16位', '32位'
],
videoEncoderEnum: {
98: 'H.264',
99: 'H.265',
100: 'AVS',
101: 'SVAC'
}
}
},
computed: {},
created() {},
methods: {
openDialog: function(data) {
this.showDialog = true
this.attributeData = data
},
close: function() {
this.showDialog = false
}
}
}
</script>

View File

@ -107,6 +107,8 @@
终端参数</el-dropdown-item>
<el-dropdown-item command="attribute" v-bind:disabled="!scope.row.status">
终端属性</el-dropdown-item>
<el-dropdown-item command="mediaAttribute" v-bind:disabled="!scope.row.status">
音视频属性</el-dropdown-item>
<el-dropdown-item command="linkDetection" v-bind:disabled="!scope.row.status" >
链路检测</el-dropdown-item>
<el-dropdown-item command="position" v-bind:disabled="!scope.row.status" >
@ -151,6 +153,7 @@
<driverInfo ref="driverInfo" />
<connectionServer ref="connectionServer" />
<controlDoor ref="controlDoor" />
<mediaAttribute ref="mediaAttribute" />
</div>
</template>
@ -164,11 +167,12 @@ import telephoneCallback from './dialog/telephoneCallback.vue'
import driverInfo from './dialog/driverInfo.vue'
import connectionServer from './dialog/connectionServer.vue'
import controlDoor from './dialog/controlDoor.vue'
import mediaAttribute from './dialog/mediaAttribute.vue'
export default {
name: 'App',
components: {
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer, controlDoor
deviceEdit, configInfo, attribute, position, textMsg, telephoneCallback, driverInfo, connectionServer, controlDoor, mediaAttribute
},
data() {
return {
@ -287,6 +291,8 @@ export default {
this.controlDoor(itemData)
} else if (command === 'connection') {
this.connection(itemData)
} else if (command === 'mediaAttribute') {
this.queryMediaAttribute(itemData)
} else {
this.$message.info('尚不支持')
}
@ -361,6 +367,13 @@ export default {
connection: function(itemData) {
this.$refs.connectionServer.openDialog(itemData.phoneNumber)
},
queryMediaAttribute: function(itemData) {
this.$store.dispatch('jtDevice/queryMediaAttribute', itemData.phoneNumber)
.then((data) => {
this.$refs.mediaAttribute.openDialog(data)
})
},
controlDoor: function(itemData) {
this.$refs.controlDoor.openDialog(itemData.phoneNumber)
},