|
1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include <f32file.h> |
|
17 #include "ExifTagHelper.h" |
|
18 |
|
19 #include "exifdecoder.h" |
|
20 #include "ImageUtils.h" |
|
21 #include "ExifTagDescriptions.h" |
|
22 |
|
23 |
|
24 // Setters (not supported - this is a decoder) |
|
25 TInt CExifDecoder::SetParam8(TUint /*aTag*/, TUint /*aIfd*/, HBufC8* /*aParam*/) |
|
26 { |
|
27 return KErrNotSupported; |
|
28 } |
|
29 |
|
30 TInt CExifDecoder::SetParam16(TUint /*aTag*/, TUint /*aIfd*/, HBufC16* /*aParam*/) |
|
31 { |
|
32 return KErrNotSupported; |
|
33 } |
|
34 |
|
35 TInt CExifDecoder::SetIntegerParam(TUint /*aTag*/, TUint /*aIfd*/, TInt /*aParam*/) |
|
36 { |
|
37 return KErrNotSupported; |
|
38 } |
|
39 |
|
40 TInt CExifDecoder::SetShortParam(TUint /*aTag*/, TUint /*aIfd*/, TUint16 /*aParam*/) |
|
41 { |
|
42 return KErrNotSupported; |
|
43 } |
|
44 |
|
45 TInt CExifDecoder::SetRationalParam(TUint /*aTag*/, TUint /*aIfd*/, TInt /*aNumerator*/, TInt /*aDenominator*/) |
|
46 { |
|
47 return KErrNotSupported; |
|
48 } |
|
49 |
|
50 TInt CExifDecoder::SetIntegerArrayParam(TUint /*aTag*/, TUint /*aIfd*/, CArrayFix<TInt>& /*aParam*/) |
|
51 { |
|
52 return KErrNotSupported; |
|
53 } |
|
54 |
|
55 TInt CExifDecoder::SetShortArrayParam(TUint /*aTag*/, TUint /*aIfd*/, CArrayFix<TUint16>& /*aParam*/) |
|
56 { |
|
57 return KErrNotSupported; |
|
58 } |
|
59 |
|
60 TInt CExifDecoder::SetRationalArrayParam(TUint /*aTag*/, TUint /*aIfd*/, CArrayFix<TRational>& /*aParam*/) |
|
61 { |
|
62 return KErrNotSupported; |
|
63 } |
|
64 |
|
65 /*static*/ |
|
66 CExifDecoder* CExifDecoder::NewL(TUint aApp1Size, const TUint8* aData) |
|
67 { |
|
68 CExifDecoder* self = new (ELeave) CExifDecoder(); |
|
69 CleanupStack::PushL(self); |
|
70 self->ConstructL(aData, aApp1Size); |
|
71 CleanupStack::Pop(self); |
|
72 return self; |
|
73 } |
|
74 |
|
75 CExifDecoder::CExifDecoder() |
|
76 { |
|
77 } |
|
78 |
|
79 void CExifDecoder::ConstructL(const TUint8* aData, TUint aApp1Size) |
|
80 { |
|
81 // use const_cast since the shared implementation beneath is also used |
|
82 // for the encoder and transform, and hence cannot be const |
|
83 TUint8* dataPtr = const_cast<TUint8*>(aData); |
|
84 InitializeIfdsL(dataPtr, aApp1Size); |
|
85 } |
|
86 |
|
87 CExifDecoder::~CExifDecoder() |
|
88 { |
|
89 } |
|
90 |
|
91 void CExifDecoder::SetIfd1L() |
|
92 { |
|
93 TUint offsetToFirstIfd = 0; |
|
94 |
|
95 CIfdGeneral* ifd0 = GetIfd(EZeroth); |
|
96 ASSERT(ifd0); |
|
97 |
|
98 if (ifd0->GetOffsetToFirstIfd(offsetToFirstIfd) == KErrNone) |
|
99 { |
|
100 if ((offsetToFirstIfd != 0) && (CheckExifOffset(offsetToFirstIfd) == KErrNone)) |
|
101 { |
|
102 CIfd1* ifd1 = CIfd1::NewLC(offsetToFirstIfd, iBase, iIntel, iExifDataLength); |
|
103 iIfds.AppendL(ifd1); |
|
104 CleanupStack::Pop(ifd1); |
|
105 |
|
106 SetThumbnailDataBaseL(ifd1, EFalse); |
|
107 } |
|
108 } |
|
109 } |
|
110 |