Menu

#28 mplayer: MPlayerCtrl doesn't consider local floating point settings

v1.0 (example)
open
nobody
mplayer (1)
5
2014-07-29
2014-07-29
No

In method TCustomMPlayerControl.TimerEvent any mplayer output is parsed and converted for further usage. Among them are floating point values (e.g. volume, length, video_fps...) which are converted using 'StrToFloatDef'. This might work fine as long as the local DecimalSeparator is defined as period ('.'). As a German user, DecimalSeparator is set to comma (',') as default in Windows and any conversion using 'StrToFloatDef' fails without raising any error setting any float value to default for all times.

Possible resolutions to solve this issue is either use 'StrToFloatDef' using a modified local with period as DecimalSeparator (not recommended, see below) or create a similar own conversion function for float values using Val().

I do not recommend using any StrToFloat function at all since I experienced irregular strange errors converting strings using a modified local settings. It ended up that sometimes floating point values were converted correct, and sometimes I got exceptions like 'EConvertError: "167.226890756303" is an invalid float'. After using an own conversion function using Val() it worked flawlessly.

Discussion


Log in to post a comment.