/*
 * Copyright 1988, 1989, 1990, 1991 Massachusetts Institute of Technology
 */


/* swtr_driver.h */

/* this is set up for an NxM crosspoint switcher at the moment;
	that is, no visual effects */

/* 
   Each input (source) has 3 channels: video, left audio, and right audio.
*/


#ifndef SWTR_DRIVER_H
#define SWTR_DRIVER_H

typedef int (*SWTR_METHOD)();

#ifndef VIDEO_CHAN
#define VIDEO_CHAN	1	
#define LEFT_CHAN	2
#define RIGHT_CHAN	4
#define ALL_CHAN	7
#define AUDIO_CHAN      LEFT_CHAN | RIGHT_CHAN
#endif /* VIDEO_CHAN */
/* maximum number of outputs (each with 3 separate channels: V,A1,A2) on the switcher */

typedef struct 
{
	int		fd;		/* the file for talking */
	int		devnum;		/* device number for the switch since
					   some switches can be chained */
	Server          *serv;
	char		port[16];	/* tty_port name - for debugging */
	char		model[32];	/* manufacturer's name */
	char		devname[32];	/* logical name */
	int         devtype;   /* same as above but compiled */
	int             outputnum[MAXSERVEROUTS]; /* which output to
						     use for a
						     particular server
						     output */
	int             computed;  /* -1 if not computed, -2 if computing,
				      0 for computed */
	unsigned char	inputs;		/* number of source inputs */
	unsigned char	outputs;	/* number of sink outputs */

	struct
	{
		unsigned char	VideoSource;
		unsigned char	LeftSource;
		unsigned char	RightSource;
	} state [MAXOUTPUTS];		/* one state record per output */

	Output output_chans[MAXOUTPUTS+1];/*For each output of switcher, 
					    record which input it connects to*/
	int default_input[MAXOUTPUTS+1];/* The default input for each output*/
	int avail[MAXOUTPUTS+1]; /* -1 if avail, clinum if busy. */
	int not_responding; /* gets set after no response to reset */

	SWTR_METHOD		reset;		/* no args */
	SWTR_METHOD		set_chan_src;	/* 3 args: ( channel, input_num, output_num ) */
	SWTR_METHOD		inquire;	/* 4 args: 1 input, 3 output: 
					   (output, &video, &left, &right) */

} SWTR, *SWTR_ptr;

SWTR_ptr	swtrutil_open();	/* given a video.conf table and a device index */
SWTR_ptr	swtrutil_close();	/* given a SWTR_ptr */

#endif /* SWTR_DRIVER_H */
