diff options
author | jstebbins <[email protected]> | 2014-08-27 20:33:49 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2014-08-27 20:33:49 +0000 |
commit | c72bb7dfa8ff86e45f15a8c103a5d8fd992c0177 (patch) | |
tree | 71059a90c198941ff37d36cca9940785db3521c7 /libhb | |
parent | 6319afe7677f7ee6aceffe9dc1a5ba44eaa983c3 (diff) |
libhb: remove emptry tx3g subtitles
We don't need the empty subtitle buffers.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6373 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r-- | libhb/dectx3gsub.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/libhb/dectx3gsub.c b/libhb/dectx3gsub.c index 7a38b1d84..9cfc031ac 100644 --- a/libhb/dectx3gsub.c +++ b/libhb/dectx3gsub.c @@ -77,7 +77,7 @@ static int write_ssa_markup(char *dst, StyleRecord *style) 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; @@ -158,11 +158,13 @@ static hb_buffer_t *tx3g_decode_to_ssa(hb_buffer_t *in, int line) 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)) @@ -200,6 +202,13 @@ static hb_buffer_t *tx3g_decode_to_ssa(hb_buffer_t *in, int line) } 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++; @@ -263,7 +272,7 @@ static int dectx3gWork( hb_work_object_t * w, hb_buffer_t ** buf_in, 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; } |