return strlen(dst);
}
-static hb_buffer_t *tx3g_decode_to_ssa(hb_buffer_t *in, int line)
+static hb_buffer_t *tx3g_decode_to_ssa(hb_work_private_t *pv, hb_buffer_t *in)
{
uint8_t *pos = in->data;
uint8_t *end = in->data + in->size;
if ( out == NULL )
goto fail;
uint8_t *dst = out->data;
+ uint8_t *start;
int charIndex = 0;
int styleIndex = 0;
- sprintf((char*)dst, "%d,,Default,,0,0,0,,", line);
+ sprintf((char*)dst, "%d,,Default,,0,0,0,,", pv->line);
dst += strlen((char*)dst);
+ start = dst;
for (pos = text, end = text + textLength; pos < end; pos++)
{
if (IS_10xxxxxx(*pos))
}
charIndex++;
}
+ if (start == dst)
+ {
+ // No text in the subtitle. This sub is just filler, drop it.
+ free(styleRecords);
+ hb_buffer_close(&out);
+ return NULL;
+ }
*dst = '\0';
dst++;
return HB_WORK_DONE;
}
- *buf_out = tx3g_decode_to_ssa(in, ++pv->line);
+ *buf_out = tx3g_decode_to_ssa(pv, in);
return HB_WORK_OK;
}