void exif_content_fix (ExifContent *c) { ExifIfd ifd = exif_content_get_ifd (c); ExifDataType dt; ExifEntry *e; unsigned int i, num; if (!c) return; dt = exif_data_get_data_type (c->parent); /* * First of all, fix all existing entries. */ exif_content_foreach_entry (c, fix_func, NULL); /* * Go through each tag and if it's not recorded, remove it. If one * is removed, exif_content_foreach_entry() will skip the next entry, * so if this happens do the loop again from the beginning to ensure * they're all checked. This could be avoided if we stop relying on * exif_content_foreach_entry but loop intelligently here. */ do { num = c->count; exif_content_foreach_entry (c, remove_not_recorded, NULL); } while (num != c->count); /* * Then check for non-existing mandatory tags and create them if needed */ num = exif_tag_table_count(); for (i = 0; i < num; ++i) { const ExifTag t = exif_tag_table_get_tag (i); if (exif_tag_get_support_level_in_ifd (t, ifd, dt) == EXIF_SUPPORT_LEVEL_MANDATORY) { if (exif_content_get_entry (c, t)) /* This tag already exists */ continue; exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content", "Tag '%s' is mandatory in IFD '%s' and has therefore been added.", exif_tag_get_name_in_ifd (t, ifd), exif_ifd_get_name (ifd)); e = exif_entry_new (); exif_content_add_entry (c, e); exif_entry_initialize (e, t); exif_entry_unref (e); } } }
static void show_ifd( ExifContent *content, void *client ) { int *ifd = (int *) client; printf( "- ifd %d\n", *ifd ); exif_content_foreach_entry( content, show_entry, client ); *ifd += 1; }
static void analyzer_jpeg_exif_content_process(ExifContent *content, void *pload) { ExifIfd ifd = exif_content_get_ifd(content); // Don't parse IFD_1 which is the thumbnail IFD and the interop one which holds no interesting data if (ifd == EXIF_IFD_1 || ifd == EXIF_IFD_INTEROPERABILITY) return; exif_content_foreach_entry(content, analyzer_jpeg_exif_entry_analyze, pload); }
static void vips_exif_exif_content( ExifContent *content, VipsExifRemove *ve ) { ve->content = content; ve->to_remove = NULL; exif_content_foreach_entry( content, (ExifContentForeachEntryFunc) vips_exif_exif_entry, ve ); vips_slist_map2( ve->to_remove, (VipsSListMap2Fn) vips_exif_exif_remove, ve, NULL ); VIPS_FREEF( g_slist_free, ve->to_remove ); }
void exif_content_fix (ExifContent *c) { ExifIfd ifd = exif_content_get_ifd (c); ExifDataType dt; ExifEntry *e; unsigned int i, num; if (!c) return; dt = exif_data_get_data_type (c->parent); exif_content_foreach_entry (c, fix_func, NULL); do { num = c->count; exif_content_foreach_entry (c, remove_not_recorded, NULL); } while (num != c->count); num = exif_tag_table_count(); for (i = 0; i < num; ++i) { const ExifTag t = exif_tag_table_get_tag (i); if (exif_tag_get_support_level_in_ifd (t, ifd, dt) == EXIF_SUPPORT_LEVEL_MANDATORY) { if (exif_content_get_entry (c, t)) continue; exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content", "Tag '%s' is mandatory in IFD '%s' and has therefore been added.", exif_tag_get_name_in_ifd (t, ifd), exif_ifd_get_name (ifd)); e = exif_entry_new (); exif_content_add_entry (c, e); exif_entry_initialize (e, t); exif_entry_unref (e); } } }
static void metadataparse_exif_data_foreach_content_func (ExifContent * content, void *user_data) { ExifIfd ifd = exif_content_get_ifd (content); if (ifd == EXIF_IFD_0 || ifd == EXIF_IFD_EXIF || ifd == EXIF_IFD_GPS) { GST_LOG ("\n Content %p: %s (ifd=%d)", content, exif_ifd_get_name (ifd), ifd); exif_content_foreach_entry (content, metadataparse_exif_content_foreach_entry_func, user_data); } }
void exif_content_fix (ExifContent *c) { ExifIfd ifd = exif_content_get_ifd (c); ExifDataType dt; ExifTag t; ExifEntry *e; if (!c) return; dt = exif_data_get_data_type (c->parent); /* First of all, fix all existing entries. */ exif_content_foreach_entry (c, fix_func, NULL); /* * Then check for existing tags that are not allowed and for * non-existing mandatory tags. */ for (t = 0; t <= 0xffff; t++) { switch (exif_tag_get_support_level_in_ifd (t, ifd, dt)) { case EXIF_SUPPORT_LEVEL_MANDATORY: if (exif_content_get_entry (c, t)) break; exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content", "Tag '%s' is mandatory in IFD '%s' and has therefore been added.", exif_tag_get_name_in_ifd (t, ifd), exif_ifd_get_name (ifd)); e = exif_entry_new (); exif_content_add_entry (c, e); exif_entry_initialize (e, t); exif_entry_unref (e); break; case EXIF_SUPPORT_LEVEL_NOT_RECORDED: e = exif_content_get_entry (c, t); if (!e) break; exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content", "Tag '%s' is not recoreded in IFD '%s' and has therefore been " "removed.", exif_tag_get_name_in_ifd (t, ifd), exif_ifd_get_name (ifd)); exif_content_remove_entry (c, e); break; case EXIF_SUPPORT_LEVEL_OPTIONAL: default: break; } } }
static void load_exif_tags( ExifData * ed , JSON::Object & tags ) { tplog2( " LOADING EXIF TAGS" ); exif_data_set_option( ed , EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS ); exif_data_set_option( ed , EXIF_DATA_OPTION_FOLLOW_SPECIFICATION ); exif_data_fix( ed ); ExifClosure closure; closure.exif_data = ed; closure.tags = & tags; for ( int i = 0; i < EXIF_IFD_COUNT; ++i ) { if ( ExifContent * c = ed->ifd[i] ) { exif_content_foreach_entry( c , foreach_exif_entry , & closure ); } } tplog2( " LOADED EXIF TAGS" ); }
static void vips_exif_get_content( ExifContent *content, VipsExifParams *params ) { exif_content_foreach_entry( content, (ExifContentForeachEntryFunc) vips_exif_attach_entry, params ); }
static void exif_content_cb (ExifContent *content, gpointer data) { exif_content_foreach_entry (content, exif_entry_cb, data); }
static void attach_exif_content( ExifContent *content, VipsExif *ve ) { exif_content_foreach_entry( content, (ExifContentForeachEntryFunc) attach_exif_entry, ve ); }
static void attach_exif_content( ExifContent *content, IMAGE *im ) { exif_content_foreach_entry( content, (ExifContentForeachEntryFunc) attach_exif_entry, im ); }
static void show_ifd( ExifContent *content, void *client ) { exif_content_foreach_entry( content, show_entry, client ); printf( "-\n" ); }
static int Centries (lua_State *L) { /** content:entries() */ ExifContent *content = checkcontent(L); lua_newtable(L); exif_content_foreach_entry(content, entryfunc, (void *)L); return 1; }
static void parse_exif_ifd(ExifContent * content, void *data) { exif_content_foreach_entry(content, parse_exif_entry, data); }