summaryrefslogtreecommitdiff
path: root/encoder.c
blob: 4e0ffb87b12753ed01916e4e37a5fb5c9ea0f325 (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
#include "encoder.h"

gboolean encoder_init(struct encoder *encoder) {
	return encoder->encoder->init(&encoder->data);
}

gssize encoder_encode(struct encoder *encoder, const guchar *inbuf, gsize inbuf_size,
			guchar *outbuf, gsize outbuf_size) {
	return encoder->encoder->encode(encoder->data, inbuf, inbuf_size,
			outbuf, outbuf_size);
}

void encoder_close(struct encoder *encoder) {
	encoder->encoder->close(encoder->data);
}

extern const struct encoder_plugin encoder_lame_encoder;

static const struct encoder_plugin *encoder_plugins[] = {
	&encoder_lame_encoder,
	NULL,
};

const struct encoder_plugin *encoder_get(const gchar *name) {
	for(int i = 0; encoder_plugins[i]; i++) {
		if(g_strcmp0(encoder_plugins[i]->name, name) == 0) {
			return encoder_plugins[i];
		}
	}
	return NULL;
}