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