-
Notifications
You must be signed in to change notification settings - Fork 1
/
ImageOutput.c
83 lines (64 loc) · 1.96 KB
/
ImageOutput.c
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* Write out images to files. */
#include <stdio.h> /* fprintf */
#include <stdlib.h> /* calloc */
#include <string.h> /* memcpy */
#include "CTI.h"
#include "ImageOutput.h"
#include "Images.h"
static void Config_handler(Instance *pi, void *msg);
static void YUV422P_handler(Instance *pi, void *data);
enum { INPUT_CONFIG, INPUT_YUV422P, INPUT_JPEG };
static Input ImageOutput_inputs[] = {
[ INPUT_CONFIG ] = { .type_label = "Config_msg", .handler = Config_handler },
[ INPUT_YUV422P ] = { .type_label = "YUV422P_buffer", .handler = YUV422P_handler },
};
//enum { /* OUTPUT_... */ };
static Output ImageOutput_outputs[] = {
//[ OUTPUT_... ] = { .type_label = "", .destination = 0L },
};
typedef struct {
Instance i;
String output_base;
} ImageOutput_private;
static Config config_table[] = {
// { "...", set_..., get_..., get_..._range },
};
static void Config_handler(Instance *pi, void *data)
{
Generic_config_handler(pi, data, config_table, table_size(config_table));
}
static void YUV422P_handler(Instance *pi, void *data)
{
// ImageOutput_private * priv = (ImageOutput_private*) pi;
YUV422P_buffer *y422p_in = data;
YUV422P_buffer_release(y422p_in);
}
static void ImageOutput_tick(Instance *pi)
{
Handler_message *hm;
hm = GetData(pi, 1);
if (hm) {
hm->handler(pi, hm->data);
ReleaseMessage(&hm,pi);
}
pi->counter++;
}
static void ImageOutput_instance_init(Instance *pi)
{
ImageOutput_private *priv = (ImageOutput_private *)pi;
String_set_local(&priv->output_base, "./");
}
static Template ImageOutput_template = {
.label = "ImageOutput",
.priv_size = sizeof(ImageOutput_private),
.inputs = ImageOutput_inputs,
.num_inputs = table_size(ImageOutput_inputs),
.outputs = ImageOutput_outputs,
.num_outputs = table_size(ImageOutput_outputs),
.tick = ImageOutput_tick,
.instance_init = ImageOutput_instance_init,
};
void ImageOutput_init(void)
{
Template_register(&ImageOutput_template);
}