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

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

gssize encoder_encode(struct encoder *encoder, GInputStream *input,
			GOutputStream *output, GError **error) {
	return encoder->encoder->encode(encoder->data, input, output, error);
}

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;
}