MediaInfoLib icon indicating copy to clipboard operation
MediaInfoLib copied to clipboard

range check error with: handle:=mediainfo_new();

Open ZaakaJarimbo opened this issue 2 years ago • 2 comments

I have used mediainfo successfully in the past (delphi 7, but now using now using Delphi 11.3 and get the following error when trying to run the app at runtime.

Range check error

the following is my code line creates the error

handle:=mediainfo_new();

with the following code

has anybody else had this problem? :

` var Handle: cardinal; w, h: integer; X, Y, s, r: string; CR:string; begin CR:=Chr(13) + Chr(10); showdebugtab(true,'PULL VIDEO INFO (MEDIAINFO)'); if (MediaInfoDLL_Load('MediaInfo.dll') = False) then begin Form1.reDebug.Lines.Add('Error while loading MediaInfo.dll'); application.ProcessMessages; exit; end; form1.reDebug.Lines.Add(padstr('MEDIA INFO VER',20,'.')+MediaInfo_Option (0, 'Info_Version', '')); application.ProcessMessages;

// // form1.reDebug.Lines.Add(padstr('Info_Parameters',20,'.')+MediaInfo_Option (0, 'Info_Parameters', '')); // // form1.reDebug.Lines.Add(padstr('Info_Capacities',20,'.') + MediaInfo_Option (0, 'Info_Capacities', '')); // // form1.reDebug.Lines.Add(padstr('Info_Codecs',20,'.') + MediaInfo_Option (0, 'Info_Codecs', '')); // handle:=mediainfo_new();

MediaInfo_Open(Handle, PChar(Form1.FileListBox1.FileName)); //mmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm=m

form1.reDebug.Lines.Add(padstr('OPEN',20,'.')+format('%d', [MediaInfo_Open(Handle, pwidechar(cfpath))]));

form1.reDebug.Lines.Add(padstr('With Complete F',20,'.')+ MediaInfo_Inform(Handle, 0));

form1.reDebug.Lines.Add(padstr('With Complete T',20,'.') +MediaInfo_Inform(Handle, 0));

end; `

ZaakaJarimbo avatar Jul 21 '23 00:07 ZaakaJarimbo

Checking the Delphi doc, "Cardinal" is only 32-bit also on 64-bit platforms, so it can not get the Handler (a 64-bit value on 64-bit platforms)

Please replace all instances of "Cardinal" by "NativeUInt" (in MediaInfoDll.pas too) (not tested on our side, we will test only later, would be nice if you can try and confirm)

JeromeMartinez avatar Jul 21 '23 02:07 JeromeMartinez

Thank you Jerome thats worked a treat :) sorry for the delay in replying.

ZaakaJarimbo avatar Jul 21 '23 17:07 ZaakaJarimbo