Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Unit für mpglib.dll (https://www.delphipraxis.net/40191-unit-fuer-mpglib-dll.html)

crypti 12. Feb 2005 00:56


Unit für mpglib.dll
 
Hallo

kann mir jemand bei Umsetzung eines Programms zum Decodieren von MP3 Dateien über die mpglib.dll nach WAV helfen?
Gleich am Anfang, hier gibt es die dll und die Sourcen in C: http://www.funsync.de/mpesch3/mpglibdll_092.zip


Der Wrappercode müsste meiner Meinung nach passend zur dll so aussehen:

Delphi-Quellcode:
  Tmpstr = record
  c : LongWord;
  end;
  Pmpstr = ^Tmpstr;

Function _InitMP3(mp : Pmpstr):Integer; cdecl; external 'mpglib.dll';
Procedure _ExitMP3(mp : Pmpstr);cdecl; external 'mpglib.dll';
Function _decodeMP3(mp : Pmpstr; inmemory : LongWord; inmemsize: LongWord; outmemory: LongWord; outmemsize, done: Integer):Integer; cdecl; external 'mpglib.dll';
tschöö

Luckie 12. Feb 2005 01:41

Re: Unit für mpglib.dll
 
Ich kenne die DLL gheader nicht, aber sieht doch ganz gut aus. Wo benötigste du denn jetzt gezielt Hilfe? Dir die Arbeit abnhemen und dir die Headerübersetzung machen wird wohl keiner.

crypti 12. Feb 2005 01:45

Re: Unit für mpglib.dll
 
Da ich momentan nur Speicherverletzungen bekomme wenn ich diese wrapperfunktionen verwende, muss da irgendwas schon falsch sein.

Hier mal zum Vergleich der c Code:

Delphi-Quellcode:
struct mpstr { char c[40000]; };


typedef BOOL (*INITMP3)  (struct mpstr *mp);
typedef void (*EXITMP3)  (struct mpstr *mp);
typedef int (*DECODEMP3) (struct mpstr *mp, char *inmemory, int inmemsize,
                           char *outmemory, int outmemsize, int *done);
Das Problem liegt auf jeden Fall bei dem Pointer Zeugs.

Luckie 12. Feb 2005 01:48

Re: Unit für mpglib.dll
 
Das cdecl kommt mir etwas komisch vor. Ich hätte da jetzt stdcall genommen oder sind die Funktionen so in der DLL deklariert?

crypti 12. Feb 2005 02:02

Re: Unit für mpglib.dll
 
Ich denke ich weiß woran es hängt, nämlich am verwendeten struct /record.

Kann mir eventuell jemand sagen wie das in Delphi aussehen würde?

Delphi-Quellcode:
struct buf {
   unsigned char *pnt;
   long size;
   long pos;
   struct buf *next;
   struct buf *prev;
};
Was soll struct buf *next; sein? Ein struct das im struct wieder sich selbst linkt?

mirage228 12. Feb 2005 07:20

Re: Unit für mpglib.dll
 
Zitat:

Zitat von crypti
Ich denke ich weiß woran es hängt, nämlich am verwendeten struct /record.

Kann mir eventuell jemand sagen wie das in Delphi aussehen würde?

Delphi-Quellcode:
struct buf {
   unsigned char *pnt;
   long size;
   long pos;
   struct buf *next;
   struct buf *prev;
};
Was soll struct buf *next; sein? Ein struct das im struct wieder sich selbst linkt?

Hi,

ich würde mal schätzen:

Delphi-Quellcode:
type
  PByte = ^Byte;

type
  Buf = packed record
  Pnt: PByte;
  Size: LONG;
  Pos: LONG;
  Next: PBuf; // ^Buf;
  Prev: PBuf; // ^Buf;
end;
mfG
mirage228

crypti 12. Feb 2005 11:42

Re: Unit für mpglib.dll
 
Hallo

bist du sicher das man das hier machen kann?

Delphi-Quellcode:
type
  Buf = packed record
  ...
  [b]Next: PBuf; // ^Buf;
  Prev: PBuf; // ^Buf; [/b]
end;

mirage228 12. Feb 2005 11:44

Re: Unit für mpglib.dll
 
Zitat:

Zitat von crypti
Hallo

bist du sicher das man das hier machen kann?

Delphi-Quellcode:
type
  Buf = packed record
  ...
  [b]Next: PBuf; // ^Buf;
  Prev: PBuf; // ^Buf; [/b]
end;

Hi,

also meineswissens ja. Du musst eben noch oben die Deklaration von PBuf ergänzen. ("type PBuf = ^Buf")
Die beiden Typen in der struct sind ja Pointer auf eine "Buf" Struktur.

mfG
mirage228

crypti 12. Feb 2005 18:29

Re: Unit für mpglib.dll
 
Hallo

ich habe das anders realisiert, trotzdem vielen Dank für euer Bemühen...

tschöö


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:46 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz