mirror of
https://github.com/viarotel-org/escrcpy.git
synced 2025-02-17 10:58:38 +01:00
style: ➖ Remove redundant comments
This commit is contained in:
parent
9b7f6a98c2
commit
05c97669f8
@ -69,31 +69,25 @@ export function parseScrcpyCodecList(rawText) {
|
|||||||
audio: [],
|
audio: [],
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分行处理
|
|
||||||
const lines = rawText.split('\n')
|
const lines = rawText.split('\n')
|
||||||
|
|
||||||
// 遍历每一行
|
|
||||||
for (const line of lines) {
|
for (const line of lines) {
|
||||||
const trimmedLine = line.trim()
|
const trimmedLine = line.trim()
|
||||||
|
|
||||||
// 跳过空行和不包含编码器信息的行
|
|
||||||
if (!trimmedLine || !trimmedLine.startsWith('--')) {
|
if (!trimmedLine || !trimmedLine.startsWith('--')) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// 提取所有的键值对
|
|
||||||
const pairs = trimmedLine.match(/--[\w-]+=[\w.-]+/g)
|
const pairs = trimmedLine.match(/--[\w-]+=[\w.-]+/g)
|
||||||
if (!pairs || pairs.length < 2)
|
if (!pairs || pairs.length < 2)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
// 将键值对转换为对象
|
|
||||||
const info = pairs.reduce((acc, pair) => {
|
const info = pairs.reduce((acc, pair) => {
|
||||||
const [key, value] = pair.substring(2).split('=')
|
const [key, value] = pair.substring(2).split('=')
|
||||||
acc[key] = value
|
acc[key] = value
|
||||||
return acc
|
return acc
|
||||||
}, {})
|
}, {})
|
||||||
|
|
||||||
// 根据键名判断类型并保存数据
|
|
||||||
if (info['video-codec'] && info['video-encoder']) {
|
if (info['video-codec'] && info['video-encoder']) {
|
||||||
result.video.push({
|
result.video.push({
|
||||||
type: 'video',
|
type: 'video',
|
||||||
@ -110,7 +104,6 @@ export function parseScrcpyCodecList(rawText) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 验证结果是否为空
|
|
||||||
if (result.video.length === 0 && result.audio.length === 0) {
|
if (result.video.length === 0 && result.audio.length === 0) {
|
||||||
throw new Error('No valid codec information found in the log content')
|
throw new Error('No valid codec information found in the log content')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user