summaryrefslogtreecommitdiffstats
path: root/libhb/decsrtsub.c
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2009-10-28 16:43:48 +0000
committerjstebbins <[email protected]>2009-10-28 16:43:48 +0000
commit0beea80199a0bb95aebc6f4b09c50faad7531b68 (patch)
treeaaffcbb3ec406ce98cbd22a31ce93cf039369767 /libhb/decsrtsub.c
parentc591cf80cf88f25822b925ed1d214953da1c2345 (diff)
allow srt and cc subtitles to be up to 2 lines high.
any additional lines after 2 are merged into 2nd line git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2897 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/decsrtsub.c')
-rw-r--r--libhb/decsrtsub.c28
1 files changed, 24 insertions, 4 deletions
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 );