Skip to content

Commit

Permalink
Mapped in all libexif functions, types and public Structs.
Browse files Browse the repository at this point in the history
  • Loading branch information
postmodern committed Sep 27, 2010
1 parent 977e6a5 commit 378b96f
Show file tree
Hide file tree
Showing 8 changed files with 436 additions and 16 deletions.
7 changes: 7 additions & 0 deletions lib/ffi/exif.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'ffi/exif/types'
require 'ffi/exif/exif'
require 'ffi/exif/content'
require 'ffi/exif/data'
require 'ffi/exif/entry'
require 'ffi/exif/rational'
require 'ffi/exif/srational'
12 changes: 12 additions & 0 deletions lib/ffi/exif/content.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module FFI
module EXIF
class Content < FFI::Struct

layout :entries, :pointer,
:count, :uint,
:parent, :pointer,
:priv, :pointer

end
end
end
14 changes: 14 additions & 0 deletions lib/ffi/exif/data.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
require 'ffi/exif/types'

module FFI
module EXIF
class Data < FFI::Struct

layout :ifd, [:pointer, EXIF.enum_type(:exif_ifd)[:count]],
:data, :pointer,
:size, :uint,
:priv, :pointer

end
end
end
17 changes: 17 additions & 0 deletions lib/ffi/exif/entry.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
require 'ffi/exif/types'

module FFI
module EXIF
class Entry < FFI::Struct

layout :tag, :exif_tag,
:format, :exif_format,
:components, :ulong,
:data, :pointer,
:size, :uint,
:parent, :pointer,
:priv, :pointer

end
end
end
143 changes: 127 additions & 16 deletions lib/ffi/exif/exif.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
require 'ffi/exif/types'
require 'ffi/exif/rational'
require 'ffi/exif/srational'

require 'ffi'

module FFI
Expand All @@ -6,22 +10,129 @@ module EXIF

ffi_lib 'exif'

enum :exif_format, [
:exif_format_byte, 1,
:exif_format_ascii, 2,
:exif_format_short, 3,
:exif_format_long, 4,
:exif_format_rational, 5,
:exif_format_sbyte, 6,
:exif_format_undefined, 7,
:exif_format_sshort, 8,
:exif_format_slong, 9,
:exif_format_srational, 10,
:exif_format_float, 11,
:exif_format_double, 12
]

attach_function :exif_format_get_name, [:exif_format], :pointer
attach_function :exif_format_get_name, [:exif_format], :string
attach_function :exif_format_get_size, [:exif_format], :uchar

attach_function :exif_ifd_get_name, [:exif_ifd], :pointer

attach_function :exif_data_new, [], :pointer
attach_function :exif_data_new_mem, [:pointer], :pointer
attach_function :exif_data_new_from_file, [:string], :pointer
attach_function :exif_data_new_from_data, [:pointer, :uint], :pointer
attach_function :exif_data_load_data, [:pointer, :pointer, :uint], :void
attach_function :exif_data_save_data, [:pointer, :pointer, :pointer], :void
attach_function :exif_data_ref, [:pointer], :void
attach_function :exif_data_unref, [:pointer], :void
attach_function :exif_data_free, [:pointer], :void
attach_function :exif_data_get_byte_order, [:pointer], :exif_byte_order
attach_function :exif_data_set_byte_order, [:pointer, :exif_byte_order], :void
attach_function :exif_data_get_mnote_data, [:pointer], :pointer
attach_function :exif_data_fix, [:pointer], :void
attach_function :exif_data_foreach_content, [:pointer, :exif_data_foreach_content_func, :pointer], :void
attach_function :exif_data_option_get_name, [:exif_data_option], :string
attach_function :exif_data_option_get_description, [:exif_data_option], :string
attach_function :exif_data_set_option, [:pointer, :exif_data_option], :void
attach_function :exif_data_unset_option, [:pointer, :exif_data_option], :void
attach_function :exif_data_set_data_type, [:pointer, :exif_data_type], :void
attach_function :exif_data_get_data_type, [:pointer], :exif_data_type
attach_function :exif_data_dump, [:pointer], :void
attach_function :exif_data_log, [:pointer, :pointer], :void

attach_function :exif_content_new, [], :pointer
attach_function :exif_content_new_mem, [:pointer], :pointer
attach_function :exif_content_ref, [:pointer], :void
attach_function :exif_content_unref, [:pointer], :void
attach_function :exif_content_free, [:pointer], :void
attach_function :exif_content_add_entry, [:pointer, :pointer], :void
attach_function :exif_content_remove_entry, [:pointer, :pointer], :void
attach_function :exif_content_get_entry, [:pointer, :exif_tag], :pointer
attach_function :exif_content_fix, [:pointer], :void
attach_function :exif_content_foreach_entry, [:pointer, :exif_content_foreach_entry_func, :pointer], :void
attach_function :exif_content_get_ifd, [:pointer], :exif_ifd
attach_function :exif_content_dump, [:pointer, :uint], :void
attach_function :exif_content_log, [:pointer, :pointer], :void

attach_function :exif_entry_new, [], :pointer
attach_function :exif_entry_new_mem, [:pointer], :pointer
attach_function :exif_entry_ref, [:pointer], :void
attach_function :exif_entry_unref, [:pointer], :void
attach_function :exif_entry_free, [:pointer], :void
attach_function :exif_entry_initialize, [:pointer, :exif_tag], :void
attach_function :exif_entry_fix, [:pointer], :void
attach_function :exif_entry_get_value, [:pointer, :pointer, :uint], :string
attach_function :exif_entry_dump, [:pointer, :uint], :void

attach_function :exif_tag_from_name, [:string], :exif_tag
attach_function :exif_tag_get_name_in_ifd, [:exif_tag, :exif_ifd], :string
attach_function :exif_tag_get_title_in_ifd, [:exif_tag, :exif_ifd], :string
attach_function :exif_tag_get_description_in_ifd, [:exif_tag, :exif_ifd], :string
attach_function :exif_tag_get_support_level_in_ifd, [:exif_tag, :exif_ifd, :exif_data_type], :exif_support_level
attach_function :exif_tag_get_name, [:exif_tag], :string
attach_function :exif_tag_get_title, [:exif_tag], :string
attach_function :exif_tag_get_description, [:exif_tag], :string
attach_function :exif_tag_table_get_tag, [:uint], :exif_tag
attach_function :exif_tag_table_get_name, [:uint], :string
attach_function :exif_tag_table_count, [], :uint

attach_function :exif_mnote_data_ref, [:pointer], :void
attach_function :exif_mnote_data_unref, [:pointer], :void
attach_function :exif_mnote_data_load, [:pointer, :pointer, :uint], :void
attach_function :exif_mnote_data_save, [:pointer, :pointer, :pointer], :void
attach_function :exif_mnote_data_count, [:pointer], :uint
attach_function :exif_mnote_data_get_id, [:pointer, :uint], :uint
attach_function :exif_mnote_data_get_name, [:pointer, :uint], :uint
attach_function :exif_mnote_data_get_title, [:pointer, :uint], :uint
attach_function :exif_mnote_data_get_description, [:pointer, :uint], :string
attach_function :exif_mnote_data_get_value, [:pointer, :uint, :pointer, :uint], :pointer
attach_function :exif_mnote_data_log, [:pointer, :pointer], :void

attach_function :exif_loader_new, [], :pointer
attach_function :exif_loader_new_mem, [:pointer], :pointer
attach_function :exif_loader_ref, [:pointer], :void
attach_function :exif_loader_unref, [:pointer], :void
attach_function :exif_loader_write_file, [:pointer, :string], :void
attach_function :exif_loader_write, [:pointer, :pointer, :uint], :uchar
attach_function :exif_loader_reset, [:pointer], :void
attach_function :exif_loader_get_data, [:pointer], :pointer
attach_function :exif_loader_get_buf, [:pointer, :pointer, :pointer], :void
attach_function :exif_loader_log, [:pointer, :pointer], :void

attach_function :exif_log_new, [], :pointer
attach_function :exif_log_new_mem, [:pointer], :pointer
attach_function :exif_log_ref, [:pointer], :void
attach_function :exif_log_unref, [:pointer], :void
attach_function :exif_log_free, [:pointer], :void
attach_function :exif_log_code_get_title, [:exif_log_code], :string
attach_function :exif_log_code_get_message, [:exif_log_code], :string
attach_function :exif_log_set_func, [:pointer, :exif_log_func, :pointer], :void

begin
attach_function :exif_log, [:pointer, :exif_log_code, :string, :string, :varargs], :void
rescue TypeError
def EXIF.exif_log(*arguments)
end
end

attach_function :exif_mem_new, [:exif_mem_alloc_func, :exif_mem_realloc_func, :exif_mem_free_func], :pointer
attach_function :exif_mem_ref, [:pointer], :void
attach_function :exif_mem_unref, [:pointer], :void
attach_function :exif_mem_alloc, [:pointer, :exif_long], :pointer
attach_function :exif_mem_realloc, [:pointer, :pointer, :exif_long], :pointer
attach_function :exif_mem_free, [:pointer, :pointer], :void
attach_function :exif_mem_new_default, [], :pointer

attach_function :exif_get_short, [:pointer, :exif_byte_order], :exif_short
attach_function :exif_get_sshort, [:pointer, :exif_byte_order], :exif_sshort
attach_function :exif_get_long, [:pointer, :exif_byte_order], :exif_long
attach_function :exif_get_slong, [:pointer, :exif_byte_order], :exif_slong
attach_function :exif_get_rational, [:pointer, :exif_byte_order], Rational
attach_function :exif_get_srational, [:pointer, :exif_byte_order], SRational

attach_function :exif_set_short, [:pointer, :exif_byte_order, :exif_short], :void
attach_function :exif_set_sshort, [:pointer, :exif_byte_order, :exif_sshort], :void
attach_function :exif_set_long, [:pointer, :exif_byte_order, :exif_long], :void
attach_function :exif_set_slong, [:pointer, :exif_byte_order, :exif_slong], :void
attach_function :exif_set_rational, [:pointer, :exif_byte_order, Rational], :void
attach_function :exif_set_srational, [:pointer, :exif_byte_order, SRational], :void
end
end
12 changes: 12 additions & 0 deletions lib/ffi/exif/rational.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'ffi/exif/types'

module FFI
module EXIF
class Rational < FFI::Struct

layout :numerator, :exif_long,
:denominator, :exif_long

end
end
end
12 changes: 12 additions & 0 deletions lib/ffi/exif/srational.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
require 'ffi/exif/types'

module FFI
module EXIF
class SRational < FFI::Struct

layout :numerator, :exif_slong,
:denominator, :exif_slong

end
end
end
Loading

0 comments on commit 378b96f

Please sign in to comment.