Now puts the EXIF data verbatim into the message passed to Translate().
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20626 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -109,7 +109,8 @@ DCRaw::DCRaw(BPositionIO& stream)
|
||||
fOutputBitsPerSample(8),
|
||||
fDecodeLeaf(0),
|
||||
fDecodeBitsZeroAfterMax(false),
|
||||
fFilters(~0)
|
||||
fFilters(~0),
|
||||
fEXIFOffset(-1)
|
||||
{
|
||||
fImages = new image_data_info[kImageBufferCount];
|
||||
fDecodeBuffer = new decode[kDecodeBufferCount];
|
||||
@@ -2792,6 +2793,10 @@ DCRaw::_ParseTIFFImageFileDirectory(off_t baseOffset, uint32 offset)
|
||||
|
||||
case 34665: // EXIF tag
|
||||
fRead.Seek(fRead.Next<uint32>() + baseOffset, SEEK_SET);
|
||||
|
||||
fEXIFOffset = fRead.Position();
|
||||
fEXIFLength = tag.length;
|
||||
|
||||
_ParseEXIF(baseOffset);
|
||||
break;
|
||||
|
||||
@@ -3353,3 +3358,15 @@ DCRaw::ImageAt(uint32 index, image_data_info& info) const
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
status_t
|
||||
DCRaw::GetEXIFTag(off_t& offset, size_t& length) const
|
||||
{
|
||||
if (fEXIFOffset < 0)
|
||||
return B_ENTRY_NOT_FOUND;
|
||||
|
||||
offset = fEXIFOffset;
|
||||
length = fEXIFLength;
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ class DCRaw {
|
||||
uint32 CountImages() const;
|
||||
status_t ImageAt(uint32 index, image_data_info& info) const;
|
||||
|
||||
status_t GetEXIFTag(off_t& offset, size_t& length) const;
|
||||
|
||||
private:
|
||||
int32 _AllocateImage();
|
||||
image_data_info& _Raw();
|
||||
@@ -178,6 +180,8 @@ class DCRaw {
|
||||
|
||||
uint32 fFilters;
|
||||
uint32 fEXIFFilters;
|
||||
off_t fEXIFOffset;
|
||||
uint32 fEXIFLength;
|
||||
|
||||
off_t fCurveOffset;
|
||||
};
|
||||
|
||||
@@ -189,6 +189,19 @@ RAWTranslator::DerivedTranslate(BPositionIO* source,
|
||||
return roster->Translate(&io, NULL, settings, target, outType);
|
||||
}
|
||||
|
||||
// retrieve EXIF data
|
||||
off_t exifOffset;
|
||||
size_t exifLength;
|
||||
if (settings != NULL && raw.GetEXIFTag(exifOffset, exifLength) == B_OK) {
|
||||
void* exifBuffer = malloc(exifLength);
|
||||
if (exifBuffer != NULL) {
|
||||
if (source->ReadAt(exifOffset, exifBuffer, exifLength)
|
||||
== (ssize_t)exifLength)
|
||||
settings->AddData("exif", B_RAW_TYPE, exifBuffer, exifLength);
|
||||
|
||||
free(exifBuffer);
|
||||
}
|
||||
}
|
||||
uint32 dataSize = data.output_width * 4 * data.output_height;
|
||||
|
||||
TranslatorBitmap header;
|
||||
|
||||
Reference in New Issue
Block a user