annotate sub/subreader.h @ 33620:565d6b4c90e9

win32 gui: Remove non-compiling debug mp_msg calls.
author diego
date Wed, 22 Jun 2011 13:48:41 +0000
parents 63dbf59fa312
children ab6d06f5b98b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
1 /*
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
2 * This file is part of MPlayer.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
3 *
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
4 * MPlayer is free software; you can redistribute it and/or modify
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
7 * (at your option) any later version.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
8 *
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
9 * MPlayer is distributed in the hope that it will be useful,
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
12 * GNU General Public License for more details.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
13 *
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License along
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
17 */
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
18
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
19 #ifndef MPLAYER_SUBREADER_H
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
20 #define MPLAYER_SUBREADER_H
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
21
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
22 #include <stdio.h>
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
23
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
24 #include "config.h"
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
25
33353
63dbf59fa312 Move some common fribidi code into a shared function.
reimar
parents: 33351
diff changeset
26 #ifdef CONFIG_FRIBIDI
63dbf59fa312 Move some common fribidi code into a shared function.
reimar
parents: 33351
diff changeset
27 #include <fribidi/fribidi.h>
63dbf59fa312 Move some common fribidi code into a shared function.
reimar
parents: 33351
diff changeset
28 int do_fribid_log2vis(int charset, const char *in, FriBidiChar *logical, FriBidiChar *visual, int flip_commas);
63dbf59fa312 Move some common fribidi code into a shared function.
reimar
parents: 33351
diff changeset
29 #endif
63dbf59fa312 Move some common fribidi code into a shared function.
reimar
parents: 33351
diff changeset
30
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
31 extern int suboverlap_enabled;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
32 extern int sub_no_text_pp; // disable text post-processing
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
33 extern int sub_match_fuzziness;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
34 extern int sub_format;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
35 extern char *sub_cp;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
36
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
37 // subtitle formats
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
38 #define SUB_INVALID -1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
39 #define SUB_MICRODVD 0
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
40 #define SUB_SUBRIP 1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
41 #define SUB_SUBVIEWER 2
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
42 #define SUB_SAMI 3
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
43 #define SUB_VPLAYER 4
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
44 #define SUB_RT 5
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
45 #define SUB_SSA 6
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
46 #define SUB_PJS 7
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
47 #define SUB_MPSUB 8
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
48 #define SUB_AQTITLE 9
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
49 #define SUB_SUBVIEWER2 10
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
50 #define SUB_SUBRIP09 11
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
51 #define SUB_JACOSUB 12
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
52 #define SUB_MPL2 13
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
53
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
54 #define MAX_SUBTITLE_FILES 128
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
55
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
56 #define SUB_MAX_TEXT 12
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
57 #define SUB_ALIGNMENT_BOTTOMLEFT 1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
58 #define SUB_ALIGNMENT_BOTTOMCENTER 2
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
59 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
60 #define SUB_ALIGNMENT_MIDDLELEFT 4
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
61 #define SUB_ALIGNMENT_MIDDLECENTER 5
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
62 #define SUB_ALIGNMENT_MIDDLERIGHT 6
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
63 #define SUB_ALIGNMENT_TOPLEFT 7
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
64 #define SUB_ALIGNMENT_TOPCENTER 8
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
65 #define SUB_ALIGNMENT_TOPRIGHT 9
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
66
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
67 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
68
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
69 int lines;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
70
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
71 unsigned long start;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
72 unsigned long end;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
73
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
74 char *text[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
75 double endpts[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
76 unsigned char alignment;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
77 } subtitle;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
78
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
79 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
80 subtitle *subtitles;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
81 char *filename;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
82 int sub_uses_time;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
83 int sub_num; // number of subtitle structs
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
84 int sub_errs;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
85 } sub_data;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
86
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
87 extern char *fribidi_charset;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
88 extern int flip_hebrew;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
89 extern int fribidi_flip_commas;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
90
32725
4802a80f7a50 Typedef the add subtitle function just like open_vob_func.
cboesch
parents: 32724
diff changeset
91 typedef void (*open_sub_func)(char *, float, int);
32724
732cd2afae10 Replace hacky vobsub loading with a new clean one.
cboesch
parents: 32642
diff changeset
92 typedef int (*open_vob_func)(const char *, const char * const, int, void *);
732cd2afae10 Replace hacky vobsub loading with a new clean one.
cboesch
parents: 32642
diff changeset
93
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
94 sub_data* sub_read_file (char *filename, float pts);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
95 subtitle* subcp_recode (subtitle *sub);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
96 // enca_fd is the file enca uses to determine the codepage.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
97 // setting to NULL disables enca.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
98 struct stream;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
99 void subcp_open (struct stream *st); /* for demux_ogg.c */
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
100 void subcp_close (void); /* for demux_ogg.c */
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
101 const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
102 const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback);
32771
0b4acbbe9652 100l: fps are not in int but float, fix prototype.
cboesch
parents: 32725
diff changeset
103 void load_subtitles(const char *fname, float fps, open_sub_func add_f);
32724
732cd2afae10 Replace hacky vobsub loading with a new clean one.
cboesch
parents: 32642
diff changeset
104 void load_vob_subtitle(const char *fname, const char * const spudec_ifo, void **spu, open_vob_func add_f);
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
105 void list_sub_file(sub_data* subd);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
106 void dump_srt(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
107 void dump_mpsub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
108 void dump_microdvd(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
109 void dump_jacosub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
110 void dump_sami(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
111 void sub_free( sub_data * subd );
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
112 void find_sub(sub_data* subd,int key);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
113 void step_sub(sub_data *subd, float pts, int movement);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
114 void sub_add_text(subtitle *sub, const char *txt, int len, double endpts, int strip_markup);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
115 int sub_clear_text(subtitle *sub, double pts);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
116
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
117 #endif /* MPLAYER_SUBREADER_H */