Try going to System Preferences +CDs & DVDs+ pane. Try changing one of the settings, such as +When you insert a music CD+ to
Ignore. Try inserting a music CD to see if it is accepted and mounted (not eventually ejected). If that works, set it back to whatever it was before and try other types of CDs to see if they are now also accepted.
If that does not help, as a test, create a new admin user account in System Preferences
Accounts pane.
http://docs.info.apple.com/article.html?path=Mac/10.5/en/8235.html
Log out and log in to the new account. See if you have the same issue in the new account, or if things work as they should.
If it works fine in the new account, you have narrowed down the cause to something in your normal user account. The hardware and overall system are OK.
If the problem recurs on the new account, the problem is more likely to be caused by some issue with the overall system, or possibly hardware.