[MPlayer-dev-eng] Small changes to subreader.c file

Adam Tlałka atlka at pg.gda.pl
Sun Oct 9 13:57:54 CEST 2005


Dnia Sun, 09 Oct 2005 11:32:06 +0200, Reimar Döffinger  
<Reimar.Doeffinger at stud.uni-karlsruhe.de> napisał:
>> designed
>> by SubRip creators. It is Windows text file which means CR-LF in it.
>
> How do you know it was supposed to be a Windows text file, and not a
> "normal" text file and they just happened to develop under windows?
> Unless there is an official spec, IMHO there is no point in
> discussing this any further.
Use the force, Luke! ;-)
Take a look at the SubRip code. In Unit03.pas we have:

// from SubRip_1.40_Beta_Src Unit03.pas
procedure TForm3.WideWriteLn(var Fic: TextFile; ws: WideString);
var
   s: AnsiString;
   wch: WideChar;
   i:integer;
begin
   if needUniCode then
   begin
     for i:=1 to Length(ws) do
     begin
       wch:=ws[i];
       s:=chr(ord(wch)mod 256)+chr(ord(wch)div 256);
       write(Fic,s);
     end;
     s:=chr(ord($0d))+chr(ord(0));
     write(Fic,s);
     s:=chr(ord($0a))+chr(ord(0));
     write(Fic,s);
   end
   else
   begin
     s:=WideStringToString(ws);//tries to convert using current codepage
     writeln(Fic,s);
   end;
end;

which means then cr/lf line ending is always used - in case of normal  
codepage
based text this is done by writeln() Pascal function and in case of two  
byte Unicode
it is done by hand. So cr/lf ending is the SRT format property and not my  
imagination.
IMHO there is no point in discussing this any further.

Regards
-- 
Adam Tlałka      mailto:atlka at pg.gda.pl    ^v^ ^v^ ^v^
System  & Network Administration Group           ~~~~~~
Computer Center,  Gdańsk University of Technology, Poland
PGP public key:   finger atlka at sunrise.pg.gda.pl




More information about the MPlayer-dev-eng mailing list