]> git.datanom.net - lensdb.git/blob - lib/exiftool/ExifTool.h
before transition to proper ide
[lensdb.git] / lib / exiftool / ExifTool.h
1 //------------------------------------------------------------------------------
2 // File: ExifTool.h
3 //
4 // Description: C++ library interface to Perl exiftool application script
5 //
6 // License: Copyright 2013-2019, Phil Harvey (philharvey66 at gmail.com)
7 //
8 // This is software, in whole or part, is free for use in
9 // non-commercial applications, provided that this copyright notice
10 // is retained. A licensing fee may be required for use in a
11 // commercial application.
12 //
13 // Created: 2013-11-23 - Phil Harvey
14 //------------------------------------------------------------------------------
15 #ifndef __EXIFTOOL_H__
16 #define __EXIFTOOL_H__
17
18 #include "ExifToolPipe.h"
19 #include "TagInfo.h"
20
21 #define NOW 0
22 #define NEVER 1e9
23
24 #define SUMMARY_DIRECTORIES_SCANNED "directories scanned"
25 #define SUMMARY_DIRECTORIES_CREATED "directories created"
26 #define SUMMARY_FILES_FAILED_CONDITION "files failed condition"
27 #define SUMMARY_IMAGE_FILES_CREATED "image files created"
28 #define SUMMARY_IMAGE_FILES_UPDATED "image files updated"
29 #define SUMMARY_IMAGE_FILES_UNCHANGED "image files unchanged"
30 #define SUMMARY_IMAGE_FILES_MOVED "image files moved"
31 #define SUMMARY_IMAGE_FILES_COPIED "image files copied"
32 #define SUMMARY_FILE_UPDATE_ERRORS "files weren't updated due to errors"
33 #define SUMMARY_FILE_CREATE_ERRORS "files weren't created due to errors"
34 #define SUMMARY_IMAGE_FILES_READ "image files read"
35 #define SUMMARY_IMAGE_FILE_ERRORS "files could not be read"
36 #define SUMMARY_OUTPUT_FILES_CREATED "output files created"
37 #define SUMMARY_OUTPUT_FILES_APPENDED "output files appended"
38 #define SUMMARY_HARD_LINKS_CREATED "hard links created"
39 #define SUMMARY_HARD_LINK_ERRORS "hard links could not be created"
40 #define SUMMARY_SYMBOLIC_LINKS_CREATED "symbolic links created"
41 #define SUMMARY_SYMBOLIC_LINK_ERRORS "symbolic links could not be created"
42
43 class ExifTool
44 {
45 public:
46 ExifTool(const char *exec=NULL, const char *arg1=NULL);
47 virtual ~ExifTool();
48
49 TagInfo *ImageInfo(const char *file, const char *opts=NULL, double timeout=NEVER);
50
51 int ExtractInfo(const char *file, const char *opts=NULL);
52 TagInfo *GetInfo(int cmdNum=0, double timeout=NEVER);
53
54 int SetNewValue(const char *tag=NULL, const char *value=NULL, int len=-1);
55 int WriteInfo(const char *file, const char *opts=NULL, TagInfo *info=NULL);
56
57 int Command(const char *cmd=NULL);
58 int Complete(double timeout=NEVER);
59
60 int IsRunning();
61 int LastComplete() { return mLastComplete; }
62 int LastCommand() { return mCmdNum; } // (undocumented)
63 void SetLastComplete(int lastComplete) { mLastComplete = lastComplete; }
64 void SetWaitTime(int waitTime) { mWaitTime = waitTime; }
65
66 char * GetOutput() { return mLastComplete > 0 ? mStdout.GetString() : NULL; }
67 int GetOutputLen() { return mLastComplete > 0 ? mStdout.GetStringLen() : 0; }
68 char * GetError() { return mLastComplete > 0 ? mStderr.GetString() : NULL; }
69 int GetErrorLen() { return mLastComplete > 0 ? mStderr.GetStringLen() : 0; } // (undocumented)
70
71 int GetSummary(const char *msg);
72
73 // flags to allow some ExifTool features to be disabled
74 // (must be set before creating ExifTool object)
75 static int sNoSigPipe; // set to disable SIGPIPE handler
76 static int sNoWatchdog; // set to disable watchdog process
77
78 private:
79 ExifToolPipe mStdout; // buffer for exiftool stdout read pipe
80 ExifToolPipe mStderr; // buffer for exiftool stderr read pipe
81 int mTo; // write pipe for exiftool stdin
82 int mPid; // exiftool application process ID
83 int mWatchdog; // watchdog process ID
84 TagInfo * mWriteInfo; // tag information to write
85 char * mCmdQueue; // queued command arguments (NULL if nothing queued)
86 int mCmdQueueLen; // length of data in command queue
87 int mCmdQueueSize;// size of command queue
88 int mLastComplete;// result of last Complete() call
89 int mCmdNum; // last command number
90 int mWaitTime; // time to wait (microsec) if no commands in queue
91 };
92
93 #endif // __EXIFTOOL_H__
This page took 0.709123 seconds and 6 git commands to generate.