I plan to read image files once and store them in a buffer in order to have access to different parts of the file. I also would like to read the metadata from this buffer so that I can reduce the file accesses to the hard disk.
Is it possible to read the metadata from files stored in a buffer with the PMT? I could not find any support on this topic. If there is no way to read from a buffer, do you have an idea or solution for my problem?
Thank you for your help.
Kind regards
Stefan Moser
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
What you probably really want to do is use PMT's metadata objects themselves.
All PmtMetadata objects reside in memory.
When the interface methods on a PmtMetadata object are called, no file I/O happens. File I/O occurs with the PmtAccessor interface.
The only time the file is hit when an open() or close() is called on a PmtAccessor object. (A close() happens automatically when a PmtAccessor goes out of scope.)
If you want to work with multiple files simultaneously, then you can use multiple PmtAccessor objects.
Dan
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you for your answers I already planned to use the PMT's metadata objects themselves. What I am really interested in is to use PmtAccessor on an istream instead, something like:
PmtAccessor::getAccessor(istream);
The reason is that I already have the file in an istream and I would like to access the metadata. I guess that this mechanism is not supported but are there any plans to support this. I think the opentiff and openexif projects support to read from a buffer but I am not sure.
Thank you very much and I like the PMT.
Kind regards
Stefan Moser
P.S: Does the PMT support the new proposed tags in EXIF 2.2 proposal?
Hi everybody,
I plan to read image files once and store them in a buffer in order to have access to different parts of the file. I also would like to read the metadata from this buffer so that I can reduce the file accesses to the hard disk.
Is it possible to read the metadata from files stored in a buffer with the PMT? I could not find any support on this topic. If there is no way to read from a buffer, do you have an idea or solution for my problem?
Thank you for your help.
Kind regards
Stefan Moser
Stefan,
The PMT does overload the ostream and istream '<<' and '>>' operators to persist metadata in XML format.
If you make a readMetadata() call like this to get metadata into a 'root' metadata object:
PmtLogicalDefinitionInterpreter interp;
interp.load();
PmtMetadataPtr root;
PmtAccessorPtr acc = PmtAccessor::getAccessor("test.jpg");
root = acc->readMetadata();
then you can work with an in-memory copy of the metadata in XML form with classes in the iostream library such as basic_stringstream like this:
basic_stringstream<char> myss;
myss << root;
You'll need to refer to the iostream classes more to see which one might work out the best for you.
Dan
Stefan,
What you probably really want to do is use PMT's metadata objects themselves.
All PmtMetadata objects reside in memory.
When the interface methods on a PmtMetadata object are called, no file I/O happens. File I/O occurs with the PmtAccessor interface.
The only time the file is hit when an open() or close() is called on a PmtAccessor object. (A close() happens automatically when a PmtAccessor goes out of scope.)
If you want to work with multiple files simultaneously, then you can use multiple PmtAccessor objects.
Dan
Hi Dan,
Thank you for your answers I already planned to use the PMT's metadata objects themselves. What I am really interested in is to use PmtAccessor on an istream instead, something like:
PmtAccessor::getAccessor(istream);
The reason is that I already have the file in an istream and I would like to access the metadata. I guess that this mechanism is not supported but are there any plans to support this. I think the opentiff and openexif projects support to read from a buffer but I am not sure.
Thank you very much and I like the PMT.
Kind regards
Stefan Moser
P.S: Does the PMT support the new proposed tags in EXIF 2.2 proposal?
White Paper: http://tsc.jeita.or.jp/avs/data/cp3451.pdf
Stefan,
There are no current plans to support the accessors like:
PmtAccessor::getAccessor(istream);
There are plans to support Exif 2.2.
Dan