diff options
-rw-r--r-- | libhb/deccc608sub.c | 3 | ||||
-rw-r--r-- | libhb/decsrtsub.c | 28 |
2 files changed, 26 insertions, 5 deletions
diff --git a/libhb/deccc608sub.c b/libhb/deccc608sub.c index 5f1e8a14f..2f1374943 100644 --- a/libhb/deccc608sub.c +++ b/libhb/deccc608sub.c @@ -1637,7 +1637,8 @@ int write_cc_buffer_as_srt (struct eia608_screen *data, struct s_write *wb) } else { if (line == 2) { wb->enc_buffer_used += encode_line (wb->enc_buffer+wb->enc_buffer_used, - (unsigned char *) " "); + (unsigned char *) "\n"); + line = 3; } else { wb->enc_buffer_used += encode_line (wb->enc_buffer+wb->enc_buffer_used, (unsigned char *) " "); diff --git a/libhb/decsrtsub.c b/libhb/decsrtsub.c index 1bb540aa0..fa3b9c468 100644 --- a/libhb/decsrtsub.c +++ b/libhb/decsrtsub.c @@ -237,7 +237,8 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv ) if( *pv->current_entry.text ) { long length; - char *p; + char *p, *q; + int line = 1; uint64_t start_time = ( pv->current_entry.start + pv->subtitle->config.offset ) * 90; uint64_t stop_time = ( pv->current_entry.stop + @@ -254,13 +255,32 @@ static hb_buffer_t *srt_read( hb_work_private_t *pv ) length = strlen( pv->current_entry.text ); - for( p = pv->current_entry.text; *p; p++) + for( q = p = pv->current_entry.text; *p; p++) { - if( *p == '\n' || *p == '\r' ) + if( *p == '\n' ) { - *p = ' '; + if ( line == 1 ) + { + *q = *p; + line = 2; + } + else + { + *q = ' '; + } + q++; + } + else if( *p != '\r' ) + { + *q = *p; + q++; + } + else + { + length--; } } + *q = '\0'; buffer = hb_buffer_init( length + 1 ); |