summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2020-06-26 01:08:35 +0200
committerChristian Grothoff <christian@grothoff.org>2020-06-26 01:08:35 +0200
commit8b04a0f003a5a8afe19f071e3017a4bb76c07931 (patch)
tree80b5bd5809fc6eb942aad2c0d5c2d1baadb707d8
parentbd9b0d690ac07c7bbe4a4f98f9620aa6b85c8876 (diff)
fix some deprecations
-rw-r--r--src/plugins/exiv2_extractor.cc692
-rw-r--r--src/plugins/previewopus_extractor.c34
-rw-r--r--src/plugins/thumbnailffmpeg_extractor.c44
3 files changed, 381 insertions, 389 deletions
diff --git a/src/plugins/exiv2_extractor.cc b/src/plugins/exiv2_extractor.cc
index ef402a8..78f9bda 100644
--- a/src/plugins/exiv2_extractor.cc
+++ b/src/plugins/exiv2_extractor.cc
@@ -43,189 +43,194 @@ class ExtractorIO : public Exiv2::BasicIo
{
private:
- /**
- * Extract context we are using.
- */
- struct EXTRACTOR_ExtractContext *ec;
+/**
+ * Extract context we are using.
+ */
+struct EXTRACTOR_ExtractContext *ec;
public:
- /**
- * Constructor.
- *
- * @param s_ec extract context to wrap
- */
- ExtractorIO (struct EXTRACTOR_ExtractContext *s_ec)
- {
- ec = s_ec;
- }
+/**
+ * Constructor.
+ *
+ * @param s_ec extract context to wrap
+ */
+ExtractorIO (struct EXTRACTOR_ExtractContext *s_ec)
+{
+ ec = s_ec;
+}
- /**
- * Destructor.
- */
- virtual ~ExtractorIO ()
- {
- /* nothing to do */
- }
- /**
- * Open stream.
- *
- * @return 0 (always successful)
- */
- virtual int open ();
-
- /**
- * Close stream.
- *
- * @return 0 (always successful)
- */
- virtual int close ();
-
- /**
- * Read up to 'rcount' bytes into a buffer
- *
- * @param rcount number of bytes to read
- * @return buffer with data read, empty buffer (!) on failure (!)
- */
- virtual Exiv2::DataBuf read (long rcount);
-
- /**
- * Read up to 'rcount' bytes into 'buf'.
- *
- * @param buf buffer to fill
- * @param rcount size of 'buf'
- * @return number of bytes read successfully, 0 on failure (!)
- */
- virtual long read (Exiv2::byte *buf,
- long rcount);
-
- /**
- * Read a single character.
- *
- * @return the character
- * @throw exception on errors
- */
- virtual int getb ();
-
- /**
- * Write to stream.
- *
- * @param data data to write
- * @param wcount how many bytes to write
- * @return -1 (always fails)
- */
- virtual long write (const Exiv2::byte *data,
- long wcount);
-
- /**
- * Write to stream.
- *
- * @param src stream to copy
- * @return -1 (always fails)
- */
- virtual long write (Exiv2::BasicIo &src);
-
- /**
- * Write a single byte.
- *
- * @param data byte to write
- * @return -1 (always fails)
- */
- virtual int putb (Exiv2::byte data);
-
- /**
- * Not supported.
- *
- * @throws error
- */
- virtual void transfer (Exiv2::BasicIo& src);
-
- /**
- * Seek to the given offset.
- *
- * @param offset desired offset
- * @parma pos offset is relative to where?
- * @return -1 on failure, 0 on success
- */
- virtual int seek (long offset,
- Exiv2::BasicIo::Position pos);
-
- /**
- * Not supported.
- *
- * @throws error
- */
- virtual Exiv2::byte* mmap (bool isWritable);
-
- /**
- * Not supported.
- *
- * @return -1 (error)
- */
- virtual int munmap ();
-
- /**
- * Return our current offset in the file.
- *
- * @return -1 on error
- */
- virtual long int tell (void) const;
-
- /**
- * Return overall size of the file.
- *
- * @return -1 on error
- */
-#if EXIV2_TEST_VERSION(0,26,0)
- virtual size_t size (void) const;
+/**
+ * Destructor.
+ */
+virtual ~ExtractorIO ()
+{
+ /* nothing to do */
+}
+
+
+/**
+ * Open stream.
+ *
+ * @return 0 (always successful)
+ */
+virtual int open ();
+
+/**
+ * Close stream.
+ *
+ * @return 0 (always successful)
+ */
+virtual int close ();
+
+/**
+ * Read up to 'rcount' bytes into a buffer
+ *
+ * @param rcount number of bytes to read
+ * @return buffer with data read, empty buffer (!) on failure (!)
+ */
+virtual Exiv2::DataBuf read (long rcount);
+
+/**
+ * Read up to 'rcount' bytes into 'buf'.
+ *
+ * @param buf buffer to fill
+ * @param rcount size of 'buf'
+ * @return number of bytes read successfully, 0 on failure (!)
+ */
+virtual long read (Exiv2::byte *buf,
+ long rcount);
+
+/**
+ * Read a single character.
+ *
+ * @return the character
+ * @throw exception on errors
+ */
+virtual int getb ();
+
+/**
+ * Write to stream.
+ *
+ * @param data data to write
+ * @param wcount how many bytes to write
+ * @return -1 (always fails)
+ */
+virtual long write (const Exiv2::byte *data,
+ long wcount);
+
+/**
+ * Write to stream.
+ *
+ * @param src stream to copy
+ * @return -1 (always fails)
+ */
+virtual long write (Exiv2::BasicIo &src);
+
+/**
+ * Write a single byte.
+ *
+ * @param data byte to write
+ * @return -1 (always fails)
+ */
+virtual int putb (Exiv2::byte data);
+
+/**
+ * Not supported.
+ *
+ * @throws error
+ */
+virtual void transfer (Exiv2::BasicIo& src);
+
+/**
+ * Seek to the given offset.
+ *
+ * @param offset desired offset
+ * @parma pos offset is relative to where?
+ * @return -1 on failure, 0 on success
+ */
+virtual int seek (long offset,
+ Exiv2::BasicIo::Position pos);
+
+/**
+ * Not supported.
+ *
+ * @throws error
+ */
+virtual Exiv2::byte*mmap (bool isWritable);
+
+/**
+ * Not supported.
+ *
+ * @return -1 (error)
+ */
+virtual int munmap ();
+
+/**
+ * Return our current offset in the file.
+ *
+ * @return -1 on error
+ */
+virtual long int tell (void) const;
+
+/**
+ * Return overall size of the file.
+ *
+ * @return -1 on error
+ */
+#if EXIV2_TEST_VERSION (0,26,0)
+virtual size_t size (void) const;
+
#else
- virtual long int size (void) const;
+virtual long int size (void) const;
+
#endif
- /**
- * Check if file is open.
- *
- * @return true (always).
- */
- virtual bool isopen () const;
-
- /**
- * Check if this file source is in error mode.
- *
- * @return 0 (always all is fine).
- */
- virtual int error () const;
-
- /**
- * Check if current position of the file is at the end
- *
- * @return true if at EOF, false if not.
- */
- virtual bool eof () const;
-
- /**
- * Not supported.
- *
- * @throws error
- */
- virtual std::string path () const;
+/**
+ * Check if file is open.
+ *
+ * @return true (always).
+ */
+virtual bool isopen () const;
+
+/**
+ * Check if this file source is in error mode.
+ *
+ * @return 0 (always all is fine).
+ */
+virtual int error () const;
+
+/**
+ * Check if current position of the file is at the end
+ *
+ * @return true if at EOF, false if not.
+ */
+virtual bool eof () const;
+
+/**
+ * Not supported.
+ *
+ * @throws error
+ */
+virtual std::string path () const;
#ifdef EXV_UNICODE_PATH
- /**
- * Not supported.
- *
- * @throws error
- */
- virtual std::wstring wpath () const;
+/**
+ * Not supported.
+ *
+ * @throws error
+ */
+virtual std::wstring wpath () const;
+
#endif
- /**
- * Not supported.
- *
- * @throws error
- */
- virtual Exiv2::BasicIo::AutoPtr temporary () const;
+/**
+ * Not supported.
+ *
+ * @throws error
+ */
+virtual Exiv2::BasicIo::AutoPtr temporary () const;
};
@@ -241,6 +246,7 @@ ExtractorIO::open ()
return 0;
}
+
/**
* Close stream.
*
@@ -280,7 +286,7 @@ ExtractorIO::read (long rcount)
*/
long
ExtractorIO::read (Exiv2::byte *buf,
- long rcount)
+ long rcount)
{
void *data;
ssize_t ret;
@@ -288,14 +294,14 @@ ExtractorIO::read (Exiv2::byte *buf,
got = 0;
while (got < rcount)
- {
- if (-1 == (ret = ec->read (ec->cls, &data, rcount - got)))
- return got;
- if (0 == ret)
- break;
- memcpy (&buf[got], data, ret);
- got += ret;
- }
+ {
+ if (-1 == (ret = ec->read (ec->cls, &data, rcount - got)))
+ return got;
+ if (0 == ret)
+ break;
+ memcpy (&buf[got], data, ret);
+ got += ret;
+ }
return got;
}
@@ -313,7 +319,7 @@ ExtractorIO::getb ()
const unsigned char *r;
if (1 != ec->read (ec->cls, &data, 1))
-#if EXIV2_TEST_VERSION(0,27,0)
+#if EXIV2_TEST_VERSION (0,27,0)
throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
@@ -332,7 +338,7 @@ ExtractorIO::getb ()
*/
long
ExtractorIO::write (const Exiv2::byte *data,
- long wcount)
+ long wcount)
{
return -1;
}
@@ -372,8 +378,8 @@ ExtractorIO::putb (Exiv2::byte data)
void
ExtractorIO::transfer (Exiv2::BasicIo& src)
{
-#if EXIV2_TEST_VERSION(0,27,0)
- throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
+#if EXIV2_TEST_VERSION (0,27,0)
+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
#endif
@@ -389,24 +395,24 @@ ExtractorIO::transfer (Exiv2::BasicIo& src)
*/
int
ExtractorIO::seek (long offset,
- Exiv2::BasicIo::Position pos)
+ Exiv2::BasicIo::Position pos)
{
int rel;
switch (pos)
- {
- case beg: // Exiv2::BasicIo::beg:
- rel = SEEK_SET;
- break;
- case cur:
- rel = SEEK_CUR;
- break;
- case end:
- rel = SEEK_END;
- break;
- default:
- abort ();
- }
+ {
+ case beg: // Exiv2::BasicIo::beg:
+ rel = SEEK_SET;
+ break;
+ case cur:
+ rel = SEEK_CUR;
+ break;
+ case end:
+ rel = SEEK_END;
+ break;
+ default:
+ abort ();
+ }
if (-1 == ec->seek (ec->cls, offset, rel))
return -1;
return 0;
@@ -421,8 +427,8 @@ ExtractorIO::seek (long offset,
Exiv2::byte *
ExtractorIO::mmap (bool isWritable)
{
-#if EXIV2_TEST_VERSION(0,27,0)
- throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
+#if EXIV2_TEST_VERSION (0,27,0)
+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
#endif
@@ -458,7 +464,7 @@ ExtractorIO::tell (void) const
*
* @return -1 on error
*/
-#if EXIV2_TEST_VERSION(0,26,0)
+#if EXIV2_TEST_VERSION (0,26,0)
size_t
#else
long int
@@ -513,8 +519,8 @@ ExtractorIO::eof () const
std::string
ExtractorIO::path () const
{
-#if EXIV2_TEST_VERSION(0,27,0)
- throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
+#if EXIV2_TEST_VERSION (0,27,0)
+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
#endif
@@ -530,12 +536,14 @@ ExtractorIO::path () const
std::wstring
ExtractorIO::wpath () const
{
-#if EXIV2_TEST_VERSION(0,27,0)
- throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
+#if EXIV2_TEST_VERSION (0,27,0)
+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
#endif
}
+
+
#endif
@@ -548,8 +556,8 @@ Exiv2::BasicIo::AutoPtr
ExtractorIO::temporary () const
{
fprintf (stderr, "throwing temporary error\n");
-#if EXIV2_TEST_VERSION(0,27,0)
- throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
+#if EXIV2_TEST_VERSION (0,27,0)
+ throw Exiv2::BasicError<char> (Exiv2::kerDecodeLangAltQualifierFailed);
#else
throw Exiv2::BasicError<char> (42 /* error code */);
#endif
@@ -563,7 +571,11 @@ ExtractorIO::temporary () const
* @param s 0-terminated UTF8 string value with the meta data
* @param type libextractor type for the meta data
*/
-#define ADD(s, type) do { if (0 != proc (proc_cls, "exiv2", type, EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen (s) + 1)) return 1; } while (0)
+#define ADD(s, type) do { if (0 != proc (proc_cls, "exiv2", type, \
+ EXTRACTOR_METAFORMAT_UTF8, \
+ "text/plain", s, strlen (s) \
+ + 1)) return 1; \
+} while (0)
/**
@@ -579,10 +591,10 @@ ExtractorIO::temporary () const
*/
static int
add_exiv2_tag (const Exiv2::ExifData& exifData,
- const std::string& key,
- enum EXTRACTOR_MetaType type,
- EXTRACTOR_MetaDataProcessor proc,
- void *proc_cls)
+ const std::string& key,
+ enum EXTRACTOR_MetaType type,
+ EXTRACTOR_MetaDataProcessor proc,
+ void *proc_cls)
{
const char *str;
Exiv2::ExifKey ek (key);
@@ -590,8 +602,8 @@ add_exiv2_tag (const Exiv2::ExifData& exifData,
if (exifData.end () == md)
return 0; /* not found */
- std::string ccstr = Exiv2::toString(*md);
- str = ccstr.c_str();
+ std::string ccstr = Exiv2::toString (*md);
+ str = ccstr.c_str ();
/* skip over whitespace */
while ( (strlen (str) > 0) && isspace ((unsigned char) str[0]))
str++;
@@ -615,28 +627,28 @@ add_exiv2_tag (const Exiv2::ExifData& exifData,
*/
static int
add_iptc_data (const Exiv2::IptcData& iptcData,
- const std::string& key,
- enum EXTRACTOR_MetaType type,
- EXTRACTOR_MetaDataProcessor proc,
- void *proc_cls)
+ const std::string& key,
+ enum EXTRACTOR_MetaType type,
+ EXTRACTOR_MetaDataProcessor proc,
+ void *proc_cls)
{
const char *str;
Exiv2::IptcKey ek (key);
Exiv2::IptcData::const_iterator md = iptcData.findKey (ek);
while (iptcData.end () != md)
- {
- if (0 != strcmp (Exiv2::toString (md->key ()).c_str (), key.c_str ()))
- break;
- std::string ccstr = Exiv2::toString (*md);
- str = ccstr.c_str ();
- /* skip over whitespace */
- while ((strlen (str) > 0) && isspace ((unsigned char) str[0]))
- str++;
- if (strlen (str) > 0)
- ADD (str, type);
- md++;
- }
+ {
+ if (0 != strcmp (Exiv2::toString (md->key ()).c_str (), key.c_str ()))
+ break;
+ std::string ccstr = Exiv2::toString (*md);
+ str = ccstr.c_str ();
+ /* skip over whitespace */
+ while ((strlen (str) > 0) && isspace ((unsigned char) str[0]))
+ str++;
+ if (strlen (str) > 0)
+ ADD (str, type);
+ md++;
+ }
return 0;
}
@@ -654,26 +666,27 @@ add_iptc_data (const Exiv2::IptcData& iptcData,
*/
static int
add_xmp_data (const Exiv2::XmpData& xmpData,
- const std::string& key,
- enum EXTRACTOR_MetaType type,
- EXTRACTOR_MetaDataProcessor proc,
- void *proc_cls)
+ const std::string& key,
+ enum EXTRACTOR_MetaType type,
+ EXTRACTOR_MetaDataProcessor proc,
+ void *proc_cls)
{
- const char * str;
+ const char *str;
Exiv2::XmpKey ek (key);
Exiv2::XmpData::const_iterator md = xmpData.findKey (ek);
while (xmpData.end () != md)
- {
- if (0 != strcmp (Exiv2::toString (md->key ()).c_str (), key.c_str ()))
- break;
- std::string ccstr = Exiv2::toString (*md);
- str = ccstr.c_str ();
- while ( (strlen (str) > 0) && isspace ((unsigned char) str[0])) str++;
- if (strlen (str) > 0)
- ADD (str, type);
- md++;
- }
+ {
+ if (0 != strcmp (Exiv2::toString (md->key ()).c_str (), key.c_str ()))
+ break;
+ std::string ccstr = Exiv2::toString (*md);
+ str = ccstr.c_str ();
+ while ( (strlen (str) > 0) && isspace ((unsigned char) str[0]))
+ str++;
+ if (strlen (str) > 0)
+ ADD (str, type);
+ md++;
+ }
return 0;
}
@@ -685,7 +698,8 @@ add_xmp_data (const Exiv2::XmpData& xmpData,
* @param s key to lookup
* @param type libextractor type to use for the meta data found under the given key
*/
-#define ADDEXIV(s,t) do { if (0 != add_exiv2_tag (exifData, s, t, ec->proc, ec->cls)) return; } while (0)
+#define ADDEXIV(s,t) do { if (0 != add_exiv2_tag (exifData, s, t, ec->proc, \
+ ec->cls)) return; } while (0)
/**
@@ -695,7 +709,8 @@ add_xmp_data (const Exiv2::XmpData& xmpData,
* @param s key to lookup
* @param type libextractor type to use for the meta data found under the given key
*/
-#define ADDIPTC(s,t) do { if (0 != add_iptc_data (iptcData, s, t, ec->proc, ec->cls)) return; } while (0)
+#define ADDIPTC(s,t) do { if (0 != add_iptc_data (iptcData, s, t, ec->proc, \
+ ec->cls)) return; } while (0)
/**
@@ -705,7 +720,8 @@ add_xmp_data (const Exiv2::XmpData& xmpData,
* @param s key to lookup
* @param type libextractor type to use for the meta data found under the given key
*/
-#define ADDXMP(s,t) do { if (0 != add_xmp_data (xmpData, s, t, ec->proc, ec->cls)) return; } while (0)
+#define ADDXMP(s,t) do { if (0 != add_xmp_data (xmpData, s, t, ec->proc, \
+ ec->cls)) return; } while (0)
/**
@@ -717,97 +733,105 @@ extern "C" void
EXTRACTOR_exiv2_extract_method (struct EXTRACTOR_ExtractContext *ec)
{
try
- {
-#if !EXIV2_TEST_VERSION(0,24,0)
- Exiv2::LogMsg::setLevel (Exiv2::LogMsg::mute);
+ {
+#if ! EXIV2_TEST_VERSION (0,24,0)
+ Exiv2::LogMsg::setLevel (Exiv2::LogMsg::mute);
#endif
- std::auto_ptr<Exiv2::BasicIo> eio(new ExtractorIO (ec));
- Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open (eio);
- if (0 == image.get ())
- return;
- image->readMetadata ();
- Exiv2::ExifData &exifData = image->exifData ();
- if (! exifData.empty ())
- {
- ADDEXIV ("Exif.Image.Copyright", EXTRACTOR_METATYPE_COPYRIGHT);
- ADDEXIV ("Exif.Photo.UserComment", EXTRACTOR_METATYPE_COMMENT);
- ADDEXIV ("Exif.GPSInfo.GPSLatitudeRef", EXTRACTOR_METATYPE_GPS_LATITUDE_REF);
- ADDEXIV ("Exif.GPSInfo.GPSLatitude", EXTRACTOR_METATYPE_GPS_LATITUDE);
- ADDEXIV ("Exif.GPSInfo.GPSLongitudeRef", EXTRACTOR_METATYPE_GPS_LONGITUDE_REF);
- ADDEXIV ("Exif.GPSInfo.GPSLongitude", EXTRACTOR_METATYPE_GPS_LONGITUDE);
- ADDEXIV ("Exif.Image.Make", EXTRACTOR_METATYPE_CAMERA_MAKE);
- ADDEXIV ("Exif.Image.Model", EXTRACTOR_METATYPE_CAMERA_MODEL);
- ADDEXIV ("Exif.Image.Orientation", EXTRACTOR_METATYPE_ORIENTATION);
- ADDEXIV ("Exif.Photo.DateTimeOriginal", EXTRACTOR_METATYPE_CREATION_DATE);
- ADDEXIV ("Exif.Photo.ExposureBiasValue", EXTRACTOR_METATYPE_EXPOSURE_BIAS);
- ADDEXIV ("Exif.Photo.Flash", EXTRACTOR_METATYPE_FLASH);
- ADDEXIV ("Exif.CanonSi.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
- ADDEXIV ("Exif.Panasonic.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
- ADDEXIV ("Exif.Olympus.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
- ADDEXIV ("Exif.Photo.FocalLength", EXTRACTOR_METATYPE_FOCAL_LENGTH);
- ADDEXIV ("Exif.Photo.FocalLengthIn35mmFilm", EXTRACTOR_METATYPE_FOCAL_LENGTH_35MM);
- ADDEXIV ("Exif.Photo.ISOSpeedRatings", EXTRACTOR_METATYPE_ISO_SPEED);
- ADDEXIV ("Exif.CanonSi.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
- ADDEXIV ("Exif.Nikon1.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
- ADDEXIV ("Exif.Nikon2.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
- ADDEXIV ("Exif.Nikon3.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
- ADDEXIV ("Exif.Photo.ExposureProgram", EXTRACTOR_METATYPE_EXPOSURE_MODE);
- ADDEXIV ("Exif.CanonCs.ExposureProgram", EXTRACTOR_METATYPE_EXPOSURE_MODE);
- ADDEXIV ("Exif.Photo.MeteringMode", EXTRACTOR_METATYPE_METERING_MODE);
- ADDEXIV ("Exif.CanonCs.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
- ADDEXIV ("Exif.Fujifilm.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
- ADDEXIV ("Exif.Olympus.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
- ADDEXIV ("Exif.Panasonic.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
- ADDEXIV ("Exif.CanonCs.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Fujifilm.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Sigma.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Nikon1.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Nikon2.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Nikon3.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Olympus.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.Panasonic.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
- ADDEXIV ("Exif.CanonSi.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Fujifilm.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Sigma.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Nikon1.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Nikon2.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Nikon3.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Olympus.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Panasonic.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
- ADDEXIV ("Exif.Photo.FNumber", EXTRACTOR_METATYPE_APERTURE);
- ADDEXIV ("Exif.Photo.ExposureTime", EXTRACTOR_METATYPE_EXPOSURE);
- }
-
- Exiv2::IptcData &iptcData = image->iptcData();
- if (! iptcData.empty())
- {
- ADDIPTC ("Iptc.Application2.Keywords", EXTRACTOR_METATYPE_KEYWORDS);
- ADDIPTC ("Iptc.Application2.City", EXTRACTOR_METATYPE_LOCATION_CITY);
- ADDIPTC ("Iptc.Application2.SubLocation", EXTRACTOR_METATYPE_LOCATION_SUBLOCATION);
- ADDIPTC ("Iptc.Application2.CountryName", EXTRACTOR_METATYPE_LOCATION_COUNTRY);
- }
-
- Exiv2::XmpData &xmpData = image->xmpData();
- if (! xmpData.empty())
- {
- ADDXMP ("Xmp.photoshop.Country", EXTRACTOR_METATYPE_LOCATION_COUNTRY);
- ADDXMP ("Xmp.photoshop.City", EXTRACTOR_METATYPE_LOCATION_CITY);
- ADDXMP ("Xmp.xmp.Rating", EXTRACTOR_METATYPE_RATING);
- ADDXMP ("Xmp.MicrosoftPhoto.Rating", EXTRACTOR_METATYPE_RATING);
- ADDXMP ("Xmp.iptc.CountryCode", EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE);
- ADDXMP ("Xmp.xmp.CreatorTool", EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE);
- ADDXMP ("Xmp.lr.hierarchicalSubject", EXTRACTOR_METATYPE_SUBJECT);
- }
- }
- catch (const Exiv2::AnyError& e)
+ std::auto_ptr<Exiv2::BasicIo> eio (new ExtractorIO (ec));
+ Exiv2::Image::AutoPtr image = Exiv2::ImageFactory::open (eio);
+ if (0 == image.get ())
+ return;
+ image->readMetadata ();
+ Exiv2::ExifData &exifData = image->exifData ();
+ if (! exifData.empty ())
{
-#if DEBUG
- std::cerr << "Caught Exiv2 exception '" << e << "'\n";
-#endif
+ ADDEXIV ("Exif.Image.Copyright", EXTRACTOR_METATYPE_COPYRIGHT);
+ ADDEXIV ("Exif.Photo.UserComment", EXTRACTOR_METATYPE_COMMENT);
+ ADDEXIV ("Exif.GPSInfo.GPSLatitudeRef",
+ EXTRACTOR_METATYPE_GPS_LATITUDE_REF);
+ ADDEXIV ("Exif.GPSInfo.GPSLatitude", EXTRACTOR_METATYPE_GPS_LATITUDE);
+ ADDEXIV ("Exif.GPSInfo.GPSLongitudeRef",
+ EXTRACTOR_METATYPE_GPS_LONGITUDE_REF);
+ ADDEXIV ("Exif.GPSInfo.GPSLongitude", EXTRACTOR_METATYPE_GPS_LONGITUDE);
+ ADDEXIV ("Exif.Image.Make", EXTRACTOR_METATYPE_CAMERA_MAKE);
+ ADDEXIV ("Exif.Image.Model", EXTRACTOR_METATYPE_CAMERA_MODEL);
+ ADDEXIV ("Exif.Image.Orientation", EXTRACTOR_METATYPE_ORIENTATION);
+ ADDEXIV ("Exif.Photo.DateTimeOriginal", EXTRACTOR_METATYPE_CREATION_DATE);
+ ADDEXIV ("Exif.Photo.ExposureBiasValue",
+ EXTRACTOR_METATYPE_EXPOSURE_BIAS);
+ ADDEXIV ("Exif.Photo.Flash", EXTRACTOR_METATYPE_FLASH);
+ ADDEXIV ("Exif.CanonSi.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
+ ADDEXIV ("Exif.Panasonic.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
+ ADDEXIV ("Exif.Olympus.FlashBias", EXTRACTOR_METATYPE_FLASH_BIAS);
+ ADDEXIV ("Exif.Photo.FocalLength", EXTRACTOR_METATYPE_FOCAL_LENGTH);
+ ADDEXIV ("Exif.Photo.FocalLengthIn35mmFilm",
+ EXTRACTOR_METATYPE_FOCAL_LENGTH_35MM);
+ ADDEXIV ("Exif.Photo.ISOSpeedRatings", EXTRACTOR_METATYPE_ISO_SPEED);
+ ADDEXIV ("Exif.CanonSi.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
+ ADDEXIV ("Exif.Nikon1.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
+ ADDEXIV ("Exif.Nikon2.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
+ ADDEXIV ("Exif.Nikon3.ISOSpeed", EXTRACTOR_METATYPE_ISO_SPEED);
+ ADDEXIV ("Exif.Photo.ExposureProgram", EXTRACTOR_METATYPE_EXPOSURE_MODE);
+ ADDEXIV ("Exif.CanonCs.ExposureProgram",
+ EXTRACTOR_METATYPE_EXPOSURE_MODE);
+ ADDEXIV ("Exif.Photo.MeteringMode", EXTRACTOR_METATYPE_METERING_MODE);
+ ADDEXIV ("Exif.CanonCs.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
+ ADDEXIV ("Exif.Fujifilm.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
+ ADDEXIV ("Exif.Olympus.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
+ ADDEXIV ("Exif.Panasonic.Macro", EXTRACTOR_METATYPE_MACRO_MODE);
+ ADDEXIV ("Exif.CanonCs.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Fujifilm.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Sigma.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Nikon1.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Nikon2.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Nikon3.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Olympus.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.Panasonic.Quality", EXTRACTOR_METATYPE_IMAGE_QUALITY);
+ ADDEXIV ("Exif.CanonSi.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Fujifilm.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Sigma.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Nikon1.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Nikon2.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Nikon3.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Olympus.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Panasonic.WhiteBalance", EXTRACTOR_METATYPE_WHITE_BALANCE);
+ ADDEXIV ("Exif.Photo.FNumber", EXTRACTOR_METATYPE_APERTURE);
+ ADDEXIV ("Exif.Photo.ExposureTime", EXTRACTOR_METATYPE_EXPOSURE);
}
- catch (void *anything)
+
+ Exiv2::IptcData &iptcData = image->iptcData ();
+ if (! iptcData.empty ())
+ {
+ ADDIPTC ("Iptc.Application2.Keywords", EXTRACTOR_METATYPE_KEYWORDS);
+ ADDIPTC ("Iptc.Application2.City", EXTRACTOR_METATYPE_LOCATION_CITY);
+ ADDIPTC ("Iptc.Application2.SubLocation",
+ EXTRACTOR_METATYPE_LOCATION_SUBLOCATION);
+ ADDIPTC ("Iptc.Application2.CountryName",
+ EXTRACTOR_METATYPE_LOCATION_COUNTRY);
+ }
+
+ Exiv2::XmpData &xmpData = image->xmpData ();
+ if (! xmpData.empty ())
{
+ ADDXMP ("Xmp.photoshop.Country", EXTRACTOR_METATYPE_LOCATION_COUNTRY);
+ ADDXMP ("Xmp.photoshop.City", EXTRACTOR_METATYPE_LOCATION_CITY);
+ ADDXMP ("Xmp.xmp.Rating", EXTRACTOR_METATYPE_RATING);
+ ADDXMP ("Xmp.MicrosoftPhoto.Rating", EXTRACTOR_METATYPE_RATING);
+ ADDXMP ("Xmp.iptc.CountryCode", EXTRACTOR_METATYPE_LOCATION_COUNTRY_CODE);
+ ADDXMP ("Xmp.xmp.CreatorTool", EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE);
+ ADDXMP ("Xmp.lr.hierarchicalSubject", EXTRACTOR_METATYPE_SUBJECT);
}
+ }
+ catch (const Exiv2::AnyError& e)
+ {
+#if DEBUG
+ std::cerr << "Caught Exiv2 exception '" << e << "'\n";
+#endif
+ }
+ catch (void *anything)
+ {
+ }
}
+
/* end of exiv2_extractor.cc */
diff --git a/src/plugins/previewopus_extractor.c b/src/plugins/previewopus_extractor.c
index 9423dcd..a47cdbc 100644
--- a/src/plugins/previewopus_extractor.c
+++ b/src/plugins/previewopus_extractor.c
@@ -37,35 +37,13 @@
#include "extractor.h"
#include <magic.h>
-#if HAVE_LIBAVUTIL_AVUTIL_H
#include <libavutil/avutil.h>
#include <libavutil/audio_fifo.h>
#include <libavutil/opt.h>
#include <libavutil/mathematics.h>
-
-#elif HAVE_FFMPEG_AVUTIL_H
-#include <ffmpeg/avutil.h>
-#include <ffmpeg/audio_fifo.h>
-#include <ffmpeg/opt.h>
-#include <ffmpeg/mathematics.h>
-#endif
-#if HAVE_LIBAVFORMAT_AVFORMAT_H
#include <libavformat/avformat.h>
-#elif HAVE_FFMPEG_AVFORMAT_H
-#include <ffmpeg/avformat.h>
-#endif
-#if HAVE_LIBAVCODEC_AVCODEC_H
#include <libavcodec/avcodec.h>
-#elif HAVE_FFMPEG_AVCODEC_H
-#include <ffmpeg/avcodec.h>
-#endif
-#if HAVE_LIBSWSCALE_SWSCALE_H
#include <libswscale/swscale.h>
-#elif HAVE_FFMPEG_SWSCALE_H
-#include <ffmpeg/swscale.h>
-#endif
-
-// TODO: Check for ffmpeg
#include <libavresample/avresample.h>
@@ -466,7 +444,7 @@ decode_audio_frame (AVFrame *frame,
fprintf (stderr, "Could not decode frame (error '%s')\n",
get_error_text (error));
#endif
- av_free_packet (&input_packet);
+ av_packet_unref (&input_packet);
return error;
}
@@ -476,7 +454,7 @@ decode_audio_frame (AVFrame *frame,
*/
if (*finished && *data_present)
*finished = 0;
- av_free_packet (&input_packet);
+ av_packet_unref (&input_packet);
return 0;
}
@@ -810,7 +788,7 @@ encode_audio_frame (AVFrame *frame,
fprintf (stderr, "Could not encode frame (error '%s')\n",
get_error_text (error));
#endif
- av_free_packet (&output_packet);
+ av_packet_unref (&output_packet);
return error;
}
@@ -824,11 +802,11 @@ encode_audio_frame (AVFrame *frame,
get_error_text (error));
#endif
- av_free_packet (&output_packet);
+ av_packet_unref (&output_packet);
return error;
}
- av_free_packet (&output_packet);
+ av_packet_unref (&output_packet);
}
return 0;
@@ -1261,8 +1239,6 @@ void __attribute__ ((constructor))
previewopus_lib_init (void)
{
av_log_set_callback (&previewopus_av_log_callback);
- av_register_all ();
-
}
diff --git a/src/plugins/thumbnailffmpeg_extractor.c b/src/plugins/thumbnailffmpeg_extractor.c
index 72f0137..9bed4ec 100644
--- a/src/plugins/thumbnailffmpeg_extractor.c
+++ b/src/plugins/thumbnailffmpeg_extractor.c
@@ -38,26 +38,11 @@
#include "extractor.h"
#include <magic.h>
-#if HAVE_LIBAVUTIL_AVUTIL_H
#include <libavutil/avutil.h>
-#elif HAVE_FFMPEG_AVUTIL_H
-#include <ffmpeg/avutil.h>
-#endif
-#if HAVE_LIBAVFORMAT_AVFORMAT_H
+#include <libavutil/imgutils.h>
#include <libavformat/avformat.h>
-#elif HAVE_FFMPEG_AVFORMAT_H
-#include <ffmpeg/avformat.h>
-#endif
-#if HAVE_LIBAVCODEC_AVCODEC_H
#include <libavcodec/avcodec.h>
-#elif HAVE_FFMPEG_AVCODEC_H
-#include <ffmpeg/avcodec.h>
-#endif
-#if HAVE_LIBSWSCALE_SWSCALE_H
#include <libswscale/swscale.h>
-#elif HAVE_FFMPEG_SWSCALE_H
-#include <ffmpeg/swscale.h>
-#endif
#if USE_JPEG
#ifdef PIX_FMT_YUVJ420P
@@ -257,8 +242,10 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
return 0;
}
if (NULL == (dst_buffer =
- av_malloc (avpicture_get_size (PIX_OUTPUT_FORMAT,
- dst_width, dst_height))))
+ av_malloc (av_image_get_buffer_size (PIX_OUTPUT_FORMAT,
+ dst_width,
+ dst_height,
+ 1))))
{
#if DEBUG
fprintf (stderr,
@@ -272,9 +259,13 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
sws_freeContext (scaler_ctx);
return 0;
}
- avpicture_fill ((AVPicture *) dst_frame, dst_buffer,
- PIX_OUTPUT_FORMAT,
- dst_width, dst_height);
+ av_image_fill_arrays (dst_frame->data,
+ dst_frame->linesize,
+ dst_buffer,
+ PIX_OUTPUT_FORMAT,
+ dst_width,
+ dst_height,
+ 1);
sws_scale (scaler_ctx,
src_data,
src_stride,
@@ -383,7 +374,7 @@ create_thumbnail (AVCodecContext *pCodecCtx, int src_width, int src_height,
err = pkt.size;
memcpy (encoder_output_buffer,pkt.data, pkt.size);
- av_free_packet (&pkt);
+ av_packet_unref (&pkt);
#else
@@ -622,6 +613,7 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
AVIOContext *io_ctx;
struct AVFormatContext *format_ctx;
AVCodecContext *codec_ctx;
+ AVCodecParameters *codecpar;
AVCodec *codec;
AVDictionary *options;
AVFrame *frame;
@@ -675,10 +667,11 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
video_stream_index = -1;
for (i = 0; i<format_ctx->nb_streams; i++)
{
+ codecpar = format_ctx->streams[i]->codecpar;
codec_ctx = format_ctx->streams[i]->codec;
if (AVMEDIA_TYPE_VIDEO != codec_ctx->codec_type)
continue;
- if (NULL == (codec = avcodec_find_decoder (codec_ctx->codec_id)))
+ if (NULL == (codec = avcodec_find_decoder (codecpar->codec_id)))
continue;
options = NULL;
if (0 != (err = avcodec_open2 (codec_ctx, codec, &options)))
@@ -760,11 +753,11 @@ extract_video (struct EXTRACTOR_ExtractContext *ec)
&packet);
if (frame_finished && frame->key_frame)
{
- av_free_packet (&packet);
+ av_packet_unref (&packet);
break;
}
}
- av_free_packet (&packet);
+ av_packet_unref (&packet);
}
if (! frame_finished)
@@ -945,7 +938,6 @@ void __attribute__ ((constructor))
thumbnailffmpeg_lib_init (void)
{
av_log_set_callback (&thumbnailffmpeg_av_log_callback);
- av_register_all ();
magic = magic_open (MAGIC_MIME_TYPE);
if (0 != magic_load (magic, NULL))
{