/* WebPSupport.c generated by valac 0.56.19, the Vala compiler
 * generated from WebPSupport.vala, do not modify */

/* 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.
 */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "metadata.h"
#include <gio/gio.h>
#include <glib/gi18n-lib.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <webp/decode.h>
#include <webp/demux.h>
#include <glib/gstdio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TYPE_PHOTO_FILE_FORMAT_DRIVER (photo_file_format_driver_get_type ())
#define PHOTO_FILE_FORMAT_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_FORMAT_DRIVER, PhotoFileFormatDriver))
#define PHOTO_FILE_FORMAT_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_FORMAT_DRIVER, PhotoFileFormatDriverClass))
#define IS_PHOTO_FILE_FORMAT_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_FORMAT_DRIVER))
#define IS_PHOTO_FILE_FORMAT_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_FORMAT_DRIVER))
#define PHOTO_FILE_FORMAT_DRIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_FORMAT_DRIVER, PhotoFileFormatDriverClass))

typedef struct _PhotoFileFormatDriver PhotoFileFormatDriver;
typedef struct _PhotoFileFormatDriverClass PhotoFileFormatDriverClass;
typedef struct _PhotoFileFormatDriverPrivate PhotoFileFormatDriverPrivate;

#define TYPE_PHOTO_FILE_FORMAT_PROPERTIES (photo_file_format_properties_get_type ())
#define PHOTO_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatProperties))
#define PHOTO_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatPropertiesClass))
#define IS_PHOTO_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES))
#define IS_PHOTO_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_FORMAT_PROPERTIES))
#define PHOTO_FILE_FORMAT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatPropertiesClass))

typedef struct _PhotoFileFormatProperties PhotoFileFormatProperties;
typedef struct _PhotoFileFormatPropertiesClass PhotoFileFormatPropertiesClass;

#define TYPE_PHOTO_FILE_ADAPTER (photo_file_adapter_get_type ())
#define PHOTO_FILE_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapter))
#define PHOTO_FILE_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapterClass))
#define IS_PHOTO_FILE_ADAPTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_ADAPTER))
#define IS_PHOTO_FILE_ADAPTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_ADAPTER))
#define PHOTO_FILE_ADAPTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapterClass))

typedef struct _PhotoFileAdapter PhotoFileAdapter;
typedef struct _PhotoFileAdapterClass PhotoFileAdapterClass;

#define TYPE_PHOTO_FILE_READER (photo_file_reader_get_type ())
#define PHOTO_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_READER, PhotoFileReader))
#define PHOTO_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_READER, PhotoFileReaderClass))
#define IS_PHOTO_FILE_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_READER))
#define IS_PHOTO_FILE_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_READER))
#define PHOTO_FILE_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_READER, PhotoFileReaderClass))

typedef struct _PhotoFileReader PhotoFileReader;
typedef struct _PhotoFileReaderClass PhotoFileReaderClass;

#define TYPE_PHOTO_METADATA (photo_metadata_get_type ())
#define PHOTO_METADATA(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_METADATA, PhotoMetadata))
#define PHOTO_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_METADATA, PhotoMetadataClass))
#define IS_PHOTO_METADATA(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_METADATA))
#define IS_PHOTO_METADATA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_METADATA))
#define PHOTO_METADATA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_METADATA, PhotoMetadataClass))

typedef struct _PhotoMetadata PhotoMetadata;
typedef struct _PhotoMetadataClass PhotoMetadataClass;

#define TYPE_PHOTO_FILE_WRITER (photo_file_writer_get_type ())
#define PHOTO_FILE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_WRITER, PhotoFileWriter))
#define PHOTO_FILE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_WRITER, PhotoFileWriterClass))
#define IS_PHOTO_FILE_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_WRITER))
#define IS_PHOTO_FILE_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_WRITER))
#define PHOTO_FILE_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_WRITER, PhotoFileWriterClass))

typedef struct _PhotoFileWriter PhotoFileWriter;
typedef struct _PhotoFileWriterClass PhotoFileWriterClass;

#define TYPE_PHOTO_FILE_METADATA_WRITER (photo_file_metadata_writer_get_type ())
#define PHOTO_FILE_METADATA_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_METADATA_WRITER, PhotoFileMetadataWriter))
#define PHOTO_FILE_METADATA_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_METADATA_WRITER, PhotoFileMetadataWriterClass))
#define IS_PHOTO_FILE_METADATA_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_METADATA_WRITER))
#define IS_PHOTO_FILE_METADATA_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_METADATA_WRITER))
#define PHOTO_FILE_METADATA_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_METADATA_WRITER, PhotoFileMetadataWriterClass))

typedef struct _PhotoFileMetadataWriter PhotoFileMetadataWriter;
typedef struct _PhotoFileMetadataWriterClass PhotoFileMetadataWriterClass;
typedef enum  {
	PHOTO_FILE_SNIFFER_OPTIONS_GET_ALL = 0x00000000,
	PHOTO_FILE_SNIFFER_OPTIONS_NO_MD5 = 0x00000001
} PhotoFileSnifferOptions;

#define PHOTO_FILE_SNIFFER_TYPE_OPTIONS (photo_file_sniffer_options_get_type ())

#define TYPE_PHOTO_FILE_SNIFFER (photo_file_sniffer_get_type ())
#define PHOTO_FILE_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer))
#define PHOTO_FILE_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_PHOTO_FILE_SNIFFER, PhotoFileSnifferClass))
#define IS_PHOTO_FILE_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_PHOTO_FILE_SNIFFER))
#define IS_PHOTO_FILE_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_PHOTO_FILE_SNIFFER))
#define PHOTO_FILE_SNIFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_PHOTO_FILE_SNIFFER, PhotoFileSnifferClass))

typedef struct _PhotoFileSniffer PhotoFileSniffer;
typedef struct _PhotoFileSnifferClass PhotoFileSnifferClass;

#define PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER (photos_webp_file_format_driver_get_type ())
#define PHOTOS_WEBP_FILE_FORMAT_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver))
#define PHOTOS_WEBP_FILE_FORMAT_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriverClass))
#define PHOTOS_IS_WEBP_FILE_FORMAT_DRIVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER))
#define PHOTOS_IS_WEBP_FILE_FORMAT_DRIVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER))
#define PHOTOS_WEBP_FILE_FORMAT_DRIVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriverClass))

typedef struct _PhotosWebpFileFormatDriver PhotosWebpFileFormatDriver;
typedef struct _PhotosWebpFileFormatDriverClass PhotosWebpFileFormatDriverClass;
typedef struct _PhotosWebpFileFormatDriverPrivate PhotosWebpFileFormatDriverPrivate;
#define _photo_file_format_driver_unref0(var) ((var == NULL) ? NULL : (var = (photo_file_format_driver_unref (var), NULL)))

#define PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES (photos_webp_file_format_properties_get_type ())
#define PHOTOS_WEBP_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties))
#define PHOTOS_WEBP_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatPropertiesClass))
#define PHOTOS_IS_WEBP_FILE_FORMAT_PROPERTIES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES))
#define PHOTOS_IS_WEBP_FILE_FORMAT_PROPERTIES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES))
#define PHOTOS_WEBP_FILE_FORMAT_PROPERTIES_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatPropertiesClass))

typedef struct _PhotosWebpFileFormatProperties PhotosWebpFileFormatProperties;
typedef struct _PhotosWebpFileFormatPropertiesClass PhotosWebpFileFormatPropertiesClass;

#define PHOTOS_TYPE_WEBP_READER (photos_webp_reader_get_type ())
#define PHOTOS_WEBP_READER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHOTOS_TYPE_WEBP_READER, PhotosWebpReader))
#define PHOTOS_WEBP_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHOTOS_TYPE_WEBP_READER, PhotosWebpReaderClass))
#define PHOTOS_IS_WEBP_READER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHOTOS_TYPE_WEBP_READER))
#define PHOTOS_IS_WEBP_READER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHOTOS_TYPE_WEBP_READER))
#define PHOTOS_WEBP_READER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHOTOS_TYPE_WEBP_READER, PhotosWebpReaderClass))

typedef struct _PhotosWebpReader PhotosWebpReader;
typedef struct _PhotosWebpReaderClass PhotosWebpReaderClass;

#define PHOTOS_TYPE_WEBP_METADATA_WRITER (photos_webp_metadata_writer_get_type ())
#define PHOTOS_WEBP_METADATA_WRITER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHOTOS_TYPE_WEBP_METADATA_WRITER, PhotosWebpMetadataWriter))
#define PHOTOS_WEBP_METADATA_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHOTOS_TYPE_WEBP_METADATA_WRITER, PhotosWebpMetadataWriterClass))
#define PHOTOS_IS_WEBP_METADATA_WRITER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHOTOS_TYPE_WEBP_METADATA_WRITER))
#define PHOTOS_IS_WEBP_METADATA_WRITER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHOTOS_TYPE_WEBP_METADATA_WRITER))
#define PHOTOS_WEBP_METADATA_WRITER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHOTOS_TYPE_WEBP_METADATA_WRITER, PhotosWebpMetadataWriterClass))

typedef struct _PhotosWebpMetadataWriter PhotosWebpMetadataWriter;
typedef struct _PhotosWebpMetadataWriterClass PhotosWebpMetadataWriterClass;

#define PHOTOS_TYPE_WEBP_SNIFFER (photos_webp_sniffer_get_type ())
#define PHOTOS_WEBP_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PHOTOS_TYPE_WEBP_SNIFFER, PhotosWebpSniffer))
#define PHOTOS_WEBP_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PHOTOS_TYPE_WEBP_SNIFFER, PhotosWebpSnifferClass))
#define PHOTOS_IS_WEBP_SNIFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PHOTOS_TYPE_WEBP_SNIFFER))
#define PHOTOS_IS_WEBP_SNIFFER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PHOTOS_TYPE_WEBP_SNIFFER))
#define PHOTOS_WEBP_SNIFFER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PHOTOS_TYPE_WEBP_SNIFFER, PhotosWebpSnifferClass))

typedef struct _PhotosWebpSniffer PhotosWebpSniffer;
typedef struct _PhotosWebpSnifferClass PhotosWebpSnifferClass;
typedef struct _PhotoFileFormatPropertiesPrivate PhotoFileFormatPropertiesPrivate;
typedef enum  {
	PHOTO_FILE_FORMAT_JFIF,
	PHOTO_FILE_FORMAT_RAW,
	PHOTO_FILE_FORMAT_PNG,
	PHOTO_FILE_FORMAT_TIFF,
	PHOTO_FILE_FORMAT_BMP,
	PHOTO_FILE_FORMAT_GIF,
	PHOTO_FILE_FORMAT_WEBP,
	PHOTO_FILE_FORMAT_AVIF,
	PHOTO_FILE_FORMAT_HEIF,
	PHOTO_FILE_FORMAT_JPEGXL,
	PHOTO_FILE_FORMAT_UNKNOWN
} PhotoFileFormat;

#define TYPE_PHOTO_FILE_FORMAT (photo_file_format_get_type ())
typedef enum  {
	PHOTO_FILE_FORMAT_FLAGS_NONE = 0x00000000
} PhotoFileFormatFlags;

#define TYPE_PHOTO_FILE_FORMAT_FLAGS (photo_file_format_flags_get_type ())
typedef struct _PhotosWebpFileFormatPropertiesPrivate PhotosWebpFileFormatPropertiesPrivate;
#define _photo_file_format_properties_unref0(var) ((var == NULL) ? NULL : (var = (photo_file_format_properties_unref (var), NULL)))
typedef struct _PhotoFileSnifferPrivate PhotoFileSnifferPrivate;

#define TYPE_DETECTED_PHOTO_INFORMATION (detected_photo_information_get_type ())
#define DETECTED_PHOTO_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_DETECTED_PHOTO_INFORMATION, DetectedPhotoInformation))
#define DETECTED_PHOTO_INFORMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_DETECTED_PHOTO_INFORMATION, DetectedPhotoInformationClass))
#define IS_DETECTED_PHOTO_INFORMATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_DETECTED_PHOTO_INFORMATION))
#define IS_DETECTED_PHOTO_INFORMATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_DETECTED_PHOTO_INFORMATION))
#define DETECTED_PHOTO_INFORMATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_DETECTED_PHOTO_INFORMATION, DetectedPhotoInformationClass))

typedef struct _DetectedPhotoInformation DetectedPhotoInformation;
typedef struct _DetectedPhotoInformationClass DetectedPhotoInformationClass;
typedef struct _PhotosWebpSnifferPrivate PhotosWebpSnifferPrivate;
#define _detected_photo_information_unref0(var) ((var == NULL) ? NULL : (var = (detected_photo_information_unref (var), NULL)))
#define _g_checksum_free0(var) ((var == NULL) ? NULL : (var = (g_checksum_free (var), NULL)))
typedef struct _DetectedPhotoInformationPrivate DetectedPhotoInformationPrivate;

#define TYPE_DIMENSIONS (dimensions_get_type ())
typedef struct _Dimensions Dimensions;
#define _media_metadata_unref0(var) ((var == NULL) ? NULL : (var = (media_metadata_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_byte_array_unref0(var) ((var == NULL) ? NULL : (var = (g_byte_array_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _WebPDemuxDelete0(var) ((var == NULL) ? NULL : (var = (WebPDemuxDelete (var), NULL)))
typedef struct _PhotoFileAdapterPrivate PhotoFileAdapterPrivate;
typedef struct _PhotoFileReaderPrivate PhotoFileReaderPrivate;
typedef struct _PhotosWebpReaderPrivate PhotosWebpReaderPrivate;
typedef struct _PhotoFileMetadataWriterPrivate PhotoFileMetadataWriterPrivate;
typedef struct _PhotosWebpMetadataWriterPrivate PhotosWebpMetadataWriterPrivate;

struct _PhotoFileFormatDriver {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PhotoFileFormatDriverPrivate * priv;
};

struct _PhotoFileFormatDriverClass {
	GTypeClass parent_class;
	void (*finalize) (PhotoFileFormatDriver *self);
	PhotoFileFormatProperties* (*get_properties) (PhotoFileFormatDriver* self);
	PhotoFileReader* (*create_reader) (PhotoFileFormatDriver* self, const gchar* filepath);
	PhotoMetadata* (*create_metadata) (PhotoFileFormatDriver* self);
	gboolean (*can_write_image) (PhotoFileFormatDriver* self);
	gboolean (*can_write_metadata) (PhotoFileFormatDriver* self);
	PhotoFileWriter* (*create_writer) (PhotoFileFormatDriver* self, const gchar* filepath);
	PhotoFileMetadataWriter* (*create_metadata_writer) (PhotoFileFormatDriver* self, const gchar* filepath);
	PhotoFileSniffer* (*create_sniffer) (PhotoFileFormatDriver* self, GFile* file, PhotoFileSnifferOptions options);
};

struct _PhotosWebpFileFormatDriver {
	PhotoFileFormatDriver parent_instance;
	PhotosWebpFileFormatDriverPrivate * priv;
};

struct _PhotosWebpFileFormatDriverClass {
	PhotoFileFormatDriverClass parent_class;
};

struct _PhotoFileFormatProperties {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PhotoFileFormatPropertiesPrivate * priv;
};

struct _PhotoFileFormatPropertiesClass {
	GTypeClass parent_class;
	void (*finalize) (PhotoFileFormatProperties *self);
	PhotoFileFormat (*get_file_format) (PhotoFileFormatProperties* self);
	PhotoFileFormatFlags (*get_flags) (PhotoFileFormatProperties* self);
	gboolean (*is_recognized_extension) (PhotoFileFormatProperties* self, const gchar* ext);
	gchar* (*get_default_extension) (PhotoFileFormatProperties* self);
	gchar** (*get_known_extensions) (PhotoFileFormatProperties* self, gint* result_length1);
	gchar* (*get_default_mime_type) (PhotoFileFormatProperties* self);
	gchar** (*get_mime_types) (PhotoFileFormatProperties* self, gint* result_length1);
	gchar* (*get_user_visible_name) (PhotoFileFormatProperties* self);
};

struct _PhotosWebpFileFormatProperties {
	PhotoFileFormatProperties parent_instance;
	PhotosWebpFileFormatPropertiesPrivate * priv;
};

struct _PhotosWebpFileFormatPropertiesClass {
	PhotoFileFormatPropertiesClass parent_class;
};

struct _PhotoFileSniffer {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PhotoFileSnifferPrivate * priv;
	GFile* file;
	PhotoFileSnifferOptions options;
	gboolean calc_md5;
};

struct _PhotoFileSnifferClass {
	GTypeClass parent_class;
	void (*finalize) (PhotoFileSniffer *self);
	DetectedPhotoInformation* (*sniff) (PhotoFileSniffer* self, gboolean* is_corrupted, GError** error);
};

struct _PhotosWebpSniffer {
	PhotoFileSniffer parent_instance;
	PhotosWebpSnifferPrivate * priv;
};

struct _PhotosWebpSnifferClass {
	PhotoFileSnifferClass parent_class;
};

struct _PhotosWebpSnifferPrivate {
	DetectedPhotoInformation* detected;
};

struct _Dimensions {
	gint width;
	gint height;
};

struct _DetectedPhotoInformation {
	GTypeInstance parent_instance;
	volatile int ref_count;
	DetectedPhotoInformationPrivate * priv;
	PhotoFileFormat file_format;
	PhotoMetadata* metadata;
	gchar* md5;
	gchar* exif_md5;
	gchar* thumbnail_md5;
	gchar* format_name;
	Dimensions image_dim;
	GdkColorspace colorspace;
	gint channels;
	gint bits_per_channel;
};

struct _DetectedPhotoInformationClass {
	GTypeClass parent_class;
	void (*finalize) (DetectedPhotoInformation *self);
};

struct _PhotoFileAdapter {
	GTypeInstance parent_instance;
	volatile int ref_count;
	PhotoFileAdapterPrivate * priv;
};

struct _PhotoFileAdapterClass {
	GTypeClass parent_class;
	void (*finalize) (PhotoFileAdapter *self);
};

struct _PhotoFileReader {
	PhotoFileAdapter parent_instance;
	PhotoFileReaderPrivate * priv;
};

struct _PhotoFileReaderClass {
	PhotoFileAdapterClass parent_class;
	PhotoMetadata* (*read_metadata) (PhotoFileReader* self, GError** error);
	GdkPixbuf* (*unscaled_read) (PhotoFileReader* self, GError** error);
	GdkPixbuf* (*scaled_read) (PhotoFileReader* self, Dimensions* full, Dimensions* scaled, GError** error);
};

struct _PhotosWebpReader {
	PhotoFileReader parent_instance;
	PhotosWebpReaderPrivate * priv;
};

struct _PhotosWebpReaderClass {
	PhotoFileReaderClass parent_class;
};

struct _PhotoFileMetadataWriter {
	PhotoFileAdapter parent_instance;
	PhotoFileMetadataWriterPrivate * priv;
};

struct _PhotoFileMetadataWriterClass {
	PhotoFileAdapterClass parent_class;
	void (*write_metadata) (PhotoFileMetadataWriter* self, PhotoMetadata* metadata, GError** error);
};

struct _PhotosWebpMetadataWriter {
	PhotoFileMetadataWriter parent_instance;
	PhotosWebpMetadataWriterPrivate * priv;
};

struct _PhotosWebpMetadataWriterClass {
	PhotoFileMetadataWriterClass parent_class;
};

static gpointer photos_webp_file_format_driver_parent_class = NULL;
static PhotosWebpFileFormatDriver* photos_webp_file_format_driver_instance;
static PhotosWebpFileFormatDriver* photos_webp_file_format_driver_instance = NULL;
static gpointer photos_webp_file_format_properties_parent_class = NULL;
static gchar** photos_webp_file_format_properties_KNOWN_EXTENSIONS;
static gint photos_webp_file_format_properties_KNOWN_EXTENSIONS_length1;
static gchar** photos_webp_file_format_properties_KNOWN_EXTENSIONS = NULL;
static gint photos_webp_file_format_properties_KNOWN_EXTENSIONS_length1 = 0;
static gint _photos_webp_file_format_properties_KNOWN_EXTENSIONS_size_ = 0;
static gchar** photos_webp_file_format_properties_KNOWN_MIME_TYPES;
static gint photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1;
static gchar** photos_webp_file_format_properties_KNOWN_MIME_TYPES = NULL;
static gint photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1 = 0;
static gint _photos_webp_file_format_properties_KNOWN_MIME_TYPES_size_ = 0;
static PhotosWebpFileFormatProperties* photos_webp_file_format_properties_instance;
static PhotosWebpFileFormatProperties* photos_webp_file_format_properties_instance = NULL;
static gint PhotosWebpSniffer_private_offset;
static gpointer photos_webp_sniffer_parent_class = NULL;
static gpointer photos_webp_reader_parent_class = NULL;
static gpointer photos_webp_metadata_writer_parent_class = NULL;

VALA_EXTERN gpointer photo_file_format_driver_ref (gpointer instance);
VALA_EXTERN void photo_file_format_driver_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_photo_file_format_driver (const gchar* name,
                                                 const gchar* nick,
                                                 const gchar* blurb,
                                                 GType object_type,
                                                 GParamFlags flags);
VALA_EXTERN void value_set_photo_file_format_driver (GValue* value,
                                         gpointer v_object);
VALA_EXTERN void value_take_photo_file_format_driver (GValue* value,
                                          gpointer v_object);
VALA_EXTERN gpointer value_get_photo_file_format_driver (const GValue* value);
VALA_EXTERN GType photo_file_format_driver_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileFormatDriver, photo_file_format_driver_unref)
VALA_EXTERN gpointer photo_file_format_properties_ref (gpointer instance);
VALA_EXTERN void photo_file_format_properties_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_photo_file_format_properties (const gchar* name,
                                                     const gchar* nick,
                                                     const gchar* blurb,
                                                     GType object_type,
                                                     GParamFlags flags);
VALA_EXTERN void value_set_photo_file_format_properties (GValue* value,
                                             gpointer v_object);
VALA_EXTERN void value_take_photo_file_format_properties (GValue* value,
                                              gpointer v_object);
VALA_EXTERN gpointer value_get_photo_file_format_properties (const GValue* value);
VALA_EXTERN GType photo_file_format_properties_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileFormatProperties, photo_file_format_properties_unref)
VALA_EXTERN gpointer photo_file_adapter_ref (gpointer instance);
VALA_EXTERN void photo_file_adapter_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_photo_file_adapter (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags);
VALA_EXTERN void value_set_photo_file_adapter (GValue* value,
                                   gpointer v_object);
VALA_EXTERN void value_take_photo_file_adapter (GValue* value,
                                    gpointer v_object);
VALA_EXTERN gpointer value_get_photo_file_adapter (const GValue* value);
VALA_EXTERN GType photo_file_adapter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileAdapter, photo_file_adapter_unref)
VALA_EXTERN GType photo_file_reader_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileReader, photo_file_adapter_unref)
VALA_EXTERN GType photo_metadata_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoMetadata, media_metadata_unref)
VALA_EXTERN GType photo_file_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileWriter, photo_file_adapter_unref)
VALA_EXTERN GType photo_file_metadata_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileMetadataWriter, photo_file_adapter_unref)
VALA_EXTERN GType photo_file_sniffer_options_get_type (void) G_GNUC_CONST ;
VALA_EXTERN gpointer photo_file_sniffer_ref (gpointer instance);
VALA_EXTERN void photo_file_sniffer_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_photo_file_sniffer (const gchar* name,
                                           const gchar* nick,
                                           const gchar* blurb,
                                           GType object_type,
                                           GParamFlags flags);
VALA_EXTERN void value_set_photo_file_sniffer (GValue* value,
                                   gpointer v_object);
VALA_EXTERN void value_take_photo_file_sniffer (GValue* value,
                                    gpointer v_object);
VALA_EXTERN gpointer value_get_photo_file_sniffer (const GValue* value);
VALA_EXTERN GType photo_file_sniffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotoFileSniffer, photo_file_sniffer_unref)
VALA_EXTERN GType photos_webp_file_format_driver_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosWebpFileFormatDriver, photo_file_format_driver_unref)
VALA_EXTERN PhotoFileFormatProperties* photo_file_format_driver_get_properties (PhotoFileFormatDriver* self);
VALA_EXTERN PhotoFileReader* photo_file_format_driver_create_reader (PhotoFileFormatDriver* self,
                                                         const gchar* filepath);
VALA_EXTERN PhotoMetadata* photo_file_format_driver_create_metadata (PhotoFileFormatDriver* self);
VALA_EXTERN gboolean photo_file_format_driver_can_write_image (PhotoFileFormatDriver* self);
VALA_EXTERN gboolean photo_file_format_driver_can_write_metadata (PhotoFileFormatDriver* self);
VALA_EXTERN PhotoFileWriter* photo_file_format_driver_create_writer (PhotoFileFormatDriver* self,
                                                         const gchar* filepath);
VALA_EXTERN PhotoFileMetadataWriter* photo_file_format_driver_create_metadata_writer (PhotoFileFormatDriver* self,
                                                                          const gchar* filepath);
VALA_EXTERN PhotoFileSniffer* photo_file_format_driver_create_sniffer (PhotoFileFormatDriver* self,
                                                           GFile* file,
                                                           PhotoFileSnifferOptions options);
VALA_EXTERN void photos_webp_file_format_driver_init (void);
VALA_EXTERN PhotosWebpFileFormatDriver* photos_webp_file_format_driver_new (void);
VALA_EXTERN PhotosWebpFileFormatDriver* photos_webp_file_format_driver_construct (GType object_type);
VALA_EXTERN void photos_webp_file_format_properties_init (void);
VALA_EXTERN PhotosWebpFileFormatDriver* photos_webp_file_format_driver_get_instance (void);
static PhotoFileFormatProperties* photos_webp_file_format_driver_real_get_properties (PhotoFileFormatDriver* base);
VALA_EXTERN GType photos_webp_file_format_properties_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosWebpFileFormatProperties, photo_file_format_properties_unref)
VALA_EXTERN PhotosWebpFileFormatProperties* photos_webp_file_format_properties_get_instance (void);
static PhotoFileReader* photos_webp_file_format_driver_real_create_reader (PhotoFileFormatDriver* base,
                                                                    const gchar* filepath);
VALA_EXTERN PhotosWebpReader* photos_webp_reader_new (const gchar* filepath);
VALA_EXTERN PhotosWebpReader* photos_webp_reader_construct (GType object_type,
                                                const gchar* filepath);
VALA_EXTERN GType photos_webp_reader_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosWebpReader, photo_file_adapter_unref)
static PhotoMetadata* photos_webp_file_format_driver_real_create_metadata (PhotoFileFormatDriver* base);
VALA_EXTERN PhotoMetadata* photo_metadata_new (void);
VALA_EXTERN PhotoMetadata* photo_metadata_construct (GType object_type);
static gboolean photos_webp_file_format_driver_real_can_write_image (PhotoFileFormatDriver* base);
static gboolean photos_webp_file_format_driver_real_can_write_metadata (PhotoFileFormatDriver* base);
static PhotoFileWriter* photos_webp_file_format_driver_real_create_writer (PhotoFileFormatDriver* base,
                                                                    const gchar* filepath);
static PhotoFileMetadataWriter* photos_webp_file_format_driver_real_create_metadata_writer (PhotoFileFormatDriver* base,
                                                                                     const gchar* filepath);
VALA_EXTERN PhotosWebpMetadataWriter* photos_webp_metadata_writer_new (const gchar* filepath);
VALA_EXTERN PhotosWebpMetadataWriter* photos_webp_metadata_writer_construct (GType object_type,
                                                                 const gchar* filepath);
VALA_EXTERN GType photos_webp_metadata_writer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosWebpMetadataWriter, photo_file_adapter_unref)
static PhotoFileSniffer* photos_webp_file_format_driver_real_create_sniffer (PhotoFileFormatDriver* base,
                                                                      GFile* file,
                                                                      PhotoFileSnifferOptions options);
VALA_EXTERN PhotosWebpSniffer* photos_webp_sniffer_new (GFile* file,
                                            PhotoFileSnifferOptions options);
VALA_EXTERN PhotosWebpSniffer* photos_webp_sniffer_construct (GType object_type,
                                                  GFile* file,
                                                  PhotoFileSnifferOptions options);
VALA_EXTERN GType photos_webp_sniffer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PhotosWebpSniffer, photo_file_sniffer_unref)
VALA_EXTERN PhotoFileFormatDriver* photo_file_format_driver_construct (GType object_type);
static void photos_webp_file_format_driver_finalize (PhotoFileFormatDriver * obj);
static GType photos_webp_file_format_driver_get_type_once (void);
VALA_EXTERN GType photo_file_format_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType photo_file_format_flags_get_type (void) G_GNUC_CONST ;
VALA_EXTERN PhotoFileFormat photo_file_format_properties_get_file_format (PhotoFileFormatProperties* self);
VALA_EXTERN PhotoFileFormatFlags photo_file_format_properties_get_flags (PhotoFileFormatProperties* self);
VALA_EXTERN gchar* photo_file_format_properties_get_default_extension (PhotoFileFormatProperties* self);
VALA_EXTERN gchar* photo_file_format_properties_get_user_visible_name (PhotoFileFormatProperties* self);
VALA_EXTERN gchar** photo_file_format_properties_get_known_extensions (PhotoFileFormatProperties* self,
                                                           gint* result_length1);
VALA_EXTERN gchar* photo_file_format_properties_get_default_mime_type (PhotoFileFormatProperties* self);
VALA_EXTERN gchar** photo_file_format_properties_get_mime_types (PhotoFileFormatProperties* self,
                                                     gint* result_length1);
VALA_EXTERN PhotosWebpFileFormatProperties* photos_webp_file_format_properties_new (void);
VALA_EXTERN PhotosWebpFileFormatProperties* photos_webp_file_format_properties_construct (GType object_type);
static PhotoFileFormat photos_webp_file_format_properties_real_get_file_format (PhotoFileFormatProperties* base);
static PhotoFileFormatFlags photos_webp_file_format_properties_real_get_flags (PhotoFileFormatProperties* base);
static gchar* photos_webp_file_format_properties_real_get_default_extension (PhotoFileFormatProperties* base);
static gchar* photos_webp_file_format_properties_real_get_user_visible_name (PhotoFileFormatProperties* base);
static gchar** photos_webp_file_format_properties_real_get_known_extensions (PhotoFileFormatProperties* base,
                                                                      gint* result_length1);
static gchar** _vala_array_dup16 (gchar** self,
                           gssize length);
static gchar* photos_webp_file_format_properties_real_get_default_mime_type (PhotoFileFormatProperties* base);
static gchar** photos_webp_file_format_properties_real_get_mime_types (PhotoFileFormatProperties* base,
                                                                gint* result_length1);
static gchar** _vala_array_dup17 (gchar** self,
                           gssize length);
VALA_EXTERN PhotoFileFormatProperties* photo_file_format_properties_construct (GType object_type);
static void photos_webp_file_format_properties_finalize (PhotoFileFormatProperties * obj);
static GType photos_webp_file_format_properties_get_type_once (void);
VALA_EXTERN gpointer detected_photo_information_ref (gpointer instance);
VALA_EXTERN void detected_photo_information_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_detected_photo_information (const gchar* name,
                                                   const gchar* nick,
                                                   const gchar* blurb,
                                                   GType object_type,
                                                   GParamFlags flags);
VALA_EXTERN void value_set_detected_photo_information (GValue* value,
                                           gpointer v_object);
VALA_EXTERN void value_take_detected_photo_information (GValue* value,
                                            gpointer v_object);
VALA_EXTERN gpointer value_get_detected_photo_information (const GValue* value);
VALA_EXTERN GType detected_photo_information_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (DetectedPhotoInformation, detected_photo_information_unref)
VALA_EXTERN DetectedPhotoInformation* photo_file_sniffer_sniff (PhotoFileSniffer* self,
                                                    gboolean* is_corrupted,
                                                    GError** error);
VALA_EXTERN PhotoFileSniffer* photo_file_sniffer_construct (GType object_type,
                                                GFile* file,
                                                PhotoFileSnifferOptions options);
VALA_EXTERN DetectedPhotoInformation* detected_photo_information_new (void);
VALA_EXTERN DetectedPhotoInformation* detected_photo_information_construct (GType object_type);
static DetectedPhotoInformation* photos_webp_sniffer_real_sniff (PhotoFileSniffer* base,
                                                          gboolean* is_corrupted,
                                                          GError** error);
VALA_EXTERN gboolean photos_is_webp (GFile* file,
                         GCancellable* cancellable,
                         GError** error);
VALA_EXTERN GType dimensions_get_type (void) G_GNUC_CONST ;
VALA_EXTERN Dimensions* dimensions_dup (const Dimensions* self);
VALA_EXTERN void dimensions_free (Dimensions* self);
VALA_EXTERN gchar* photo_metadata_exif_hash (PhotoMetadata* self);
VALA_EXTERN gchar* photo_metadata_thumbnail_hash (PhotoMetadata* self);
static void photos_webp_sniffer_finalize (PhotoFileSniffer * obj);
static GType photos_webp_sniffer_get_type_once (void);
VALA_EXTERN PhotoMetadata* photo_file_reader_read_metadata (PhotoFileReader* self,
                                                GError** error);
VALA_EXTERN GdkPixbuf* photo_file_reader_unscaled_read (PhotoFileReader* self,
                                            GError** error);
VALA_EXTERN PhotoFileReader* photo_file_reader_construct (GType object_type,
                                              const gchar* filepath,
                                              PhotoFileFormat file_format);
static PhotoMetadata* photos_webp_reader_real_read_metadata (PhotoFileReader* base,
                                                      GError** error);
VALA_EXTERN GFile* photo_file_adapter_get_file (PhotoFileAdapter* self);
static GdkPixbuf* photos_webp_reader_real_unscaled_read (PhotoFileReader* base,
                                                  GError** error);
VALA_EXTERN gchar* photo_file_adapter_get_filepath (PhotoFileAdapter* self);
static guint8* _vala_array_dup18 (guint8* self,
                           gssize length);
static void _g_free_gdk_pixbuf_destroy_notify (guint8* pixels,
                                        gpointer self);
static GType photos_webp_reader_get_type_once (void);
VALA_EXTERN void photo_file_metadata_writer_write_metadata (PhotoFileMetadataWriter* self,
                                                PhotoMetadata* metadata,
                                                GError** error);
VALA_EXTERN PhotoFileMetadataWriter* photo_file_metadata_writer_construct (GType object_type,
                                                               const gchar* filepath,
                                                               PhotoFileFormat file_format);
static void photos_webp_metadata_writer_real_write_metadata (PhotoFileMetadataWriter* base,
                                                      PhotoMetadata* metadata,
                                                      GError** error);
VALA_EXTERN void photo_metadata_write_to_file (PhotoMetadata* self,
                                   GFile* file,
                                   GError** error);
static GType photos_webp_metadata_writer_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

void
photos_webp_file_format_driver_init (void)
{
	PhotosWebpFileFormatDriver* _tmp0_;
	_tmp0_ = photos_webp_file_format_driver_new ();
	_photo_file_format_driver_unref0 (photos_webp_file_format_driver_instance);
	photos_webp_file_format_driver_instance = _tmp0_;
	photos_webp_file_format_properties_init ();
}

static gpointer
_photo_file_format_driver_ref0 (gpointer self)
{
	return self ? photo_file_format_driver_ref (self) : NULL;
}

PhotosWebpFileFormatDriver*
photos_webp_file_format_driver_get_instance (void)
{
	PhotosWebpFileFormatDriver* _tmp0_;
	PhotosWebpFileFormatDriver* _tmp1_;
	PhotosWebpFileFormatDriver* result;
	_tmp0_ = photos_webp_file_format_driver_instance;
	_tmp1_ = _photo_file_format_driver_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static PhotoFileFormatProperties*
photos_webp_file_format_driver_real_get_properties (PhotoFileFormatDriver* base)
{
	PhotosWebpFileFormatDriver * self;
	PhotosWebpFileFormatProperties* _tmp0_;
	PhotoFileFormatProperties* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	_tmp0_ = photos_webp_file_format_properties_get_instance ();
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_PHOTO_FILE_FORMAT_PROPERTIES, PhotoFileFormatProperties);
	return result;
}

static PhotoFileReader*
photos_webp_file_format_driver_real_create_reader (PhotoFileFormatDriver* base,
                                                   const gchar* filepath)
{
	PhotosWebpFileFormatDriver * self;
	PhotosWebpReader* _tmp0_;
	PhotoFileReader* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	g_return_val_if_fail (filepath != NULL, NULL);
	_tmp0_ = photos_webp_reader_new (filepath);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_PHOTO_FILE_READER, PhotoFileReader);
	return result;
}

static PhotoMetadata*
photos_webp_file_format_driver_real_create_metadata (PhotoFileFormatDriver* base)
{
	PhotosWebpFileFormatDriver * self;
	PhotoMetadata* _tmp0_;
	PhotoMetadata* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	_tmp0_ = photo_metadata_new ();
	result = _tmp0_;
	return result;
}

static gboolean
photos_webp_file_format_driver_real_can_write_image (PhotoFileFormatDriver* base)
{
	PhotosWebpFileFormatDriver * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	result = FALSE;
	return result;
}

static gboolean
photos_webp_file_format_driver_real_can_write_metadata (PhotoFileFormatDriver* base)
{
	PhotosWebpFileFormatDriver * self;
	gboolean result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	result = TRUE;
	return result;
}

static PhotoFileWriter*
photos_webp_file_format_driver_real_create_writer (PhotoFileFormatDriver* base,
                                                   const gchar* filepath)
{
	PhotosWebpFileFormatDriver * self;
	PhotoFileWriter* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	g_return_val_if_fail (filepath != NULL, NULL);
	result = NULL;
	return result;
}

static PhotoFileMetadataWriter*
photos_webp_file_format_driver_real_create_metadata_writer (PhotoFileFormatDriver* base,
                                                            const gchar* filepath)
{
	PhotosWebpFileFormatDriver * self;
	PhotosWebpMetadataWriter* _tmp0_;
	PhotoFileMetadataWriter* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	g_return_val_if_fail (filepath != NULL, NULL);
	_tmp0_ = photos_webp_metadata_writer_new (filepath);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_PHOTO_FILE_METADATA_WRITER, PhotoFileMetadataWriter);
	return result;
}

static PhotoFileSniffer*
photos_webp_file_format_driver_real_create_sniffer (PhotoFileFormatDriver* base,
                                                    GFile* file,
                                                    PhotoFileSnifferOptions options)
{
	PhotosWebpFileFormatDriver * self;
	PhotosWebpSniffer* _tmp0_;
	PhotoFileSniffer* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	_tmp0_ = photos_webp_sniffer_new (file, options);
	result = G_TYPE_CHECK_INSTANCE_CAST (_tmp0_, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer);
	return result;
}

PhotosWebpFileFormatDriver*
photos_webp_file_format_driver_construct (GType object_type)
{
	PhotosWebpFileFormatDriver* self = NULL;
	self = (PhotosWebpFileFormatDriver*) photo_file_format_driver_construct (object_type);
	return self;
}

PhotosWebpFileFormatDriver*
photos_webp_file_format_driver_new (void)
{
	return photos_webp_file_format_driver_construct (PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER);
}

static void
photos_webp_file_format_driver_class_init (PhotosWebpFileFormatDriverClass * klass,
                                           gpointer klass_data)
{
	photos_webp_file_format_driver_parent_class = g_type_class_peek_parent (klass);
	((PhotoFileFormatDriverClass *) klass)->finalize = photos_webp_file_format_driver_finalize;
	((PhotoFileFormatDriverClass *) klass)->get_properties = (PhotoFileFormatProperties* (*) (PhotoFileFormatDriver*)) photos_webp_file_format_driver_real_get_properties;
	((PhotoFileFormatDriverClass *) klass)->create_reader = (PhotoFileReader* (*) (PhotoFileFormatDriver*, const gchar*)) photos_webp_file_format_driver_real_create_reader;
	((PhotoFileFormatDriverClass *) klass)->create_metadata = (PhotoMetadata* (*) (PhotoFileFormatDriver*)) photos_webp_file_format_driver_real_create_metadata;
	((PhotoFileFormatDriverClass *) klass)->can_write_image = (gboolean (*) (PhotoFileFormatDriver*)) photos_webp_file_format_driver_real_can_write_image;
	((PhotoFileFormatDriverClass *) klass)->can_write_metadata = (gboolean (*) (PhotoFileFormatDriver*)) photos_webp_file_format_driver_real_can_write_metadata;
	((PhotoFileFormatDriverClass *) klass)->create_writer = (PhotoFileWriter* (*) (PhotoFileFormatDriver*, const gchar*)) photos_webp_file_format_driver_real_create_writer;
	((PhotoFileFormatDriverClass *) klass)->create_metadata_writer = (PhotoFileMetadataWriter* (*) (PhotoFileFormatDriver*, const gchar*)) photos_webp_file_format_driver_real_create_metadata_writer;
	((PhotoFileFormatDriverClass *) klass)->create_sniffer = (PhotoFileSniffer* (*) (PhotoFileFormatDriver*, GFile*, PhotoFileSnifferOptions)) photos_webp_file_format_driver_real_create_sniffer;
}

static void
photos_webp_file_format_driver_instance_init (PhotosWebpFileFormatDriver * self,
                                              gpointer klass)
{
}

static void
photos_webp_file_format_driver_finalize (PhotoFileFormatDriver * obj)
{
	PhotosWebpFileFormatDriver * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PHOTOS_TYPE_WEBP_FILE_FORMAT_DRIVER, PhotosWebpFileFormatDriver);
	PHOTO_FILE_FORMAT_DRIVER_CLASS (photos_webp_file_format_driver_parent_class)->finalize (obj);
}

static GType
photos_webp_file_format_driver_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhotosWebpFileFormatDriverClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photos_webp_file_format_driver_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotosWebpFileFormatDriver), 0, (GInstanceInitFunc) photos_webp_file_format_driver_instance_init, NULL };
	GType photos_webp_file_format_driver_type_id;
	photos_webp_file_format_driver_type_id = g_type_register_static (TYPE_PHOTO_FILE_FORMAT_DRIVER, "PhotosWebpFileFormatDriver", &g_define_type_info, 0);
	return photos_webp_file_format_driver_type_id;
}

GType
photos_webp_file_format_driver_get_type (void)
{
	static volatile gsize photos_webp_file_format_driver_type_id__once = 0;
	if (g_once_init_enter (&photos_webp_file_format_driver_type_id__once)) {
		GType photos_webp_file_format_driver_type_id;
		photos_webp_file_format_driver_type_id = photos_webp_file_format_driver_get_type_once ();
		g_once_init_leave (&photos_webp_file_format_driver_type_id__once, photos_webp_file_format_driver_type_id);
	}
	return photos_webp_file_format_driver_type_id__once;
}

void
photos_webp_file_format_properties_init (void)
{
	PhotosWebpFileFormatProperties* _tmp0_;
	_tmp0_ = photos_webp_file_format_properties_new ();
	_photo_file_format_properties_unref0 (photos_webp_file_format_properties_instance);
	photos_webp_file_format_properties_instance = _tmp0_;
}

static gpointer
_photo_file_format_properties_ref0 (gpointer self)
{
	return self ? photo_file_format_properties_ref (self) : NULL;
}

PhotosWebpFileFormatProperties*
photos_webp_file_format_properties_get_instance (void)
{
	PhotosWebpFileFormatProperties* _tmp0_;
	PhotosWebpFileFormatProperties* _tmp1_;
	PhotosWebpFileFormatProperties* result;
	_tmp0_ = photos_webp_file_format_properties_instance;
	_tmp1_ = _photo_file_format_properties_ref0 (_tmp0_);
	result = _tmp1_;
	return result;
}

static PhotoFileFormat
photos_webp_file_format_properties_real_get_file_format (PhotoFileFormatProperties* base)
{
	PhotosWebpFileFormatProperties * self;
	PhotoFileFormat result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	result = PHOTO_FILE_FORMAT_WEBP;
	return result;
}

static PhotoFileFormatFlags
photos_webp_file_format_properties_real_get_flags (PhotoFileFormatProperties* base)
{
	PhotosWebpFileFormatProperties * self;
	PhotoFileFormatFlags result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	result = PHOTO_FILE_FORMAT_FLAGS_NONE;
	return result;
}

static gchar*
photos_webp_file_format_properties_real_get_default_extension (PhotoFileFormatProperties* base)
{
	PhotosWebpFileFormatProperties * self;
	gchar* _tmp0_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	_tmp0_ = g_strdup ("webp");
	result = _tmp0_;
	return result;
}

static gchar*
photos_webp_file_format_properties_real_get_user_visible_name (PhotoFileFormatProperties* base)
{
	PhotosWebpFileFormatProperties * self;
	gchar* _tmp0_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	_tmp0_ = g_strdup (_ ("WebP"));
	result = _tmp0_;
	return result;
}

static gchar**
_vala_array_dup16 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gchar**
photos_webp_file_format_properties_real_get_known_extensions (PhotoFileFormatProperties* base,
                                                              gint* result_length1)
{
	PhotosWebpFileFormatProperties * self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	_tmp0_ = photos_webp_file_format_properties_KNOWN_EXTENSIONS;
	_tmp0__length1 = photos_webp_file_format_properties_KNOWN_EXTENSIONS_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup16 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

static gchar*
photos_webp_file_format_properties_real_get_default_mime_type (PhotoFileFormatProperties* base)
{
	PhotosWebpFileFormatProperties * self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	_tmp0_ = photos_webp_file_format_properties_KNOWN_MIME_TYPES;
	_tmp0__length1 = photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1;
	_tmp1_ = _tmp0_[0];
	_tmp2_ = g_strdup (_tmp1_);
	result = _tmp2_;
	return result;
}

static gchar**
_vala_array_dup17 (gchar** self,
                   gssize length)
{
	if (length >= 0) {
		gchar** result;
		gssize i;
		result = g_new0 (gchar*, length + 1);
		for (i = 0; i < length; i++) {
			gchar* _tmp0_;
			_tmp0_ = g_strdup (self[i]);
			result[i] = _tmp0_;
		}
		return result;
	}
	return NULL;
}

static gchar**
photos_webp_file_format_properties_real_get_mime_types (PhotoFileFormatProperties* base,
                                                        gint* result_length1)
{
	PhotosWebpFileFormatProperties * self;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	gchar** result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	_tmp0_ = photos_webp_file_format_properties_KNOWN_MIME_TYPES;
	_tmp0__length1 = photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup17 (_tmp0_, _tmp0__length1) : _tmp0_;
	_tmp1__length1 = _tmp0__length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}

PhotosWebpFileFormatProperties*
photos_webp_file_format_properties_construct (GType object_type)
{
	PhotosWebpFileFormatProperties* self = NULL;
	self = (PhotosWebpFileFormatProperties*) photo_file_format_properties_construct (object_type);
	return self;
}

PhotosWebpFileFormatProperties*
photos_webp_file_format_properties_new (void)
{
	return photos_webp_file_format_properties_construct (PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES);
}

static void
photos_webp_file_format_properties_class_init (PhotosWebpFileFormatPropertiesClass * klass,
                                               gpointer klass_data)
{
	gchar* _tmp0_;
	gchar** _tmp1_;
	gchar* _tmp2_;
	gchar** _tmp3_;
	photos_webp_file_format_properties_parent_class = g_type_class_peek_parent (klass);
	((PhotoFileFormatPropertiesClass *) klass)->finalize = photos_webp_file_format_properties_finalize;
	((PhotoFileFormatPropertiesClass *) klass)->get_file_format = (PhotoFileFormat (*) (PhotoFileFormatProperties*)) photos_webp_file_format_properties_real_get_file_format;
	((PhotoFileFormatPropertiesClass *) klass)->get_flags = (PhotoFileFormatFlags (*) (PhotoFileFormatProperties*)) photos_webp_file_format_properties_real_get_flags;
	((PhotoFileFormatPropertiesClass *) klass)->get_default_extension = (gchar* (*) (PhotoFileFormatProperties*)) photos_webp_file_format_properties_real_get_default_extension;
	((PhotoFileFormatPropertiesClass *) klass)->get_user_visible_name = (gchar* (*) (PhotoFileFormatProperties*)) photos_webp_file_format_properties_real_get_user_visible_name;
	((PhotoFileFormatPropertiesClass *) klass)->get_known_extensions = (gchar** (*) (PhotoFileFormatProperties*, gint*)) photos_webp_file_format_properties_real_get_known_extensions;
	((PhotoFileFormatPropertiesClass *) klass)->get_default_mime_type = (gchar* (*) (PhotoFileFormatProperties*)) photos_webp_file_format_properties_real_get_default_mime_type;
	((PhotoFileFormatPropertiesClass *) klass)->get_mime_types = (gchar** (*) (PhotoFileFormatProperties*, gint*)) photos_webp_file_format_properties_real_get_mime_types;
	_tmp0_ = g_strdup ("webp");
	_tmp1_ = g_new0 (gchar*, 1 + 1);
	_tmp1_[0] = _tmp0_;
	photos_webp_file_format_properties_KNOWN_EXTENSIONS = _tmp1_;
	photos_webp_file_format_properties_KNOWN_EXTENSIONS_length1 = 1;
	_photos_webp_file_format_properties_KNOWN_EXTENSIONS_size_ = photos_webp_file_format_properties_KNOWN_EXTENSIONS_length1;
	_tmp2_ = g_strdup ("image/webp");
	_tmp3_ = g_new0 (gchar*, 1 + 1);
	_tmp3_[0] = _tmp2_;
	photos_webp_file_format_properties_KNOWN_MIME_TYPES = _tmp3_;
	photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1 = 1;
	_photos_webp_file_format_properties_KNOWN_MIME_TYPES_size_ = photos_webp_file_format_properties_KNOWN_MIME_TYPES_length1;
}

static void
photos_webp_file_format_properties_instance_init (PhotosWebpFileFormatProperties * self,
                                                  gpointer klass)
{
}

static void
photos_webp_file_format_properties_finalize (PhotoFileFormatProperties * obj)
{
	PhotosWebpFileFormatProperties * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PHOTOS_TYPE_WEBP_FILE_FORMAT_PROPERTIES, PhotosWebpFileFormatProperties);
	PHOTO_FILE_FORMAT_PROPERTIES_CLASS (photos_webp_file_format_properties_parent_class)->finalize (obj);
}

static GType
photos_webp_file_format_properties_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhotosWebpFileFormatPropertiesClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photos_webp_file_format_properties_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotosWebpFileFormatProperties), 0, (GInstanceInitFunc) photos_webp_file_format_properties_instance_init, NULL };
	GType photos_webp_file_format_properties_type_id;
	photos_webp_file_format_properties_type_id = g_type_register_static (TYPE_PHOTO_FILE_FORMAT_PROPERTIES, "PhotosWebpFileFormatProperties", &g_define_type_info, 0);
	return photos_webp_file_format_properties_type_id;
}

GType
photos_webp_file_format_properties_get_type (void)
{
	static volatile gsize photos_webp_file_format_properties_type_id__once = 0;
	if (g_once_init_enter (&photos_webp_file_format_properties_type_id__once)) {
		GType photos_webp_file_format_properties_type_id;
		photos_webp_file_format_properties_type_id = photos_webp_file_format_properties_get_type_once ();
		g_once_init_leave (&photos_webp_file_format_properties_type_id__once, photos_webp_file_format_properties_type_id);
	}
	return photos_webp_file_format_properties_type_id__once;
}

static inline gpointer
photos_webp_sniffer_get_instance_private (PhotosWebpSniffer* self)
{
	return G_STRUCT_MEMBER_P (self, PhotosWebpSniffer_private_offset);
}

PhotosWebpSniffer*
photos_webp_sniffer_construct (GType object_type,
                               GFile* file,
                               PhotoFileSnifferOptions options)
{
	PhotosWebpSniffer* self = NULL;
	DetectedPhotoInformation* _tmp0_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	self = (PhotosWebpSniffer*) photo_file_sniffer_construct (object_type, file, options);
	_tmp0_ = detected_photo_information_new ();
	_detected_photo_information_unref0 (self->priv->detected);
	self->priv->detected = _tmp0_;
	return self;
}

PhotosWebpSniffer*
photos_webp_sniffer_new (GFile* file,
                         PhotoFileSnifferOptions options)
{
	return photos_webp_sniffer_construct (PHOTOS_TYPE_WEBP_SNIFFER, file, options);
}

static gpointer
_detected_photo_information_ref0 (gpointer self)
{
	return self ? detected_photo_information_ref (self) : NULL;
}

static DetectedPhotoInformation*
photos_webp_sniffer_real_sniff (PhotoFileSniffer* base,
                                gboolean* is_corrupted,
                                GError** error)
{
	PhotosWebpSniffer * self;
	gboolean _vala_is_corrupted = FALSE;
	gboolean _tmp0_ = FALSE;
	GFile* _tmp1_;
	GChecksum* md5_checksum = NULL;
	DetectedPhotoInformation* _tmp3_;
	PhotoMetadata* _tmp4_;
	gboolean _tmp11_ = FALSE;
	guint8* _tmp22_ = NULL;
	gint _tmp22__length1 = 0;
	gint __tmp22__size_ = 0;
	guint8* buffer = NULL;
	guint8* _tmp25_;
	gint _tmp25__length1;
	gint buffer_length1;
	gint _buffer_size_;
	gsize count = 0UL;
	GFileInputStream* fins = NULL;
	GFile* _tmp26_;
	GFileInputStream* _tmp27_;
	GByteArray* ba = NULL;
	GByteArray* _tmp28_;
	GFileInputStream* _tmp49_;
	DetectedPhotoInformation* _tmp55_;
	DetectedPhotoInformation* _tmp56_;
	DetectedPhotoInformation* _tmp57_;
	GError* _inner_error0_ = NULL;
	DetectedPhotoInformation* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_SNIFFER, PhotosWebpSniffer);
	_vala_is_corrupted = FALSE;
	_tmp1_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->file;
	_tmp0_ = photos_is_webp (_tmp1_, NULL, &_inner_error0_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return NULL;
	}
	if (!_tmp0_) {
		result = NULL;
		if (is_corrupted) {
			*is_corrupted = _vala_is_corrupted;
		}
		return result;
	}
	md5_checksum = NULL;
	if (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
		GChecksum* _tmp2_;
		_tmp2_ = g_checksum_new (G_CHECKSUM_MD5);
		_g_checksum_free0 (md5_checksum);
		md5_checksum = _tmp2_;
	}
	_tmp3_ = self->priv->detected;
	_tmp4_ = photo_metadata_new ();
	_media_metadata_unref0 (_tmp3_->metadata);
	_tmp3_->metadata = _tmp4_;
	{
		DetectedPhotoInformation* _tmp5_;
		PhotoMetadata* _tmp6_;
		GFile* _tmp7_;
		_tmp5_ = self->priv->detected;
		_tmp6_ = _tmp5_->metadata;
		_tmp7_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->file;
		media_metadata_read_from_file (G_TYPE_CHECK_INSTANCE_CAST (_tmp6_, TYPE_MEDIA_METADATA, MediaMetadata), _tmp7_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		GError* _tmp8_;
		const gchar* _tmp9_;
		DetectedPhotoInformation* _tmp10_;
		err = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp8_ = err;
		_tmp9_ = _tmp8_->message;
		g_debug ("WebPSupport.vala:125: Failed to load meta-data from file: %s", _tmp9_);
		_tmp10_ = self->priv->detected;
		_media_metadata_unref0 (_tmp10_->metadata);
		_tmp10_->metadata = NULL;
		_g_error_free0 (err);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_g_checksum_free0 (md5_checksum);
		return NULL;
	}
	if (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
		DetectedPhotoInformation* _tmp12_;
		PhotoMetadata* _tmp13_;
		_tmp12_ = self->priv->detected;
		_tmp13_ = _tmp12_->metadata;
		_tmp11_ = _tmp13_ != NULL;
	} else {
		_tmp11_ = FALSE;
	}
	if (_tmp11_) {
		DetectedPhotoInformation* _tmp14_;
		DetectedPhotoInformation* _tmp15_;
		PhotoMetadata* _tmp16_;
		gchar* _tmp17_;
		DetectedPhotoInformation* _tmp18_;
		DetectedPhotoInformation* _tmp19_;
		PhotoMetadata* _tmp20_;
		gchar* _tmp21_;
		_tmp14_ = self->priv->detected;
		_tmp15_ = self->priv->detected;
		_tmp16_ = _tmp15_->metadata;
		_tmp17_ = photo_metadata_exif_hash (_tmp16_);
		_g_free0 (_tmp14_->exif_md5);
		_tmp14_->exif_md5 = _tmp17_;
		_tmp18_ = self->priv->detected;
		_tmp19_ = self->priv->detected;
		_tmp20_ = _tmp19_->metadata;
		_tmp21_ = photo_metadata_thumbnail_hash (_tmp20_);
		_g_free0 (_tmp18_->thumbnail_md5);
		_tmp18_->thumbnail_md5 = _tmp21_;
	}
	if (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
		guint8* _tmp23_;
		_tmp23_ = g_new0 (guint8, 64 * 1024);
		_tmp22_ = (g_free (_tmp22_), NULL);
		_tmp22_ = _tmp23_;
		_tmp22__length1 = 64 * 1024;
		__tmp22__size_ = _tmp22__length1;
	} else {
		guint8* _tmp24_;
		_tmp24_ = g_new0 (guint8, 8 * 1024);
		_tmp22_ = (g_free (_tmp22_), NULL);
		_tmp22_ = _tmp24_;
		_tmp22__length1 = 8 * 1024;
		__tmp22__size_ = _tmp22__length1;
	}
	_tmp25_ = _tmp22_;
	_tmp25__length1 = _tmp22__length1;
	_tmp22_ = NULL;
	_tmp22__length1 = 0;
	buffer = _tmp25_;
	buffer_length1 = _tmp25__length1;
	_buffer_size_ = buffer_length1;
	count = (gsize) 0;
	_tmp26_ = G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->file;
	_tmp27_ = g_file_read (_tmp26_, NULL, &_inner_error0_);
	fins = _tmp27_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		buffer = (g_free (buffer), NULL);
		_tmp22_ = (g_free (_tmp22_), NULL);
		_g_checksum_free0 (md5_checksum);
		return NULL;
	}
	_tmp28_ = g_byte_array_new ();
	ba = _tmp28_;
	{
		gboolean _tmp29_ = FALSE;
		_tmp29_ = TRUE;
		while (TRUE) {
			gsize bytes_read = 0UL;
			GFileInputStream* _tmp30_;
			guint8* _tmp31_;
			gint _tmp31__length1;
			GByteArray* _tmp32_;
			guint8* _tmp33_;
			gint _tmp33__length1;
			WebPData d = {0};
			GByteArray* _tmp36_;
			guint8* _tmp37_;
			gint _tmp37__length1;
			WebPDemuxState state = 0;
			WebPDemuxer* demux = NULL;
			WebPData _tmp38_;
			WebPDemuxer* _tmp39_;
			if (!_tmp29_) {
			}
			_tmp29_ = FALSE;
			_tmp30_ = fins;
			_tmp31_ = buffer;
			_tmp31__length1 = buffer_length1;
			bytes_read = (gsize) g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp30_, g_input_stream_get_type (), GInputStream), _tmp31_, (gsize) _tmp31__length1, NULL, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				g_propagate_error (error, _inner_error0_);
				_g_byte_array_unref0 (ba);
				_g_object_unref0 (fins);
				buffer = (g_free (buffer), NULL);
				_tmp22_ = (g_free (_tmp22_), NULL);
				_g_checksum_free0 (md5_checksum);
				return NULL;
			}
			if (bytes_read <= ((gsize) 0)) {
				break;
			}
			_tmp32_ = ba;
			_tmp33_ = buffer;
			_tmp33__length1 = buffer_length1;
			g_byte_array_append (_tmp32_, _tmp33_ + 0, (gint) (((gint) bytes_read) - 0));
			count += bytes_read;
			if (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
				GChecksum* _tmp34_;
				guint8* _tmp35_;
				gint _tmp35__length1;
				_tmp34_ = md5_checksum;
				_tmp35_ = buffer;
				_tmp35__length1 = buffer_length1;
				g_checksum_update (_tmp34_, _tmp35_, bytes_read);
			}
			memset (&d, 0, sizeof (WebPData));
			_tmp36_ = ba;
			_tmp37_ = _tmp36_->data;
			_tmp37__length1 = _tmp36_->len;
			d.bytes = _tmp37_;
			d.size = _tmp37__length1;
			_tmp38_ = d;
			_tmp39_ = WebPDemuxPartial (&_tmp38_, &state);
			demux = _tmp39_;
			if (state == WEBP_DEMUX_PARSE_ERROR) {
				_vala_is_corrupted = TRUE;
				_WebPDemuxDelete0 (demux);
				break;
			}
			if (state > WEBP_DEMUX_PARSED_HEADER) {
				DetectedPhotoInformation* _tmp40_;
				DetectedPhotoInformation* _tmp41_;
				gchar* _tmp42_;
				DetectedPhotoInformation* _tmp43_;
				DetectedPhotoInformation* _tmp44_;
				DetectedPhotoInformation* _tmp45_;
				WebPDemuxer* _tmp46_;
				DetectedPhotoInformation* _tmp47_;
				WebPDemuxer* _tmp48_;
				_tmp40_ = self->priv->detected;
				_tmp40_->file_format = PHOTO_FILE_FORMAT_WEBP;
				_tmp41_ = self->priv->detected;
				_tmp42_ = g_strdup ("WebP");
				_g_free0 (_tmp41_->format_name);
				_tmp41_->format_name = _tmp42_;
				_tmp43_ = self->priv->detected;
				_tmp43_->channels = 4;
				_tmp44_ = self->priv->detected;
				_tmp44_->bits_per_channel = 8;
				_tmp45_ = self->priv->detected;
				_tmp46_ = demux;
				_tmp45_->image_dim.width = (gint) WebPDemuxGetI (_tmp46_, WEBP_FF_CANVAS_WIDTH);
				_tmp47_ = self->priv->detected;
				_tmp48_ = demux;
				_tmp47_->image_dim.height = (gint) WebPDemuxGetI (_tmp48_, WEBP_FF_CANVAS_HEIGHT);
				if (!G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
					_WebPDemuxDelete0 (demux);
					break;
				}
			}
			_WebPDemuxDelete0 (demux);
		}
	}
	_tmp49_ = fins;
	if (_tmp49_ != NULL) {
		GFileInputStream* _tmp50_;
		_tmp50_ = fins;
		g_input_stream_close (G_TYPE_CHECK_INSTANCE_CAST (_tmp50_, g_input_stream_get_type (), GInputStream), NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_propagate_error (error, _inner_error0_);
			_g_byte_array_unref0 (ba);
			_g_object_unref0 (fins);
			buffer = (g_free (buffer), NULL);
			_tmp22_ = (g_free (_tmp22_), NULL);
			_g_checksum_free0 (md5_checksum);
			return NULL;
		}
	}
	if (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_SNIFFER, PhotoFileSniffer)->calc_md5) {
		DetectedPhotoInformation* _tmp51_;
		GChecksum* _tmp52_;
		const gchar* _tmp53_;
		gchar* _tmp54_;
		_tmp51_ = self->priv->detected;
		_tmp52_ = md5_checksum;
		_tmp53_ = g_checksum_get_string (_tmp52_);
		_tmp54_ = g_strdup (_tmp53_);
		_g_free0 (_tmp51_->md5);
		_tmp51_->md5 = _tmp54_;
	}
	_tmp55_ = self->priv->detected;
	if (_tmp55_->file_format != PHOTO_FILE_FORMAT_WEBP) {
		result = NULL;
		_g_byte_array_unref0 (ba);
		_g_object_unref0 (fins);
		buffer = (g_free (buffer), NULL);
		_tmp22_ = (g_free (_tmp22_), NULL);
		_g_checksum_free0 (md5_checksum);
		if (is_corrupted) {
			*is_corrupted = _vala_is_corrupted;
		}
		return result;
	}
	_tmp56_ = self->priv->detected;
	_tmp57_ = _detected_photo_information_ref0 (_tmp56_);
	result = _tmp57_;
	_g_byte_array_unref0 (ba);
	_g_object_unref0 (fins);
	buffer = (g_free (buffer), NULL);
	_tmp22_ = (g_free (_tmp22_), NULL);
	_g_checksum_free0 (md5_checksum);
	if (is_corrupted) {
		*is_corrupted = _vala_is_corrupted;
	}
	return result;
}

static void
photos_webp_sniffer_class_init (PhotosWebpSnifferClass * klass,
                                gpointer klass_data)
{
	photos_webp_sniffer_parent_class = g_type_class_peek_parent (klass);
	((PhotoFileSnifferClass *) klass)->finalize = photos_webp_sniffer_finalize;
	g_type_class_adjust_private_offset (klass, &PhotosWebpSniffer_private_offset);
	((PhotoFileSnifferClass *) klass)->sniff = (DetectedPhotoInformation* (*) (PhotoFileSniffer*, gboolean*, GError**)) photos_webp_sniffer_real_sniff;
}

static void
photos_webp_sniffer_instance_init (PhotosWebpSniffer * self,
                                   gpointer klass)
{
	self->priv = photos_webp_sniffer_get_instance_private (self);
	self->priv->detected = NULL;
}

static void
photos_webp_sniffer_finalize (PhotoFileSniffer * obj)
{
	PhotosWebpSniffer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PHOTOS_TYPE_WEBP_SNIFFER, PhotosWebpSniffer);
	_detected_photo_information_unref0 (self->priv->detected);
	PHOTO_FILE_SNIFFER_CLASS (photos_webp_sniffer_parent_class)->finalize (obj);
}

static GType
photos_webp_sniffer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhotosWebpSnifferClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photos_webp_sniffer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotosWebpSniffer), 0, (GInstanceInitFunc) photos_webp_sniffer_instance_init, NULL };
	GType photos_webp_sniffer_type_id;
	photos_webp_sniffer_type_id = g_type_register_static (TYPE_PHOTO_FILE_SNIFFER, "PhotosWebpSniffer", &g_define_type_info, 0);
	PhotosWebpSniffer_private_offset = g_type_add_instance_private (photos_webp_sniffer_type_id, sizeof (PhotosWebpSnifferPrivate));
	return photos_webp_sniffer_type_id;
}

GType
photos_webp_sniffer_get_type (void)
{
	static volatile gsize photos_webp_sniffer_type_id__once = 0;
	if (g_once_init_enter (&photos_webp_sniffer_type_id__once)) {
		GType photos_webp_sniffer_type_id;
		photos_webp_sniffer_type_id = photos_webp_sniffer_get_type_once ();
		g_once_init_leave (&photos_webp_sniffer_type_id__once, photos_webp_sniffer_type_id);
	}
	return photos_webp_sniffer_type_id__once;
}

PhotosWebpReader*
photos_webp_reader_construct (GType object_type,
                              const gchar* filepath)
{
	PhotosWebpReader* self = NULL;
	g_return_val_if_fail (filepath != NULL, NULL);
	self = (PhotosWebpReader*) photo_file_reader_construct (object_type, filepath, PHOTO_FILE_FORMAT_WEBP);
	return self;
}

PhotosWebpReader*
photos_webp_reader_new (const gchar* filepath)
{
	return photos_webp_reader_construct (PHOTOS_TYPE_WEBP_READER, filepath);
}

static PhotoMetadata*
photos_webp_reader_real_read_metadata (PhotoFileReader* base,
                                       GError** error)
{
	PhotosWebpReader * self;
	PhotoMetadata* metadata = NULL;
	PhotoMetadata* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	GError* _inner_error0_ = NULL;
	PhotoMetadata* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_READER, PhotosWebpReader);
	_tmp0_ = photo_metadata_new ();
	metadata = _tmp0_;
	_tmp1_ = photo_file_adapter_get_file (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapter));
	_tmp2_ = _tmp1_;
	media_metadata_read_from_file (G_TYPE_CHECK_INSTANCE_CAST (metadata, TYPE_MEDIA_METADATA, MediaMetadata), _tmp2_, &_inner_error0_);
	_g_object_unref0 (_tmp2_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		_media_metadata_unref0 (metadata);
		return NULL;
	}
	result = metadata;
	return result;
}

static guint8*
_vala_array_dup18 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

static void
_g_free_gdk_pixbuf_destroy_notify (guint8* pixels,
                                   gpointer self)
{
	g_free (pixels);
}

static GdkPixbuf*
photos_webp_reader_real_unscaled_read (PhotoFileReader* base,
                                       GError** error)
{
	PhotosWebpReader * self;
	guint8* buffer = NULL;
	gint buffer_length1 = 0;
	gint _buffer_size_ = 0;
	gchar* _tmp0_;
	gchar* _tmp1_;
	guint8* _tmp2_ = NULL;
	gsize _tmp3_ = 0;
	WebPBitstreamFeatures features = {0};
	guint8* _tmp4_;
	gint _tmp4__length1;
	WebPBitstreamFeatures _tmp5_ = {0};
	WebPBitstreamFeatures _tmp6_;
	gint width = 0;
	gint height = 0;
	guint8* pixdata = NULL;
	guint8* _tmp8_;
	gint _tmp8__length1;
	gint _tmp9_ = 0;
	gint _tmp10_ = 0;
	guint8* _tmp11_;
	gint pixdata_length1;
	gint _pixdata_size_;
	guint8* _tmp12_;
	gint _tmp12__length1;
	guint8* _tmp14_;
	gint _tmp14__length1;
	guint8* _tmp15_;
	gint _tmp15__length1;
	GdkPixbuf* _tmp16_;
	GError* _inner_error0_ = NULL;
	GdkPixbuf* result;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_READER, PhotosWebpReader);
	_tmp0_ = photo_file_adapter_get_filepath (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapter));
	_tmp1_ = _tmp0_;
	g_file_get_contents (_tmp1_, (gchar**) (&_tmp2_), &_tmp3_, &_inner_error0_);
	buffer = (g_free (buffer), NULL);
	buffer = _tmp2_;
	buffer_length1 = _tmp3_;
	_buffer_size_ = buffer_length1;
	_g_free0 (_tmp1_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		buffer = (g_free (buffer), NULL);
		return NULL;
	}
	memset (&features, 0, sizeof (WebPBitstreamFeatures));
	_tmp4_ = buffer;
	_tmp4__length1 = buffer_length1;
	WebPGetFeatures (_tmp4_, (gint) _tmp4__length1, &_tmp5_);
	features = _tmp5_;
	_tmp6_ = features;
	if (_tmp6_.has_animation) {
		GError* _tmp7_;
		_tmp7_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Animated WebP files are not yet supported");
		_inner_error0_ = _tmp7_;
		g_propagate_error (error, _inner_error0_);
		buffer = (g_free (buffer), NULL);
		return NULL;
	}
	_tmp8_ = buffer;
	_tmp8__length1 = buffer_length1;
	_tmp11_ = WebPDecodeRGBA (_tmp8_, (gint) _tmp8__length1, &_tmp9_, &_tmp10_);
	width = _tmp9_;
	height = _tmp10_;
	pixdata = _tmp11_;
	pixdata_length1 = -1;
	_pixdata_size_ = pixdata_length1;
	_tmp12_ = pixdata;
	_tmp12__length1 = pixdata_length1;
	if (_tmp12_ == NULL) {
		GError* _tmp13_;
		_tmp13_ = g_error_new_literal (G_IO_ERROR, G_IO_ERROR_INVALID_DATA, "Failed to decode WebP file");
		_inner_error0_ = _tmp13_;
		g_propagate_error (error, _inner_error0_);
		pixdata = (g_free (pixdata), NULL);
		buffer = (g_free (buffer), NULL);
		return NULL;
	}
	pixdata_length1 = (width * height) * 4;
	_tmp14_ = pixdata;
	_tmp14__length1 = pixdata_length1;
	_tmp15_ = (_tmp14_ != NULL) ? _vala_array_dup18 (_tmp14_, _tmp14__length1) : _tmp14_;
	_tmp15__length1 = _tmp14__length1;
	_tmp16_ = gdk_pixbuf_new_from_data (_tmp15_, GDK_COLORSPACE_RGB, TRUE, 8, width, height, width * 4, _g_free_gdk_pixbuf_destroy_notify, NULL);
	result = _tmp16_;
	pixdata = (g_free (pixdata), NULL);
	buffer = (g_free (buffer), NULL);
	return result;
}

static void
photos_webp_reader_class_init (PhotosWebpReaderClass * klass,
                               gpointer klass_data)
{
	photos_webp_reader_parent_class = g_type_class_peek_parent (klass);
	((PhotoFileReaderClass *) klass)->read_metadata = (PhotoMetadata* (*) (PhotoFileReader*, GError**)) photos_webp_reader_real_read_metadata;
	((PhotoFileReaderClass *) klass)->unscaled_read = (GdkPixbuf* (*) (PhotoFileReader*, GError**)) photos_webp_reader_real_unscaled_read;
}

static void
photos_webp_reader_instance_init (PhotosWebpReader * self,
                                  gpointer klass)
{
}

static GType
photos_webp_reader_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhotosWebpReaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photos_webp_reader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotosWebpReader), 0, (GInstanceInitFunc) photos_webp_reader_instance_init, NULL };
	GType photos_webp_reader_type_id;
	photos_webp_reader_type_id = g_type_register_static (TYPE_PHOTO_FILE_READER, "PhotosWebpReader", &g_define_type_info, 0);
	return photos_webp_reader_type_id;
}

GType
photos_webp_reader_get_type (void)
{
	static volatile gsize photos_webp_reader_type_id__once = 0;
	if (g_once_init_enter (&photos_webp_reader_type_id__once)) {
		GType photos_webp_reader_type_id;
		photos_webp_reader_type_id = photos_webp_reader_get_type_once ();
		g_once_init_leave (&photos_webp_reader_type_id__once, photos_webp_reader_type_id);
	}
	return photos_webp_reader_type_id__once;
}

PhotosWebpMetadataWriter*
photos_webp_metadata_writer_construct (GType object_type,
                                       const gchar* filepath)
{
	PhotosWebpMetadataWriter* self = NULL;
	g_return_val_if_fail (filepath != NULL, NULL);
	self = (PhotosWebpMetadataWriter*) photo_file_metadata_writer_construct (object_type, filepath, PHOTO_FILE_FORMAT_WEBP);
	return self;
}

PhotosWebpMetadataWriter*
photos_webp_metadata_writer_new (const gchar* filepath)
{
	return photos_webp_metadata_writer_construct (PHOTOS_TYPE_WEBP_METADATA_WRITER, filepath);
}

static void
photos_webp_metadata_writer_real_write_metadata (PhotoFileMetadataWriter* base,
                                                 PhotoMetadata* metadata,
                                                 GError** error)
{
	PhotosWebpMetadataWriter * self;
	GFile* _tmp0_;
	GFile* _tmp1_;
	GError* _inner_error0_ = NULL;
	self = G_TYPE_CHECK_INSTANCE_CAST (base, PHOTOS_TYPE_WEBP_METADATA_WRITER, PhotosWebpMetadataWriter);
	g_return_if_fail (IS_PHOTO_METADATA (metadata));
	_tmp0_ = photo_file_adapter_get_file (G_TYPE_CHECK_INSTANCE_CAST (self, TYPE_PHOTO_FILE_ADAPTER, PhotoFileAdapter));
	_tmp1_ = _tmp0_;
	photo_metadata_write_to_file (metadata, _tmp1_, &_inner_error0_);
	_g_object_unref0 (_tmp1_);
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		g_propagate_error (error, _inner_error0_);
		return;
	}
}

static void
photos_webp_metadata_writer_class_init (PhotosWebpMetadataWriterClass * klass,
                                        gpointer klass_data)
{
	photos_webp_metadata_writer_parent_class = g_type_class_peek_parent (klass);
	((PhotoFileMetadataWriterClass *) klass)->write_metadata = (void (*) (PhotoFileMetadataWriter*, PhotoMetadata*, GError**)) photos_webp_metadata_writer_real_write_metadata;
}

static void
photos_webp_metadata_writer_instance_init (PhotosWebpMetadataWriter * self,
                                           gpointer klass)
{
}

static GType
photos_webp_metadata_writer_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PhotosWebpMetadataWriterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) photos_webp_metadata_writer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PhotosWebpMetadataWriter), 0, (GInstanceInitFunc) photos_webp_metadata_writer_instance_init, NULL };
	GType photos_webp_metadata_writer_type_id;
	photos_webp_metadata_writer_type_id = g_type_register_static (TYPE_PHOTO_FILE_METADATA_WRITER, "PhotosWebpMetadataWriter", &g_define_type_info, 0);
	return photos_webp_metadata_writer_type_id;
}

GType
photos_webp_metadata_writer_get_type (void)
{
	static volatile gsize photos_webp_metadata_writer_type_id__once = 0;
	if (g_once_init_enter (&photos_webp_metadata_writer_type_id__once)) {
		GType photos_webp_metadata_writer_type_id;
		photos_webp_metadata_writer_type_id = photos_webp_metadata_writer_get_type_once ();
		g_once_init_leave (&photos_webp_metadata_writer_type_id__once, photos_webp_metadata_writer_type_id);
	}
	return photos_webp_metadata_writer_type_id__once;
}

gboolean
photos_is_webp (GFile* file,
                GCancellable* cancellable,
                GError** error)
{
	GFileInputStream* ins = NULL;
	GFileInputStream* _tmp0_;
	guint8 buffer[12] = {0};
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), FALSE);
	g_return_val_if_fail ((cancellable == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (cancellable, g_cancellable_get_type ()), FALSE);
	_tmp0_ = g_file_read (file, NULL, &_inner_error0_);
	ins = _tmp0_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp1_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		return _tmp1_;
	}
	{
		GFileInputStream* _tmp2_;
		gboolean _tmp3_ = FALSE;
		gboolean _tmp4_ = FALSE;
		gboolean _tmp5_ = FALSE;
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		gboolean _tmp8_ = FALSE;
		gboolean _tmp9_ = FALSE;
		guint8 _tmp10_;
		_tmp2_ = ins;
		g_input_stream_read (G_TYPE_CHECK_INSTANCE_CAST (_tmp2_, g_input_stream_get_type (), GInputStream), buffer, (gsize) 12, NULL, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp10_ = buffer[0];
		if (_tmp10_ == ((guint8) 'R')) {
			guint8 _tmp11_;
			_tmp11_ = buffer[1];
			_tmp9_ = _tmp11_ == ((guint8) 'I');
		} else {
			_tmp9_ = FALSE;
		}
		if (_tmp9_) {
			guint8 _tmp12_;
			_tmp12_ = buffer[2];
			_tmp8_ = _tmp12_ == ((guint8) 'F');
		} else {
			_tmp8_ = FALSE;
		}
		if (_tmp8_) {
			guint8 _tmp13_;
			_tmp13_ = buffer[3];
			_tmp7_ = _tmp13_ == ((guint8) 'F');
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			guint8 _tmp14_;
			_tmp14_ = buffer[8];
			_tmp6_ = _tmp14_ == ((guint8) 'W');
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			guint8 _tmp15_;
			_tmp15_ = buffer[9];
			_tmp5_ = _tmp15_ == ((guint8) 'E');
		} else {
			_tmp5_ = FALSE;
		}
		if (_tmp5_) {
			guint8 _tmp16_;
			_tmp16_ = buffer[10];
			_tmp4_ = _tmp16_ == ((guint8) 'B');
		} else {
			_tmp4_ = FALSE;
		}
		if (_tmp4_) {
			guint8 _tmp17_;
			_tmp17_ = buffer[11];
			_tmp3_ = _tmp17_ == ((guint8) 'P');
		} else {
			_tmp3_ = FALSE;
		}
		if (_tmp3_) {
			result = TRUE;
			_g_object_unref0 (ins);
			return result;
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		gchar* _tmp18_;
		gchar* _tmp19_;
		GError* _tmp20_;
		const gchar* _tmp21_;
		_error_ = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp18_ = g_file_get_path (file);
		_tmp19_ = _tmp18_;
		_tmp20_ = _error_;
		_tmp21_ = _tmp20_->message;
		g_debug ("WebPSupport.vala:250: Failed to read from file %s: %s", _tmp19_, _tmp21_);
		_g_free0 (_tmp19_);
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp22_ = FALSE;
		g_propagate_error (error, _inner_error0_);
		_g_object_unref0 (ins);
		return _tmp22_;
	}
	result = FALSE;
	_g_object_unref0 (ins);
	return result;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

