HDMI采集右键菜单添加无损/有损设置

This commit is contained in:
fangxiang 2022-05-12 20:48:22 +08:00
parent 16f1ef6e4c
commit 543ee25205
6 changed files with 105 additions and 2 deletions

View File

@ -1,6 +1,6 @@
{
"name": "media_player_client",
"version": "1.4.5",
"version": "1.4.6",
"description": "A Quasar Framework app",
"productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>",

View File

@ -1054,6 +1054,16 @@ export default class ClientConnection {
}
}
public async setHdmiInDecodeType(index: number, type: string) {
try {
return await this.doRpc<Protocol.SetHdmiInDecodeTypeResponseEntity>(
new Protocol.SetHdmiInDecodeTypeRequestEntity(index, type)
);
} catch (e) {
console.error(e);
}
}
public destory() {
if (this.ws) {
this.ws.onclose = null;

View File

@ -39,8 +39,37 @@
{{ prop.node.name }}
</div>
</q-item-section>
<q-popup-proxy context-menu>
<q-popup-proxy context-menu @before-show="updateContextMenu">
<q-list>
<q-item
clickable
v-ripple
v-close-popup
v-if="prop.node.item_data.window_type == 'EwindowType::HdmiIn'"
@click="setHdmiInDecodeType(1, 'NV12')"
>
<q-item-section>
{{ $t("lossy ") + $t("picture quality") }}
</q-item-section>
<q-item-section side v-if="lossy_pic">
<q-icon name="done" />
</q-item-section>
</q-item>
<q-item
clickable
v-ripple
v-close-popup
v-if="prop.node.item_data.window_type == 'EwindowType::HdmiIn'"
@click="setHdmiInDecodeType(1, 'NV16')"
>
<q-item-section>
{{ $t("lossless ") + $t("picture quality") }}
</q-item-section>
<q-item-section side v-if="!lossy_pic">
<q-icon name="done" />
</q-item-section>
</q-item>
<q-item
v-if="
prop.node.name == $t('signal source') ||
@ -158,6 +187,8 @@ export default defineComponent({
const $q = useQuasar();
const $t = useI18n();
const lossy_pic = ref(false);
const content_height = ref(0);
const refresh_content_height = () => {
@ -187,6 +218,7 @@ export default defineComponent({
tree,
tree_nodes,
content_height,
lossy_pic,
loga(a: any) {
console.log(a);
},
@ -232,6 +264,31 @@ export default defineComponent({
timeout: 1500,
});
},
updateContextMenu() {
lossy_pic.value =
(GlobalData.getInstance().applicationConfig?.hdmi_in_decode_type_1 ??
"NV12") == "NV12";
},
async setHdmiInDecodeType(index: number, type: string) {
let success = false;
const response = await GlobalData.getInstance()
.getCurrentClient()
?.setHdmiInDecodeType(index, type);
if (response) {
success = response.success;
}
$q.notify({
color: success ? "positive" : "negative",
icon: success ? "done" : "warning",
message:
$t.t("set") + (success ? $t.t("success") : $t.t("fail")) + "!",
position: "top",
timeout: 1500,
});
},
};
},
});

View File

@ -27,4 +27,5 @@ export default class ApplicationConfigEntity {
application_data_dir: string = "";
runtime_os: string = "";
registered: boolean = false;
hdmi_in_decode_type_1: string | undefined;
}

View File

@ -420,6 +420,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "RpcGetSystemNetworkInfo";
}
public static get kRpcSetHdmiInDecodeType() {
return Commands.PROTOCOL_PREFIX + "RpcSetHdmiInDecodeType";
}
static _all_commands = new Set([
Commands.kUnKnowCommand,
Commands.kSearchDevice,
@ -524,6 +528,7 @@ export namespace Protocol {
Commands.kRpcDeleteTimingTask,
Commands.kRpcGetTimingTasks,
Commands.kRpcGetSystemNetworkInfo,
Commands.kRpcSetHdmiInDecodeType,
]);
public static get AllCommands() {
return this._all_commands;
@ -2667,4 +2672,28 @@ export namespace Protocol {
net_mask = "192.168.1.1";
mac_address = "AA:BB:CC:DD:EE:FF";
}
export class SetHdmiInDecodeTypeRequestEntity extends PacketEntity {
constructor(index: number, type: string, rpc_id = 0) {
super();
super.command = Commands.kRpcSetHdmiInDecodeType;
super.flag = PacketEntity.FLAG_REQUEST;
super.rpc_id = rpc_id;
this.index = index ?? 1;
this.type = type ?? "NV12";
}
index: number;
type: string;
note: string = "";
}
export class SetHdmiInDecodeTypeResponseEntity extends PacketEntity {
constructor() {
super();
super.flag = PacketEntity.FLAG_RESPONSE;
}
success = false;
note = "";
}
}

View File

@ -508,4 +508,10 @@ export default {
"new task": "新建任务",
all: "全部",
unknow: "未知",
lossy: "有损",
"lossy ": "有损",
lossless: "无损",
"lossless ": "无损",
"picture quality": "画质",
set: "设置",
};