Commit 642b319a authored by Hannes Domani's avatar Hannes Domani Committed by Tristan Matthews

subtitle-demux: speedup SSA parser

Signed-off-by: default avatarTristan Matthews <le.businessman@gmail.com>
(cherry picked from commit 6cccd64dacf431e1c33877e131b09ff906c85972)
parent 4083a750
...@@ -1083,6 +1083,7 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle, ...@@ -1083,6 +1083,7 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle,
{ {
demux_sys_t *p_sys = p_demux->p_sys; demux_sys_t *p_sys = p_demux->p_sys;
text_t *txt = &p_sys->txt; text_t *txt = &p_sys->txt;
size_t header_len = 0;
for( ;; ) for( ;; )
{ {
...@@ -1155,12 +1156,12 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle, ...@@ -1155,12 +1156,12 @@ static int ParseSSA( demux_t *p_demux, subtitle_t *p_subtitle,
free( psz_text ); free( psz_text );
/* All the other stuff we add to the header field */ /* All the other stuff we add to the header field */
char *psz_header; size_t s_len = strlen( s );
if( asprintf( &psz_header, "%s%s\n", p_sys->psz_header = realloc_or_free( p_sys->psz_header, header_len + s_len + 2 );
p_sys->psz_header ? p_sys->psz_header : "", s ) == -1 ) if( !p_sys->psz_header )
return VLC_ENOMEM; return VLC_ENOMEM;
free( p_sys->psz_header ); snprintf( p_sys->psz_header + header_len, s_len + 2, "%s\n", s );
p_sys->psz_header = psz_header; header_len += s_len + 1;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment