blob: ec500475cc3b72e5484ee2b1e2e0f8e1ce67a549 (
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
32
33
34
35
|
#include "encoder.h"
#include <lame/lame.h>
static gboolean lame_encoder_init(gpointer *data) {
lame_global_flags *gfp;
gfp = lame_init();
int ret = lame_init_params(gfp);
*data = gfp;
return (ret >= 0 ? TRUE : FALSE);
}
static gssize lame_encoder_encode(gpointer data, const guchar *inbuf, gsize inbuf_size,
guchar *outbuf, gsize outbuf_size) {
lame_global_flags *gfp = data;
int ret = lame_encode_buffer_interleaved(gfp, (short*)inbuf, inbuf_size / 4,
outbuf, outbuf_size);
return ret;
}
static void lame_encoder_close(gpointer data) {
lame_global_flags *gfp = data;
lame_close(gfp);
}
const struct encoder_plugin encoder_lame_encoder = {
.name = "lame",
.init = lame_encoder_init,
.encode = lame_encoder_encode,
.close = lame_encoder_close,
};
|