home *** CD-ROM | disk | FTP | other *** search
/ PC Welt 2001 September / PC-WELT 9-2001.ISO / software / hw / brennen / flask_src.exe / Input / IFOParser / pgc.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  2000-05-06  |  2.5 KB  |  145 lines

  1.  
  2. /*
  3.  * PGROGRAM CHAIN INFORMATION
  4.  *
  5.  * Copyright (C) 1998-2000  Thomas Mirlacher
  6.  *
  7.  * This program is free software; you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License as published by
  9.  * the Free Software Foundation; either version 2 of the License, or
  10.  * (at your option) any later version.
  11.  * 
  12.  * This program is distributed in the hope that it will be useful,
  13.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15.  * GNU General Public License for more details.
  16.  * 
  17.  * You should have received a copy of the GNU General Public License
  18.  * along with this program; if not, write to the Free Software
  19.  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  20.  * 
  21.  * The author may be reached as dent@cosy.sbg.ac.at, or
  22.  * Thomas Mirlacher, Jakob-Haringerstr. 2, A-5020 Salzburg,
  23.  * Austria
  24.  *
  25.  *------------------------------------------------------------
  26.  *
  27.  */
  28.  
  29.  
  30. #ifdef PARSER
  31. #include <stdio.h>
  32. #endif
  33. #include <sys/types.h>
  34. //#include <unistd.h>
  35. #include "ifo.h"
  36.  
  37. #include "misc.h"
  38. #include "decode.h"
  39.  
  40. #define PGCI_COLOR_LEN 4
  41.  
  42. /**
  43.  *
  44.  */
  45.  
  46. int ifoGetCLUT (char *pgc, char **ptr)
  47. {
  48.     *ptr = pgc;
  49.  
  50.     if (!pgc)
  51.         return -1;
  52.  
  53.     *ptr += 2;    
  54.     *ptr += 10;
  55.     *ptr += 8 * 2;            // AUDIO
  56.     *ptr += 32 * 4;            // SUBPICTURE
  57.     *ptr += 8;
  58.  
  59.     return 0;
  60. }
  61.  
  62.  
  63. /**
  64.  *
  65.  */
  66.  
  67. int ifoGetProgramMap (char *pgc, char **ptr)
  68. {
  69.     int num;
  70.     *ptr = pgc;
  71.  
  72.     if (!pgc)
  73.         return -1;
  74.  
  75.     *ptr += 2;    
  76.     num = **ptr;
  77.  
  78.     *ptr += 10;
  79.     *ptr += 8 * 2;            // AUDIO
  80.     *ptr += 32 * 4;            // SUBPICTURE
  81.     *ptr += 8;
  82.     *ptr += 16 * PGCI_COLOR_LEN;    // CLUT
  83.     *ptr += 2;
  84.  
  85.     *ptr = get2bytes ((unsigned char *)*ptr) + pgc;
  86.  
  87.     return num;
  88. }
  89.  
  90.  
  91. /**
  92.  *
  93.  */
  94.  
  95. int ifoGetCellPlayInfo (char *pgc, char **ptr)
  96. {
  97.     int num;
  98.     *ptr = pgc;
  99.  
  100.     if (!pgc)
  101.         return -1;
  102.  
  103.     *ptr += 3;    
  104.     num = **ptr;
  105.  
  106.     *ptr += 9;
  107.     *ptr += 8 * 2;            // AUDIO
  108.     *ptr += 32 * 4;            // SUBPICTURE
  109.     *ptr += 8;
  110.     *ptr += 16 * PGCI_COLOR_LEN;    // CLUT
  111.     *ptr += 4;
  112.  
  113.     *ptr =  get2bytes ((unsigned char *)*ptr) + pgc;
  114.  
  115.     return num;
  116. }
  117.  
  118.  
  119. /**
  120.  *
  121.  */
  122.  
  123. int ifoGetCellPos (char *pgc, char **ptr)
  124. {
  125.     int num;
  126.     *ptr = pgc;
  127.  
  128.     if (!pgc)
  129.         return -1;
  130.  
  131.     *ptr += 3;    
  132.     num = **ptr;
  133.  
  134.     *ptr += 9;
  135.     *ptr += 8 * 2;            // AUDIO
  136.     *ptr += 32 * 4;            // SUBPICTURE
  137.     *ptr += 8;
  138.     *ptr += 16 * PGCI_COLOR_LEN;    // CLUT
  139.     *ptr += 6;
  140.  
  141.     *ptr = get2bytes ((unsigned char *)*ptr) + pgc;
  142.  
  143.     return num;
  144. }
  145.