annotate sub/subreader.h @ 34096:36085e0bfe0e

Support decoding 8SVX in IFF.
author cehoyos
date Fri, 07 Oct 2011 15:55:57 +0000
parents 02f1dc5c8bda
children 715567f3387f
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
33908
02f1dc5c8bda Forgotten commit of subreader.h adding SUB_GOOGLE define.
reimar
parents: 33790
diff changeset
53 #define SUB_GOOGLE 14
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
54
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
55 #define MAX_SUBTITLE_FILES 128
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
56
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
57 #define SUB_MAX_TEXT 12
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
58 #define SUB_ALIGNMENT_BOTTOMLEFT 1
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
59 #define SUB_ALIGNMENT_BOTTOMCENTER 2
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
60 #define SUB_ALIGNMENT_BOTTOMRIGHT 3
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
61 #define SUB_ALIGNMENT_MIDDLELEFT 4
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
62 #define SUB_ALIGNMENT_MIDDLECENTER 5
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
63 #define SUB_ALIGNMENT_MIDDLERIGHT 6
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
64 #define SUB_ALIGNMENT_TOPLEFT 7
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
65 #define SUB_ALIGNMENT_TOPCENTER 8
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
66 #define SUB_ALIGNMENT_TOPRIGHT 9
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
67
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
68 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
69
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
70 int lines;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
71
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
72 unsigned long start;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
73 unsigned long end;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
74
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
75 char *text[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
76 double endpts[SUB_MAX_TEXT];
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
77 unsigned char alignment;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
78 } subtitle;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
79
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
80 typedef struct {
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
81 subtitle *subtitles;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
82 char *filename;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
83 int sub_uses_time;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
84 int sub_num; // number of subtitle structs
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
85 int sub_errs;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
86 } sub_data;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
87
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
88 extern char *fribidi_charset;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
89 extern int flip_hebrew;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
90 extern int fribidi_flip_commas;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
91
32725
4802a80f7a50 Typedef the add subtitle function just like open_vob_func.
cboesch
parents: 32724
diff changeset
92 typedef void (*open_sub_func)(char *, float, int);
32724
732cd2afae10 Replace hacky vobsub loading with a new clean one.
cboesch
parents: 32642
diff changeset
93 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
94
33790
ab6d06f5b98b Add const to some string pointer arguments that will not be modified.
ib
parents: 33353
diff changeset
95 sub_data* sub_read_file (const char *filename, float pts);
32454
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
96 subtitle* subcp_recode (subtitle *sub);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
97 // 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
98 // setting to NULL disables enca.
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
99 struct stream;
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
100 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
101 void subcp_close (void); /* for demux_ogg.c */
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
102 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
103 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
104 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
105 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
106 void list_sub_file(sub_data* subd);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
107 void dump_srt(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
108 void dump_mpsub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
109 void dump_microdvd(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
110 void dump_jacosub(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
111 void dump_sami(sub_data* subd, float fps);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
112 void sub_free( sub_data * subd );
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
113 void find_sub(sub_data* subd,int key);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
114 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
115 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
116 int sub_clear_text(subtitle *sub, double pts);
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
117
69d3be4d52a2 Create a new directory, "sub", for subtitles and OSD related code.
cigaes
parents:
diff changeset
118 #endif /* MPLAYER_SUBREADER_H */