The Interactive Engineer Volume 4, Number 4, 1995
In this Issue:Widescreen CD-i
CD-i keyboards and keypad

Table of Contents
Displaying 16:9 aspect ratio1
Media Mogul Keypads3
CD-i Keyboard example code4
Electronic CD-i catalogue5
CD-i Training courses8
A launcher program8

In the next Interactive Engineer: Media Mogul: Load/save variables to your own file CD-i Mailserver: get a wealth of information and source codes by email

How to display in 16:9 aspect ratio

Developing widescreen applications

Richard Van De laarschot Philips Interactive Media Centre Many people have questions on how to display 16:9 video material on a 16:9 television screen. This article explains how to do it. First of all you need a TV that can display 16:9 Aspect Ratio (AR) images. This TV needs to be connected to a CD-i player with a Euro AV Connecter cable. The CD-i application needs a Euro AV Connecter cable to switch the TV in 16:9 or 4:3 AR. If you connect your TV by CVBS or antenna it will not work. Then you need a CD-i player (with Euro AV Connector, so not a CDI450) that supports 16:9. All the players with the new player shell (with the CD-i logo with moving colours) support 16:9. In the shell you go to 'Options' and 'General' to switch the '16:9 screen display' to 'ON'. This will set a 'AR="16:9"' string in the DT_DISPLY entry of the CSD file. What to do in the application. The application has to check the CSD DT_DISPLY string to see if it is allowed to switch to 16:9. If it finds no 'AR=' string then you have a CD-i player that does not support AR switching (old player shell). If it finds 'AR="4:3"' then you have a CD-i player that does support AR switching (new player shell) but the '16:9 screen display' option in the General Options is set to OFF. This means you may not switch AR to 16:9. If you do find the 'AR="16:9"' string then you have a CD-i player that does support AR switching (new player shell) and the '16:9 screen display' option in the General Options is set to ON. This means that you may switch AR to 16:9. The application can then switch the AR to 16:9 (or 4:3) using the DC_SetAR call (see Green Book VII-180). I will now include the Source code of a Media Mogul plugin that will do this.
/**************************************************
* Filename:	cdi_16_9.c
* Purpose:	MeMo plugin to support 16:9 <--> 4:3 switching
* Arguments:	'0' or '1'
*   			'0' will switch the Aspect Ratio to 4:3
*        		'1' will switch the AR to 16:9
* Returns:  	On Error it will exit with error code 1 AND
*           	will set the Media Mogul variable Z to 999.
*
*  If you have set 16:9 to ON in the player shell
*  AND
*  Your CD-i player is connected to the TV (that supports 16:9) 
*  by Euro AV plug 
*  THEN
*  This plugin will switch the AR 
**************************************************/
#include 
#include 
#include  
#include  

#define SYSERR                  (-1)

/* globals */
int vpath, armode;


/*******************
* Function to set the Media Mogul Variable 'Z' to '999'.
* This is done to let Media Mogul know the plugin failed.
* It will return a 1 on Error.
*******************/
Set_MeMo_varZ()
{
int zd, value_z, result;

zd = _ev_link("Z");
if (zd == SYSERR)
	{
	return(1);
	}
value_z = 999;
result = _ev_set(zd, value_z, 0);
if (result == SYSERR)
	{
	return(1);
	}
result = _ev_unlink(zd);
if (result == SYSERR)
	{
	return(1);
	}
return(0);
}
/**************************************************
* main()
**************************************************/
main( argc, argv )
int argc;
char **argv;
{
 int i;
 char *devnam, *parstr;

 /* check if a '1' (set to 16:9) or '0' (set to 4:3) is given */
 if (argc < 2) 
	{
	/* argc < 2 */
	i = Set_MeMo_varZ();
	exit(1); 
	}
 armode = atoi(argv[1]);
 if ((armode != 0) && (armode != 1)) 
	{
	/* illegal ARmode */
	i = Set_MeMo_varZ();
	exit(1); 
	}

 /* open video path */
 if ((devnam = csd_devname(DT_VIDEO,1)) == NULL)
	{
	/* can not get video path */
	free(devnam);
	i = Set_MeMo_varZ();
	exit(1);
	}
 if ((vpath = open(devnam, S_IREAD | S_IWRITE)) == SYSERR) 
	{
	/* can not open video path */
	free(devnam);
	i = Set_MeMo_varZ();
	exit(1); 
	}
 free(devnam);

 /* read csd entry string */
 if ((devnam = csd_devname(DT_DISPLY,1)) == NULL)
	{
	/* can not get Display Monitor path */
	free(devnam);
	i = Set_MeMo_varZ();
	exit(1);
	}
 if ((parstr = csd_devparam(devnam)) == NULL) 
	{
	/* can not get Display Monitor string */
	free(devnam);
	free(parstr);
	i = Set_MeMo_varZ();
	exit(1); 
	}
 free(devnam);
 i = findstr(1, parstr, "AR=\"16:9\"");
 free(parstr);
 if (i == 0) 
	{
	/* armode not set to 16:9 in CSD file (in player shell) */
	i = Set_MeMo_varZ();
	exit(1); 
	}

 /* switch AR */
 i = SetAR();
 if (i == SYSERR) 
	{
	/* set AR failed */
	i = Set_MeMo_varZ();
	exit(1); 
	}
 /* set AR succeeded */
 exit(0);
}


#asm

* Function to switch the Aspect Ratio.
* This function needs two GLOBAL variables          
* 'int vpath, armode' with exactly these names.    
* In 'vpath' it needs the video path              
* and in 'armode' it needs the argument passed.
* This may have only the values '0' or '1'.      
* '0' will switch the AR to 4:3 and            
* '1' will switch the AR to 16:9.             
* The function will return SYSERR (-1) if it failed
* and OK (0) if it could switch the AR.

DC_SetAR		equ		$20 

SetAR:		movem.l	d2-d3,-(a7)
			move.l	vpath(a6),d0	
			move.w	#SS_DC,d1
			move.w	#DC_SetAR,d2
			move.l	armode(a6),d3
			OS9		I$SetStt
			bcs.s	ERROR
			moveq	#0,d0
			movem.l	(a7)+,d2-d3
			rts
ERROR		moveq	#-1,d0
			movem.l	(a7)+,d2-d3
			rts

#endasm
This source code will be available through the PIMC mailserver to all developers with a support contract or an information services contract. If you have any problems in receiving it, you can ask hein@pimc.be to send you this program written by Richard Van De Laarschot.

Media Mogul Keypads

Makes Kiosk Applications User Friendly

David Ward NSO UK & northern Europe The Swedish company Serv & Tech specialises in Point of Sales applications where information on a wide range of products or services needs to be made accessible in a simple to use manner. Faced with customer resistance to a pointer solution(trackball, remote), and finding the touch-screen unsuitable for eye-level TV displays, they designed a simple 0-9 keypad by which users can make a selection. "The success of this solution was even greater than expected" says Christer Lindstrom. "Kiosk users are given a control that looks like a telephone keypad - an instantly familiar and universally accepted controller. The menu screens where the user makes a choice have numbers against each selection and the user can quickly access the product or service information that they require even passing through two or three menu layers. People are used to remember short number sequences and can quickly find their way in and out the disc contents by recalling three or four members that lead to a particular area. By using two extra keys on a 4x3 keypad we offer a simple one-key selection to bring you back into the main menu pages." The cost advantages of a keypad solution is also significant, being about 1/10th of a touch screen with no problems of installation and servicing. Serv&Tech even have an interface which allows a standard phone keypad to be used, allowing environmentally protected or ruggedised keypads from third-party phone suppliers to be used when the kiosk location is hostile. Serv&Tech is able to supply both versions of the keypad - integral keypad/interface or just the interface for use with a third-party keypad. Connection to the player is by a supplied cable which connects to the consumer player serial port. The keyboard works with Media Mogul plus the Optimage Keyboard plug-in. Example scripts are supplied with the keypad. Please contact Christer Lindstrom at Serv&Tech for further information. A demonstration package comprising a keypad and a disc is available for evaluation. Serv&Tech Christer Lindstršm Hallefunlundregatan 16 S42658 Vastra Frolunda Sweden Phone +46 31 299170 Fax +46 31 694608

CD-i Keyboard

example codes

Jan Matejka Philips Interactive Media Centre The following code contains a set of functions to obtain control of a CD-i keyboard in an application, and to configure it in the appropriate mode (parameters : delay, repeat freq. etc..). Also a signal handler is installed that can correctly signal/process all incoming keycodes. This code is supplied AS IS and is not likely to be executable in this format, although the functions are written in a way that they can easily be incorporated in existing C-Code. Although this code has proven to be stable on a range of different CD-i player types, the programmer cannot guarantee full functionality of these functions on every CD-i player+keyboard setup. This code is only meant as an example. This source code will be available through the PIMC mailserver to all developers with a support contract or an information services contract. If you have any problems in receiving it, you can contact hein@pimc.be to send you this program written by Jan Matejka.
/**************************************************
*
*
*   CDI KEYBOARD example code...
*
*
*   programmer 	: Jan Matejka, Philips Int. Media
*   platform 	: CD-i
*   compiler	: Microware OS9 C compiler V3.2.3 for Sun/Sparc 
*
/*************************************************/

#include 
#include 
#include 
#include 
#include   
#include 
#include 
#include 
#include 

#include "cdm.h"
#include "debug.h"


#define		SCAN_SIG		280

/* KEYBOARD DEFINITIONS	*/
#define		KEYBOARD_SIG		300

#define		KB_MODE_WAIT		0x01
#define		KB_MODE_REMOVE		0x02

#define		KB_KEY_PRESSED		0x01
#define		KB_KEY_AUTO_REPEAT	0x02
#define		KB_KEY_RELEASED		0x04

/*	globals		*/
extern int	errno;


int		keyboard_path;

unsigned short	kb_ok_flag;

short		inkey;
unsigned char	type;

char		character[1];


void		init_kb();
void		flush_keyboard_buffer();
void		signal_handler();


/*************************************************/

main()
{


init_kb();
intercept(signal_handler);
kb_ssig(keyboard_path, KEYBOARD_SIG);
dc_ssig(video_path,SCAN_SIG,0);



while(1);

exit(0);
}

/*************************************************/



//************************************************/

void init_kb()
{
char *kb_devname;

	if ((kb_devname = csd_devname(DT_KEYBRD, 1)) == NULL)
		{
		DEBUG_ON(printf("CSD Error on keyboard name\n");)
		kb_ok_flag = 0;
		}
		else 
		{
		if ((keyboard_path = open(kb_devname, S_IREAD)) == -1)
			{
			DEBUG_ON(printf("Error on opening keyboard\n");)
			kb_ok_flag = 0;
			}
			else
			{
			kb_ok_flag = 1;
			kb_repeat(keyboard_path,25,5); 	/* default auto-repeat is on, delay time : 25 ticks, repeat time : 5 ticks */
			flush_keyboard_buffer();
			}
		}
}

/*************************************************/

void	flush_keyboard_buffer()
{
short		inkey;
unsigned char	type;

	if (kb_ok_flag)
		{
		do kb_read(keyboard_path,KB_MODE_REMOVE,&inkey,&type);
			while (type);
		Wait_n_Ticks(2);
		do kb_read(keyboard_path,KB_MODE_REMOVE,&inkey,&type);
			while (type);
		}
}

	
/**************************************************
* SIGNAL_HANDLER						*
**************************************************/

void signal_handler(signum)
register int 	signum;
{

switch(signum)
	{

	case	KEYBOARD_SIG:
		kb_read(keyboard_path,KB_MODE_REMOVE,&inkey,&type);
		printf("inkey : %d --- type : %d\n",inkey,type);
		if (type & (KB_KEY_PRESSED | KB_KEY_AUTO_REPEAT) )
			{
			if (scan_count<40)
				{
				printf("hello...\n");
				scan_count++;
				}
			}

		kb_ssig(keyboard_path, KEYBOARD_SIG);
		break;

	case	SCAN_SIG:
		dc_ssig(video_path,SCAN_SIG,0);
		break;

	case SIGQUIT:
	case SIGINT:
		exit(0);

	default:
		DEBUG_ON(printf("Signal_Handler: Unknown signal [%d]\n", signum););
	}
}
/*************************************************/

Electronic CD-i catalogue

Your publicity for free

Kris Aelterman Philips Interactive Media Centre Philips Media is assembling an electronic catalogue of all existing CD-i titles. The catalogue will initially be published as a CD-i disc, with regular updates. Other means of distribution will be evaluated later, like Tele-CD-i, CD-rom, Internet. CD-i resellers, partners of Philips Media and producers mentioned on the disc will receive a free copy of the disc, others will be able to buy it. You will find a questionnaire on the next two pages. Please return this questionnaire to make sure that your titles get the proper attention! Here is why we think you would like to add your title to the catalogue: • Your titles get exposure to the world-wide CD-i community • Advertising on disc will be possible - contact us for more details. Fill out the questionnaire for every title you want to include in the catalogue. We would very much appreciate a sample copy of the titles in the catalogue. If you can't send a sample, please include a copy of the packaging or of some relevant screens to enable a picture of the title to be included in the catalogue. Send all information to: Kris Aelterman/PIMC Maastrichterstraat 63 3500 HASSELT Belgium Fax: +32-11-242-168 Phone: +32-11-242-547 E-mail: KRIS@PIMC.BE FAX FROM: To: Kris Aelterman Fax: +32-11-242 168 E-mail: KRIS@PIMC.BE Philips Interactive Media Centre - Hasselt (Belgium) QUESTIONNAIRE Title: .......................................................................................................................................... If the original title is not English please give an English translation : .......................................................................................................................................... Title summary: (50-100 words, attach paper if necessary) .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... .......................................................................................................................................... Category: (please mark only 1 category) Point of Information/Sales [] Music [] Training [] Movie [] Educational [] Games [] Special Interest [] Kids [] Language Learning [] Erotic [] Target Audience: .......................................................................................................................................... Language on disc .......................................................................................................................................... Catalognumber: (1 character/box) Barcode: (1 character/box) |_|_|_|_|_|_|_|_|_|_|_|_|_| |_|_|_|_|_|_|_|_|_|_|_|_|_| Number of discs per package: ...... TV Standard Supported: NTSC [] PAL [] Format: CD-I [] CD-Ie (extra functionality with DV cartridge) [] DV-I (DV cartridge required) [] DV (linear DV, green book encoded) [] VCD (linear DV, white book encoded) [] Peripherals: supported required DV-cartridge [] [] Printer [] [] Touchscreen [] [] Modem [] [] Floppy disk [] [] Other (specify): [] []..................... ..................... Collateral Material ........................................................................................................................................ ........................................................................................................................................ ........................................................................................................................................ Publishing Company: (Commissioner) Name: .............................................................. Contactperson: ..................................................... Tel.: ...................... Fax : .......................... Country: ................... Producer: (Studio) Name: .............................................................. Contactperson: ..................................................... Tel.: ...................... Fax : .......................... Country: ................... Distribution Company: Name: .............................................................. Contactperson: ..................................................... Tel.: ...................... Fax : .......................... Country: ................... Availability: [] General release [] Limited release [] Internal Use Only Year of release: ......... Price: ..................................................

CD-i Training Courses

PIMC organizes special courses for CD-i developers. The CD-i Training Courses are meant for managers, designers, producers, programmers and other people who are interested in CD-i production. Courses are generally held in Hasselt, Belgium. For prices in your country please contact your local Philips representative. For registration and more information please contact: PIMC Training Ann Holsteyns Maastrichterstraat 63 3500 Hasselt - Belgium tel.: +32 11 242546 fax: +32 11 242273 CD-i Design Principles The workshop (3 days) handles design issues of Multimedia applications from storyboard to asset gathering, providing the insight necessary to successfully produce a CD-i title. Experienced Senior Designers will help participants to produce a CD-i title at the end of the workshop. Aug. 02 - 04, 1995 Nov. 08 - 10, 1995 CD-i Programming Tools • CD-i Development with MediaMogul (4 days course) handles with hands-on instruction the process of authoring a MediaMogul application. Jul. 25 - 28, 1995 Aug. 22 - 25, 1995 • CD-i Programming with Balboa (4 days workshop) is meant for experienced programmers and offers the basics of development with Balboa Libraries. Jul. 11 -13 , 1995 Sep. 12 - 15, 1995 Digital Video Basics • Digital Video Principles (1day course) gives a general overview of the Digital Video production process and of the MPEG1 encoding process. Jul. 18, 1995 Aug. 17, 1995 • Digital Video hands-on Delta Vx (1 day workshop) presents and compares the systems SUN/Androx and Optimage/Delta V series, specifying the advantages and limits of both systems. Jul. 19, 1995 Aug. 18, 1995

Launcher program

An example

Richard van de Laarschot Philips Interactive Media Centre Many people would like to have a launcher program that gives them the possibility of loading their application in the memory colour of there choice. This launcher has to check for the presence of a DV cartridge and (if possible) to check if the DV cartridge is White book compatible. I wrote an example program that will do this and will play the Philips bumper (from the FPD disk Version 8.04) before it chains to the application. It will give a black screen with a hidden cursor while it is chaining to the application. (I use chaining to minimise memory use, the launcher program will be removed from memory while the application is loaded). This program needs in the root directory the following files from the FPD disk (version 8.04): • cdi_bumper (containing the modules 'cdi_bumper' and 'cdi_bumpdata'. You can find this file in the root of the FPD disk) • bumper.rtf (the real time file. You can find this file in the 'pimi_bumper/data/dbl' directory) • And of course the 'bumper_load_util.c' needs to be linked with this program, other wise you will get some undefined labels. You can find the launcher program on the following pages. Please note: a new FPD disc is being developed right now, the old one is not available any more. We will keep you informed.
/******************************************************************************
* Filename:		launcher.c
* Purpose:		This is the application that is initially loaded by the player
*				shell; it then loads the actual application and
*				chains to it, having first decremented its own link count.
*				after it has run the philips bumper
******************************************************************************/
#include <memory.h>
#include <module.h>
#include <modes.h>
#include <ucm.h>
#include <csd.h>
#include <cdfm.h>
#include <bumper.h>
#include <rtr.h>


#define BUMP_LCT_HEIGHT		480	
#define	BUMP_ARGNUM		2	/* Max number of bumper cmd line args */
#define	VOLUME_UP		0x00000000

#define APPLICATION_NAME        "cdi_main"
#define APPLICATION_NAME_NODV   "cdi_main2"
 

extern int errno;			/* Needed externals */
extern int os9forkc();
extern char **environ;

char *argblk[BUMP_ARGNUM] = {"cdi_bumper", 0};
char *argblk1[] = {APPLICATION_NAME, 0};
char *argblk2[] = {APPLICATION_NAME_NODV, 0};
char *bumpdata = "cdi_bumpdata";

extern int os9exec(), chainc();
 
/******************************************************************************
* main()
******************************************************************************/
main( argc, argv )
int argc;
char **argv;
{
	int vpath;
	int f0, f1, pid, waitpid;
	unsigned int bumper_status;
	mod_exec *datmod, *modlink(), *modcload();
	BUMPER_DATA *bumpmod;
	char cdnam[10], applic_mod_name[64], *devnam;

	errno = 0;

 	/* Load the bumper executable and data module */
	if ( (int)modcload( argblk[0], 0, VIDEO1) == SYSERR )
		exit( errno );

	/* Link to the data module */
	if ( (int)(datmod = modlink( bumpdata, MT_ANY )) == SYSERR )
		if ( (int)(datmod = modcload( bumpdata, 0, VIDEO1 )) == SYSERR )
			exit( errno );

	/* Point to the actual data section of the module */
	bumpmod = (BUMPER_DATA *)((char *)datmod + ((DATA_MODULE *)datmod)->data_offset);

	/* Get video environment setup */
	if ( bump_init_vid( &vpath, &(bumpmod->dcp), 
				BUMP_LCT_HEIGHT, bumpmod->vid_name ) == SYSERR )
		exit( errno );

	if ( (devnam = csd_devname(DT_VIDEO,1)) == NULL )
            exit(errno);
      if ( (vpath = open( devnam, S_IREAD )) == SYSERR )
            exit( errno );
      free( devnam );
      gc_hide(vpath);

	/* Remember height of LCTs */
	bumpmod->lct_height = BUMP_LCT_HEIGHT;
	init_audio();			/* Set up audio so it plays */

	/* Set compat bit and PAL flag */
	if ( set_comp_mode( vpath, &(bumpmod->pal_flag) ) == SYSERR )
		exit( errno );

	/* Null these out, assume we don't pass */
	bumpmod->app_pa_buf = NULL;
	bumpmod->app_pb_buf = NULL;
	bumpmod->pcb = NULL;

	/* Shut down the planes then execute DCP */
	dc_wrfi( vpath, bumpmod->dcp.fcta, FCT_ICF, cp_icf(PA, ICF_MIN) );
	dc_wrfi( vpath, bumpmod->dcp.fctb, FCT_ICF, cp_icf(PB, ICF_MIN) );
	dc_exec( vpath, bumpmod->dcp.fcta, bumpmod->dcp.fctb );

      /* Fork the Bumper */
      if ( (pid = os9exec( os9forkc, argblk[0], argblk, environ,
						 0, 0, (vpath + 1) )) == SYSERR )
                exit( errno );
      do
                {
                waitpid = wait( &bumper_status );
                }
      while ((waitpid != -1) && (waitpid != pid)); /* wait for bumper to finisch */
	while (munload( bumpdata, 0)!=-1);	/* Decrement the data module's link count */

/*
 * This concludes what is necessary for the bumper
 * itself to run; From here on down it's strictly
 * application.  
 */

        gc_hide(vpath);
        f0 = dc_crfct( vpath, PA, 3, 0);
        if (f0 == -1) exit(errno);
        dc_wrfi( vpath, f0, 0, cp_tci(MIX_OFF, TR_ON, TR_ON) );
        dc_wrfi( vpath, f0, 1, cp_bkcol(BK_LOW, BK_BLACK) );
        dc_wrfi( vpath, f0, 2, cp_icm(ICM_OFF, ICM_OFF, NM_1, EV_OFF, CS_A) );
        f1 = dc_crfct( vpath, PB, 3, 0);
        if (f1 == -1) exit(errno);
        dc_wrfi( vpath, f1, 0, cp_tci(MIX_OFF, TR_ON, TR_ON) );
        dc_wrfi( vpath, f1, 1, cp_bkcol(BK_LOW, BK_BLACK) );
        dc_wrfi( vpath, f1, 2, cp_icm(ICM_OFF, ICM_OFF, NM_1, EV_OFF, CS_A) );
        dc_exec( vpath, f0, f1 );

	  if ( (int)(devnam = csd_devname( DT_CDC, 1)) == -1 )
		    exit(errno);
	  strcpy(cdnam, devnam);
	  strcpy ( applic_mod_name, cdnam);
	  strcat ( applic_mod_name, "/");
        free( devnam );
        if(csd_devname(90,1)!=NULL) /* is there a DV cartridge */
          { /* goto cdi_main (that needs DV) with a black screen */
		if ((int)modlink("vcd", MT_ANY) != SYSERR)
			{
			 /* DV cartridge is Green book AND White book compatible */
			}
		else
			{
			/* DV cartridge is NOT White book compatible
			   Plays all MPEG as defined by the Green book */
			}
            strcat ( applic_mod_name, APPLICATION_NAME);
		/* you can change the memory colour to the colour you want 
		   your application to be loaded in */
            modcload(applic_mod_name,0,SYSRAM); 
            os9exec(chainc,argblk1[0],argblk1, environ, 0, 0, (vpath + 1));
        	exit(0);                        /* Git outta here */
          }
	  else
		{/* go to cdi_main2 (that needs no DV) with a black screen */
		 strcat ( applic_mod_name, APPLICATION_NAME_NODV);
		/* you can change the memory colour to the colour you want 
		   your application to be loaded in */
		 modcload(applic_mod_name,0,VIDEO1);
		 os9exec(chainc,argblk2[0],argblk2, environ, 0, 0, (vpath + 1));
		 exit(0);			/* Git outta here */
		}
}


/************************************************************************
* set_comp_mode()
*
* Purpose: 	Set the compatability mode on the CD-I system assuming
*				that the images used are 384 actual bytes wide
* Passed:	the video device number,
*			a ptr to the var which will contain the PAL flag,
* Output:	The compatability mode will be set according to the info
*				found in the CSD,
*			If we are displaying on a 625 line system, the pal_flag will
*				be set to YES, else it will be NO
* Returned:	OK or SYSERR
************************************************************************/
int set_comp_mode( vpath, pal_flag )
int vpath, *pal_flag;
{
	char *disp_dev, *disp_param;
	char *csd_devname(), *csd_devparam();
	REG char *dp;
	int mode, org_diff;

#define TV_TYPE_STR		"TV"	/* TV type ID string */
#define PAL_625_STR		"625"	/* Spec's 625 line system */

	if ( (disp_dev = csd_devname( DT_VIDEO, 1 )) == NULL )
		return ( SYSERR );

	if ( (disp_param = csd_devparam( disp_dev )) == NULL )
	{
		free( disp_dev );
		return ( SYSERR );
	}

	mode = 1;					/* Mode 1 is for 384 width on Monitor */
	dp = disp_param; 			/* If "TV" is found then mode should be 0 */
	while ( *dp != '\0' )
	{
		if (strncmp( dp++, TV_TYPE_STR, strlen(TV_TYPE_STR) ) == 0) 
		{
			mode = 0;
			break;
		}
	}

	*pal_flag = NO;				/* Assume NTSC */
	dp = disp_param; 			/* If 625 is found, then we are in PAL */
	while ( *dp != '\0' )
	{
		if (strncmp( dp++, PAL_625_STR, strlen(PAL_625_STR) ) == 0) 
		{
			*pal_flag = YES;
			if ( mode == 1 )	/* Need mode to be 0 w/384x240 on 625 lines */
				mode = 0;
			break;
		}
	}

	free( disp_dev );			/* Give back memory for csd stuff */
	free( disp_param );
								/* Set appropriate compatability mode */
								/*  and set return value to parameter */
	Errchk( org_diff = dc_setcmp( vpath, mode ) );

								/* Reset ptr to report from offset */
								/* Also, if in PAL, move org down 40 lines */
	pt_org( vpath, (org_diff >> 16), (org_diff & 0xff) );

	return ( OK );

#undef TV_TYPE_STR
#undef PAL_625_STR

}

/************************************************************************
* init_audio()
* Purpose:	Open up the audio device and set the attenuation to its 
*			initial full on value.
************************************************************************/
init_audio()
{
	int apath;
	char *aud_dev;

	errno = 0;
	if ((aud_dev = csd_devname( DT_AUDIO, 1 )) == NULL )
		return( SYSERR );

	apath = open( aud_dev, (S_IREAD | S_IWRITE));
	free( aud_dev );

	sc_atten( apath, VOLUME_UP );
}
This source code will be available through the PIMC mailserver to all developers with a support contract or an information services contract. If you have any problems in receiving it, you can contact hein@pimc.be to send you this program written by Richard Van De Laarschot.

The Interactive Engineer

EditorHein Zegers
ContributorsKris Aelterman
Erik Beerten
Marc De Krock
Ann Holsteyns
Jan Matejka
Richard Van De Laarschot
David Ward
The Interactive Engineer is a publication of Philips Interactive Media. Its purpose is to provide up-to-date information on CD-i technology to all supported developers and PIM software engineers 11050 Santa Monica Boulevard Los Angeles, CA 90025 Copyright © 1995 Philips Interactive Media, Inc. All rights reserved. Not to be reproduced without the express written permission of Philips Interactive Media.