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", "name": "media_player_client",
"version": "1.4.5", "version": "1.4.6",
"description": "A Quasar Framework app", "description": "A Quasar Framework app",
"productName": "MediaPlayerClient", "productName": "MediaPlayerClient",
"author": "fangxiang <fangxiang@cloudview.work>", "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() { public destory() {
if (this.ws) { if (this.ws) {
this.ws.onclose = null; this.ws.onclose = null;

View File

@ -39,8 +39,37 @@
{{ prop.node.name }} {{ prop.node.name }}
</div> </div>
</q-item-section> </q-item-section>
<q-popup-proxy context-menu> <q-popup-proxy context-menu @before-show="updateContextMenu">
<q-list> <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 <q-item
v-if=" v-if="
prop.node.name == $t('signal source') || prop.node.name == $t('signal source') ||
@ -158,6 +187,8 @@ export default defineComponent({
const $q = useQuasar(); const $q = useQuasar();
const $t = useI18n(); const $t = useI18n();
const lossy_pic = ref(false);
const content_height = ref(0); const content_height = ref(0);
const refresh_content_height = () => { const refresh_content_height = () => {
@ -187,6 +218,7 @@ export default defineComponent({
tree, tree,
tree_nodes, tree_nodes,
content_height, content_height,
lossy_pic,
loga(a: any) { loga(a: any) {
console.log(a); console.log(a);
}, },
@ -232,6 +264,31 @@ export default defineComponent({
timeout: 1500, 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 = ""; application_data_dir: string = "";
runtime_os: string = ""; runtime_os: string = "";
registered: boolean = false; registered: boolean = false;
hdmi_in_decode_type_1: string | undefined;
} }

View File

@ -420,6 +420,10 @@ export namespace Protocol {
return Commands.PROTOCOL_PREFIX + "RpcGetSystemNetworkInfo"; return Commands.PROTOCOL_PREFIX + "RpcGetSystemNetworkInfo";
} }
public static get kRpcSetHdmiInDecodeType() {
return Commands.PROTOCOL_PREFIX + "RpcSetHdmiInDecodeType";
}
static _all_commands = new Set([ static _all_commands = new Set([
Commands.kUnKnowCommand, Commands.kUnKnowCommand,
Commands.kSearchDevice, Commands.kSearchDevice,
@ -524,6 +528,7 @@ export namespace Protocol {
Commands.kRpcDeleteTimingTask, Commands.kRpcDeleteTimingTask,
Commands.kRpcGetTimingTasks, Commands.kRpcGetTimingTasks,
Commands.kRpcGetSystemNetworkInfo, Commands.kRpcGetSystemNetworkInfo,
Commands.kRpcSetHdmiInDecodeType,
]); ]);
public static get AllCommands() { public static get AllCommands() {
return this._all_commands; return this._all_commands;
@ -2667,4 +2672,28 @@ export namespace Protocol {
net_mask = "192.168.1.1"; net_mask = "192.168.1.1";
mac_address = "AA:BB:CC:DD:EE:FF"; 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": "新建任务", "new task": "新建任务",
all: "全部", all: "全部",
unknow: "未知", unknow: "未知",
lossy: "有损",
"lossy ": "有损",
lossless: "无损",
"lossless ": "无损",
"picture quality": "画质",
set: "设置",
}; };