Fix MP1 with demuxer lavf in MPEG (PS) files.
[mplayer/glamo.git] / subreader.h
blob18aeed05c951f4a1f16f0530b429292838477d99
1 #ifndef MPLAYER_SUBREADER_H
2 #define MPLAYER_SUBREADER_H
4 #include <stdio.h>
6 #include "config.h"
8 extern int suboverlap_enabled;
9 extern int sub_no_text_pp; // disable text post-processing
10 extern int sub_match_fuzziness;
12 // subtitle formats
13 #define SUB_INVALID -1
14 #define SUB_MICRODVD 0
15 #define SUB_SUBRIP 1
16 #define SUB_SUBVIEWER 2
17 #define SUB_SAMI 3
18 #define SUB_VPLAYER 4
19 #define SUB_RT 5
20 #define SUB_SSA 6
21 #define SUB_PJS 7
22 #define SUB_MPSUB 8
23 #define SUB_AQTITLE 9
24 #define SUB_SUBVIEWER2 10
25 #define SUB_SUBRIP09 11
26 #define SUB_JACOSUB 12
27 #define SUB_MPL2 13
29 // One of the SUB_* constant above
30 extern int sub_format;
32 #define MAX_SUBTITLE_FILES 128
34 #define SUB_MAX_TEXT 12
35 #define SUB_ALIGNMENT_BOTTOMLEFT 1
36 #define SUB_ALIGNMENT_BOTTOMCENTER 2
37 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
38 #define SUB_ALIGNMENT_MIDDLELEFT 4
39 #define SUB_ALIGNMENT_MIDDLECENTER 5
40 #define SUB_ALIGNMENT_MIDDLERIGHT 6
41 #define SUB_ALIGNMENT_TOPLEFT 7
42 #define SUB_ALIGNMENT_TOPCENTER 8
43 #define SUB_ALIGNMENT_TOPRIGHT 9
45 typedef struct {
47 int lines;
49 unsigned long start;
50 unsigned long end;
52 char *text[SUB_MAX_TEXT];
53 double endpts[SUB_MAX_TEXT];
54 unsigned char alignment;
55 } subtitle;
57 typedef struct {
58 subtitle *subtitles;
59 char *filename;
60 int sub_uses_time;
61 int sub_num; // number of subtitle structs
62 int sub_errs;
63 } sub_data;
65 extern char *fribidi_charset;
66 extern int flip_hebrew;
67 extern int fribidi_flip_commas;
69 sub_data* sub_read_file (char *filename, float pts);
70 subtitle* subcp_recode (subtitle *sub);
71 // enca_fd is the file enca uses to determine the codepage.
72 // setting to NULL disables enca.
73 struct stream_st;
74 void subcp_open (struct stream_st *st); /* for demux_ogg.c */
75 void subcp_close (void); /* for demux_ogg.c */
76 #ifdef CONFIG_ENCA
77 const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback);
78 const char* guess_cp(struct stream_st *st, const char *preferred_language, const char *fallback);
79 #endif
80 char ** sub_filenames(const char *path, char *fname);
81 void list_sub_file(sub_data* subd);
82 void dump_srt(sub_data* subd, float fps);
83 void dump_mpsub(sub_data* subd, float fps);
84 void dump_microdvd(sub_data* subd, float fps);
85 void dump_jacosub(sub_data* subd, float fps);
86 void dump_sami(sub_data* subd, float fps);
87 void sub_free( sub_data * subd );
88 void find_sub(sub_data* subd,int key);
89 void step_sub(sub_data *subd, float pts, int movement);
90 void sub_add_text(subtitle *sub, const char *txt, int len, double endpts);
91 int sub_clear_text(subtitle *sub, double pts);
93 #endif /* MPLAYER_SUBREADER_H */