Rockbox mail archive
Subject: Viewing Files With Plugins UPDATED
From: Daniel Stenberg (daniel_at_haxx.se)
Ok, here's my revised version and based on the posted comments, I really think
we can implement it like this and then proceed with improvements after the
Viewing a File
When a file is PLAYed, the following will be made in order to figure out
what to do with the particular file:
1. Internally recognized extensions (.mp3, .m3u etc) (like today)
2. Extension config file ".rockbox/view.config". A config file lists
extensions and what plugin (file name) that should be ran to view that
particular file. This file is _not_ scanned at boot, but will be read
and cached at first use. We could possibly have an option to parse it
automaticly at boot.
3. Check if ".rockbox/viewer/[extension]-[anything].rock" exists, and if it
does: use that. These plugins _are not_ scanned at boot nor after USB
4. If none of the above worked, the file type is unsupported.
No Rebuild Needed
This enables users to add, remove or replace viewers at will with no
rebuilds at all necessary, and without Rockbox even being aware of what
plugins that exist or not. Plugins can finally become true 3rd party
The "on play" screen can then get a "view with..." option that offers the
user to view the currently selected file using one of the viewers present in
the ".rockbox/viewer" directory. This would enable for example .m3u files to
get viewed by the text viewer, or sending an mp3 file to a hex-editor etc.
The concept of "view supported" files changes somewhat. Internally supported
formats are of course present, but extensions in the "view.config" are
only supported once the file has been read and and so are extensions that
have been "verified to work". That means we've played one successfully and
thus there was a plugin for it in the proper dir.
The 'view.config' file will have a field for this, see below for the file
format. (The icon can also be provided as a separate file next to the
plugin, as in "[extension]-[anything].icon", but this will then make it
suffer from the same drawbaks as the "view supported" have. The icon
file should then use the same syntax as the icon field of the view.config
view.config File Format:
Each line conists of extension, file name and icon data.
extension TAB] plugin file name TAB 12 icon digits 00 12 34 56 67 89
# this is a comment line
txt txt-viewer.rock 55 55 55 55 55 55
rvf rvf-video.rock 5d 7f 5d 7f 5d 7f
We would add a separate config file in the build system that makes viewer
plugins get a suitable name for the viewer-directory when built. So that
viewer.c becomes txt-viewer.rock and chip8.c becomes ch8-chip8.rock etc. If
the plugin is not mentioned in this file, it would be named like today.
(I already have work done on this that seems to mostly work.)
Daniel Stenberg -- http://rockbox.haxx.se/ -- http://daniel.haxx.se/
Page was last modified "Jan 10 2012" The Rockbox Crew