GNOME Bugzilla – Bug 773172
typefinding: mis-detects iTunes artwork cache ( .itc ) file as audio/mpeg
Last modified: 2016-11-21 19:01:42 UTC
dev@unstable:~/Music/iTunes/Album Artwork/Cache$ find . -type f | xargs gst-typefind-1.0 2>&1 | grep audio ./900E2E35296E478E/00/09/09/900E2E35296E478E-FA98AEF9DE671990.itc - audio/mpeg, mpegversion=(int)1, layer=(int)3, parsed=(boolean)false ./900E2E35296E478E/00/12/15/900E2E35296E478E-8A75DB96D95AFFC0.itc - audio/mpeg, mpegversion=(int)1, layer=(int)3, parsed=(boolean)false ./900E2E35296E478E/01/06/02/900E2E35296E478E-9D15631A66A4F261.itc - audio/mpeg, mpegversion=(int)1, layer=(int)2, parsed=(boolean)false ./900E2E35296E478E/01/11/04/900E2E35296E478E-F47BDEC2F52CE4B1.itc - audio/mpeg, framed=(boolean)false, mpegversion=(int)4, stream-format=(string)adts, level=(string)2, base-profile=(string)ltp, profile=(string)ltp, channels=(int)8, rate=(int)8000 ./900E2E35296E478E/04/09/09/900E2E35296E478E-B9A0A86977666994.itc - audio/mpeg, mpegversion=(int)1, layer=(int)1, parsed=(boolean)false ./900E2E35296E478E/06/12/10/900E2E35296E478E-72CF0EEA7F262AC6.itc - audio/mpeg, mpegversion=(int)1, layer=(int)2, parsed=(boolean)false ./900E2E35296E478E/07/08/08/900E2E35296E478E-CD92D349348A5887.itc - audio/mpeg, mpegversion=(int)1, layer=(int)2, parsed=(boolean)false Here, iTunes is a symlink to iTunes dir in OSX partition.
Created attachment 337955 [details] Screenshot with rhythmbox importing and playing ( random noise ) itc files.
Thanks for the bug report. Could you please attach a few such files? Thanks!
Created attachment 337958 [details] Attached the first 6 files ( tar.gz ) mentioned in the bug description
Created attachment 340088 [details] [review] typefind: add typefinder for Apple/iTunes itc artwork files Avoids mpeg/audio false-positive described at:
Created attachment 340089 [details] [review] add typefinder for Apple/iTunes itc artwork files
Comment on attachment 340089 [details] [review] add typefinder for Apple/iTunes itc artwork files Thanks for working on this. >+/*** application/itc ***/ >+static GstStaticCaps itc_caps = GST_STATIC_CAPS ("application/itc"); >+#define ITC_CAPS (gst_static_caps_get(&itc_caps)) OOC, is this a media type that is used elsewhere, or made-up? >+ /* take 1x magic at start as a good hint */ >+ if (!memcmp (c.data, magic, 8)) { >+ itc_prob = GST_TYPE_FIND_MAXIMUM - 3; >+ data_scan_ctx_advance (tf, &c, 8); >+ } else >+ goto done; I think it'd be nicer to read if it was reflowed as if (memcmp () != 0) return; ... What is the meaning of these 'preamble' bytes? Do they always exist once, twice, three times? (and in a row?) My gut feeling is that the probability advertised here is a bit too high for the kind of data checked.
(In reply to Tim-Philipp Müller from comment #6) > Comment on attachment 340089 [details] [review] [review] > add typefinder for Apple/iTunes itc artwork files > > Thanks for working on this. > > >+/*** application/itc ***/ > >+static GstStaticCaps itc_caps = GST_STATIC_CAPS ("application/itc"); > >+#define ITC_CAPS (gst_static_caps_get(&itc_caps)) > > OOC, is this a media type that is used elsewhere, or made-up? Made up > [...] > What is the meaning of these 'preamble' bytes? Do they always exist once, > twice, three times? (and in a row?) Happens 3 times in a row after the magic on all samples. > > My gut feeling is that the probability advertised here is a bit too high for > the kind of data checked. It can be extended a bit to incorporate more checks. Will post an updated patch latter. Thanks for taking a look.
Created attachment 340275 [details] [review] add typefinder for Apple/iTunes itc artwork files Added two more tests and went with more modest scores this time around
Comment on attachment 340275 [details] [review] add typefinder for Apple/iTunes itc artwork files Looks good to me
Review of attachment 340275 [details] [review]: Thanks for taking a look Sebastian. Pushed as 7e14875458c6f2d.. typefind: add typefinder for Apple/iTunes itc artwork files