Need help from a zLIB expert for VB.NET function

2019-09-11 14:28发布

问题:

Need to know if I'm wasting my time on this. Using UltraID3lib which does not decompress frames but stores them in an array using an exception function. The flags used says they are compressed but not Encrypted.

If the bytes are indeed zLIB compressed and in the the correct format: How can I decompress them, given that fact I know absolutely nothing about zLIB and I'm just a part time coder who was drop on he's head as a child. (Please explain slowly).

The MP3 user-defined frame (TXXX) holds a small xml string. A fast (bad example) to get the byte array stored by UltraID3Lib:

UltraID3.Read(MP3FileName) 'actual file in folder

Dim byte1 As ID3v23EncryptedCompressedFrame
For Each byte1 In UltraID3.ID3v2Tag.Frames
    Dim str1 = byte1.FrameBytes
    Dim result1 = BytesToString2(str1)
    Stop 'lets see what we got
Next

This site says if it has 789C near the beginning its zLib compressed: http://www.xtremevbtalk.com/showthread.php?t=318843

I used these function2 to convert to hex: https://social.msdn.microsoft.com/Forums/vstudio/en-US/fa53ce74-fd53-4d2a-bc05-619fb9d32481/convert-byte-array-to-hex-string?forum=vbgeneral

example function 1 at start of article:

000B0789C6330377433D63534D575F3F737B570343767B02929CA2C4B2D4BCD2B29B6B31D376367989B9A976C519F9E5ACE1989452536FA6019B924C206968017A10CA461F2C6AA3FD58A61427E5E72AA42228A114666E6F88CD04772110D5923799

example function 2 at end of article:

000000B0789C6330377433D63534D575F3F737B570343767B02929CA2C4B2D4BCD2B29B6B301D376367989B9A976C519F9E50ACE1989452536FA60019B924C20696800017A10CA461F2C6AA30FD58A61427E5E72AA42228A114666E6F88CD047721100D5923799

回答1:

Your "example function 2" is a hex representation of a valid zlib stream, starting with the 789c, which decompresses to:

71F3-15-FOO58A77<trivevents><event><name>show Chart</name><time>10000000.000000</time></event><event><name>show once a</name><time>26700000.000000</time></event></trivevents>

However "example function 1" is a corrupted version of "example function 2", with, for some reason, several missing zero digits.

You can use the .NET DeflateStream class to decompress.



标签: mp3 zlib id3v2