doorbell

diff doorbelld/src/main.c @ 5:f21ae31ef0e7

craptacular
author John Tsiombikas <nuclear@member.fsf.org>
date Tue, 15 Mar 2016 08:35:21 +0200
parents 08ea0abdbb8a
children dc4018af3a40
line diff
     1.1 --- a/doorbelld/src/main.c	Mon Mar 14 04:20:59 2016 +0200
     1.2 +++ b/doorbelld/src/main.c	Tue Mar 15 08:35:21 2016 +0200
     1.3 @@ -64,7 +64,6 @@
     1.4  			}
     1.5  		}
     1.6  		printf("serving test pattern\n");
     1.7 -		save_image("output.ppm", frame, width, height);
     1.8  	}
     1.9  
    1.10  	if(pthread_create(&thread, 0, frame_proc, 0) == -1) {
    1.11 @@ -112,6 +111,12 @@
    1.12  		for(i=0; i<num_sockets; i++) {
    1.13  			if(FD_ISSET(sock[i], &rdset)) {
    1.14  				srv_handle(sock[i]);
    1.15 +				if(fd == -1) {
    1.16 +					pthread_mutex_lock(&mutex);
    1.17 +					frame_available = 1;
    1.18 +					pthread_mutex_unlock(&mutex);
    1.19 +					pthread_cond_signal(&condvar);
    1.20 +				}
    1.21  			}
    1.22  		}
    1.23  	}
    1.24 @@ -141,8 +146,9 @@
    1.25  
    1.26  		if(fd != -1) {
    1.27  			wcam_read_frame_rgb(fd, frame);
    1.28 -			save_image("output.ppm", frame, width, height);
    1.29 +			/*save_image("output.ppm", frame, width, height);*/
    1.30  		}
    1.31 +		srv_send_frame(frame, width, height);
    1.32  	}
    1.33  	return 0;
    1.34  }