fix: HEVC description返回完整box+标题分割调试日志 (#1442) #1442
@@ -44,16 +44,15 @@ function findCodecConfig(buffer: ArrayBuffer, start: number, end: number): Array
|
||||
// 子 box 从 entryOffset + 8 + 6 + 2 + 16 + 2 + 2 + 2 + 2 + 4 + 2 + 2 + 2 + 2 = entryOffset + 78
|
||||
// 更简单的做法:扫描 entry 内的子 box
|
||||
const entryEnd = entryOffset + entrySize
|
||||
const subBoxStart = entryOffset + 8 + 68 // VisualSampleEntry 固定字段共 68 字节
|
||||
const subBoxStart = entryOffset + 8 + 70 // VisualSampleEntry 固定字段共 70 字节
|
||||
const result = findCodecConfig(buffer, subBoxStart, entryEnd)
|
||||
if (result) return result
|
||||
entryOffset += entrySize
|
||||
}
|
||||
} else if (type === "avcC" || type === "hvcC") {
|
||||
// 找到目标 box,返回其内容(不含 box header)
|
||||
const dataStart = offset + 8
|
||||
const dataSize = size - 8
|
||||
return buffer.slice(dataStart, dataStart + dataSize)
|
||||
// 找到目标 box,返回完整 box(含 header)
|
||||
// 返回完整 box(含 size + type header),WebCodecs HEVC decoder 需要
|
||||
return buffer.slice(offset, offset + size)
|
||||
}
|
||||
|
||||
if (size === 0) break
|
||||
@@ -432,6 +431,7 @@ export function useCanvasPlayer(
|
||||
|
||||
// 按 "/" 分割为多行("/" 作为手动换行符)
|
||||
const lines = title.text.split(/[//⁄∕]/)
|
||||
console.log("[drawTitle] 原始标题:", JSON.stringify(title.text), "分割后:", lines)
|
||||
const lineHeight = fontSize * 1.3
|
||||
const totalHeight = lines.length * lineHeight
|
||||
|
||||
|
||||
Reference in New Issue
Block a user