Problem mp3 Titellänge bei MCI-MP3-Commands

Anfängerfragen zum Programmieren mit PureBasic.
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von ccode_new »

...Hier geht's weiter:

Ich habe mich dann mal noch mit der "MediaInfo.dll" befasst.

Es ist dort aber noch nicht vorgesehen ID3-Tag zu setzen.
Auch ist mir vollkommen unklar wie man die Cover-Image Daten (als Base64-String) auslesen kann.

Das hier funktioniert nämlich nicht.

test2.s = MediaInfo_Get(Handle, #Stream_General, 0, "Cover_Data") ;???

Hier der Code:

Code: Alles auswählen

#MediaInfo_Shared = #True

Enumeration ; Kinds of Stream
  #Stream_General
  #Stream_Video
  #Stream_Audio
  #Stream_Text
  #Stream_Chapters
  #Stream_Image
  #Stream_Menu
  #Stream_Max
EndEnumeration

Enumeration ; Kind of information
  #Info_Name; InfoKind = Unique name of Parameter.
  #Info_Text; InfoKind = Value of Parameter.
  #Info_Measure      ; InfoKind = Unique name of measure unit of Parameter.
  #Info_Options      ; InfoKind = See infooptions_t.
  #Info_Name_Text    ; InfoKind = Translated name of Parameter.
  #Info_Measure_Text ; InfoKind = Translated name of measure unit.
  #Info_Info         ; InfoKind = More information about the Parameter.
  #Info_HowTo        ; InfoKind = How this Parameter is supported, could be N (No), B (Beta), R (Read only), W (Read/Write).
  #Info_Domain       ; InfoKind = Domain of this piece of information.
  #Info_Max 
EndEnumeration

Enumeration ; Used with Format info
  #InfoFormat_Name    
  #InfoFormat_LongName    
  #InfoFormat_Family    
  #InfoFormat_KindofFormat    
  #InfoFormat_Parser    
  #InfoFormat_Info    
  #InfoFormat_Extensions    
  #InfoFormat_Url    
  #InfoFormat_Max 
EndEnumeration

Enumeration ; Used with Codec info
  #InfoCodec_Codec    
  #InfoCodec_Name    
  #InfoCodec_KindOfCode    
  #InfoCodec_KindOfStream    
  #InfoCodec_KindofCodec    
  #InfoCodec_BitRate_Mode    
  #InfoCodec_Description    
  #InfoCodec_Url    
  #InfoCodec_Max 
EndEnumeration

Enumeration ; Used with Info options
  #InfoOption_ShowInInform
  #InfoOption_Reserved
  #InfoOption_ShowInSupported
  #InfoOption_TypeOfValue
  #InfoOption_Max
EndEnumeration

Enumeration ; Used with File options
  #FileOption_Nothing   
  #FileOption_Recursive 
  #FileOption_CloseAll  
  #FileOption_Max       =$04
EndEnumeration

; // Prototypes supporting unicode functions
Prototype protoMediaInfo_New()
Prototype protoMediaInfo_Delete(Handle)
Prototype protoMediaInfo_Inform(Handle, Options)
Prototype protoMediaInfo_Open(Handle, file.p-unicode)
Prototype protoMediaInfo_Close(Handle)
Prototype protoMediaInfo_Option(Handle, option.p-unicode, Value.p-unicode)
Prototype protoMediaInfo_Get(Handle, StreamKind, StreamNumber, Parameter.p-unicode, InfoKind, SearchKind)
Prototype protoMediaInfo_Set(Handle, StreamKind, StreamNumber, Parameter.p-unicode, InfoKind, SearchKind)

Procedure MediaInfo_Init()
  If OpenLibrary(90, "MediaInfo.dll")
    Global MediaInfo_New.protoMediaInfo_New         = GetFunction(90, "MediaInfo_New")
    Global MediaInfo_Delete.protoMediaInfo_Delete   = GetFunction(90, "MediaInfo_Delete")
    Global MediaInfo_Close.protoMediaInfo_Close     = GetFunction(90, "MediaInfo_Close")
    Global _MediaInfo_Inform.protoMediaInfo_Inform  = GetFunction(90, "MediaInfo_Inform")
    Global Mediainfo_Open.protoMediaInfo_Open       = GetFunction(90, "MediaInfo_Open")
    Global _MediaInfo_Option.protoMediaInfo_Option  = GetFunction(90, "MediaInfo_Option")
    Global _MediaInfo_Get.protoMediaInfo_Get        = GetFunction(90, "MediaInfo_Get")
    Global _MediaInfo_Set.protoMediaInfo_Set        = GetFunction(90, "MediaInfo_Set")
    ; // Check for proper obtained function entry points
    If MediaInfo_New And MediaInfo_Delete And _MediaInfo_Inform And Mediainfo_Open And _MediaInfo_Option And _MediaInfo_Get
      ProcedureReturn #True
    Else
      CloseLibrary(90)
    EndIf 
  EndIf 
EndProcedure 

Procedure MediaInfo_Exit()
  ProcedureReturn CloseLibrary(90)
EndProcedure

Macro MediaInfo_Inform(Handle, reserved=0)
  PeekS(_MediaInfo_Inform(Handle, reserved), #PB_Any, #PB_Unicode)
EndMacro

Macro MediaInfo_Get(Handle, StreamKind, StreamNumber, Parameter, InfoKind = #Info_Text, SearchKind = #Info_Name)
  PeekS(_MediaInfo_Get(Handle, StreamKind, StreamNumber, Parameter, InfoKind, SearchKind), #PB_Any, #PB_Unicode)
EndMacro

Macro MediaInfo_Option(Handle, option, Value = "")
  PeekS(_MediaInfo_Option(Handle, option, Value), #PB_Any, #PB_Unicode)
EndMacro


CompilerIf Defined(MediaInfo_Shared, #PB_Constant)
  If MediaInfo_Init()
  CompilerEndIf 
  
  Handle = MediaInfo_New()
  
  If Handle
    
    MessageRequester("MediaInfo: Version", MediaInfo_Option(Handle, "Info_Version"))
    
    If MediaInfo_Open(Handle, OpenFileRequester("Select file", "", "Media|*.*", 0))         
      
      ; // Lets get some general example infos of the first stream found (index 0)
      
      Info.s =  "----- General -----"
      Info + #CRLF$ + "Duration : "     + MediaInfo_Get(Handle,#Stream_General, 0, "Duration/String3")
      Info + #CRLF$ + "Format : "       + MediaInfo_Get(Handle,#Stream_General, 0, "Format") + #CRLF$ 
      
      
      ; // Some infos of the Videostream if included
      
      Info + #CRLF$ + "----- Video -----"
      Info + #CRLF$ + "Format : "       + MediaInfo_Get(Handle,#Stream_Video, 0, "Format") 
      Info + #CRLF$ + "Format/Info : "  + MediaInfo_Get(Handle,#Stream_Video, 0, "Format/Info")
      Info + #CRLF$ + "Width : "        + MediaInfo_Get(Handle,#Stream_Video, 0, "Width")
      Info + #CRLF$ + "Height : "       + MediaInfo_Get(Handle,#Stream_Video, 0, "Height") + #CRLF$ 
      
      
      ; // Some infos of the Audiostream if included
      
      Info + #CRLF$ + "----- Audio -----"
      Info + #CRLF$ + "Channels : "     + MediaInfo_Get(Handle,#Stream_Audio, 0, "Channel(s)")
      Info + #CRLF$ + "SamplingRate : " + MediaInfo_Get(Handle,#Stream_Audio, 0, "SamplingRate") + " hz"
      
      test.s = MediaInfo_Get(Handle, #Stream_General, 0, "Cover_Type")
      test2.s = MediaInfo_Get(Handle, #Stream_General, 0, "Cover_Data") ;???
      
      Debug test
      Debug test2 ;???
      
      MessageRequester("MediaInfo: Some example infos", Info)
      
      
      ; // Example for obtaining less Infos ...
      
      MediaInfo_Option(Handle, "Complete", "")
      MessageRequester("MediaInfo: Inform with Complete=false", MediaInfo_Inform(Handle))
      
      
      ; // ... and all infos
      
      MediaInfo_Option(Handle, "Complete", "1")
      MessageRequester("MediaInfo: Inform with Complete=true", MediaInfo_Inform(Handle))
      
      
      ; // Another example of the  Inform option
      
      MediaInfo_Option(Handle, "Inform", "General;File size is %FileSize/String%")
      MessageRequester("MediaInfo: Custom Inform", MediaInfo_Inform(Handle))
      
      
      ; // Option to save a list of all supported MediaInfo parameters
      
      If MessageRequester("Service", "Do you want me to save all MediaInfo parameters as txt file?",  #PB_MessageRequester_YesNo) = #PB_MessageRequester_Yes
        file.s = SaveFileRequester("Please choose location", "","Text (*.txt)|*.txt",0)
        If file
          If GetExtensionPart(file) = ""
            file + ".txt"
          EndIf
          CreateFile(99, file)
          CompilerIf #PB_Compiler_Unicode
            WriteStringFormat(99, #PB_Unicode)
          CompilerEndIf
          WriteString(99, MediaInfo_Option(Handle, "Info_Parameters"))
          CloseFile(99)
        EndIf
      EndIf
      
      MediaInfo_Close(Handle) 
    EndIf 
    
    MediaInfo_Delete(Handle)
  EndIf
  
  
  CompilerIf Defined(MediaInfo_Shared, #PB_Constant)
    MediaInfo_Exit()
  CompilerEndIf
EndIf
Aber dann habe ich noch doch noch etwas gefunden.
Die AudioGenie-Lib !!!

Hier mein Code zum testen:

Code: Alles auswählen

EnableExplicit

DeclareModule SoundInfo
  
  Prototype.l AUDIOAnalyzeFileW(*FileName)
  Prototype.i AUDIOGetAlbumW()
  Prototype.i AUDIOGetArtistW()
  Prototype.i AUDIOGetBitrateW()
  Prototype.i AUDIOGetChannelModeW()
  Prototype.i AUDIOGetChannelsW()
  Prototype.i AUDIOGetCommentW()
  Prototype.i AUDIOGetComposerW()
  Prototype.i AUDIOGetDurationMillisW()
  Prototype.f AUDIOGetDurationW()
  Prototype.i AUDIOGetFileSizeW()
  Prototype.i AUDIOGetGenreW()
  Prototype.i AUDIOGetSampleRateW()
  Prototype.i AUDIOGetTitleW()
  Prototype.i AUDIOGetTrackW()
  Prototype.i AUDIOGetVersionW()
  Prototype.i AUDIOGetYearW()
  Prototype.l AUDIOIsValidFormatW()
  Prototype.l AUDIOSaveChangesToFileW(*FileName)
  Prototype.l AUDIOSaveChangesW()
  Prototype AUDIOSetAlbumW(*Album)
  Prototype AUDIOSetArtistW(*Artist)
  Prototype AUDIOSetCommentW(*Comment)
  Prototype AUDIOSetComposerW(*Composer)
  Prototype AUDIOSetGenreW(*Genre)
  Prototype AUDIOSetTitleW(*Title)
  Prototype AUDIOSetTrackW(*Track)
  Prototype AUDIOSetYearW(*Year)
  Prototype.l ID3V2AddPictureFileW(*Filename, *Desc, PictureTyp.l, asLink.l)
  Prototype.l ID3V2GetPictureFileW(*Filename, Index.l)
  Prototype.l ID3V2SetImageSubFrameW(*P, maxLen.i, *ID, *Desc, PictureType.l)
  Prototype.l ID3V2SaveChangesW()
  Prototype.l ID3V2DeleteAllFramesW(FrameID.i)
  Prototype.l ID3V2GetCommercialFrameReceivedAsW(Index.l)
  Prototype.l ID3V2RemoveTagW()
  
  Enumeration PictureTyp
    #Other
    #Pixels32x32FileIcon
    #OtherFileIcon
    #CoverFront
    #CoverBack
    #LeafletPage
    #Media
    #LeadArtist
    #Artist
    #Conductor
    #Band
    #Composer
    #Lyricist
    #RecordingLocation
    #DuringRecording
    #DuringPerformance
    #ScreenCapture
    #ColouredFish
    #Illustration
    #BandLogo
    #StudioLogo
  EndEnumeration
  
  Structure MediaInfo
    title.s
    artist.s
    album.s
    year.s
    comment.s
    track.s
    genre.s
    bitrate.s
    samplerate.s
    channels.s
    length.s
  EndStructure
  
  Global AudioLib
  Global Media.MediaInfo
  Global AudioFile.s = ""
  Global IsMedia.b = #False
  
  Declare.i InitMedia()
  Declare.b OpenMedia(File.s)
  Declare.s GetTitle()
  Declare SetTitle(title.s)
  Declare.s GetArtist()
  Declare SetArtist(artist.s)
  Declare.s GetAlbum()
  Declare SetAlbum(album.s)
  Declare.s GetYear()
  Declare SetYear(year.s)
  Declare.s GetComment()
  Declare SetComment(comment.s)
  Declare.s GetTrack()
  Declare SetTrack(track.s)
  Declare.s GetGenre()
  Declare SetGenre(genre.s)
  Declare.s GetBitrate()
  Declare.s GetSamplerate()
  Declare.s GetChannels()
  Declare.s GetLength()
  Declare SetNewTag()
  Declare.b GetCoverImage(SaveFile.s, index.l)
  Declare.b SetCoverImage(OpenFile.s, Desc.s, PictureTyp.l)
  Declare.b RemoveTag()
  Declare.b CloseMedia()
  
EndDeclareModule

Module SoundInfo
  
  ;Nice-Functions
  Procedure.s ReadBstr(*String) ; By Fr34k
    Result$ = ""
    If *String 
      length.l = WideCharToMultiByte_(#CP_ACP, 0, *String, -1, 0, 0, 0, 0)
      *Buffer = AllocateMemory(length)
      If *Buffer
        WideCharToMultiByte_(#CP_ACP, 0, *String, -1, *Buffer, length, 0, 0)
        Result$ = PeekS(*Buffer, -1, #PB_Ascii)
        FreeMemory(*Buffer)
      EndIf
    EndIf
    ProcedureReturn Result$
  EndProcedure
  
  Procedure StringToBStr (string$) ; By Zapman Inspired by Fr34k
    Protected Unicode$ = Space(Len(string$)* 2 + 2)
    Protected bstr_string.l
    PokeS(@Unicode$, string$, -1, #PB_Unicode)
    bstr_string = SysAllocString_(@Unicode$)
    ProcedureReturn bstr_string 
  EndProcedure
  ;.....................
  
  Procedure.i InitMedia()
    AudioLib = OpenLibrary(#PB_Any, "AudioGenie3.dll")
    If AudioLib
      Global AUDIOAnalyzeFile.AUDIOAnalyzeFileW = GetFunction(AudioLib, "AUDIOAnalyzeFileW")   
      Global AUDIOGetAlbum.AUDIOGetAlbumW = GetFunction(AudioLib, "AUDIOGetAlbumW")
      Global AUDIOGetArtist.AUDIOGetArtistW = GetFunction(AudioLib, "AUDIOGetArtistW")
      Global AUDIOGetBitrate.AUDIOGetBitrateW = GetFunction(AudioLib, "AUDIOGetBitrateW")
      Global AUDIOGetChannelMode.AUDIOGetChannelModeW = GetFunction(AudioLib, "AUDIOGetChannelModeW")
      Global AUDIOGetChannels.AUDIOGetChannelsW = GetFunction(AudioLib, "AUDIOGetChannelsW")
      Global AUDIOGetComment.AUDIOGetCommentW = GetFunction(AudioLib, "AUDIOGetCommentW")
      Global AUDIOGetDurationMillis.AUDIOGetDurationMillisW = GetFunction(AudioLib, "AUDIOGetDurationMillisW")
      Global AUDIOGetFileSize.AUDIOGetFileSizeW = GetFunction(AudioLib, "AUDIOGetFileSizeW")
      Global AUDIOGetGenre.AUDIOGetGenreW = GetFunction(AudioLib, "AUDIOGetGenreW")
      Global AUDIOGetSampleRate.AUDIOGetSampleRateW = GetFunction(AudioLib, "AUDIOGetSampleRateW")
      Global AUDIOGetTitle.AUDIOGetTitleW = GetFunction(AudioLib, "AUDIOGetTitleW")
      Global AUDIOGetTrack.AUDIOGetTrackW = GetFunction(AudioLib, "AUDIOGetTrackW")
      Global AUDIOGetVersion.AUDIOGetVersionW = GetFunction(AudioLib, "AUDIOGetVersionW")
      Global AUDIOGetYear.AUDIOGetYearW = GetFunction(AudioLib, "AUDIOGetYearW")
      Global AUDIOIsValidFormat.AUDIOIsValidFormatW = GetFunction(AudioLib, "AUDIOIsValidFormatW")
      Global AUDIOSaveChanges.AUDIOSaveChangesW = GetFunction(AudioLib, "AUDIOSaveChangesW")
      Global AUDIOSetAlbum.AUDIOSetAlbumW = GetFunction(AudioLib, "AUDIOSetAlbumW")
      Global AUDIOSetArtist.AUDIOSetArtistW = GetFunction(AudioLib, "AUDIOSetArtistW")
      Global AUDIOSetComment.AUDIOSetCommentW = GetFunction(AudioLib, "AUDIOSetCommentW")
      Global AUDIOSetGenre.AUDIOSetGenreW = GetFunction(AudioLib, "AUDIOSetGenreW")
      Global AUDIOSetTitle.AUDIOSetTitleW = GetFunction(AudioLib, "AUDIOSetTitleW")
      Global AUDIOSetTrack.AUDIOSetTrackW = GetFunction(AudioLib, "AUDIOSetTrackW")
      Global AUDIOSetYear.AUDIOSetYearW = GetFunction(AudioLib, "AUDIOSetYearW")
      Global ID3V2AddPictureFile.ID3V2AddPictureFileW = GetFunction(AudioLib, "ID3V2AddPictureFileW")
      Global ID3V2GetPictureFile.ID3V2GetPictureFileW = GetFunction(AudioLib, "ID3V2GetPictureFileW")
      Global ID3V2SaveChanges.ID3V2SaveChangesW = GetFunction(AudioLib, "ID3V2SaveChangesW")
      Global ID3V2SetImageSubFrame.ID3V2SetImageSubFrameW = GetFunction(AudioLib, "ID3V2SetImageSubFrameW")
      Global ID3V2DeleteAllFrames.ID3V2DeleteAllFramesW = GetFunction(AudioLib, "ID3V2DeleteAllFramesW")
      Global ID3V2RemoveTag.ID3V2RemoveTagW = GetFunction(AudioLib, "ID3V2RemoveTagW")
    EndIf
    ProcedureReturn AudioLib
  EndProcedure
  
  Procedure.b OpenMedia(File.s)
    If IsLibrary(AudioLib)
      If AUDIOAnalyzeFile(@File)
        AudioFile = File
        Media\album = ReadBstr(AUDIOGetAlbum())
        Media\artist = ReadBstr(AUDIOGetArtist())
        Media\bitrate = Str(AUDIOGetBitrate())
        Media\channels = Str(AUDIOGetChannels())
        Media\comment = ReadBstr(AUDIOGetComment())
        Media\genre = ReadBstr(AUDIOGetGenre())
        Media\length = Str(AUDIOGetDurationMillis())
        Media\samplerate = Str(AUDIOGetSampleRate())
        Media\title = ReadBstr(AUDIOGetTitle())
        Media\track = ReadBstr(AUDIOGetTrack())
        Media\year = ReadBstr(AUDIOGetYear())
        IsMedia = #True
        ProcedureReturn #True
      Else
        Debug "Die Datei kann nicht eingelesen werden."
        ProcedureReturn #False
      EndIf
    EndIf
  EndProcedure
  
  Procedure.s GetTitle()
    If IsMedia = #True
      ProcedureReturn Media\title
    EndIf
  EndProcedure
  
  Procedure SetTitle(title.s)
    If IsMedia = #True
      Media\title = title
      AUDIOSetTitle(@Media\title)
    EndIf
  EndProcedure
  
  Procedure.s GetArtist()
    If IsMedia = #True
      ProcedureReturn Media\artist
    EndIf
  EndProcedure
  
  Procedure SetArtist(artist.s)
    If IsMedia = #True
      Media\artist = artist
      AUDIOSetArtist(@Media\artist)
    EndIf
  EndProcedure
  
  Procedure.s GetAlbum()
    If IsMedia = #True
      ProcedureReturn Media\album
    EndIf
  EndProcedure
  
  Procedure SetAlbum(album.s)
    If IsMedia = #True
      Media\album = album
      AUDIOSetAlbum(@Media\album)
    EndIf
  EndProcedure
  
  Procedure.s GetYear()
    If IsMedia = #True
      ProcedureReturn Media\year
    EndIf
  EndProcedure
  
  Procedure SetYear(year.s)
    If IsMedia = #True
      Media\year = year
      AUDIOSetYear(@Media\year)
    EndIf
  EndProcedure
  
  Procedure.s GetComment()
    If IsMedia = #True
      ProcedureReturn Media\comment
    EndIf
  EndProcedure
  
  Procedure SetComment(comment.s)
    If IsMedia = #True
      Media\comment = comment
      AUDIOSetComment(@Media\comment)
    EndIf
  EndProcedure
  
  Procedure.s GetTrack()
    If IsMedia = #True
      ProcedureReturn Media\track
    EndIf
  EndProcedure
  
  Procedure SetTrack(track.s)
    If IsMedia = #True
      Media\track = track
      AUDIOSetTrack(@Media\track)
    EndIf
  EndProcedure
  
  Procedure.s GetGenre()
    If IsMedia = #True
      ProcedureReturn Media\genre
    EndIf
  EndProcedure
  
  Procedure SetGenre(genre.s)
    If IsMedia = #True
      Media\genre = genre
      AUDIOSetGenre(@Media\genre)
    EndIf
  EndProcedure
  
  Procedure.s GetBitrate()
    If IsMedia = #True
      ProcedureReturn Media\bitrate
    EndIf
  EndProcedure
  
  Procedure.s GetSamplerate()
    If IsMedia = #True
      ProcedureReturn Media\samplerate
    EndIf
  EndProcedure
  
  Procedure.s GetChannels()
    If IsMedia = #True
      ProcedureReturn Media\channels
    EndIf
  EndProcedure
  
  Procedure.s GetLength()
    Protected Time.i, RTime.s
    Protected H.i, M.i, S.i
    If IsMedia = #True
      Time = Val(Media\length)
      If Time > 0
        Time / 1000
        S = Time % 60
        Time / 60
        M = Time % 60
        Time / 60
        H = Time % 60
      EndIf
      RTime = RSet(Str(H), 2, "0") + ":" + RSet(Str(M), 2, "0") + ":" + RSet(Str(S), 2, "0")  
      ProcedureReturn RTime
    Else
      ProcedureReturn "00:00:00"
    EndIf
  EndProcedure
  
  Procedure SetNewTag()
    AUDIOSaveChanges()
    ID3V2SaveChanges()
  EndProcedure
  
  Procedure.b GetCoverImage(SaveFile.s, index.l) ;Bei File muss eine Bilddatei angegeben werden (z.B. bild.jpg)
    If index >= 1
      If ID3V2GetPictureFile(@SaveFile, index) ;Der Index muss mind. 1 sein.
        ProcedureReturn #True
      EndIf
    Else
      Debug "Das Bild: "+SaveFile+" konnte nicht erstellt werden."
      ProcedureReturn #False
    EndIf
  EndProcedure
  
  Procedure.b SetCoverImage(OpenFile.s, Desc.s, PictureTyp.l)
    If ID3V2AddPictureFile(@OpenFile, @Desc, PictureTyp.l, 0)
      ProcedureReturn #True
    Else
      ProcedureReturn #False
    EndIf
  EndProcedure
  
  Procedure.b RemoveTag()
    If ID3V2RemoveTag() = -1
      ProcedureReturn #True
    Else
      ProcedureReturn #False
    EndIf
  EndProcedure
  
  Procedure.b CloseMedia()
    If IsLibrary(AudioLib)
      CloseLibrary(AudioLib)
      AudioLib = #Null
      ProcedureReturn #True
    Else
      ProcedureReturn #False
    EndIf
  EndProcedure
  
EndModule

;-Main
CompilerIf #PB_Compiler_IsMainFile
  Global MediaFile.s, CoverImage.s, Eingabe.s, ende.b = #False
  OpenConsole()
  MediaFile = OpenFileRequester("Wähle eine Musikdatei aus.", "*.mp3", "Musik Files|*.mp3;*.ogg;*.flac;*.wav", 0)
  UseModule SoundInfo
  If IsLibrary(InitMedia()) ;InitMedia ist WICHTIG !
    OpenMedia(MediaFile)
    Anfang:
    PrintN("Titel: "+GetTitle())
    PrintN("Artist: "+GetArtist())
    PrintN("Album: "+GetAlbum())
    PrintN("Year: "+GetYear())
    PrintN("Comment: "+GetComment())
    PrintN("Track: "+GetTrack())
    PrintN("Genre: "+GetGenre())
    PrintN("Bitrate: "+GetBitrate())
    PrintN("Channels: "+GetChannels())
    PrintN("Length: "+GetLength())
    Input()
    GetCoverImage(GetCurrentDirectory()+"song.jpg", 1)
    GetCoverImage(GetCurrentDirectory()+"song.jpg", 2)
    ;RemoveTag()
    
    
    ;Beispiel-Einträge
    SetTitle("Vorhanden")
    SetArtist("Auch vorhanden")
    SetAlbum("Unknow")
    SetYear("2018") ;Bitte eine Zahl als String übergeben, Danke!
    SetComment("Alles nur dummes Gelapp.")
    SetTrack("0") ;Bitte auch hier eine Zahl als String übergeben, Danke!
    SetGenre("Muss erst noch erfunden werden.")
    
    If SetCoverImage(GetCurrentDirectory()+"testbild.jpg", "Nettes Bild", #CoverFront)
      Debug "Das Bild wurde übernommen."
    EndIf
    
    If ende = #False
      ende = #True
      Goto Anfang
    Else
      PrintN("Möchten Sie die neuen Einträge dauerhaft übernehmen ? (ja oder nein)")
      Eingabe = Input()
      If UCase(Eingabe) = "JA"
        SetNewTag()
      EndIf
    EndIf
    CloseMedia() ;Bitte nicht vergessen !
  EndIf 
  UnuseModule SoundInfo
CompilerEndIf

DisableExplicit
Hier ist sind alle benötigten Daten:
https://workupload.com/file/8AuA6A2M
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
schleicher
Beiträge: 214
Registriert: 30.03.2014 19:57
Computerausstattung: Purebasic 5.70
Wohnort: 18314 Löbnitz

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von schleicher »

Hallo ccode_new

Großes Dankeschön.
Leider habe wohl vergessen zu erwähnen welches Betriebssystem ich auf meinen Rechnern verwende.
Ich habe Windows 10 home 32bit und Windows Vista home 32bit.
Die dll-Dateien von dir funktionieren so von dir bei mir nicht. Für welches Betriebssystem sind die ?

AudioGenie3.dll und MediaInfo.dll habe ich für Windows 32bit im Internet gefunden und somit
die beiden Codes von dir erfolgreich testen können.
AudioGenie ist für mich perfekt . Alles drin. Thanks

Ich würde aber gern auch deine anderen beiden Codes testen. Kannst du die benötigten Dll_Dateien für Windows 32bit bereitstellen ?

Hier die beiden Dll für Audiogenie und Mediainfo für Win 32bit:
https://workupload.com/file/TnznjYVL
Purebasic 5.51
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von ccode_new »

Hallo schleicher,

ja da hast du dir ganz schön was erschlichen. :mrgreen:

Naja!

Spaß bei Seite!

Ich habe zu Danken! Denn ohne deine Wünsche hätte ich bis jetzt dafür noch keine Initiative ergriffen.

Die Sache mit den 32bit hättest du aber schon mal etwas eher erwähnen können.

Hier die TagLib für 32bit:
https://workupload.com/file/wU8fPN6z
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
schleicher
Beiträge: 214
Registriert: 30.03.2014 19:57
Computerausstattung: Purebasic 5.70
Wohnort: 18314 Löbnitz

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von schleicher »

Hallo ccode_new.
Es werden sich auch bestimmt viele andere noch über deine Arbeit freuen.


Die taglib teste ich morgen .
Purebasic 5.51
schleicher
Beiträge: 214
Registriert: 30.03.2014 19:57
Computerausstattung: Purebasic 5.70
Wohnort: 18314 Löbnitz

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von schleicher »

Hallo ccode_new

Habe heute weiter getestet. Auch mit deinen neuen taglib`s habe ich taglib nicht zum laufen bekommen. Sagt immer noch das das Betriebssystem nicht passt.

Dann habe ich weiter Audiogie getestet. War auch begeistert, bis ich feststellte das einige mp3`s
nicht korrekt ausgelesen werden. Ich konnte auch nicht rausfinden warum. Alle Textinformationen werden immer korrekt augelesen, nur Bitrate und Länge nicht. Es wird wohl anhande der Bitrate die Länge errechnet. Da diese aber nicht korrekt ist ist es die Länge auch nicht.
Hier mal ein Screenshot eines Beispieles :

Bild

Vieleicht eine Idee was da los ist ?
Purebasic 5.51
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von ccode_new »

Einen schönen Sonntag schleicher.

Ich habe jetzt gerade kein 32bit Windows zum testen, aber eigentlich müsste die tag_c.dll unter Windows 10 32bit funktionieren. (In CMake für VisualStudio2017 (x86) erstellt und dort per Projektstandard für 32bit (Win32) kompiliert.
???

Kannst du bitte einmal deine Mp3 mit der MediaInfo.dll testen. Wird dort auch eine falsche Bitrate (z.B. 32 statt 320) angezeigt ?
Ansonsten würde mich der Rückgabewert von folgender AudioGenie3.dll Funktion interessieren.
AUDIOAnalyzeFile(@File)
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
schleicher
Beiträge: 214
Registriert: 30.03.2014 19:57
Computerausstattung: Purebasic 5.70
Wohnort: 18314 Löbnitz

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von schleicher »

Hallo ccode_new

Hab es gerade eben mit mediainfo getestet und dort erscheint bei Bitrate : Variable
Da liegt wohl auch schon das Problem.

Du möchtest die Ausgabe von AUDIOAnalyzeFile(@File) wissen.
Weiss nicht genau welchen Wert du meinst media\bitrate =32 und media\length=1285999

Taglib habe ich noch nicht weiter getestet. Sitze an meinem alten Rechner mit Vista. Da gehts nicht und unter win 10 muss ich noch testen.
Purebasic 5.51
schleicher
Beiträge: 214
Registriert: 30.03.2014 19:57
Computerausstattung: Purebasic 5.70
Wohnort: 18314 Löbnitz

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von schleicher »

Hallo code_new
Hab mich noch einmal mit deiner Soundinfo_Dll.pb beschäftigt.

Es kommt folgende Fehlermeldung :

[16:07:59] Warte auf den Start des Executable...
[16:07:59] Executable-Typ: Windows - x86 (32bit, Unicode)
[16:07:59] Executable gestartet.
[16:08:04] [ERROR] SoundInfo_Dll.pb (Zeile: 142)
[16:08:04] [ERROR] PeekS(): ungültiger Wert als Parameter 'Flags' angegeben.
[16:08:13] Das Programm wurde beendet.


Bei Soundinfo.pb
Fehlermeldung:

Invalid MachineTyp in Objekt tag_c.dll
Purebasic 5.51
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von ccode_new »

Halli Hallo Hallöchen!
schleicher hat geschrieben:[16:08:04] [ERROR] SoundInfo_Dll.pb (Zeile: 142)[16:08:04] [ERROR] PeekS(): ungültiger Wert als Parameter 'Flags' angegeben.

Also in Zeile 142 steht:

Media\title = Trim(PeekS(taglib_tag_title(*FileInfo) ,-1, #PB_UTF8))

Mir ist unklar das #PB_UTF8 ein ungültiger Parameter ist.

Du könntest alle #PB_UTF8 Konstanten ja mal gegen #PB_Ascii ersetzen.
(Oder du lässt den letzten Parameter einfach mal weg.)

Du könntest auch mal diese Zeile auskommentieren:
taglib_set_strings_unicode(#True)

Einen Test wäre es wert.

Ich meine diesen Wert:
If AUDIOAnalyzeFile(@File)
Debug AUDIOAnalyzeFile(@File)
....

Gibt die Art der Datei an. ( 1 = Mp3 )
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
ccode_new
Beiträge: 1214
Registriert: 27.11.2016 18:13
Wohnort: Erzgebirge

Re: Problem mp3 Titellänge bei MCI-MP3-Commands

Beitrag von ccode_new »

Der Support:
:bluescreen:

Und wurde das Problem schon gelöst ?
Betriebssysteme: div. Windows, Linux, Unix - Systeme

no Keyboard, press any key
no mouse, you need a cat
Antworten