1 // 2 // C++ Implementation: Interface to decode .SUP (projectX) subtitles 3 // Author: Mean, fixounet@free.fr 4 // (C) 2007 MEAN 5 /*************************************************************************** 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 ***************************************************************************/ 13 14 #ifndef ADMVideoSupSub_H 15 #define ADMVideoSupSub_H 16 17 typedef struct 18 { 19 uint32_t pos; 20 uint32_t size; 21 uint32_t pts; 22 }SUPIndex; 23 24 class SUPIndexArray 25 { 26 public: 27 SUPIndexArray(uint32_t nb); 28 ~SUPIndexArray(); 29 30 SUPIndex *index; 31 uint32_t nbIndex; 32 uint32_t indexCeil; 33 34 uint32_t insert(uint32_t pos, uint32_t size, uint32_t pts); 35 }; 36 37 class ADMVideoSupSub 38 { 39 protected: 40 FILE *_fd; 41 uint8_t parse(void); 42 uint8_t decode(uint32_t size, uint8_t *data); 43 uint8_t decodeRLE(uint32_t off,uint32_t start,uint32_t end,uint8_t *data,uint32_t _dataSize); 44 uint8_t setPalette( uint32_t *palette ); 45 uint8_t buildYUV( int16_t *palette ); 46 47 48 vobSubBitmap *bitmap; 49 uint32_t currentImage; 50 51 uint32_t _colors[4]; 52 uint32_t _subW,_subH,_alpha[4]; 53 int16_t _YUVPalette[16]; 54 public: 55 ADMVideoSupSub(char *supfile,uint32_t ix); 56 ~ADMVideoSupSub(); 57 SUPIndexArray *index; 58 uint32_t getNbImage(void); 59 vobSubBitmap *getBitmap( 60 uint32_t nb,uint32_t *start, uint32_t *end,uint32_t *first,uint32_t *last); 61 62 }; 63 64 #endif