[MPlayer-dev-eng] MKV files and subtitles charset

Evgeniy Stepanov eugeni.stepanov at gmail.com
Sat Aug 5 16:19:54 CEST 2006


On Saturday 05 August 2006 17:28, Siarhei Siamashka wrote:
> From matroska technical description page, looks like UTF-8 is always used
> at least for SRT and SSA subtitles:
> http://www.matroska.org/technical/specs/subtitles/index.html
>
> I have 'subcp = cp1251' in my configuration file and seems like it also
> affects MKV files resulting in wrong charset being displayed.
>
> libmpdemux/demox_mkv.c contains function handle_subtitles() function which
> sets sub_utf8 global variable to 1. But it does not have any effect.
>
> By the way, this handle_subtitles() gets called after a few seconds of
> video playback, probably at the moment where the first subtitled message
> should appear. Maybe it is just called too late.

Recoding is performed by subcp_recode1() call at the end of 
handle_subtitles(), and it is definitely wrong. Subtitles in matroska are 
already in utf-8, subcp should be ignored.

Further still, subcp_recode1() assumes that sub->text[i] size is 
ICBUFFSIZE=512, but mkv demuxer allocates 256 bytes only (demux_mkv.c:2406).

I suggest removing subcp_recode1() call.

There is also a minor bug in handle_subtitles(), read beyond the end of 
allocated area. Fixed by mkv_fix.patch.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkv_fix.patch
Type: text/x-diff
Size: 542 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060805/f9a6e767/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mkv_sub_recode.patch
Type: text/x-diff
Size: 429 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20060805/f9a6e767/attachment-0001.patch>


More information about the MPlayer-dev-eng mailing list