I420 support patch by Benjamin Zores <ben@tutuxclan.org>
[mplayer.git] / subreader.h
blobbcf9aed08b758ebf34acaf865fa0885688d02f96
1 #ifndef __MPLAYER_SUBREADER_H
2 #define __MPLAYER_SUBREADER_H
4 #include <stdio.h>
6 extern int suboverlap_enabled;
7 extern int sub_no_text_pp; // disable text post-processing
8 extern int sub_match_fuzziness;
10 // subtitle formats
11 #define SUB_INVALID -1
12 #define SUB_MICRODVD 0
13 #define SUB_SUBRIP 1
14 #define SUB_SUBVIEWER 2
15 #define SUB_SAMI 3
16 #define SUB_VPLAYER 4
17 #define SUB_RT 5
18 #define SUB_SSA 6
19 #define SUB_PJS 7
20 #define SUB_MPSUB 8
21 #define SUB_AQTITLE 9
22 #define SUB_SUBVIEWER2 10
23 #define SUB_SUBRIP09 11
24 #define SUB_JACOSUB 12
25 #define SUB_MPL2 13
27 // One of the SUB_* constant above
28 extern int sub_format;
30 #define MAX_SUBTITLE_FILES 128
32 #define SUB_MAX_TEXT 10
33 #define SUB_ALIGNMENT_BOTTOMLEFT 1
34 #define SUB_ALIGNMENT_BOTTOMCENTER 2
35 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
36 #define SUB_ALIGNMENT_MIDDLELEFT 4
37 #define SUB_ALIGNMENT_MIDDLECENTER 5
38 #define SUB_ALIGNMENT_MIDDLERIGHT 6
39 #define SUB_ALIGNMENT_TOPLEFT 7
40 #define SUB_ALIGNMENT_TOPCENTER 8
41 #define SUB_ALIGNMENT_TOPRIGHT 9
43 typedef struct {
45 int lines;
47 unsigned long start;
48 unsigned long end;
50 char *text[SUB_MAX_TEXT];
51 unsigned char alignment;
52 } subtitle;
54 typedef struct {
55 subtitle *subtitles;
56 char *filename;
57 int sub_uses_time;
58 int sub_num; // number of subtitle structs
59 int sub_errs;
60 } sub_data;
62 sub_data* sub_read_file (char *filename, float pts);
63 subtitle* subcp_recode1 (subtitle *sub);
64 // enca_fd is the file enca uses to determine the codepage.
65 // setting to NULL disables enca.
66 void subcp_open (FILE *enca_fd); /* for demux_ogg.c */
67 void subcp_close (void); /* for demux_ogg.c */
68 #ifdef HAVE_ENCA
69 void* guess_cp(FILE *enca_fd, char *preferred_language, char *fallback);
70 #endif
71 char ** sub_filenames(char *path, char *fname);
72 void list_sub_file(sub_data* subd);
73 void dump_srt(sub_data* subd, float fps);
74 void dump_mpsub(sub_data* subd, float fps);
75 void dump_microdvd(sub_data* subd, float fps);
76 void dump_jacosub(sub_data* subd, float fps);
77 void dump_sami(sub_data* subd, float fps);
78 void sub_free( sub_data * subd );
79 void find_sub(sub_data* subd,int key);
80 void step_sub(sub_data *subd, float pts, int movement);
81 #endif