Calling MediaInfo.dll from Xojo

Anyone ever used this library in Xojo? There’s documentation, but I’m not sure how to translate the C/C# /C++ calls into Xojo calls…

Hi Andy,

I gave the DLL a try with the following code in Xojo 2020 R1.2:

I installed the Universal Installer for Windows.

Unfortunately, the function does not exist in both 32-bit and 64-bit mode. Maybe I missed something in the DLL? A common issue is that the DLL may have mangled the function name, since Xojo requires a C-style format.

Not sure what else to say.

There is a command line tool.
A few weeks a client asked about it.

/Users/cs/Desktop/mediainfo/mediainfo --full /Users/cs/Desktop/Package/ac3.mp4 >test.txt

We tried this and got a text file easily with all the details via shell class.

Thank you, @eugenedakin!

I have it working now… The documentation is HORRIBLE!! Looking at the VB sample gave me the most information. The format of the parameters and sub-parameters, if documented, I couldn’t find it…
The "Options” function is particularly weird…

Here’s the basics…

Declare Sub MediaInfo_Close Lib "MediaInfo.dll" (handle As Ptr)
Declare Function MediaInfo_Inform Lib "MediaInfo.dll" (handle As Ptr, resv As Ptr) As WString
Declare Function MediaInfo_New Lib "MediaInfo.dll" () As Ptr
Declare Function MediaInfo_Open Lib "MediaInfo.dll" (handle As Ptr, fName As WString) As Integer
Declare Function MediaInfo_Option Lib "MediaInfo.dll" (handle as Ptr, option as WString, value as WString) As WString
Private Sub ShowInfo()
Dim Handle as Ptr = MediaInfo_New()
Dim Status As Integer = MediaInfo_Open(Handle, TestFile.NativePath)
If Status = 1 Then
  Dim Options As WString = MediaInfo_Option(Handle, "Info_Parameters", "")
  TextArea1.Text = "Parameters: " + EndOfLine + Options + EndOfLine + EndOfLine
  Options = MediaInfo_Option(Handle, "Inform", "General;Duration=%Duration/String3%")
  TextArea1.AppendText("Options: " + Options + EndofLine + EndOfLine)
  Dim s As WString = MediaInfo_Inform(Handle, Ptr(0))
  TextArea1.AppendText("Info: " + EndOfLine + s)
  TextArea1.Text = "Couldn't get info for: " + TestFile.Name
End If

Test Project

You’ll need to add the dll - I needed it to be in the “contents” folder for some reason. Thought it was supposed to go in “frameworks”??

1 Like

Glad that you were able to get it to work :slight_smile:

This is VERY common. Sometimes the documentation is so poor, that it is easier to rewrite the DLL and then make documentation myself. Occasionally there is a sliver of information that is found on an obscure website through a Google search, if I am lucky!