diff options
Diffstat (limited to 'src/talker.c')
-rw-r--r-- | src/talker.c | 22 |
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; } |