[gelöst] MediaInfo.dll und PBOSL_LoadDllMemory

Anfängerfragen zum Programmieren mit PureBasic.
Benutzeravatar
scholly
Beiträge: 793
Registriert: 04.11.2005 21:30
Wohnort: Düsseldorf

Beitrag von scholly »

:bounce:

Erfolgsmeldung, und falls es jemand Nachvollziehen will:

Alter Code per Import:

Code: Alles auswählen

video.s = "test.avi"

Import "MediaInfo0770.lib"
  MediaInfo_New()
  MediaInfo_Delete(handle)
  MediaInfoA_Inform(Handle,Options)
  MediaInfoA_Open(handle,file.s)
  MediaInfoA_Option(Handle,Option.s,Value.s)
  MediaInfoA_Get(Handle,StreamKind,StreamNumber,Parameter.s,InfoKind,SearchKind)
EndImport
 
Handle = MediaInfo_New()
 
If Handle
  MediaInfoA_Open(Handle,video)         
   
  info_ptr = MediaInfoA_Get(Handle,2, 0, "SamplingRate_String", 1, 0) 
  MessageRequester ("", PeekS(info_ptr))
    
  info_ptr =  MediaInfoA_Inform(Handle,Options)
  MessageRequester ("", PeekS(info_ptr))
    
  info_ptr = MediaInfoA_Option(Handle, "Info_Parameters", "")
  MessageRequester ("", PeekS(info_ptr))
    
  Debug PeekS(info_ptr)
  
  MediaInfo_Delete(Handle)
EndIf
  
End


ProtoType statt Import:

Code: Alles auswählen

video.s = "test.avi"

Prototype protoMediaInfo_New()
Prototype protoMediaInfo_Delete(handle)
Prototype protoMediaInfoA_Inform(Handle,Options)
Prototype protoMediaInfoA_Open(handle,file.s)
Prototype protoMediaInfoA_Option(handle,option.s,value.s)
Prototype protoMediaInfoA_Get(Handle,StreamKind,StreamNumber,Parameter.s,InfoKind,SearchKind)

If OpenLibrary(0, "MediaInfo0770.dll")

  MediaInfo_New.protoMediaInfo_New        = GetFunction(0, "MediaInfo_New")
  MediaInfo_Delete.protoMediaInfo_Delete  = GetFunction(0, "MediaInfo_Delete")
  MediaInfoA_Inform.protoMediaInfoA_Inform= GetFunction(0, "MediaInfoA_Inform")
  MediainfoA_Open.protoMediaInfoA_Open    = GetFunction(0, "MediaInfoA_Open")
  MediaInfoA_Option.protoMediaInfoA_Option= GetFunction(0, "MediaInfoA_Option")
  MediaInfoA_Get.protoMediaInfoA_Get      = GetFunction(0, "MediaInfoA_Get")

  handle = MediaInfo_New()

  If Handle
    MediaInfoA_Open(Handle,video)         
    
    info_ptr = MediaInfoA_Get(Handle,2, 0, "SamplingRate_String", 1, 0) 
    MessageRequester ("", PeekS(info_ptr))
    
    info_ptr =  MediaInfoA_Inform(Handle,Options)
    MessageRequester ("", PeekS(info_ptr))
    
    info_ptr = MediaInfoA_Option(Handle, "Info_Parameters", "")
    MessageRequester ("", PeekS(info_ptr))
    
    Debug PeekS(info_ptr)
  
    MediaInfo_Delete(Handle)
  EndIf

  CloseLibrary(0) 
EndIf

End
Per PBOSL_LoadDllMemory:

Code: Alles auswählen

video.s = "test.avi"

Prototype pMediaInfo_New()
Prototype pMediaInfo_Delete(handle)
Prototype pMediaInfoA_Inform(Handle,Options)
Prototype pMediaInfoA_Open(handle,file.s)
Prototype pMediaInfoA_Option(handle,option.s,value.s)
Prototype pMediaInfoA_Get(Handle,StreamKind,StreamNumber,Parameter.s,InfoKind,SearchKind)

hModule = LoadLibraryM(?Label_MediaInfo_DLL)

If hModule
  MediaInfo_New.pMediaInfo_New        = GetProcAddressM(hModule, "MediaInfo_New")
  MediaInfo_Delete.pMediaInfo_Delete  = GetProcAddressM(hModule, "MediaInfo_Delete")
  MediaInfoA_Inform.pMediaInfoA_Inform= GetProcAddressM(hmodule, "MediaInfoA_Inform")
  MediainfoA_Open.pMediaInfoA_Open    = GetProcAddressM(hModule, "MediaInfoA_Open")
  MediaInfoA_Option.pMediaInfoA_Option= GetProcAddressM(hModule, "MediaInfoA_Option")
  MediaInfoA_Get.pMediaInfoA_Get      = GetProcAddressM(hModule, "MediaInfoA_Get")

  handle = MediaInfo_New()

  If Handle
    MediaInfoA_Open(Handle,video)         
    
    info_ptr = MediaInfoA_Get(Handle,2, 0, "SamplingRate_String", 1, 0) 
    MessageRequester ("", PeekS(info_ptr))
    
    info_ptr =  MediaInfoA_Inform(Handle,Options)
    MessageRequester ("", PeekS(info_ptr))
    
    info_ptr = MediaInfoA_Option(Handle, "Info_Parameters", "")
    MessageRequester ("", PeekS(info_ptr))
    
    Debug PeekS(info_ptr)
  
    MediaInfo_Delete(Handle)
  EndIf

  FreeLibraryM(hModule) 
EndIf

End

DataSection
  Label_MediaInfo_DLL:
  IncludeBinary "MediaInfo0770.dll"
EndDataSection
:praise: , Thomas

un jezz: Ärzte statt e-m@il für Meg :lurk:
Zuletzt geändert von scholly am 23.05.2008 23:24, insgesamt 2-mal geändert.
Ich bin blutiger PB-Anfänger.
seit 17.12.08: PB 4.3 unter XP Home(SP3)
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

Was ist mit "MediaInfo_Delete(Handle) " ?
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Benutzeravatar
scholly
Beiträge: 793
Registriert: 04.11.2005 21:30
Wohnort: Düsseldorf

Beitrag von scholly »

Tja, das kommt davon, wenn ich zu der Uhrzeit noch multitasken will :oops:

Besser so ?

Und ist der Zwischenschritt über Prototype so korrekt?
Ganz verstanden hab ich das nämlich noch nicht :oops: , aber bei mir tuts was es soll :lol:
Ich bin blutiger PB-Anfänger.
seit 17.12.08: PB 4.3 unter XP Home(SP3)
Benutzeravatar
ts-soft
Beiträge: 22292
Registriert: 08.09.2004 00:57
Computerausstattung: Mainboard: MSI 970A-G43
CPU: AMD FX-6300 Six-Core Processor
GraKa: GeForce GTX 750 Ti, 2 GB
Memory: 16 GB DDR3-1600 - Dual Channel
Wohnort: Berlin

Beitrag von ts-soft »

scholly hat geschrieben:Und ist der Zwischenschritt über Prototype so korrekt?
Ganz verstanden hab ich das nämlich noch nicht :oops: , aber bei mir tuts was es soll :lol:
Ja, die Prototypes sorgen in erster Linie dafür, das der Parametertyp und die
Anzahl Parameter stimmen, weil ohne kann der Compiler dies nicht prüfen
und erzeugt IMA wenns nicht hinhaut.
PureBasic 5.73 LTS | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Nutella hat nur sehr wenig Vitamine. Deswegen muss man davon relativ viel essen.
Bild
Antworten