~ubuntu-branches/debian/sid/libopenraw/sid

« back to all changes in this revision

Viewing changes to .pc/02-fix_support_for_ORF_and_PEF.patch/lib/peffile.cpp

  • Committer: Bazaar Package Importer
  • Author(s): David Paleino
  • Date: 2010-08-18 11:36:32 UTC
  • Revision ID: james.westby@ubuntu.com-20100818113632-l0xc1bc2ydcuds0i
Tags: 0.0.8-2
* debian/control:
  - updated my email address
  - DMUA removed
  - Sarah J. Fortune added as co-maintainer (Closes: #530244)
  - Build-Depends change: libjpeg62-dev → libjpeg-dev
  - Standards-Version bumped to 3.9.1
    + debian/libopenraw-dev.install, debian/libopenrawgnome-dev.install:
      don't install *.la files anymore (§10.2)
  - remove Build-Depends on quilt
  - Build-Depend on debhelper >= 7.0.50~
* debian/copyright: updated copyright years for debian/*
* debian/patches/02-fix_support_for_ORF_and_PEF.patch added,
  cherry-picked from upstream's git (see comment) (Closes: #569788)
* debian/source/format: using 3.0 (quilt)
* debian/rules:
  - removed quilt machinery
  - use full dh7 power :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * libopenraw - peffile.cpp
 
3
 *
 
4
 * Copyright (C) 2006-2008 Hubert Figuiere
 
5
 *
 
6
 * This library is free software: you can redistribute it and/or
 
7
 * modify it under the terms of the GNU Lesser General Public License
 
8
 * as published by the Free Software Foundation, either version 3 of
 
9
 * the License, or (at your option) any later version.
 
10
 *
 
11
 * This library is distributed in the hope that it will be useful,
 
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
14
 * Lesser General Public License for more details.
 
15
 *
 
16
 * You should have received a copy of the GNU Lesser General Public
 
17
 * License along with this library.  If not, see
 
18
 * <http://www.gnu.org/licenses/>.
 
19
 */
 
20
 
 
21
 
 
22
#include <iostream>
 
23
#include <libopenraw++/thumbnail.h>
 
24
#include <libopenraw++/rawdata.h>
 
25
 
 
26
#include "debug.h"
 
27
#include "ifd.h"
 
28
#include "ifdfilecontainer.h"
 
29
#include "ifddir.h"
 
30
#include "ifdentry.h"
 
31
#include "io/file.h"
 
32
#include "peffile.h"
 
33
 
 
34
using namespace Debug;
 
35
 
 
36
namespace OpenRaw {
 
37
 
 
38
 
 
39
        namespace Internals {
 
40
                const struct IFDFile::camera_ids_t PEFFile::s_def[] = {
 
41
                        { "PENTAX *ist D      ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
42
                                                                                                                 OR_TYPEID_PENTAX_IST_D) },
 
43
                        { "PENTAX *ist DL     ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
44
                                                                                                                 OR_TYPEID_PENTAX_IST_DL) },
 
45
                        { "PENTAX K10D        ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
46
                                                                                                                 OR_TYPEID_PENTAX_K10D_PEF) },
 
47
                        { "PENTAX K100D       ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
48
                                                                                                                 OR_TYPEID_PENTAX_K100D_PEF) },
 
49
                        { "PENTAX K100D Super ", OR_MAKE_FILE_TYPEID(OR_TYPEID_VENDOR_PENTAX, 
 
50
                                                                                                                 OR_TYPEID_PENTAX_K100D_PEF) },
 
51
                        { 0, 0 }
 
52
                };
 
53
 
 
54
 
 
55
                RawFile *PEFFile::factory(IO::Stream *s)
 
56
                {
 
57
                        return new PEFFile(s);
 
58
                }
 
59
 
 
60
                PEFFile::PEFFile(IO::Stream *s)
 
61
                        : IFDFile(s, OR_RAWFILE_TYPE_PEF)
 
62
                {
 
63
                        _setIdMap(s_def);
 
64
                }
 
65
 
 
66
 
 
67
                PEFFile::~PEFFile()
 
68
                {
 
69
                }
 
70
 
 
71
                IFDDir::Ref  PEFFile::_locateCfaIfd()
 
72
                {
 
73
                        // in PEF the CFA IFD is the main IFD
 
74
                        if(!m_mainIfd) {
 
75
                                m_mainIfd = _locateMainIfd();
 
76
                        }
 
77
                        return m_mainIfd;
 
78
                }
 
79
 
 
80
 
 
81
                IFDDir::Ref  PEFFile::_locateMainIfd()
 
82
                {
 
83
                        return m_container->setDirectory(0);
 
84
                }
 
85
 
 
86
                ::or_error PEFFile::_getRawData(RawData & data, uint32_t /*options*/)
 
87
                {
 
88
                        ::or_error err;
 
89
                        if(!m_cfaIfd) {
 
90
                                m_cfaIfd = _locateCfaIfd();
 
91
                        }
 
92
                        err = _getRawDataFromDir(data, m_cfaIfd);
 
93
                        if(err == OR_ERROR_NONE) {
 
94
                                uint16_t compression = 0;
 
95
                                m_cfaIfd->getValue(IFD::EXIF_TAG_COMPRESSION, compression);
 
96
                                switch(compression) {
 
97
                                case 1:
 
98
                                        data.setDataType(OR_DATA_TYPE_CFA);
 
99
                                        break;
 
100
                                case 65535:
 
101
                                        // TODO decompress
 
102
                                        break;
 
103
                                default:
 
104
                                        break;
 
105
                                }
 
106
                        }
 
107
                        return err;
 
108
                }
 
109
        }
 
110
}
 
111