This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via aef381e3ac79970a4167fd9f0d5d681e4203ef5e (commit) via 32857ab67cf984aeeb14cec514406fdf6cc0eff3 (commit) via a97d1e9056b14aecb130f45368093a06c4b82cf5 (commit) from bcd98a45393d9f7273c4d8c589580ff457f3bc1a (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/aef381e3ac79970a4167fd9f0d5d681e4203e...
commit aef381e3ac79970a4167fd9f0d5d681e4203ef5e Author: Cyril Hrubis metan@ucw.cz Date: Sat Jun 2 20:14:04 2012 +0200
loaders: Add generic function to load Meta Data.
diff --git a/demos/c_simple/Makefile b/demos/c_simple/Makefile index c03f374..22efd37 100644 --- a/demos/c_simple/Makefile +++ b/demos/c_simple/Makefile @@ -6,7 +6,7 @@ INCLUDE= LDLIBS+=-lGP -lGP_backends -lSDL -L$(TOPDIR)/build/
APPS=backend_example loaders_example loaders filters_symmetry gfx_koch- virtual_backend_example meta_data meta_data_png + virtual_backend_example meta_data meta_data_dump
include $(TOPDIR)/pre.mk include $(TOPDIR)/app.mk diff --git a/demos/c_simple/meta_data_png.c b/demos/c_simple/meta_data_dump.c similarity index 94% rename from demos/c_simple/meta_data_png.c rename to demos/c_simple/meta_data_dump.c index 9f6543b..d9aacfb 100644 --- a/demos/c_simple/meta_data_png.c +++ b/demos/c_simple/meta_data_dump.c @@ -22,7 +22,7 @@
/*
- Read png meta-data and print them into stdout. + Read image meta-data and print them into stdout.
*/
@@ -37,7 +37,7 @@
int main(int argc, char *argv[]) { - GP_MetaData *data = GP_MetaDataCreate(20); + GP_MetaData *data = GP_MetaDataCreate(80); int i;
if (argc < 2) { @@ -53,7 +53,7 @@ int main(int argc, char *argv[]) GP_MetaDataClear(data); - if (GP_LoadPNGMetaData(argv[i], data)) { + if (GP_LoadMetaData(argv[i], data)) { fprintf(stderr, "Failed to read '%s' meta-data: %sn", argv[1], strerror(errno)); } else { diff --git a/include/loaders/GP_Loaders.h b/include/loaders/GP_Loaders.h index d374f99..c7aab95 100644 --- a/include/loaders/GP_Loaders.h +++ b/include/loaders/GP_Loaders.h @@ -54,6 +54,11 @@ GP_Context *GP_LoadImage(const char *src_path, GP_ProgressCallback *callback);
/* + * Loads image Meta Data (if possible). + */ +int GP_LoadMetaData(const char *src_path, GP_MetaData *data); + +/* * Simple saving function, the image format is matched by file extension. * * Retruns zero on succes. diff --git a/libs/loaders/GP_Loaders.c b/libs/loaders/GP_Loaders.c index a6349bc..f298983 100644 --- a/libs/loaders/GP_Loaders.c +++ b/libs/loaders/GP_Loaders.c @@ -148,6 +148,50 @@ skip_filename_check: return NULL; }
+int GP_LoadMetaData(const char *src_path, GP_MetaData *data) +{ + int len; + + len = strlen(src_path); + + if (len < 3) { + errno = ENOSYS; + return 1; + } + + switch (src_path[len - 1]) { + /* PNG, JPG, JPEG */ + case 'g': + case 'G': + switch (src_path[len - 2]) { + case 'n': + case 'N': + if (src_path[len - 3] == 'p' || + src_path[len - 3] == 'P') + return GP_LoadPNGMetaData(src_path, data); + break; + case 'p': + case 'P': + if (src_path[len - 3] == 'j' || + src_path[len - 3] == 'J') + return GP_LoadJPGMetaData(src_path, data); + break; + case 'e': + case 'E': + if ((src_path[len - 3] == 'p' || + src_path[len - 3] == 'P') && + (src_path[len - 4] == 'j' || + src_path[len - 4] == 'J')) + return GP_LoadJPGMetaData(src_path, data); + break; + } + break; + } + + errno = ENOSYS; + return 1; +} + int GP_SaveImage(const GP_Context *src, const char *dst_path, GP_ProgressCallback *callback) {
http://repo.or.cz/w/gfxprim.git/commit/32857ab67cf984aeeb14cec514406fdf6cc0e...
commit 32857ab67cf984aeeb14cec514406fdf6cc0eff3 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jun 2 20:05:40 2012 +0200
loaders: More work on Exif loader, mostly finisned.
diff --git a/libs/loaders/GP_MetaExif.c b/libs/loaders/GP_MetaExif.c index e6a89bc..08fb7f9 100644 --- a/libs/loaders/GP_MetaExif.c +++ b/libs/loaders/GP_MetaExif.c @@ -71,38 +71,39 @@ static const char *IFD_format_names[] = { };
enum IFD_tags { - /* image description */ + /* ASCII text no multibyte encoding */ IFD_IMAGE_DESCRIPTION = 0x010e, - /* camera manufacturer */ + /* Device (camer, scanner, ...) manufacturer */ IFD_MAKE = 0x010f, - /* camera model */ + /* Device model */ IFD_MODEL = 0x0110, - /* 1 = upper left, 3 = lower right, 6 = upper right, * - * 8 = lower left, 9 = undefined */ + /* Image orientation * + * 1 upper left, 3 lower right, 6 upper right, * + * 8 lower left, other reserved */ IFD_ORIENTATION = 0x0112, - /* x resolution */ + /* X resolution 72 DPI is default */ IFD_X_RESOLUTION = 0x011a, - /* y resolution */ + /* Y resolution 72 DPI is default */ IFD_Y_RESOLUTION = 0x011b, - /* 1 = no unit, 2 = inch, 3 = centimeter */ + /* 1 = no unit, 2 = inch (default), 3 = centimeter */ IFD_RESOLUTION_UNIT = 0x0128, - /* software */ + /* Software string. */ IFD_SOFTWARE = 0x0131, - /* date time */ + /* YYYY:MM:DD HH:MM:SS in 24 hours format */ IFD_DATE_TIME = 0x0132, - /* white point */ + /* White Point */ IFD_WHITE_POINT = 0x013e, - /* primary chromaticies */ + /* Primary Chromaticies */ IFD_PRIMARY_CHROMATICIES = 0x013f, - /* YCbCr coefficients */ + /* YCbCr Coefficients */ IFD_Y_CB_CR_COEFFICIENTS = 0x0211, - /* YCbCr positioning */ + /* YCbCr Positioning */ IFD_Y_CB_CR_POSITIONING = 0x0213, - /* reference black white */ + /* Reference Black White */ IFD_REFERENCE_BLACK_WHITE = 0x0214, - /* copyright */ + /* Copyright */ IFD_COPYRIGHT = 0x8298, - /* exif offset */ + /* Exif SubIFD Offset */ IFD_EXIF_OFFSET = 0x8769,
/* TAGs from Exif SubIFD */ @@ -150,6 +151,18 @@ enum IFD_tags { IFD_MAKER_NOTE = 0x927c, /* Comment */ IFD_USER_COMMENT = 0x9286, + + /* Stores FlashPix version, undefined, may be four ASCII numbers */ + IFD_FLASH_PIX_VERSION = 0xa000, + /* Unknown may be 1 */ + IFD_COLOR_SPACE = 0xa001, + /* Exif Image Width and Height */ + IFD_EXIF_IMAGE_WIDTH = 0xa002, + IFD_EXIF_IMAGE_HEIGHT = 0xa003, + /* May store related audio filename */ + IFD_RELATED_SOUND_FILE = 0xa004, + /* */ + };
struct IFD_tag { @@ -164,8 +177,8 @@ struct IFD_tag { static const struct IFD_tag IFD_tags[] = { /* TAGs from IFD0 */ {IFD_IMAGE_DESCRIPTION, "Image Description", IFD_ASCII_STRING, 0}, - {IFD_MAKE, "Camera Manufacturer", IFD_ASCII_STRING, 0}, - {IFD_MODEL, "Camera Model", IFD_ASCII_STRING, 0}, + {IFD_MAKE, "Make", IFD_ASCII_STRING, 0}, + {IFD_MODEL, "Model", IFD_ASCII_STRING, 0}, {IFD_ORIENTATION, "Orientation", IFD_UNSIGNED_SHORT, 1}, {IFD_X_RESOLUTION, "X Resolution", IFD_UNSIGNED_RATIONAL, 1}, {IFD_Y_RESOLUTION, "Y Resolution", IFD_UNSIGNED_RATIONAL, 1}, @@ -206,6 +219,12 @@ static const struct IFD_tag IFD_tags[] = { {IFD_FOCAL_LENGTH, "Focal Length", IFD_UNSIGNED_RATIONAL, 1}, {IFD_MAKER_NOTE, "Maker Note", IFD_UNDEFINED, 0}, {IFD_USER_COMMENT, "User Comment", IFD_UNDEFINED, 0}, + {IFD_FLASH_PIX_VERSION, "Flash Pix Version", IFD_UNDEFINED, 4}, + {IFD_COLOR_SPACE, "Color Space", IFD_UNSIGNED_SHORT, 1}, + /* these two may be short in some cases */ + {IFD_EXIF_IMAGE_WIDTH, "Exif Image Width", IFD_UNSIGNED_LONG, 1}, + {IFD_EXIF_IMAGE_HEIGHT, "Exif Image Height", IFD_UNSIGNED_LONG, 1}, + {IFD_RELATED_SOUND_FILE, "Related Soundfile", IFD_ASCII_STRING, 0}, };
static const char *IFD_format_name(uint16_t format) @@ -357,10 +376,12 @@ static void load_tag(GP_MetaData *self, void *buf, size_t buf_len, int swap, GP_DEBUG(1, "Unexpected tag '%s' num_components %u expected %u", res->name, num_comp, res->num_components); } + + const char *addr;
switch (format) { case IFD_ASCII_STRING: { - const char *addr = get_string(buf, buf_len, num_comp, &val); + addr = get_string(buf, buf_len, num_comp, &val);
if (addr == NULL) return; @@ -382,9 +403,24 @@ static void load_tag(GP_MetaData *self, void *buf, size_t buf_len, int swap, else goto unused; break; + case IFD_UNDEFINED: + switch (res->tag) { + case IFD_EXIF_VERSION: + case IFD_FLASH_PIX_VERSION: + addr = get_string(buf, buf_len, num_comp, &val); + + if (addr == NULL) + return; + + GP_MetaDataCreateString(self, res->name, addr, num_comp, 1); + break; + default: + goto unused; + } + break; unused: default: - GP_DEBUG(1, "Unused record '%s' format '%s' (0x%02x)", res->name, + GP_DEBUG(0, "Unused record '%s' format '%s' (0x%02x)", res->name, IFD_format_name(format), format); } }
http://repo.or.cz/w/gfxprim.git/commit/a97d1e9056b14aecb130f45368093a06c4b82...
commit a97d1e9056b14aecb130f45368093a06c4b82cf5 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jun 2 19:33:40 2012 +0200
loaders: MetaData: edhance printing rational numbers.
diff --git a/libs/loaders/GP_MetaData.c b/libs/loaders/GP_MetaData.c index 1a7ad93..a81480f 100644 --- a/libs/loaders/GP_MetaData.c +++ b/libs/loaders/GP_MetaData.c @@ -103,7 +103,8 @@ void GP_MetaDataPrint(GP_MetaData *self) printf("%in", rec->val.i); break; case GP_META_RATIONAL: - printf("%i/%in", rec->val.r.num, rec->val.r.den); + printf("%i/%i (%.4f)n", rec->val.r.num, rec->val.r.den, + (float)rec->val.r.num / rec->val.r.den); break; case GP_META_STRING: printf("'%s'n", rec->val.str);
-----------------------------------------------------------------------
Summary of changes: demos/c_simple/Makefile | 2 +- .../c_simple/{meta_data_png.c => meta_data_dump.c} | 6 +- include/loaders/GP_Loaders.h | 5 + libs/loaders/GP_Loaders.c | 44 +++++++++++ libs/loaders/GP_MetaData.c | 3 +- libs/loaders/GP_MetaExif.c | 78 ++++++++++++++----- 6 files changed, 112 insertions(+), 26 deletions(-) rename demos/c_simple/{meta_data_png.c => meta_data_dump.c} (94%)
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.