PDA

View Full Version : in_***.dll in_module.GetFileInfo


jean.renaud.lrs
8th September 2008, 21:52
I'm working on a way to use input modules (in_*.dll) with a third-party software to decode all the sound files types known.

By using exported API winampGetInModule2 and extracting in_module and out_module structs, I can Play, Pause, Stop, GetOutputTime and Seek, but i'm also trying to find a way to get total time of the sound.

The function "void (*GetFileInfo)(const in_char *file, in_char *title, int *length_in_ms)" from "in_module" seems to be the right one, but if i call it before playing the sound, the value of "length_in_ms" returned is 0 or -1. The only way to obtain the real value is to get it while playing the sound.

Is there something I make wrong ? The input plugin successfully opens, so it should work...

I'm also trying to understand why the value of GetOutputTime will never reach the maximum value of GetLength while playing. It stops tenths of a seconds before.

DrO
14th September 2008, 19:38
the plugin won't know how long a file is until it's playing it unless you use call the winampGetExtendedFileInfo(W) export (if present) to get the 'length' meta field from the file.

this is why when you start playing a file in winamp, there's a brief delay before the track length/position appears in the main window.

-daz

jean.renaud.lrs
15th September 2008, 02:26
Finally, everything works perfect. This is not necessary to play the file before. I explain.

Firstly, i did not included all the informations in my first post.

I am using Delphi to make my app, so someone has translated the original C code to Pascal code.

There was just a bad translation with the function GetFileInfo. The function was declared like this :

procedure GetFileInfo(var Filename: PChar; var Title: PChar; var Time_In_Ms: Integer); cdecl;

So, the "var" statement says the variable is passed by reference (pointer), and "PChar" is already a pointer to a string. So we a have a pointer to a pointer to a string.

The original code uses "char*", so it's only a pointer to a string. There is the problem. I just removed the "var" statements.

I had to look the C code to understand that...