Autor Beitrag
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: So 16.08.09 15:29 
Überarbeitete Version (0.5b) ist draußen. Wer die Unit zum Bearbeiten von ID3-Tags unter Delphi 2009 einsetzt, sollte dringend die neue Version benutzen.

Download-Links sind gleichgeblieben, siehe erstes Posting.

Danke nochmal an der Stelle an den netten Menschen aus Wien, der mir das Problem gemeldet hat. :D

_________________
We are, we were and will not be.
Teekeks
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 211
Erhaltene Danke: 23



BeitragVerfasst: Mo 19.10.09 07:44 
Hallo Gausi!
Ich habe mir mal erlaubt deinen "Kram" mal etwas zu verkürzen und nur die Stelle rauskopiert und angepasst welche die Trackinfos ausgibt.

Die will ich euch natürlich nicht vorenthalten.
Sie geht auf jeden Fall für Lazarus.
Alles andere weiß ich nicht.

Gruß Teekeks
Einloggen, um Attachments anzusehen!
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mo 19.10.09 10:50 
Dieser Code kann aber manchmal Probleme machen bzw. dauert unnötig lang, da ein (möglicherweise sehr umfangreicher) ID3v2-Tag am Anfang für die Suche nach einem MPEG-Header nicht übersprungen wird.

Die Original-Unit ist höchstwahrscheinlich nicht direkt Lazarus-kompatibel, da ich für das Auslesen von Texten im ANSI/ISO8859-Format eine Heuristik verwende, die auf gewisse Windows-API-Methoden zurückgreift.
Wenn ich mal Zeit dazu finde, kann ich mal schauen, inwiefern man das Ding für Lazarus umbauen muss - ggf. mit leichten Einschränkung dafür.

_________________
We are, we were and will not be.
Teekeks
ontopic starontopic starontopic starontopic starontopic starofftopic starofftopic starofftopic star
Beiträge: 211
Erhaltene Danke: 23



BeitragVerfasst: Mo 19.10.09 15:29 
Wäre schön wenn du das machen könntest...

Solange arbeite ich mit meiner variante, fürs erste geht das so.
Ich würde mich aber darüber freuen wenn du das Ändern würdest.

Gruß Teekeks
DjVinny
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Di 21.09.10 19:13 
Hi,

I have an issue. I recently upgraded to Delphi 2009 a while back, and decided to redo a program I have been personally using for a while. As I loaded it up into Delphi I noticed I had an old version of mp3fileutils (0.3) which was not compiling correctly. So I upgraded to mp3fileutils 0.5b. Now I get an access violation here;

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
         stream := TFileStream.Create(memo1.Lines.Strings[i], fmOpenRead or fmShareDenyWrite);
         id3v2Tag.ReadFromStream(stream);    <--------- ACCESS VIOLATION gets thrown.
         if Not Id3v2Tag.exists then
          stream.Seek(0, sobeginning)
          else
          stream.Seek(Id3v2Tag.size, soFromBeginning);
          stream.Free;


Any help would be appreciated. Thank you.
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Di 21.09.10 19:21 
Hello and :welcome: in the Entwickler-Ecke. :wave:

As written in the reply to your mail a few moments ago:

The two (ok, here are some more ;-)) lines of code seems to be correct - I have no idea what goes wrong there.
Have you created the id3v2Tag-Object properly by id3v2Tag := TId3v2Tag.Create? Are there at least (i+1) lines in the memo? Was tFileStream.Create completed successful? Was the Access Violation in this line of code, or is it raised somewhere deep in mp3FileUtils?

It is often easier to find such bugs with tools like Madexcept (free for non-commercial use). Just install it, activate the madExcept-Settings (there will be a menu-item in the Delphi-IDE after install). This will give some more information. :)

_________________
We are, we were and will not be.
DjVinny
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Di 21.09.10 22:03 
It is weird. As it worked before with the old version.

But here are the answers to your questions.

memo1 is populated, as far as I can see I but some popups in mp3fileutils on readfromstream and it doesnt even get to that point.

I also put a messagedlg between these two lines;

stream := TFileStream.Create(memo1.Lines.Strings[i], fmOpenRead or fmShareDenyWrite);
<--- popup dialog was here.
id3v2Tag.ReadFromStream(stream);

and the popup displayed. So it happens after the filestream.create


and Id3v2Tag := TId3v2Tag.Create; is in Form.Show
DjVinny
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Di 21.09.10 22:35 
I do not know what you need from the madexcept But;

ausblenden volle Höhe Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
63:
64:
65:
66:
67:
68:
69:
70:
71:
72:
73:
74:
75:
76:
77:
78:
79:
80:
81:
82:
83:
84:
85:
86:
87:
88:
89:
90:
91:
92:
93:
94:
95:
96:
97:
98:
99:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
compiled with     : Delphi 2009
madExcept version : 3.0l
callstack crc     : $9b971e14, $cf1ff7a6, $cf1ff7a6
exception number  : 1
exception class   : EAccessViolation
exception message : Access violation at address 004EDE70 in module 'DmVinnyMp3Tools.exe'. Write of address 00000009.

main thread ($ec4):
004ede70 +000 DmVinnyMp3Tools.exe Mp3FileUtils    2036  +0 TID3v2Tag.Clear
004ed68e +00a DmVinnyMp3Tools.exe Mp3FileUtils    1649  +2 TID3v2Tag.ReadFromStream
004f53c1 +349 DmVinnyMp3Tools.exe Unit4            217 +35 TForm4.Button1Click
004c2c33 +06f DmVinnyMp3Tools.exe Controls                 TControl.Click
00496786 +01e DmVinnyMp3Tools.exe StdCtrls                 TCustomButton.Click
004971e8 +010 DmVinnyMp3Tools.exe StdCtrls                 TCustomButton.CNCommand
004c26ca +2d2 DmVinnyMp3Tools.exe Controls                 TControl.WndProc
004c6bcf +513 DmVinnyMp3Tools.exe Controls                 TWinControl.WndProc
0049644c +06c DmVinnyMp3Tools.exe StdCtrls                 TButtonControl.WndProc
004c22f0 +024 DmVinnyMp3Tools.exe Controls                 TControl.Perform
004c6d1f +023 DmVinnyMp3Tools.exe Controls                 DoControlMsg
004c771b +00b DmVinnyMp3Tools.exe Controls                 TWinControl.WMCommand
004dcc34 +02c DmVinnyMp3Tools.exe Forms                    TCustomForm.WMCommand
004c26ca +2d2 DmVinnyMp3Tools.exe Controls                 TControl.WndProc
004c6bcf +513 DmVinnyMp3Tools.exe Controls                 TWinControl.WndProc
004d9c58 +594 DmVinnyMp3Tools.exe Forms                    TCustomForm.WndProc
0047c028 +014 DmVinnyMp3Tools.exe Classes                  StdWndProc
004c62e8 +02c DmVinnyMp3Tools.exe Controls                 TWinControl.MainWndProc
0047c028 +014 DmVinnyMp3Tools.exe Classes                  StdWndProc
7569cd7c +047 USER32.dll                                   SendMessageW
756a0ad1 +016 USER32.dll                                   CallWindowProcW
004c6ccb +0d7 DmVinnyMp3Tools.exe Controls                 TWinControl.DefaultHandler
004c3050 +010 DmVinnyMp3Tools.exe Controls                 TControl.WMLButtonUp
004c26ca +2d2 DmVinnyMp3Tools.exe Controls                 TControl.WndProc
004c6bcf +513 DmVinnyMp3Tools.exe Controls                 TWinControl.WndProc
0049644c +06c DmVinnyMp3Tools.exe StdCtrls                 TButtonControl.WndProc
004c62e8 +02c DmVinnyMp3Tools.exe Controls                 TWinControl.MainWndProc
0047c028 +014 DmVinnyMp3Tools.exe Classes                  StdWndProc
75697df5 +00a USER32.dll                                   DispatchMessageW
004e216f +0f3 DmVinnyMp3Tools.exe Forms                    TApplication.ProcessMessage
004e21b2 +00a DmVinnyMp3Tools.exe Forms                    TApplication.HandleMessage
004e24dd +0c9 DmVinnyMp3Tools.exe Forms                    TApplication.Run
00500ef2 +06e DmVinnyMp3Tools.exe DmVinnyMp3Tools   26  +7 initialization
75e43675 +010 kernel32.dll                                 BaseThreadInitThunk

modules:
00400000 DmVinnyMp3Tools.exe                    D:\[_APPLICATIONS AND UTILITIES_]\[PROGRAMMING]\[[_DELPHI PROJECT FILES_]]\DELPHI PROJECTS\CD CATALOGER
6dff0000 mpr.dll             6.1.7600.16385     C:\windows\system32
6e140000 DUser.dll           6.1.7600.16385     C:\windows\system32
6e690000 msimg32.dll         6.1.7600.16385     C:\windows\system32
71ed0000 dwmapi.dll          6.1.7600.16385     C:\windows\system32
728c0000 uxtheme.dll         6.1.7600.16385     C:\windows\system32
73260000 comctl32.dll        6.10.7600.16385    C:\windows\WinSxS\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.7600.16385_none_421189da2b7fabfc
73400000 winmm.dll           6.1.7600.16385     C:\windows\system32
735f0000 version.dll         6.1.7600.16385     C:\windows\system32
739a0000 wsock32.dll         6.1.7600.16385     C:\windows\system32
74dd0000 CRYPTBASE.dll       6.1.7600.16385     C:\windows\syswow64
74de0000 SspiCli.dll         6.1.7600.16484     C:\windows\syswow64
74e40000 RPCRT4.dll          6.1.7600.16385     C:\windows\syswow64
74f30000 NSI.dll             6.1.7600.16385     C:\windows\syswow64
74f40000 IMM32.DLL           6.1.7600.16385     C:\windows\system32
74fa0000 ADVAPI32.dll        6.1.7600.16385     C:\windows\syswow64
75260000 MSCTF.dll           6.1.7600.16385     C:\windows\syswow64
75330000 msvcrt.dll          7.0.7600.16385     C:\windows\syswow64
753f0000 comdlg32.dll        6.1.7600.16385     C:\windows\syswow64
75680000 USER32.dll          6.1.7600.16385     C:\windows\syswow64
75780000 SHLWAPI.dll         6.1.7600.16385     C:\windows\syswow64
757e0000 CLBCatQ.DLL         2001.12.8530.16385 C:\windows\syswow64
75870000 GDI32.dll           6.1.7600.16385     C:\windows\syswow64
75900000 USP10.dll           1.626.7600.16385   C:\windows\syswow64
759a0000 LPK.dll             6.1.7600.16385     C:\windows\syswow64
759b0000 ole32.dll           6.1.7600.16385     C:\windows\syswow64
75df0000 WS2_32.dll          6.1.7600.16385     C:\windows\syswow64
75e30000 kernel32.dll        6.1.7600.16385     C:\windows\syswow64
75fe0000 shell32.dll         6.1.7600.16644     C:\windows\syswow64
76c30000 KERNELBASE.dll      6.1.7600.16385     C:\windows\syswow64
76d70000 oleaut32.dll        6.1.7600.16567     C:\windows\syswow64
76e00000 sechost.dll         6.1.7600.16385     C:\windows\SysWOW64
77270000 ntdll.dll           6.1.7600.16559     C:\windows\SysWOW64



cpu registers:
eax = 00000000
ebx = 00000000
ecx = 00000000
edx = 01e06de8
esi = 00000000
edi = 01e06de8
eip = 004ede70
esp = 0018f4f4
ebp = 0018f570

stack dump:
0018f4f4  93 d6 4e 00 70 f5 18 00 - d0 2e d4 01 5c 1d 49 00  ..N.p.......\.I.
0018f504  00 00 00 00 c6 53 4f 00 - ec f8 18 00 5c 4b 40 00  .....SO.....\K@.
0018f514  70 f5 18 00 10 f7 18 00 - 68 67 49 00 40 9d d2 01  p.......hgI.@...
0018f524  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
0018f534  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
0018f544  00 00 00 00 00 00 00 00 - 00 00 00 00 00 00 00 00  ................
0018f554  0e 00 00 00 e8 6d e0 01 - e8 cd df 01 0c 00 00 00  .....m..........
0018f564  00 00 00 00 00 00 00 00 - 00 00 00 00 b4 f6 18 00  ................
0018f574  39 2c 4c 00 40 9d d2 01 - 8b 67 49 00 10 f7 18 00  9,L.@....gI.....
0018f584  ed 71 49 00 40 9d d2 01 - cd 26 4c 00 10 f7 18 00  .qI.@....&L.....
0018f594  1c f9 18 00 40 9d d2 01 - 27 70 69 75 5f f8 28 73  ....@...'piu_.(s
0018f5a4  d8 08 41 00 00 00 00 00 - 00 00 00 00 2b f8 28 73  ..A.........+.(s
0018f5b4  0b f9 28 73 30 7a 96 00 - fc f5 18 00 00 00 00 00  ..(s0z..........
0018f5c4  30 7a 96 00 00 00 00 00 - 00 00 00 00 00 00 00 00  0z..............
0018f5d4  00 00 00 00 2b f8 28 73 - 01 00 00 00 78 f6 18 00  ....+.(s....x...
0018f5e4  00 00 00 00 f4 f5 18 00 - d8 08 41 00 00 00 00 00  ..........A.....
0018f5f4  00 00 00 00 b4 88 f5 22 - 28 f6 18 00 38 62 69 75  ......."(...8biu
0018f604  d8 08 41 00 15 02 00 00 - 00 00 00 00 00 00 00 00  ..A.............
0018f614  2b f8 28 73 cd ab ba dc - 00 00 00 00 00 00 00 00  +.(s............
0018f624  2b f8 28 73 38 f6 18 00 - 54 f6 18 00 30 02 70 75  +.(s8...T...0.pu

disassembling:
004ede70      public Mp3FileUtils.TID3v2Tag.Clear:  ; function entry point
004ede70 2036 > mov     byte ptr [eax+9], 3
004ede74 2037   mov     byte ptr [eax+$a], 0
004ede78 2038   xor     edx, edx
004ede7a        mov     [eax+$18], edx
004ede7d 2039   xor     edx, edx
[...]
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Di 21.09.10 23:36 
Are you really sure that id3v2Tag is not nil at the line you call ReadFromStream? As I see in the call stack, the exception occurs in the Clear method which is pretty simple. Nearly the only object accessed in there is the TId3v2Tag itself.
DjVinny
Hält's aus hier
Beiträge: 4



BeitragVerfasst: Di 21.09.10 23:44 
Im absolutely sure, because before I call the id3 tag, I parse the filename which is displayed on the listview prior to the error... so I know its getting the input.

To make it more clear, I have 5 columns in my listview. The first column holds the filename which is parsed from memo1. The second and third column holds the mp3 file title and artist which the program attempts to grab by splitting the (-) minus symbol (if this was a fairy tale all mp3s would be named in this manner: artist - title.mp3) in the filename. Then the fourth and fifth columns hold the actual call to the id3 tag.

So therefore memo1 has to be populated or columns 1 through 3 would raise an error.

I also currently have it working with JEDI tools, but it seems faster with your utility, and I would rather switch back to yours.
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Mi 22.09.10 10:37 
Ok, this is strange. The call of ReadFromStream is ok, but Clear (first line in the ReadFromStream-metod) raises the Exception? :gruebel:

You can try the ReadFromFile-method instead, but I don't think that this will really solve the problem (as this will call ReadFromStream). You wrote, that you are porting the project to Delphi2009. I suppose that the real reason for this Access Violation is somewhere else. Maybe you read/write some strings assuming every char is represented by one single byte which somehow corrupts the memory of your application. :nixweiss:

_________________
We are, we were and will not be.
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Do 23.06.11 16:40 
Nur zur Info ein kleiner Push: Ich habe eben Version 0.6 hochgeladen, die auch schon in meinem Player zum Einsatz kommt. Darin u.a. enthalten Unterstützung für "Private Frames" und ein paar Bugfixes, die allerdings nur bei einigen wenigen mp3-Dateien aufgefallen sein dürften. Daher war das nicht so furchtbar dringend.

Außerdem gibt es jetzt eine Portierung der alten Version nach Lazarus, die mir freundlicherweise zugeschickt wurde. Die ist nicht von mir getestet, sieht aber auf den ersten Blick ganz gut aus. Die Bugfixes sind da noch nicht eingepflegt, das muss man ggf. selber nachholen.

Wer schon mit Bewertungen und Abspielzählern gearbeitet hat, muss seinen Code evtl. leicht modifizieren. Da gab es eine kleine Änderung.

_________________
We are, we were and will not be.
Gausi Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 8535
Erhaltene Danke: 473

Windows 7, Windows 10
D7 PE, Delphi XE3 Prof, Delphi 10.3 CE
BeitragVerfasst: Sa 03.12.11 19:22 
Hier habe ich einen doofen Bug gefunden und gefixed, der mit der neuen Bewertungsmethode zusammenhängt.

Damit ist dann auch der Fehler in Nemp behoben, dass die automatische Bewertung neue Dateien erstmal mit "voll der Schrott" bewertet hat, anstelle von "joah, ganz nett".

Download hier: Mp3FileUtils, Version 0.6a.

_________________
We are, we were and will not be.