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),
|
fOutputBitsPerSample(8),
|
||||||
fDecodeLeaf(0),
|
fDecodeLeaf(0),
|
||||||
fDecodeBitsZeroAfterMax(false),
|
fDecodeBitsZeroAfterMax(false),
|
||||||
fFilters(~0)
|
fFilters(~0),
|
||||||
|
fEXIFOffset(-1)
|
||||||
{
|
{
|
||||||
fImages = new image_data_info[kImageBufferCount];
|
fImages = new image_data_info[kImageBufferCount];
|
||||||
fDecodeBuffer = new decode[kDecodeBufferCount];
|
fDecodeBuffer = new decode[kDecodeBufferCount];
|
||||||
@@ -2792,6 +2793,10 @@ DCRaw::_ParseTIFFImageFileDirectory(off_t baseOffset, uint32 offset)
|
|||||||
|
|
||||||
case 34665: // EXIF tag
|
case 34665: // EXIF tag
|
||||||
fRead.Seek(fRead.Next<uint32>() + baseOffset, SEEK_SET);
|
fRead.Seek(fRead.Next<uint32>() + baseOffset, SEEK_SET);
|
||||||
|
|
||||||
|
fEXIFOffset = fRead.Position();
|
||||||
|
fEXIFLength = tag.length;
|
||||||
|
|
||||||
_ParseEXIF(baseOffset);
|
_ParseEXIF(baseOffset);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -3353,3 +3358,15 @@ DCRaw::ImageAt(uint32 index, image_data_info& info) const
|
|||||||
return B_OK;
|
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;
|
uint32 CountImages() const;
|
||||||
status_t ImageAt(uint32 index, image_data_info& info) const;
|
status_t ImageAt(uint32 index, image_data_info& info) const;
|
||||||
|
|
||||||
|
status_t GetEXIFTag(off_t& offset, size_t& length) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int32 _AllocateImage();
|
int32 _AllocateImage();
|
||||||
image_data_info& _Raw();
|
image_data_info& _Raw();
|
||||||
@@ -178,6 +180,8 @@ class DCRaw {
|
|||||||
|
|
||||||
uint32 fFilters;
|
uint32 fFilters;
|
||||||
uint32 fEXIFFilters;
|
uint32 fEXIFFilters;
|
||||||
|
off_t fEXIFOffset;
|
||||||
|
uint32 fEXIFLength;
|
||||||
|
|
||||||
off_t fCurveOffset;
|
off_t fCurveOffset;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -189,6 +189,19 @@ RAWTranslator::DerivedTranslate(BPositionIO* source,
|
|||||||
return roster->Translate(&io, NULL, settings, target, outType);
|
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;
|
uint32 dataSize = data.output_width * 4 * data.output_height;
|
||||||
|
|
||||||
TranslatorBitmap header;
|
TranslatorBitmap header;
|
||||||
|
|||||||
Reference in New Issue
Block a user