38b02a26a9
(http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg23098.html) Background: when you access a file over HTTP, you cannot rely on a file extension being present; instead the file's mime-type is conveyed in the HTTP Content-Type response header. This facility adds a mime-type-to-extension map to the registry to handle this. There are two new osgDB::Registry functions which are pretty self-explanatory: void addMimeTypeExtensionMapping( mime-type, extension ) ReaderWriter* getReaderWriterForMimeType( mime-type ) I also added the file osgDB/MimeTypes.cpp which houses a hard-coded list of built-in types. I took the list from here (http://www.webmaster-toolkit.com/mime-types.shtml) and then pared it down to include mostly image and video types, editing them to map to existing plugins where possible. In addition, I updated the CURL plugin to a) install a set of built-in mime-type mappings, and b) use them to look up an extension in the event that the target filename does not have an extension. Here is a test case. This URL pulls down a JPEG (without a file extension): osgviewer --image "http://us.maps3.yimg.com/aerial.maps.yimg.com/ximg?v=1.8&s=256&t=a&r=1&x=0&y=0&z=2" " |
||
---|---|---|
.. | ||
Archive | ||
AuthenticationMap | ||
ConvertUTF | ||
DatabasePager | ||
DotOsgWrapper | ||
DynamicLibrary | ||
Export | ||
Field | ||
FieldReader | ||
FieldReaderIterator | ||
FileCache | ||
FileNameUtils | ||
FileUtils | ||
fstream | ||
ImageOptions | ||
ImagePager | ||
Input | ||
Output | ||
ParameterOutput | ||
PluginQuery | ||
ReaderWriter | ||
ReadFile | ||
Registry | ||
Serializer | ||
SharedStateManager | ||
Version | ||
WriteFile |