OrbiSubs: per-channel subtitle position for WebVTT, 608 and 708, applied without restart
Tarea 082 ("ahora son noticias y tienen un banner"). Abajo, arriba del zócalo, arriba o
personalizada (5-95 %), igual en las tres salidas. El panel calcula el line: del WebVTT,
la fila 608 y la ventana 708 (posicion.js, con tests) y lo deja en <canal>.pos.json, que
los procesos releen en cada segmento: guardar solo la posición no reinicia nada.
- 608: tabla de PAC de las 15 filas; el bloque nunca se sale de 1-15.
- 708: DefineWindow anclado abajo-centro o arriba-centro en el %.
- WebVTT: siempre borde de arriba (",start"): Chromium ignora ",end".
- Cada cue va en un solo .vtt: con el fin recortado entre escrituras, hls.js lo
mostraba dos veces.
- Modal con preview sobre un cuadro del canal; la fila del canal muestra la opción.
- check_cc.py muestra filas 608 y ventanas 708.
This commit is contained in:
+20
-4
@@ -2,7 +2,9 @@
|
||||
"""Lee un .ts con SEI GA94 y muestra el texto 608 del campo pedido (1=CC1, 2=CC3)
|
||||
y los bytes de texto del 708 por servicio. Solo para verificar la salida."""
|
||||
import sys
|
||||
from orbisubs_srt import partir, pts_de
|
||||
from orbisubs_srt import PAC_FILA, partir, pts_de
|
||||
# Fila de cada PAC (082): para ver dónde quedó cada subtítulo.
|
||||
PAC_INV = {v: k for k, v in PAC_FILA.items()}
|
||||
EXT = {0x12: "ÁÉÓÚÜü‘¡*’—©℠•“”ÀÂÇÈÊËëÎÏïÔÙùÛ«»", 0x13: "ÃãÍÌìÒòÕõ{}\\^_|~ÄäÖöߥ¤│Å娸┌┐└┘"}
|
||||
ESP = "®°½¿™¢£♪à èâêîôû"
|
||||
BAS = {0x2A: "á", 0x5C: "é", 0x5E: "í", 0x5F: "ó", 0x60: "ú", 0x7B: "ç", 0x7C: "÷", 0x7D: "Ñ", 0x7E: "ñ"}
|
||||
@@ -23,7 +25,7 @@ for pes in aus:
|
||||
tri = [pes[j + 7 + 3 * k: j + 10 + 3 * k] for k in range(n)]
|
||||
frames.append((pts, tri))
|
||||
frames.sort()
|
||||
buf, txt, prev = "", [], None
|
||||
buf, txt, prev, filas = "", [], None, set()
|
||||
d708 = {1: bytearray(), 2: bytearray()}
|
||||
pkt = bytearray()
|
||||
for pts, tri in frames:
|
||||
@@ -33,8 +35,13 @@ for pts, tri in frames:
|
||||
a, b = t[1] & 0x7F, t[2] & 0x7F
|
||||
if (a, b) == prev and a < 0x20: continue
|
||||
prev = (a, b)
|
||||
if a in (0x14, 0x15) and b == 0x2F:
|
||||
txt.append(f"{pts/90000:9.2f} {buf.strip()}"); buf = ""
|
||||
if 0x10 <= a <= 0x17 and 0x40 <= b <= 0x7F:
|
||||
f = PAC_INV.get((a, 0x40 if b < 0x60 else 0x60))
|
||||
if f: filas.add(f)
|
||||
buf += " "
|
||||
elif a in (0x14, 0x15) and b == 0x2F:
|
||||
fs = "-".join(str(x) for x in sorted(filas))
|
||||
txt.append(f"{pts/90000:9.2f} [filas {fs}] {buf.strip()}"); buf = ""; filas = set()
|
||||
elif a in (0x14, 0x15): pass
|
||||
elif a == 0x11 and 0x30 <= b <= 0x3F: buf += ESP[b - 0x30]
|
||||
elif a in (0x12, 0x13) and 0x20 <= b <= 0x3F: buf = buf[:-1] + EXT[a][b - 0x20]
|
||||
@@ -52,6 +59,15 @@ for pts, tri in frames:
|
||||
pkt = bytearray()
|
||||
pkt += t[1:3]
|
||||
for l in txt[:12]: print(l)
|
||||
ANCLA = {0: "arriba-izq", 1: "arriba-centro", 2: "arriba-der", 3: "medio-izq", 4: "centro",
|
||||
5: "medio-der", 6: "abajo-izq", 7: "abajo-centro", 8: "abajo-der"}
|
||||
for s in (1, 2):
|
||||
b = d708[s]
|
||||
# DefineWindow (0x98-0x9F + 6 bytes): anclaje y posición vertical/horizontal (%).
|
||||
ventanas = set()
|
||||
for i, c in enumerate(b):
|
||||
if 0x98 <= c <= 0x9F and i + 6 < len(b):
|
||||
p = b[i + 1:i + 7]
|
||||
ventanas.add((ANCLA.get(p[3] >> 4, p[3] >> 4), p[1] & 0x7F, p[2]))
|
||||
print(f"708 svc{s} ventanas (anclaje, vertical %, horizontal %):", sorted(ventanas))
|
||||
print(f"708 svc{s}:", "".join(chr(c) if 0x20 <= c < 0x7F or 0xA0 <= c else "|" for c in b)[:400])
|
||||
|
||||
Reference in New Issue
Block a user