Extractor::MetadataProcessor
Constants
CALLBACK = ->(cls : ::Pointer(Void), plugin : ::Pointer(Char), type : MetaType, format : MetaFormat, mime_type : ::Pointer(Char), data : ::Pointer(Char), size : SizeT) do
callback = unbox(cls)
plugin_name = PLUGIN_NAMES[String.new(plugin)]
mime_type = String.new(mime_type)
value = case format
when MetaFormat::UTF8
String.new(Bytes.new(data, size - 1), "UTF-8")
when MetaFormat::C_STRING
String.new(Bytes.new(data, size - 1), "ASCII")
else
Bytes.new(data, size)
end
begin
callback.call(plugin_name, type, format, mime_type, value)
0
rescue Abort
1
end
end