1 #include <stdlib.h>
2 #include <stdint.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <stdbool.h>
6 
7 #include <arcan_shmif.h>
8 
9 #ifdef ENABLE_FSRV_AVFEED
arcan_frameserver_avfeed_run(const char * resource,const char * keyfile)10 void arcan_frameserver_avfeed_run(const char* resource, const char* keyfile)
11 #else
12 int main(int argc, char** argv)
13 #endif
14 {
15 	struct arg_arr* aarr;
16 	struct arcan_shmif_cont cont = arcan_shmif_open(
17 		SEGID_APPLICATION, SHMIF_ACQUIRE_FATALFAIL, &aarr);
18 
19 	uint8_t step_r = 0;
20 	uint8_t step_g = 0;
21 	uint8_t step_b = 255;
22 
23 	int left = 5;
24 	while (left--) {
25 		for (size_t row = 0; row < cont.h; row++)
26 			for (size_t col = 0; col < cont.w; col++)
27 				cont.vidp[ row * cont.addr->w + col ] = SHMIF_RGBA(step_r, step_g, step_b, 0xff);
28 		step_r++;
29 		step_g += step_r == 255;
30 		step_b += step_g == 255;
31 
32 		arcan_shmif_signal(&cont, SHMIF_SIGVID);
33 		sleep(1);
34 		printf("left: %d\n", left);
35 	}
36 	printf("shutting down\n");
37 	arcan_shmif_drop(&cont);
38 
39 #ifndef ENABLE_FSRV_AVFEED
40 	return EXIT_SUCCESS;
41 #endif
42 }
43