configure: add return_check and return_statement_check helpers
[mplayer.git] / sub / subreader.h
blob9c7465d71a5b4314b20e2ed0e156ce0f8cfb8c04
1 /*
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
22 #include <stdio.h>
23 #include <stdbool.h>
25 #include "config.h"
27 extern int suboverlap_enabled;
28 extern int sub_no_text_pp; // disable text post-processing
29 extern int sub_match_fuzziness;
31 // subtitle formats
32 #define SUB_INVALID -1
33 #define SUB_MICRODVD 0
34 #define SUB_SUBRIP 1
35 #define SUB_SUBVIEWER 2
36 #define SUB_SAMI 3
37 #define SUB_VPLAYER 4
38 #define SUB_RT 5
39 #define SUB_SSA 6
40 #define SUB_PJS 7
41 #define SUB_MPSUB 8
42 #define SUB_AQTITLE 9
43 #define SUB_SUBVIEWER2 10
44 #define SUB_SUBRIP09 11
45 #define SUB_JACOSUB 12
46 #define SUB_MPL2 13
48 // One of the SUB_* constant above
49 extern int sub_format;
51 #define MAX_SUBTITLE_FILES 128
53 #define SUB_MAX_TEXT 12
54 #define SUB_ALIGNMENT_BOTTOMLEFT 1
55 #define SUB_ALIGNMENT_BOTTOMCENTER 2
56 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
57 #define SUB_ALIGNMENT_MIDDLELEFT 4
58 #define SUB_ALIGNMENT_MIDDLECENTER 5
59 #define SUB_ALIGNMENT_MIDDLERIGHT 6
60 #define SUB_ALIGNMENT_TOPLEFT 7
61 #define SUB_ALIGNMENT_TOPCENTER 8
62 #define SUB_ALIGNMENT_TOPRIGHT 9
64 typedef struct subtitle {
66 int lines;
68 unsigned long start;
69 unsigned long end;
71 char *text[SUB_MAX_TEXT];
72 double endpts[SUB_MAX_TEXT];
73 unsigned char alignment;
74 } subtitle;
76 typedef struct sub_data {
77 subtitle *subtitles;
78 char *filename;
79 int sub_uses_time;
80 int sub_num; // number of subtitle structs
81 int sub_errs;
82 } sub_data;
84 extern char *fribidi_charset;
85 extern int flip_hebrew;
86 extern int fribidi_flip_commas;
88 struct MPOpts;
89 sub_data* sub_read_file (char *filename, float pts, struct MPOpts *opts);
90 subtitle* subcp_recode (subtitle *sub);
91 // enca_fd is the file enca uses to determine the codepage.
92 // setting to NULL disables enca.
93 struct stream;
94 void subcp_open (struct stream *st); /* for demux_ogg.c */
95 void subcp_close (void); /* for demux_ogg.c */
96 #ifdef CONFIG_ENCA
97 const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback);
98 const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback);
99 #endif
100 char ** sub_filenames(const char *path, char *fname);
101 void list_sub_file(sub_data* subd);
102 void dump_srt(sub_data* subd, float fps);
103 void dump_mpsub(sub_data* subd, float fps);
104 void dump_microdvd(sub_data* subd, float fps);
105 void dump_jacosub(sub_data* subd, float fps);
106 void dump_sami(sub_data* subd, float fps);
107 void sub_free( sub_data * subd );
108 struct MPContext;
109 void find_sub(struct MPContext *mpctx, sub_data* subd,int key);
110 void step_sub(sub_data *subd, float pts, int movement);
111 void sub_add_text(subtitle *sub, const char *txt, int len, double endpts);
112 int sub_clear_text(subtitle *sub, double pts);
114 #endif /* MPLAYER_SUBREADER_H */