Added the possibility to define a filter in the NativePreview mechanism, e.g. for hex decoding
This commit is contained in:
parent
36923ec921
commit
da6051a3a0
@ -697,6 +697,7 @@ namespace {
|
||||
nativePreview.size_ = sizeWmf;
|
||||
nativePreview.width_ = 0;
|
||||
nativePreview.height_ = 0;
|
||||
nativePreview.filter_ = "";
|
||||
nativePreview.mimeType_ = "image/x-wmf";
|
||||
nativePreviews.push_back(nativePreview);
|
||||
}
|
||||
@ -706,6 +707,7 @@ namespace {
|
||||
nativePreview.size_ = sizeTiff;
|
||||
nativePreview.width_ = 0;
|
||||
nativePreview.height_ = 0;
|
||||
nativePreview.filter_ = "";
|
||||
nativePreview.mimeType_ = "image/tiff";
|
||||
nativePreviews.push_back(nativePreview);
|
||||
}
|
||||
|
||||
@ -64,6 +64,7 @@ namespace Exiv2 {
|
||||
uint32_t size_;
|
||||
uint32_t width_;
|
||||
uint32_t height_;
|
||||
std::string filter_;
|
||||
std::string mimeType_;
|
||||
};
|
||||
|
||||
|
||||
@ -403,10 +403,14 @@ namespace {
|
||||
{
|
||||
if (!(0 <= parIdx && static_cast<size_t>(parIdx) < image.nativePreviews().size())) return;
|
||||
nativePreview_ = image.nativePreviews()[parIdx];
|
||||
size_ = nativePreview_.size_;
|
||||
width_ = nativePreview_.width_;
|
||||
height_ = nativePreview_.height_;
|
||||
valid_ = true;
|
||||
if (nativePreview_.size_ == 0) {
|
||||
size_ = getData().size_;
|
||||
} else {
|
||||
size_ = nativePreview_.size_;
|
||||
}
|
||||
}
|
||||
|
||||
Loader::AutoPtr createLoaderNative(PreviewId id, const Image &image, int parIdx)
|
||||
@ -452,7 +456,11 @@ namespace {
|
||||
#endif
|
||||
return DataBuf();
|
||||
}
|
||||
return DataBuf(data + nativePreview_.position_, nativePreview_.size_);
|
||||
if (nativePreview_.filter_ == "") {
|
||||
return DataBuf(data + nativePreview_.position_, nativePreview_.size_);
|
||||
} else {
|
||||
throw Error(1, "Invalid native preview filter: " + nativePreview_.filter_);
|
||||
}
|
||||
}
|
||||
|
||||
bool LoaderNative::readDimensions()
|
||||
|
||||
@ -334,6 +334,7 @@ namespace Exiv2 {
|
||||
if (io_->error() || io_->eof()) throw Error(14);
|
||||
|
||||
if (format == 1) {
|
||||
nativePreview.filter_ = "";
|
||||
nativePreview.mimeType_ = "image/jpeg";
|
||||
nativePreviews_.push_back(nativePreview);
|
||||
} else {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user