[vlc-commits] subtitles: support MicroDVD color extension
Jean-Baptiste Kempf
git at videolan.org
Mon Jun 27 15:37:35 CEST 2016
vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jun 27 14:19:02 2016 +0200| [a1dce336a372fd36692351d1be24d2ef3afb5784] | committer: Jean-Baptiste Kempf
subtitles: support MicroDVD color extension
Ref #1825
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a1dce336a372fd36692351d1be24d2ef3afb5784
---
modules/codec/subsdec.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/modules/codec/subsdec.c b/modules/codec/subsdec.c
index 640d4b5..74c47ad 100644
--- a/modules/codec/subsdec.c
+++ b/modules/codec/subsdec.c
@@ -966,6 +966,19 @@ static text_segment_t* ParseSubtitles( int *pi_align, const char *psz_subtitle )
psz_subtitle++;
}
}
+ else if( (psz_subtitle[1] == 'C' || psz_subtitle[1] == 'c' )
+ && psz_subtitle[3] == '$' && i_len >= 7 )
+ {
+ /* Yes, they use BBGGRR, instead of RRGGBB */
+ char psz_color[7];
+ psz_color[0] = psz_subtitle[8]; psz_color[1] = psz_subtitle[9];
+ psz_color[2] = psz_subtitle[6]; psz_color[3] = psz_subtitle[7];
+ psz_color[4] = psz_subtitle[4]; psz_color[5] = psz_subtitle[5];
+ psz_color[6] = '\0';
+ p_segment = NewTextSegmentPushStyle( p_segment, &p_stack );
+ p_segment->style->i_font_color = vlc_html_color( psz_color, NULL );
+ p_segment->style->i_features |= STYLE_HAS_FONT_COLOR;
+ }
// Hide other {x:y} atrocities, like {c:$bbggrr} or {P:x}
psz_subtitle = psz_tag_end + 1;
}
More information about the vlc-commits
mailing list