Re: [coreAudio] Detecting corrupted files
Re: [coreAudio] Detecting corrupted files
- Subject: Re: [coreAudio] Detecting corrupted files
- From: Brian Whitman <email@hidden>
- Date: Wed, 8 Mar 2006 15:55:38 -0500
QT will convert to LPCM, yes. Look for the ConvertMovieSndTrack example,
http://developer.apple.com/samplecode/ConvertMovieSndTrack/
ConvertMovieSndTrack.html
However, back to John's solution, you can assume the fork won't crash
right away-- on my 2.5GB machine it takes a minute or so. So if you
just read the first sample for example, you can assume it better come
back within a second or so. But this is such a gross set of
assumptions with concordant problems: reading off a CD, network
drive; maybe the machine has tiny memory to begin with... a real
solution either involves 1) detecting if the file is corrupted
outside of CoreAudio, 2) using another reading library (QT,
libavcodec, libmad etc) or 3) waiting for the fix.
Around 1), I found this: http://jo.ath.cx/soft/mp3check/
mp3check.html , it's a GPL mp3 integrity check. I ran it on one of my
known bad files:
# curl -O http://variogr.am/clarity.mp3
# ./mp3check-0.7.3-macosx -eBS clarity.mp3
And it returned a host of "invalid header", "CRC error," etc. Good
files did not return any such errors. So that's a start!
On Mar 8, 2006, at 3:45 PM, Alexander v. Below wrote:
Am 08.03.2006 um 21:30 schrieb Brian Whitman:
One option is for your main process fork off a UNIX helper process
that tries to read the MP3 file. The main and helper processes use
a shared variable to signal how the fileread is coming along.
That, I think, is the only possible workaround right now, although
it's worse because it's not just that it spins in a loop, it eats
up all available RAM while it does it and eventually crashes
trying to alloc more. The files that it breaks on are corrupted,
the frames are all mangled. There's probably a way to go into the
bytes of the mp3 and do some 'correctness' check on them before
calling the read function.
We are probably going back to QT for the moment just for reading.
I will say I've only found a handful of these problem files among
our testbed of ca. 100K files.
Pardon my language, but "F%ยง#". Forking a process sounded like a
somewhat awkward, but workable solution. But if even that may case
a crash... Oh joy
I am trying to convert the files to linear PCM. Could QuickTime
help me there? Or could I call a QuickTime function to give me an
indication if the file is damaged or not?
Thanks
Alex
--
Brian Whitman. http://variogr.am/
The Echo Nest Corporation
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden