annotate sub/subreader.h @ 33339:f3c1141dfea7

Remove some useless code that calculates something that is then never used and some pointless ().
author reimar
date Sat, 07 May 2011 20:32:31 +0000
parents 0b4acbbe9652
children a9a7c7514c43
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
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
26 extern int suboverlap_enabled;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
27 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
28 extern int sub_match_fuzziness;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
29 extern int sub_format;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
30 extern char *sub_cp;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
31
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
32 // subtitle formats
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
33 #define SUB_INVALID -1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
34 #define SUB_MICRODVD 0
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
35 #define SUB_SUBRIP 1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
36 #define SUB_SUBVIEWER 2
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
37 #define SUB_SAMI 3
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
38 #define SUB_VPLAYER 4
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
39 #define SUB_RT 5
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
40 #define SUB_SSA 6
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
41 #define SUB_PJS 7
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
42 #define SUB_MPSUB 8
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
43 #define SUB_AQTITLE 9
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
44 #define SUB_SUBVIEWER2 10
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
45 #define SUB_SUBRIP09 11
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
46 #define SUB_JACOSUB 12
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
47 #define SUB_MPL2 13
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
48
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
49 #define MAX_SUBTITLE_FILES 128
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
50
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
51 #define SUB_MAX_TEXT 12
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
52 #define SUB_ALIGNMENT_BOTTOMLEFT 1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
53 #define SUB_ALIGNMENT_BOTTOMCENTER 2
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
54 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
55 #define SUB_ALIGNMENT_MIDDLELEFT 4
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
56 #define SUB_ALIGNMENT_MIDDLECENTER 5
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
57 #define SUB_ALIGNMENT_MIDDLERIGHT 6
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
58 #define SUB_ALIGNMENT_TOPLEFT 7
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
59 #define SUB_ALIGNMENT_TOPCENTER 8
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
60 #define SUB_ALIGNMENT_TOPRIGHT 9
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
61
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
62 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
63
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
64 int lines;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
65
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
66 unsigned long start;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
67 unsigned long end;
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 char *text[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
70 double endpts[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
71 unsigned char alignment;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
72 } subtitle;
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 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
75 subtitle *subtitles;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
76 char *filename;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
77 int sub_uses_time;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
78 int sub_num; // number of subtitle structs
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
79 int sub_errs;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
80 } sub_data;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
81
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
82 extern char *fribidi_charset;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
83 extern int flip_hebrew;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
84 extern int fribidi_flip_commas;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
85
32725
4802a80f7a50 Typedef the add subtitle function just like open_vob_func.
cboesch
parents: 32724
diff changeset
86 typedef void (*open_sub_func)(char *, float, int);
32724
732cd2afae10 Replace hacky vobsub loading with a new clean one.
cboesch
parents: 32642
diff changeset
87 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
88
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
89 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
90 subtitle* subcp_recode (subtitle *sub);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
91 // 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
92 // setting to NULL disables enca.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
93 struct stream;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
94 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
95 void subcp_close (void); /* for demux_ogg.c */
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
96 #ifdef CONFIG_ENCA
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
97 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
98 const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
99 #endif
32771
0b4acbbe9652 100l: fps are not in int but float, fix prototype.
cboesch
parents: 32725
diff changeset
100 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
101 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
102 void list_sub_file(sub_data* subd);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
103 void dump_srt(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
104 void dump_mpsub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
105 void dump_microdvd(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
106 void dump_jacosub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
107 void dump_sami(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
108 void sub_free( sub_data * subd );
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
109 void find_sub(sub_data* subd,int key);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
110 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
111 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
112 int sub_clear_text(subtitle *sub, double pts);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
113
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
114 #endif /* MPLAYER_SUBREADER_H */