aboutsummaryrefslogtreecommitdiff
path: root/src/talker.c
diff options
context:
space:
mode:
authorkartofen <mladenovnasko0@gmail.com>2022-10-17 23:04:12 +0300
committerkartofen <mladenovnasko0@gmail.com>2022-10-17 23:04:12 +0300
commit7e64d0c78e8a21f2ede7eab1303758391001c0dc (patch)
treea01e44b12d66de3e4fbc5cf5ab20f439fc8d6fc8 /src/talker.c
parentb1b7c92aa96af5502f276819b628b05d54f4655c (diff)
many changes in progess
Diffstat (limited to 'src/talker.c')
-rw-r--r--src/talker.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/src/talker.c b/src/talker.c
index 027d0e6..0ba2994 100644
--- a/src/talker.c
+++ b/src/talker.c
@@ -13,6 +13,7 @@
#define X_RES 160
#define Y_RES 120
+camera_handle cam_handle;
void on_send(char *buf, int *bytes)
{
@@ -24,12 +25,27 @@ void on_send(char *buf, int *bytes)
*bytes = REC_CAP + 2 + image_sz;
- memcpy(&(buf[REC_CAP+2]), camera_get_image(), image_sz);
+ memcpy(&(buf[REC_CAP+2]), camera_get_image(&cam_handle), image_sz);
}
int main(void)
{
- camera_init(CAM, X_RES, Y_RES);
- return talker("4950", "localhost", &on_send);
+ int ret = 1;
+
+ camera_params params = {0};
+ params.device = "/dev/video0";
+ params.x_res = 160;
+ params.y_res = 120;
+
+ camera_init(&cam_handle, params);
+
+ if(talker("4950", "localhost", &on_send) != 0) {
+ goto finish;
+ }
+
+ ret = 0;
+finish:
+ camera_deinit(&cam_handle);
+ return ret;
}