
/*
 *
 * Copyright (C) 1998,1999  Thomas Mirlacher
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 * 
 * The author may be reached as dent@cosy.sbg.ac.at, or
 * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
 * Austria
 *
 *------------------------------------------------------------
 *
 */

#include "IFOParser.h"
#include <stdio.h>

#include <io.h>
#include <stdlib.h>

#include <sys/types.h>
//#include <unistd.h>
#include <fcntl.h>

#include "ifo.h"
#include "misc.h"

extern void ifo_print_audiosub (u_char *ptr);
extern void ifoPrintSPU		(ifo_spu_t *spu, u_int num);
extern void ifoPrintAudio	(ifo_audio_t *audio, u_int num);
extern void ifoPrintTMT		(ifo_t *ifo);
extern void ifoPrint_ptt (ifo_ptt_t *ptt);
extern void ifoPrint_vts_vobu_addr_map (ifo_t *ifo);
extern void ifoPrint_vtsm_vobu_addr_map (ifo_t *ifo);
extern void ifoPrint_vts_cell_addr (ifo_t *ifo);
extern void ifoPrint_vtsm_cell_addr (ifo_t *ifo);
extern void ifoPrint_title_pgci (ifo_t *ifo);
extern void ifoPrintToast (u_char *toast);
extern void ifoPrint_menu_pgci (ifo_t *ifo);
extern void ifoPrint_pgc_cmd (u_char *pgc_ptr);


/**
 *
 */

int my_main (int argc, char **argv)
{
   CIFOParser ifo;
	TPGC *pgc;
	int i;

   ifo.Load("matrix.ifo");


/*	ifo_t *ifo;
	int   fd;

	printf ("free InFormatiOn project %s\n", version);
	printf ("--------------------------------\n");
	printf ("(c) 1999-2000 by Thomas Mirlacher\n\n");

	if ((fd = open (argv[1], O_RDONLY|_O_BINARY)) < 0) {
		fprintf (stderr, "error opening file %s.\n", argv[1]);
		exit (-1);
	}

	if (!(ifo = ifoOpen (fd, 0))) {
		fprintf (stderr, "error initializing ifo.\n");
		exit (-1);
	}

	ifoPrintVideo (ifo->data[ID_MAT] + IFO_OFFSET_VIDEO);

	if (!ifoIsVTS (ifo)) {
		char *ptr;
		int num;

		if ((num = ifoGetAudio ((char *)ifo->data[ID_MAT] + IFO_OFFSET_AUDIO, &ptr)) > 0)
			ifoPrintAudio ((ifo_audio_t *)ptr, num);

		if ((num = ifoGetSPU ((char *)ifo->data[ID_MAT] + IFO_OFFSET_SUBPIC, &ptr)) > 0)
			ifoPrintSPU ((ifo_spu_t *)ptr, num);

		//ifoPrintSPU (ifoGetSPU (ifo->data[ID_MAT] + IFO_OFFSET_SUBPIC));

		ifoPrintTMT (ifo);

		ifoPrint_ptt (ifo_get_ptt (ifo));
	}

	if (!ifoIsVMG (ifo)) {
		ifo_print_audiosub (ifo->data[ID_TMT]);
		ifoPrintToast (ifo->data[ID_PTT]);

//		ifoPrint_ptt (ifo_get_ptt (ifo));
	}

	ifoPrint_title_pgci (ifo);

	ifoPrint_menu_pgci (ifo);
	ifoPrint_vtsm_cell_addr (ifo);
	ifoPrint_vtsm_vobu_addr_map (ifo);

	ifoPrint_vts_cell_addr (ifo);
	ifoPrint_vts_vobu_addr_map (ifo);

	ifoClose (ifo);
*/
	return 0;
}
