1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348
|
/* Copyright 2016 Software Freedom Conservancy Inc.
*
* This software is licensed under the GNU LGPL (version 2.1 or later).
* See the COPYING file in this distribution.
*/
[CCode (
cprefix = "Exif",
lower_case_cprefix="exif_"
)]
namespace Exif {
[CCode (
cname="ExifByteOrder",
cheader_filename="libexif/exif-byte-order.h",
cprefix="EXIF_BYTE_ORDER_"
)]
public enum ByteOrder {
INTEL,
MOTOROLA;
public unowned string get_name();
}
[Compact]
[CCode (
cname="ExifContent",
cheader_filename="libexif/exif-content.h",
ref_function="exif_content_ref",
ref_function_void=true,
unref_function="exif_content_unref",
free_function="exif_content_free"
)]
public class Content {
[CCode (cname="exif_content_new")]
public Content();
public void add_entry(Entry entry);
public void remove_entry(Entry entry);
public void dump(uint indent = 4);
public void foreach_entry(ForeachEntryFunc cb, void *user);
public unowned Entry get_entry(Tag tag);
public void fix();
public Ifd get_ifd();
public Entry **entries;
public int count;
public Data parent;
}
[CCode (
cheader_filename="libexif/exif-utils.h",
cprefix="exif_",
lower_case_cprefix="exif_"
)]
namespace Convert {
public static uint16 get_short(uchar *buffer, ByteOrder byteOrder);
public static int16 get_sshort(uchar *buffer, ByteOrder byteOrder);
public static uint32 get_long(uchar *buffer, ByteOrder byteOrder);
public static int32 get_slong(uchar *buffer, ByteOrder byteOrder);
public static Rational get_rational(uchar *buffer, ByteOrder byteOrder);
public static void set_short(uchar *buffer, ByteOrder byteOrder, uint16 val);
public static void set_sshort(uchar *buffer, ByteOrder byteOrder, int16 val);
public static void set_long(uchar *buffer, ByteOrder byteOrder, uint32 val);
public static void set_slong(uchar *buffer, ByteOrder byteOrder, int32 val);
}
[CCode (
cheader_filename="libexif/exif-content.h",
has_target=false,
cname="ExifContentForeachEntryFunc"
)]
public delegate void ForeachEntryFunc(Entry e, void *user);
[Compact]
[CCode (
cname="ExifData",
cheader_filename="libexif/exif-data.h",
ref_function="exif_data_ref",
ref_function_void=true,
unref_function="exif_data_unref",
free_function="exif_data_free"
)]
public class Data {
[CCode (cname="exif_data_new")]
public Data();
public static Data? new_from_file(string path);
public static Data? new_from_data([CCode (array_length_pos=1.1)]uint8[] data);
public void dump();
public void fix();
public void foreach_content(ForeachContentFunc cb, void *user = null);
public ByteOrder get_byte_order();
public DataType get_data_type();
public void load_data(uchar *buffer, uint size);
public void set_option(DataOption option);
public void unset_option(DataOption option);
public void save_data(uchar **buffer, uint *size);
public void set_data_type(DataType data_type);
// length is Exif.IFD_COUNT
public Content ifd[Exif.IFD_COUNT];
public uchar *data;
public uint size;
}
[CCode (
cheader_filename="libexif/exif-data.h",
has_target=false,
cname="ExifDataForeachContentFunc"
)]
public delegate void ForeachContentFunc(Content c, void *user);
[CCode (
cname="ExifDataOption",
cheader_filename="libexif/exif-data.h",
cprefix="EXIF_DATA_OPTION_"
)]
public enum DataOption {
IGNORE_UNKNOWN_TAGS,
FOLLOW_SPECIFICATION,
DONT_CHANGE_MAKER_NOTE;
public unowned string get_name();
public unowned string get_description();
}
[CCode (
cname="ExifDataType",
cheader_filename="libexif/exif-data-type.h",
cprefix="EXIF_DATA_TYPE_"
)]
public enum DataType {
UNCOMPRESSED_CHUNKY,
UNCOMPRESSED_PLANAR,
UNCOMPRESSED_YCC,
COMPRESSED;
public bool is_valid() {
switch (this) {
case UNCOMPRESSED_CHUNKY:
case UNCOMPRESSED_PLANAR:
case UNCOMPRESSED_YCC:
case COMPRESSED:
return true;
default:
return false;
}
}
}
[CCode (cname="EXIF_DATA_TYPE_COUNT")]
public const int DATA_TYPE_COUNT;
[Compact]
[CCode (
cname="ExifEntry",
cheader_filename="libexif/exif-entry.h",
ref_function="exif_entry_ref",
ref_function_void=true,
unref_function="exif_entry_unref"
)]
public class Entry {
[CCode (cname="exif_entry_new")]
public Entry();
public void dump(uint indent = 4);
public void initialize(Tag tag);
public void fix();
public unowned char* get_value(char *val, uint maxlen);
public string get_string() {
char[] buffer = new char[256];
get_value(buffer, 256);
GLib.StringBuilder builder = new GLib.StringBuilder();
foreach (char c in buffer)
builder.append_c(c);
return builder.str;
}
public Tag tag;
public Format format;
public ulong components;
public uchar *data;
public uint size;
public Content *parent;
}
[CCode (
cname="ExifFormat",
cheader_filename="libexif/exif-format.h",
cprefix="EXIF_FORMAT_"
)]
public enum Format {
BYTE,
ASCII,
SHORT,
LONG,
RATIONAL,
SBYTE,
UNDEFINED,
SSHORT,
SLONG,
SRATIONAL,
FLOAT,
DOUBLE;
public unowned string get_name();
public unowned uchar get_size();
}
[CCode (
cname="ExifIfd",
cheader_filename="libexif/exif-ifd.h",
cprefix="EXIF_IFD_"
)]
public enum Ifd {
[CCode (cname="EXIF_IFD_0")]
ZERO,
[CCode (cname="EXIF_IFD_1")]
ONE,
EXIF,
GPS,
INTEROPERABILITY;
public unowned string get_name();
}
[CCode (cname="EXIF_IFD_COUNT")]
public const int IFD_COUNT;
[Compact]
[CCode (
cname="ExifLoader",
cheader_filename="libexif/exif-loader.h",
ref_function="exif_loader_ref",
ref_function_void=true,
unref_function="exif_loader_unref",
free_function="exif_loader_free"
)]
public class Loader {
[CCode (cname="exif_loader_new")]
public Loader();
public void write_file(string fname);
public void reset();
public Data get_data();
}
// TODO: Flesh out Log functionality
[Compact]
[CCode (
cname="ExifLog",
cheader_filename="libexif/exif-loader.h",
ref_function="exif_log_ref",
ref_function_void=true,
unref_function="exif_log_unref",
free_function="exif_log_free"
)]
public class Log {
[CCode (cname="exif_log_new")]
public Log();
}
[CCode (
cname="ExifLogCode",
cheader_filename="libexif/exif-log.h",
cprefix="EXIF_LOG_CODE_"
)]
public enum LogCode {
NONE,
DEBUG,
NO_MEMORY,
CORRUPT_DATA;
public unowned string get_title();
public unowned string get_message();
}
[Compact]
[CCode (
cname="ExifMem",
cheader_filename="libexif/exif-mem.h",
ref_function="exif_mem_ref",
ref_function_void=true,
unref_function="exif_mem_unref"
)]
public class Mem {
public void *alloc(uint32 size);
public void *realloc(void *ptr, uint32 size);
public void free(void *ptr);
public static Mem new_default();
}
[SimpleType]
[CCode (
cname="ExifRational",
cheader_filename="libexif/exif-utils.h"
)]
public struct Rational {
uint32 numerator;
uint32 denominator;
}
[CCode (
cname="ExifSupportLevel",
cheader_filename="libexif/exif-tag.h",
cprefix="EXIF_SUPPORT_LEVEL_"
)]
public enum SupportLevel {
UNKNOWN,
NOT_RECORDED,
MANDATORY,
OPTIONAL
}
[CCode (
cname="ExifTag",
cheader_filename="libexif/exif-tag.h",
cprefix="EXIF_TAG_"
)]
public enum Tag {
PIXEL_X_DIMENSION,
PIXEL_Y_DIMENSION,
BITS_PER_SAMPLE,
DATE_TIME_ORIGINAL,
ORIENTATION,
RELATED_IMAGE_WIDTH,
RELATED_IMAGE_LENGTH,
EXPOSURE_TIME,
FNUMBER,
ISO_SPEED_RATINGS,
MAKE,
MODEL,
FLASH,
FOCAL_LENGTH,
GPS_LATITUDE,
GPS_LATITUDE_REF,
GPS_LONGITUDE,
GPS_LONGITUDE_REF,
ARTIST,
COPYRIGHT,
SOFTWARE,
IMAGE_DESCRIPTION;
public unowned string get_name_in_ifd(Ifd ifd);
public unowned string get_title_in_ifd(Ifd ifd);
public unowned string get_description_in_ifd(Ifd ifd);
public SupportLevel get_support_level_in_ifd(Ifd ifd, DataType data_type);
}
}
|