mediafile: Media File Metadata Utilities
(require (planet neil/mediafile:1:0)) |
1 Introduction
2 Types
(listof (cons/c any/c (listof (cons/c symbol? any/c))))
struct
(struct mediafile (path type identity size mtime props) #:extra-constructor-name make-mediafile #:transparent) path : path? type : mediafile-type? identity : any/c size : any/c mtime : any/c props : mediafile-props?
3 Content Types
This package currently supports a few different MIME content-types, listed in the following subsections, along with lists of references that were used in the implementation for each content-type.
3.1 TIFF (image/tiff)
Adobe Developers Association, TIFF Revision 6.0, 1992-06-03
3.2 JPEG/Exif (image/jpeg)
ITU CCITT T.81, Terminal Equipment and Protocols for Telematic Services - Information Technology - Digital Compression and Coding of Continuous-Tone Still Images - Requirements and Guidelines, 1992-09
CIPA DC-008-Translation-2010: Exchangeable image file format for digital still cameras: Exif Version 2.3, 2010-04-26
Davis Burren, EXIF MakerNote of Canon, Revision 1.15, 2001-06-03
Evan Hunter, Canon Makernote information, viewed 2012-11-17
Canon MakerNote Tags defined in Exiv2, viewed 2012-11-17
GVsoft Exif MakerNote information, viewed 2012-11-23
3.3 Ogg Vorbis (audio/ogg)
Vorbis I specification, 2012-02-03
Ogg Vorbis I format specification: comment field and header specification
4 Files and Scanning
procedure
(scan-mediafiles start-path-or-paths [ #:canonicalize-paths? canonicalize-paths? #:type-mandatory? type-mandatory? #:props-mandatory? props-mandatory? #:old-hash old-hash #:remove-other-paths? remove-other-paths?]) → immutable-hash? start-path-or-paths : (or/c path-string? (list-of path-string?)) canonicalize-paths? : boolean? = #true type-mandatory? : boolean? = #false props-mandatory? : boolean? = #false old-hash : immutable-hash? = #f remove-other-paths? : boolean? = #true
5 Test Files
This package contains some files that are used for test data. Contributions of particular kinds of additional files are welcome.
5.1 Current Test Files
- "test-files/"
"exif-org/" – JPEG/Exif and other files, from http://exif.org/samples.html, courtesy of John Hawkins.
- "public-domain/" – Files known to be in the legal public domain, for testing with a breadth of file creators (e.g., different camera models) and situations (e.g., different Ogg container layouts).
"jpeg/" – JPEG/Exif and JPEG/JFIF files from public domain, especially verbatim as saved by particular camera models.
5.2 Contributing Test Files
Set camera to capture the image in a relatively small file size. This means setting camera to low resolution, high compression, low quality, etc. (The small size is to make including files with the package more practical.)
- Choose a photographic subject (e.g., stop sign, cloud, thumbtack, light switch) that:
Does not contain any trademarks or copyrighted material (no brand names, logos, book pages, etc.).
Does not contain anything personally-identifiable, such as faces.
Is G-rated. (No showing off Racket programmer abs.)
Is not too complicated, so should compress well.
Take photo with camera.
Do not edit the photo in any way at all – it must be byte-for-byte identical to how the camera first wrote it to your memory card.
Email the photo to: neil@neilvandyke.org
In the text of the email, please state “This image is in the public domain.” Note that you are legally giving up all copyright to this image, to make including it in a regression test suite more practical.
6 Known Issues
Assemble a suite of test input files, without legal encumbrances. Preferrably small enough file sizes to include in PLaneT package, as part of built-in unit tests.
Needs more real-world testing with diversity of files.
Malformed or insufficiently supported TIFF and Exif files can result in infinite loops or use excessive resources.
Support for additional Exif MakerNotes, especially Nikon ones.
A little bit more support for Canon Exif MakerNotes is possible, such as decoding Custom Functions.
Add support for getting info about multiple streams in Ogg files.
Support additional file types, especially JPEG/JFIF, PNG, and the multiple MP3 ID3 variants.
Add feature to map properties of different formats to common ontology.
Make a variation on scan-mediafiles with a fold interface, such as for various ways of getting incremental results, including if the scanning is in concurrent thread or process.
7 History
- PLaneT 1:0 —
2012-11-27 Initial version, for alpha testing and soliciting additional test files. Some subsequent releases are likely to have backward-incompatible changes, such as changes to types of properties.
8 Legal
Copyright 2012 Neil Van Dyke. This program is Free Software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. See http://www.gnu.org/licenses/ for details. For other licenses and consulting, please contact the author. Test files from exif.org (used with permission) and/or that are in the public domain might also be included with this software, and no copyright on them is claimed on those test files by the author of this software.