aboutsummaryrefslogtreecommitdiff
path: root/src/talker.c
blob: 8b092742c5c3fc2f11d743fd9ca4dc027bf33926 (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
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>

#include "socket.h"
#include "camera.h"
#include "typedef.h"

#define CAM "/dev/video0"
#define X_RES 160
#define Y_RES 120

void on_send(char *buf, int *bytes)
{
    // write here audio

    int cisz = camera_get_image_size();
    buf[0] = (unsigned char)X_RES;
    buf[1] = (unsigned char)Y_RES;

    *bytes = cisz + 2;

    memcpy(&(buf[2]), camera_get_image(), cisz);

    printf("%d\n", *bytes);
}

int main(void)
{
    camera_init(CAM, X_RES, Y_RES);
    return talker("4950", "localhost", &on_send);
}