summaryrefslogtreecommitdiff
path: root/decoder.h
blob: 36aa04dd259982ec90ca4dd557680b1f9e247ae5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef DECODER_H
#define DECODER_H

#include <glib.h>
#include <gio/gio.h>

struct decoder_plugin {
	const gchar *name;
	const gchar * const *extensions;

	gboolean (*init)(gpointer *data);
	gssize (*decode)(gpointer data, const guchar *inbuf, gsize inbuf_size,
			guchar *outbuf, gsize outbuf_size);
	void (*close)(gpointer data);
};

struct decoder {
	const struct decoder_plugin *decoder;

	gpointer data;
};

gboolean decoder_init(struct decoder *decoder);
gssize decoder_decode(struct decoder *decoder, const guchar *inbuf,
		gsize inbuf_size, guchar *outbuf, gsize outbuf_size);
void decoder_close(struct decoder *decoder);

const struct decoder_plugin *decoder_get(const gchar *name);
const struct decoder_plugin *decoder_find(const gchar *filename);

#endif