/*
 mid2253-test.c

 Test program for mid2253.c
 2 styledtext overlays will be shown on Stream A

 Link with mid2253.o
 To compile and run, do "make mid2253-test && ./mid2253-test"
*/


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>



#include "mid2253.h"

int main(int argc, char *argv[])
{
	int devid;
	char *dev = "/dev/video2";
	int chan = 0; // Stream A
	MID2253_OSD_DATA osd1 = {
		osdstyledtext: {
			osdOn: 1,
			osdChan: chan,
			id: 0,
			xoffset: 50,
			yoffset: 50,
			font: "FreeSans",
			size: 32,
			style: MID2253_STYLE_OUTLINE | MID2253_STYLE_SHADOW,
			background: 0,
			color: 0,
			"OSD1"
		}
	};
	MID2253_OSD_DATA osd2 = {
		osdstyledtext: {
			osdOn: 1,
			osdChan: chan,
			id: 1,
			xoffset: 50,
			yoffset: 150,
			font: "FreeSans",
			size: 32,
			style: MID2253_STYLE_OUTLINE | MID2253_STYLE_SHADOW | MID2253_STYLE_BOLD,
			background: 0,
			color: 0,
			"OSD2"
		}
	};
	
	
	devid = open(dev, O_RDWR);
	if (devid < 0) {
		perror(dev);
		exit(1);
	}
	
	S2253_SetOsd(MID2253_OSDTYPE_STYLEDTEXT, &osd1, devid, 0);
	S2253_SetOsd(MID2253_OSDTYPE_STYLEDTEXT, &osd2, devid, 0);
	
	close(devid);
	return 0;
}
