2
/***************************************************************************
4
* This program is free software; you can redistribute it and/or modify *
5
* it under the terms of the GNU General Public License as published by *
6
* the Free Software Foundation; either version 2 of the License, or *
7
* (at your option) any later version. *
9
***************************************************************************/
14
#define VS_MAXPACKET 128*1024
16
#define NOSUB 0xffffffff
18
#define MAX_DISPLAY_TIME 3000 // 3s
20
//************************************
21
typedef struct vobSubParam
27
//************************************
31
uint8_t *_dirty; /// Dirty lines (non transparent)
33
uint8_t isDirty(uint32_t line);
34
uint8_t setDirty(uint32_t line);
36
uint32_t _width,_height;
37
uint32_t placeTop, placeHeight; /// Position of the sub
39
uint8_t *_bitmap; /// YUV image
40
uint8_t *_alphaMask; /// alpha mask
43
vobSubBitmap(uint32_t w, uint32_t h);
47
/// Convert palette bitmap to yuv&mask bitmap
48
uint8_t buildYUV( int16_t *palette );
49
/// Generate the final bitmap (resized)
50
uint8_t subResize(vobSubBitmap **tgt,uint32_t newx,uint32_t newy,
51
uint32_t oldtop, uint32_t oldheight);
53
//************************************
54
class ADMVideoVobSub:public AVDMGenericVideoStream
58
virtual char *printConf(void);
59
uint8_t readbyte(void); /// Read a byte from buffer
60
uint16_t readword(void); /// Read a 16 bits word from buffer
61
uint8_t forward(uint32_t v); /// Read a 16 bits word from buffer
62
uint8_t decodeRLE(uint32_t off,uint32_t start,uint32_t end);
63
uint8_t setup(void); /// Rebuild internal info
64
uint8_t cleanup(void); /// Destroy all internal info
65
uint8_t paletteYUV( void ); /// Convert RGB Pallette to yuv
66
uint8_t Palettte2Display( void ); /// Convert the RLE to YUV bitmap
67
uint8_t handleSub( uint32_t idx );/// Decode a sub packet
68
uint32_t lookupSub(uint64_t time);/// Return sub index corresponding to time
70
ADM_mpegDemuxerProgramStream *_parser;
71
uint8_t *_data; /// Data for packet
72
VobSubInfo *_vobSubInfo; /// Info of the index file
74
vobSubBitmap *_original; /// True size (..) depacked vobsub
75
vobSubBitmap *_resampled; /// Final one; to be blended in picture
76
vobSubBitmap *_chromaResampled; /// Same as above but shinked by 2
77
uint32_t _x1,_y1,_x2,_y2; /// sub boxing
79
uint8_t _displaying; /// Is display active
82
uint32_t _dataSize; /// Size of the data chunk
84
uint8_t _colors[4]; /// Colors palette
85
uint8_t _alpha[4]; /// Colors alpha
86
int16_t _YUVPalette[16]; /// Luma only
87
uint32_t _currentSub; ///
90
/* This 3 functions are used by OCR */
91
ADMVideoVobSub( char *fileidx,uint32_t idx);
92
vobSubBitmap *getBitmap(uint32_t nb,uint32_t *start, uint32_t *end,uint32_t *first,uint32_t *last);
93
uint32_t getNbImage( void);
96
ADMVideoVobSub( AVDMGenericVideoStream *in,CONFcouple *setup);
98
virtual uint8_t getFrameNumberNoAlloc(uint32_t frame, uint32_t *len,
99
ADMImage *data,uint32_t *flags);
100
virtual uint8_t getCoupledConf( CONFcouple **couples) ;
101
virtual uint8_t configure( AVDMGenericVideoStream *instream);