Patch #1271 » ps.diff
| trunk/include/exiv2/asfvideo.hpp (revision 4698) → trunk/include/exiv2/asfvideo.hpp (working copy) | ||
|---|---|---|
| 75 | 75 |
//@{
|
| 76 | 76 |
void readMetadata(); |
| 77 | 77 |
void writeMetadata(); |
| 78 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 78 | 79 |
//@} |
| 79 | 80 | |
| 80 | 81 |
//! @name Accessors |
| trunk/include/exiv2/bmpimage.hpp (revision 4698) → trunk/include/exiv2/bmpimage.hpp (working copy) | ||
|---|---|---|
| 85 | 85 |
//! @name Manipulators |
| 86 | 86 |
//@{
|
| 87 | 87 |
void readMetadata(); |
| 88 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 88 | 89 |
/*! |
| 89 | 90 |
@brief Todo: Write metadata back to the image. This method is not |
| 90 | 91 |
yet(?) implemented. Calling it will throw an Error(31). |
| trunk/include/exiv2/crwimage.hpp (revision 4698) → trunk/include/exiv2/crwimage.hpp (working copy) | ||
|---|---|---|
| 88 | 88 |
//@{
|
| 89 | 89 |
void readMetadata(); |
| 90 | 90 |
void writeMetadata(); |
| 91 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 91 | 92 |
/*! |
| 92 | 93 |
@brief Not supported. CRW format does not contain IPTC metadata. |
| 93 | 94 |
Calling this function will throw an Error(32). |
| trunk/include/exiv2/epsimage.hpp (revision 4698) → trunk/include/exiv2/epsimage.hpp (working copy) | ||
|---|---|---|
| 84 | 84 |
//! @name Manipulators |
| 85 | 85 |
//@{
|
| 86 | 86 |
void readMetadata(); |
| 87 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 87 | 88 |
void writeMetadata(); |
| 88 | 89 |
/*! |
| 89 | 90 |
@brief Not supported. |
| trunk/include/exiv2/gifimage.hpp (revision 4698) → trunk/include/exiv2/gifimage.hpp (working copy) | ||
|---|---|---|
| 86 | 86 |
//! @name Manipulators |
| 87 | 87 |
//@{
|
| 88 | 88 |
void readMetadata(); |
| 89 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 89 | 90 |
/*! |
| 90 | 91 |
@brief Todo: Write metadata back to the image. This method is not |
| 91 | 92 |
yet(?) implemented. Calling it will throw an Error(31). |
| trunk/include/exiv2/matroskavideo.hpp (revision 4698) → trunk/include/exiv2/matroskavideo.hpp (working copy) | ||
|---|---|---|
| 84 | 84 |
//@{
|
| 85 | 85 |
void readMetadata(); |
| 86 | 86 |
void writeMetadata(); |
| 87 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 87 | 88 |
//@} |
| 88 | 89 | |
| 89 | 90 |
//! @name Accessors |
| trunk/include/exiv2/mrwimage.hpp (revision 4698) → trunk/include/exiv2/mrwimage.hpp (working copy) | ||
|---|---|---|
| 79 | 79 | |
| 80 | 80 |
//! @name Manipulators |
| 81 | 81 |
//@{
|
| 82 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 82 | 83 |
void readMetadata(); |
| 83 | 84 |
/*! |
| 84 | 85 |
@brief Todo: Write metadata back to the image. This method is not |
| trunk/include/exiv2/orfimage.hpp (revision 4698) → trunk/include/exiv2/orfimage.hpp (working copy) | ||
|---|---|---|
| 79 | 79 | |
| 80 | 80 |
//! @name Manipulators |
| 81 | 81 |
//@{
|
| 82 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 82 | 83 |
void readMetadata(); |
| 83 | 84 |
void writeMetadata(); |
| 84 | 85 |
/*! |
| trunk/include/exiv2/pgfimage.hpp (revision 4698) → trunk/include/exiv2/pgfimage.hpp (working copy) | ||
|---|---|---|
| 83 | 83 | |
| 84 | 84 |
//! @name Manipulators |
| 85 | 85 |
//@{
|
| 86 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 86 | 87 |
void readMetadata(); |
| 87 | 88 |
void writeMetadata(); |
| 88 | 89 |
//@} |
| trunk/include/exiv2/psdimage.hpp (revision 4698) → trunk/include/exiv2/psdimage.hpp (working copy) | ||
|---|---|---|
| 86 | 86 | |
| 87 | 87 |
//! @name Manipulators |
| 88 | 88 |
//@{
|
| 89 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 89 | 90 |
void readMetadata(); |
| 90 | 91 |
void writeMetadata(); |
| 91 | 92 |
/*! |
| trunk/include/exiv2/quicktimevideo.hpp (revision 4698) → trunk/include/exiv2/quicktimevideo.hpp (working copy) | ||
|---|---|---|
| 71 | 71 | |
| 72 | 72 |
//! @name Manipulators |
| 73 | 73 |
//@{
|
| 74 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 74 | 75 |
void readMetadata(); |
| 75 | 76 |
void writeMetadata(); |
| 76 | 77 |
//@} |
| trunk/include/exiv2/rafimage.hpp (revision 4698) → trunk/include/exiv2/rafimage.hpp (working copy) | ||
|---|---|---|
| 78 | 78 | |
| 79 | 79 |
//! @name Manipulators |
| 80 | 80 |
//@{
|
| 81 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 81 | 82 |
void readMetadata(); |
| 82 | 83 |
/*! |
| 83 | 84 |
@brief Todo: Write metadata back to the image. This method is not |
| trunk/include/exiv2/riffvideo.hpp (revision 4698) → trunk/include/exiv2/riffvideo.hpp (working copy) | ||
|---|---|---|
| 71 | 71 | |
| 72 | 72 |
//! @name Manipulators |
| 73 | 73 |
//@{
|
| 74 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 74 | 75 |
void readMetadata(); |
| 75 | 76 |
void writeMetadata(); |
| 76 | 77 |
//@} |
| ... | ... | |
| 185 | 186 |
RiffVideo(const RiffVideo& rhs); |
| 186 | 187 |
//! Assignment operator |
| 187 | 188 |
RiffVideo& operator=(const RiffVideo& rhs); |
| 189 |
bool equalsRiffTag(Exiv2::DataBuf& buf ,const char* str); |
|
| 188 | 190 |
//@} |
| 189 | 191 | |
| 190 | 192 |
private: |
| 193 |
const static int RIFF_TAG_SIZE; |
|
| 194 |
const static char* RIFF_CHUNK_HEADER_ICCP; |
|
| 195 |
const static char* RIFF_CHUNK_HEADER_EXIF; |
|
| 196 |
const static char* RIFF_CHUNK_HEADER_XMP; |
|
| 191 | 197 |
//! Variable to check the end of metadata traversing. |
| 192 | 198 |
bool continueTraversing_; |
| 193 | 199 |
//! Variable which stores current stream being processsed. |
| trunk/include/exiv2/rw2image.hpp (revision 4698) → trunk/include/exiv2/rw2image.hpp (working copy) | ||
|---|---|---|
| 76 | 76 | |
| 77 | 77 |
//! @name Manipulators |
| 78 | 78 |
//@{
|
| 79 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 79 | 80 |
void readMetadata(); |
| 80 | 81 |
/*! |
| 81 | 82 |
@brief Todo: Write metadata back to the image. This method is not |
| trunk/include/exiv2/tgaimage.hpp (revision 4698) → trunk/include/exiv2/tgaimage.hpp (working copy) | ||
|---|---|---|
| 86 | 86 | |
| 87 | 87 |
//! @name Manipulators |
| 88 | 88 |
//@{
|
| 89 |
void printStructure(std::ostream& out, PrintStructureOption option,int depth); |
|
| 89 | 90 |
void readMetadata(); |
| 90 | 91 |
/*! |
| 91 | 92 |
@brief Todo: Write metadata back to the image. This method is not |
| trunk/src/asfvideo.cpp (revision 4698) → trunk/src/asfvideo.cpp (working copy) | ||
|---|---|---|
| 310 | 310 |
{
|
| 311 | 311 |
} |
| 312 | 312 | |
| 313 |
void AsfVideo::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 314 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 315 |
IoCloser closer(*io_); |
|
| 316 |
// Ensure this is the correct image type |
|
| 317 |
if (!isAsfType(*io_, true)) {
|
|
| 318 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 319 |
throw Error(3, "ASF"); |
|
| 320 |
} |
|
| 321 |
} // AsfVideo::printStructure |
|
| 322 | ||
| 313 | 323 |
void AsfVideo::readMetadata() |
| 314 | 324 |
{
|
| 315 | 325 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
| trunk/src/basicio.cpp (revision 4698) → trunk/src/basicio.cpp (working copy) | ||
|---|---|---|
| 2151 | 2151 |
} |
| 2152 | 2152 |
#endif |
| 2153 | 2153 | |
| 2154 |
//! Internal Pimpl structure of class LocalNetFileIo. |
|
| 2155 |
class LocalNetFileIo::LocalNetFileImpl : public Impl {
|
|
| 2156 |
public: |
|
| 2157 |
//! Constructor |
|
| 2158 |
LocalNetFileImpl(const std::string& path, size_t blockSize); |
|
| 2159 |
#ifdef EXV_UNICODE_PATH |
|
| 2160 |
//! Constructor accepting a unicode path in an std::wstring |
|
| 2161 |
LocalNetFileImpl(const std::wstring& wpath, size_t blockSize); |
|
| 2162 |
#endif |
|
| 2163 |
Exiv2::Uri hostInfo_; //!< the host information extracted from the path |
|
| 2164 | ||
| 2165 |
// METHODS |
|
| 2166 |
/*! |
|
| 2167 |
@brief Get the length (in bytes) of the remote file. |
|
| 2168 |
@return Return -1 if the size is unknown. Otherwise it returns the length of remote file (in bytes). |
|
| 2169 |
@throw Error if the server returns the error code. |
|
| 2170 |
*/ |
|
| 2171 |
long getFileLength(); |
|
| 2172 |
/*! |
|
| 2173 |
@brief Get the data by range. |
|
| 2174 |
@param lowBlock The start block index. |
|
| 2175 |
@param highBlock The end block index. |
|
| 2176 |
@param response The data from the server. |
|
| 2177 |
@throw Error if the server returns the error code. |
|
| 2178 |
@note Set lowBlock = -1 and highBlock = -1 to get the whole file content. |
|
| 2179 |
*/ |
|
| 2180 |
void getDataByRange(long lowBlock, long highBlock, std::string& response); |
|
| 2181 |
/*! |
|
| 2182 |
@brief Submit the data to the remote machine. The data replace a part of the remote file. |
|
| 2183 |
The replaced part of remote file is indicated by from and to parameters. |
|
| 2184 |
@param data The data are submitted to the remote machine. |
|
| 2185 |
@param size The size of data. |
|
| 2186 |
@param from The start position in the remote file where the data replace. |
|
| 2187 |
@param to The end position in the remote file where the data replace. |
|
| 2188 |
@note The data are submitted to the remote machine via POST. This requires the script file |
|
| 2189 |
on the remote machine to receive the data and edit the remote file. The server-side |
|
| 2190 |
script may be specified with the environment string EXIV2_HTTP_POST. The default value is |
|
| 2191 |
"/exiv2.php". More info is available at http://dev.exiv2.org/wiki/exiv2 |
|
| 2192 |
@throw Error if it fails. |
|
| 2193 |
*/ |
|
| 2194 |
void writeRemote(const byte* data, size_t size, long from, long to); |
|
| 2195 |
protected: |
|
| 2196 |
// NOT IMPLEMENTED |
|
| 2197 |
LocalNetFileImpl(const LocalNetFileImpl& rhs); //!< Copy constructor |
|
| 2198 |
LocalNetFileImpl& operator=(const LocalNetFileImpl& rhs); //!< Assignment |
|
| 2199 |
}; // class LocalNetFileIo::LocalNetFileImpl |
|
| 2200 | ||
| 2201 |
LocalNetFileIo::LocalNetFileImpl::LocalNetFileImpl(const std::string& url, size_t blockSize):Impl(url, blockSize) |
|
| 2202 |
{
|
|
| 2203 |
hostInfo_ = Exiv2::Uri::Parse(url); |
|
| 2204 |
Exiv2::Uri::Decode(hostInfo_); |
|
| 2205 |
} |
|
| 2206 |
#ifdef EXV_UNICODE_PATH |
|
| 2207 |
LocalNetFileIo::LocalNetFileImpl::LocalNetFileImpl(const std::wstring& wurl, size_t blockSize):Impl(wurl, blockSize) |
|
| 2208 |
{
|
|
| 2209 |
std::string url; |
|
| 2210 |
url.assign(wurl.begin(), wurl.end()); |
|
| 2211 |
path_ = url; |
|
| 2212 | ||
| 2213 |
hostInfo_ = Exiv2::Uri::Parse(url); |
|
| 2214 |
Exiv2::Uri::Decode(hostInfo_); |
|
| 2215 |
} |
|
| 2216 |
#endif |
|
| 2217 | ||
| 2218 |
long LocalNetFileIo::LocalNetFileImpl::getFileLength() |
|
| 2219 |
{
|
|
| 2220 |
return 0L; |
|
| 2221 |
} |
|
| 2222 | ||
| 2223 |
void LocalNetFileIo::LocalNetFileImpl::getDataByRange(long lowBlock, long highBlock, std::string& response) |
|
| 2224 |
{
|
|
| 2225 |
} |
|
| 2226 | ||
| 2227 |
void LocalNetFileIo::LocalNetFileImpl::writeRemote(const byte* data, size_t size, long from, long to) |
|
| 2228 |
{
|
|
| 2229 |
} |
|
| 2230 |
LocalNetFileIo::LocalNetFileIo(const std::string& url, size_t blockSize) |
|
| 2231 |
{
|
|
| 2232 |
p_ = new LocalNetFileImpl(url, blockSize); |
|
| 2233 |
} |
|
| 2234 |
#ifdef EXV_UNICODE_PATH |
|
| 2235 |
LocalNetFileIo::LocalNetFileIo(const std::wstring& wurl, size_t blockSize) |
|
| 2236 |
{
|
|
| 2237 |
p_ = new LocalNetFileImpl(wurl, blockSize); |
|
| 2238 |
} |
|
| 2239 |
#endif |
|
| 2240 | ||
| 2154 | 2241 |
#if EXV_USE_CURL == 1 |
| 2155 | 2242 |
//! Internal Pimpl structure of class RemoteIo. |
| 2156 | 2243 |
class CurlIo::CurlImpl : public Impl {
|
| trunk/src/bmpimage.cpp (revision 4698) → trunk/src/bmpimage.cpp (working copy) | ||
|---|---|---|
| 121 | 121 |
} |
| 122 | 122 |
} // BmpImage::readMetadata |
| 123 | 123 | |
| 124 |
void BmpImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 125 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 126 |
IoCloser closer(*io_); |
|
| 127 |
// Ensure this is the correct image type |
|
| 128 |
if (!isBmpType(*io_, true)) {
|
|
| 129 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 130 |
throw Error(3, "BMP"); |
|
| 131 |
} |
|
| 132 |
} // BmpImage::printStructure |
|
| 133 | ||
| 124 | 134 |
void BmpImage::writeMetadata() |
| 125 | 135 |
{
|
| 126 | 136 |
// Todo: implement me! |
| trunk/src/crwimage.cpp (revision 4698) → trunk/src/crwimage.cpp (working copy) | ||
|---|---|---|
| 145 | 145 | |
| 146 | 146 |
} // CrwImage::readMetadata |
| 147 | 147 | |
| 148 |
void CrwImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 149 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 150 |
IoCloser closer(*io_); |
|
| 151 |
// Ensure this is the correct image type |
|
| 152 |
if (!isCrwType(*io_, true)) {
|
|
| 153 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 154 |
throw Error(3, "CRW"); |
|
| 155 |
} |
|
| 156 |
} // CrwImage::printStructure |
|
| 157 | ||
| 148 | 158 |
void CrwImage::writeMetadata() |
| 149 | 159 |
{
|
| 150 | 160 |
#ifdef DEBUG |
| trunk/src/epsimage.cpp (revision 4698) → trunk/src/epsimage.cpp (working copy) | ||
|---|---|---|
| 1109 | 1109 |
throw Error(32, "Image comment", "EPS"); |
| 1110 | 1110 |
} |
| 1111 | 1111 | |
| 1112 |
void EpsImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 1113 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 1114 |
IoCloser closer(*io_); |
|
| 1115 |
// Ensure this is the correct image type |
|
| 1116 |
if (!isEpsType(*io_, true)) {
|
|
| 1117 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 1118 |
throw Error(3, "EPS"); |
|
| 1119 |
} |
|
| 1120 |
} // EpsImage::printStructure |
|
| 1121 | ||
| 1112 | 1122 |
void EpsImage::readMetadata() |
| 1113 | 1123 |
{
|
| 1114 | 1124 |
#ifdef DEBUG |
| trunk/src/gifimage.cpp (revision 4698) → trunk/src/gifimage.cpp (working copy) | ||
|---|---|---|
| 75 | 75 |
throw(Error(32, "Image comment", "GIF")); |
| 76 | 76 |
} |
| 77 | 77 | |
| 78 |
void GifImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 79 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 80 |
IoCloser closer(*io_); |
|
| 81 |
// Ensure this is the correct image type |
|
| 82 |
if (!isGifType(*io_, true)) {
|
|
| 83 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 84 |
throw Error(3, "GIF"); |
|
| 85 |
} |
|
| 86 |
} // GifImage::printStructure |
|
| 87 | ||
| 78 | 88 |
void GifImage::readMetadata() |
| 79 | 89 |
{
|
| 80 | 90 |
#ifdef DEBUG |
| trunk/src/matroskavideo.cpp (revision 4698) → trunk/src/matroskavideo.cpp (working copy) | ||
|---|---|---|
| 496 | 496 |
{
|
| 497 | 497 |
} |
| 498 | 498 | |
| 499 |
void MatroskaVideo::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 500 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 501 |
IoCloser closer(*io_); |
|
| 502 |
// Ensure this is the correct image type |
|
| 503 |
if (!isMkvType(*io_, true)) {
|
|
| 504 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 505 |
throw Error(3, "MKV"); |
|
| 506 |
} |
|
| 507 |
} // MatroskaVideo::printStructure |
|
| 508 | ||
| 499 | 509 |
void MatroskaVideo::readMetadata() |
| 500 | 510 |
{
|
| 501 | 511 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
| trunk/src/mrwimage.cpp (revision 4698) → trunk/src/mrwimage.cpp (working copy) | ||
|---|---|---|
| 95 | 95 |
throw(Error(32, "Image comment", "MRW")); |
| 96 | 96 |
} |
| 97 | 97 | |
| 98 |
void MrwImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 99 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 100 |
IoCloser closer(*io_); |
|
| 101 |
// Ensure this is the correct image type |
|
| 102 |
if (!isMrwType(*io_, true)) {
|
|
| 103 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 104 |
throw Error(3, "MRW"); |
|
| 105 |
} |
|
| 106 |
} // MrwImage::printStructure |
|
| 107 | ||
| 98 | 108 |
void MrwImage::readMetadata() |
| 99 | 109 |
{
|
| 100 | 110 |
#ifdef DEBUG |
| trunk/src/orfimage.cpp (revision 4698) → trunk/src/orfimage.cpp (working copy) | ||
|---|---|---|
| 89 | 89 |
throw(Error(32, "Image comment", "ORF")); |
| 90 | 90 |
} |
| 91 | 91 | |
| 92 |
void OrfImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 93 |
std::cout << "ORF IMAGE" << std::endl; |
|
| 94 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 95 |
IoCloser closer(*io_); |
|
| 96 |
// Ensure this is the correct image type |
|
| 97 |
if (!isOrfType(*io_, true)) {
|
|
| 98 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 99 |
throw Error(3, "ORF"); |
|
| 100 |
} |
|
| 101 |
io_->seek(0,BasicIo::beg); |
|
| 102 |
printTiffStructure(io(),out,option,depth-1); |
|
| 103 |
} // OrfImage::printStructure |
|
| 104 | ||
| 92 | 105 |
void OrfImage::readMetadata() |
| 93 | 106 |
{
|
| 94 | 107 |
#ifdef DEBUG |
| trunk/src/pgfimage.cpp (revision 4698) → trunk/src/pgfimage.cpp (working copy) | ||
|---|---|---|
| 108 | 108 |
} |
| 109 | 109 |
} // PgfImage::PgfImage |
| 110 | 110 | |
| 111 |
void PgfImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 112 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 113 |
IoCloser closer(*io_); |
|
| 114 |
// Ensure this is the correct image type |
|
| 115 |
if (!isPgfType(*io_, true)) {
|
|
| 116 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 117 |
throw Error(3, "PGF"); |
|
| 118 |
} |
|
| 119 |
} // PgfImage::printStructure |
|
| 120 | ||
| 111 | 121 |
void PgfImage::readMetadata() |
| 112 | 122 |
{
|
| 113 | 123 |
#ifdef DEBUG |
| trunk/src/psdimage.cpp (revision 4698) → trunk/src/psdimage.cpp (working copy) | ||
|---|---|---|
| 141 | 141 |
throw(Error(32, "Image comment", "Photoshop")); |
| 142 | 142 |
} |
| 143 | 143 | |
| 144 |
void PsdImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 145 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 146 |
IoCloser closer(*io_); |
|
| 147 |
// Ensure this is the correct image type |
|
| 148 |
if (!isPsdType(*io_, true)) {
|
|
| 149 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 150 |
throw Error(3, "PSD"); |
|
| 151 |
} |
|
| 152 |
} // PsdImage::printStructure |
|
| 153 | ||
| 144 | 154 |
void PsdImage::readMetadata() |
| 145 | 155 |
{
|
| 146 | 156 |
#ifdef DEBUG |
| trunk/src/quicktimevideo.cpp (revision 4698) → trunk/src/quicktimevideo.cpp (working copy) | ||
|---|---|---|
| 626 | 626 |
{
|
| 627 | 627 |
} |
| 628 | 628 | |
| 629 |
void QuickTimeVideo::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 630 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 631 |
IoCloser closer(*io_); |
|
| 632 |
// Ensure this is the correct image type |
|
| 633 |
if (!isQTimeType(*io_, true)) {
|
|
| 634 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 635 |
throw Error(3, "QT"); |
|
| 636 |
} |
|
| 637 |
} // QuickTimeVideo::printStructure |
|
| 629 | 638 | |
| 630 | 639 |
void QuickTimeVideo::readMetadata() |
| 631 | 640 |
{
|
| trunk/src/rafimage.cpp (revision 4698) → trunk/src/rafimage.cpp (working copy) | ||
|---|---|---|
| 95 | 95 |
throw(Error(32, "Image comment", "RAF")); |
| 96 | 96 |
} |
| 97 | 97 | |
| 98 |
void RafImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 99 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 100 |
IoCloser closer(*io_); |
|
| 101 |
// Ensure this is the correct image type |
|
| 102 |
if (!isRafType(*io_, true)) {
|
|
| 103 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 104 |
throw Error(3, "RAF"); |
|
| 105 |
} |
|
| 106 |
} // RafImage::printStructure |
|
| 107 | ||
| 98 | 108 |
void RafImage::readMetadata() |
| 99 | 109 |
{
|
| 100 | 110 |
#ifdef DEBUG |
| trunk/src/riffvideo.cpp (revision 4698) → trunk/src/riffvideo.cpp (working copy) | ||
|---|---|---|
| 41 | 41 |
#include "tags_int.hpp" |
| 42 | 42 |
#include "types.hpp" |
| 43 | 43 |
#include "tiffimage_int.hpp" |
| 44 |
#include "image_int.hpp" |
|
| 44 | 45 |
// + standard includes |
| 45 | 46 |
#include <cmath> |
| 46 | 47 | |
| ... | ... | |
| 516 | 517 |
return "video/riff"; |
| 517 | 518 |
} |
| 518 | 519 | |
| 520 |
const int RiffVideo::RIFF_TAG_SIZE = 0x4; |
|
| 521 |
const char* RiffVideo::RIFF_CHUNK_HEADER_ICCP = "ICCP"; |
|
| 522 |
const char* RiffVideo::RIFF_CHUNK_HEADER_EXIF = "EXIF"; |
|
| 523 |
const char* RiffVideo::RIFF_CHUNK_HEADER_XMP = "XMP "; |
|
| 524 | ||
| 525 |
/*! |
|
| 526 |
@brief Function used to check equality of a Tags with a |
|
| 527 |
particular string (ignores case while comparing). |
|
| 528 |
@param buf Data buffer that will contain Tag to compare |
|
| 529 |
@param str char* Pointer to string |
|
| 530 |
@return Returns true if the buffer value is equal to string. |
|
| 531 |
*/ |
|
| 532 |
bool RiffVideo::equalsRiffTag(Exiv2::DataBuf& buf, const char* str) {
|
|
| 533 |
for(int i = 0; i < 4; i++ ) |
|
| 534 |
if(toupper(buf.pData_[i]) != str[i]) |
|
| 535 |
return false; |
|
| 536 |
return true; |
|
| 537 |
} |
|
| 538 | ||
| 539 |
void RiffVideo::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 540 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 541 |
IoCloser closer(*io_); |
|
| 542 |
// Ensure this is the correct image type |
|
| 543 |
if (!isRiffType(*io_, true)) {
|
|
| 544 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 545 |
throw Error(3, "RIFF"); |
|
| 546 |
} |
|
| 547 | ||
| 548 |
bool bPrint = option==kpsBasic || option==kpsRecursive; |
|
| 549 |
if ( bPrint || option == kpsXMP || option == kpsIccProfile || option == kpsIptcErase ) {
|
|
| 550 |
byte data [RIFF_TAG_SIZE * 2]; |
|
| 551 |
io_->read(data, RIFF_TAG_SIZE * 2); |
|
| 552 |
uint64_t filesize = Exiv2::getULong(data + RIFF_TAG_SIZE, littleEndian); |
|
| 553 |
DataBuf chunkId(5) ; |
|
| 554 |
chunkId.pData_[4] = '\0' ; |
|
| 555 | ||
| 556 |
if ( bPrint ) {
|
|
| 557 |
out << Internal::indent(depth) |
|
| 558 |
<< "STRUCTURE OF RIFF FILE: " |
|
| 559 |
<< io().path() |
|
| 560 |
<< std::endl; |
|
| 561 |
out << Internal::indent(depth) |
|
| 562 |
<< Internal::stringFormat(" Chunk | Length | Offset | Payload")
|
|
| 563 |
<< std::endl; |
|
| 564 |
} |
|
| 565 | ||
| 566 |
io_->seek(0,BasicIo::beg); // rewind |
|
| 567 |
while ( !io_->eof() && (uint64_t) io_->tell() < filesize) {
|
|
| 568 |
uint64_t offset = (uint64_t) io_->tell(); |
|
| 569 |
byte size_buff[RIFF_TAG_SIZE]; |
|
| 570 |
io_->read(chunkId.pData_, RIFF_TAG_SIZE); |
|
| 571 |
io_->read(size_buff, RIFF_TAG_SIZE); |
|
| 572 |
long size = Exiv2::getULong(size_buff, littleEndian); |
|
| 573 |
DataBuf payload(offset?size:RIFF_TAG_SIZE); // header is different from chunks |
|
| 574 |
io_->read(payload.pData_, payload.size_); |
|
| 575 | ||
| 576 |
if ( bPrint ) {
|
|
| 577 |
out << Internal::indent(depth) |
|
| 578 |
<< Internal::stringFormat(" %s | %12u | %12u | ", (const char*)chunkId.pData_,size,(uint32_t)offset)
|
|
| 579 |
<< Internal::binaryToString(payload,payload.size_>32?32:payload.size_) |
|
| 580 |
<< std::endl; |
|
| 581 |
} |
|
| 582 | ||
| 583 |
if ( equalsRiffTag(chunkId, RIFF_CHUNK_HEADER_EXIF) && option==kpsRecursive ) {
|
|
| 584 |
// create memio object with the payload, then print the structure |
|
| 585 |
BasicIo::AutoPtr p = BasicIo::AutoPtr(new MemIo(payload.pData_,payload.size_)); |
|
| 586 |
printTiffStructure(*p,out,option,depth); |
|
| 587 |
} |
|
| 588 | ||
| 589 |
bool bPrintPayload = (equalsRiffTag(chunkId, RIFF_CHUNK_HEADER_XMP) && option==kpsXMP) |
|
| 590 |
|| (equalsRiffTag(chunkId, RIFF_CHUNK_HEADER_ICCP) && option==kpsIccProfile) |
|
| 591 |
; |
|
| 592 |
if ( bPrintPayload ) {
|
|
| 593 |
out.write((const char*) payload.pData_,payload.size_); |
|
| 594 |
} |
|
| 595 | ||
| 596 |
if ( offset && io_->tell() % 2 ) io_->seek(+1, BasicIo::cur); // skip padding byte on sub-chunks |
|
| 597 |
} |
|
| 598 |
} |
|
| 599 |
} // RiffVideo::printStructure |
|
| 600 | ||
| 519 | 601 |
void RiffVideo::writeMetadata() |
| 520 | 602 |
{
|
| 521 | 603 |
} // RiffVideo::writeMetadata |
| trunk/src/rw2image.cpp (revision 4698) → trunk/src/rw2image.cpp (working copy) | ||
|---|---|---|
| 100 | 100 |
throw(Error(32, "Image comment", "RW2")); |
| 101 | 101 |
} |
| 102 | 102 | |
| 103 |
void Rw2Image::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 104 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 105 |
IoCloser closer(*io_); |
|
| 106 |
// Ensure this is the correct image type |
|
| 107 |
if (!isRw2Type(*io_, true)) {
|
|
| 108 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 109 |
throw Error(3, "RW2"); |
|
| 110 |
} |
|
| 111 |
} // Rw2Image::printStructure |
|
| 112 | ||
| 103 | 113 |
void Rw2Image::readMetadata() |
| 104 | 114 |
{
|
| 105 | 115 |
#ifdef DEBUG |
| trunk/src/tgaimage.cpp (revision 4698) → trunk/src/tgaimage.cpp (working copy) | ||
|---|---|---|
| 74 | 74 |
throw(Error(32, "Image comment", "TGA")); |
| 75 | 75 |
} |
| 76 | 76 | |
| 77 |
void TgaImage::printStructure(std::ostream& out, PrintStructureOption option, int depth) {
|
|
| 78 |
if (io_->open() != 0) throw Error(9, io_->path(), strError()); |
|
| 79 |
IoCloser closer(*io_); |
|
| 80 |
// Ensure this is the correct image type |
|
| 81 |
if (!isTgaType(*io_, true)) {
|
|
| 82 |
if (io_->error() || io_->eof()) throw Error(14); |
|
| 83 |
throw Error(3, "TGA"); |
|
| 84 |
} |
|
| 85 |
} // TgaImage::printStructure |
|
| 86 | ||
| 77 | 87 |
void TgaImage::readMetadata() |
| 78 | 88 |
{
|
| 79 | 89 |
#ifdef DEBUG |