2 * This file is part of MPlayer.
4 * MPlayer 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 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_SUBREADER_H
20 #define MPLAYER_SUBREADER_H
27 extern int suboverlap_enabled
;
28 extern int sub_no_text_pp
; // disable text post-processing
29 extern int sub_match_fuzziness
;
32 #define SUB_INVALID -1
33 #define SUB_MICRODVD 0
35 #define SUB_SUBVIEWER 2
43 #define SUB_SUBVIEWER2 10
44 #define SUB_SUBRIP09 11
45 #define SUB_JACOSUB 12
48 // One of the SUB_* constant above
49 extern int sub_format
;
51 #define SUB_MAX_TEXT 12
52 #define SUB_ALIGNMENT_BOTTOMLEFT 1
53 #define SUB_ALIGNMENT_BOTTOMCENTER 2
54 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
55 #define SUB_ALIGNMENT_MIDDLELEFT 4
56 #define SUB_ALIGNMENT_MIDDLECENTER 5
57 #define SUB_ALIGNMENT_MIDDLERIGHT 6
58 #define SUB_ALIGNMENT_TOPLEFT 7
59 #define SUB_ALIGNMENT_TOPCENTER 8
60 #define SUB_ALIGNMENT_TOPRIGHT 9
62 typedef struct subtitle
{
69 char *text
[SUB_MAX_TEXT
];
70 double endpts
[SUB_MAX_TEXT
];
71 unsigned char alignment
;
74 typedef struct sub_data
{
78 int sub_num
; // number of subtitle structs
83 sub_data
* sub_read_file (char *filename
, float pts
, struct MPOpts
*opts
);
84 subtitle
* subcp_recode (subtitle
*sub
);
85 // enca_fd is the file enca uses to determine the codepage.
86 // setting to NULL disables enca.
88 void subcp_open (struct stream
*st
); /* for demux_ogg.c */
89 void subcp_close (void); /* for demux_ogg.c */
91 const char* guess_buffer_cp(unsigned char* buffer
, int buflen
, const char *preferred_language
, const char *fallback
);
92 const char* guess_cp(struct stream
*st
, const char *preferred_language
, const char *fallback
);
94 void list_sub_file(sub_data
* subd
);
95 void dump_srt(sub_data
* subd
, float fps
);
96 void dump_mpsub(sub_data
* subd
, float fps
);
97 void dump_microdvd(sub_data
* subd
, float fps
);
98 void dump_jacosub(sub_data
* subd
, float fps
);
99 void dump_sami(sub_data
* subd
, float fps
);
100 void sub_free( sub_data
* subd
);
102 void find_sub(struct MPContext
*mpctx
, sub_data
* subd
,int key
);
103 void step_sub(sub_data
*subd
, float pts
, int movement
);
104 void sub_add_text(subtitle
*sub
, const char *txt
, int len
, double endpts
);
105 int sub_clear_text(subtitle
*sub
, double pts
);
107 #endif /* MPLAYER_SUBREADER_H */