Mercurial > mplayer.hg
annotate subreader.h @ 31725:8e850ff84b27
Allocate memory for paletted image data separately to avoid
issues with e.g. the "cut" function.
author | reimar |
---|---|
date | Sat, 24 Jul 2010 21:40:06 +0000 |
parents | b41cbf02f854 |
children | 7369969407d6 |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
17 */ |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
30168
diff
changeset
|
18 |
23689
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
22805
diff
changeset
|
19 #ifndef MPLAYER_SUBREADER_H |
3f0d00abc073
Do not use leading underscores in multiple inclusion guards, they are reserved.
diego
parents:
22805
diff
changeset
|
20 #define MPLAYER_SUBREADER_H |
258 | 21 |
12910 | 22 #include <stdio.h> |
23 | |
30168 | 24 #include "config.h" |
25 | |
8361
2202c00001e3
overlapping subtitles support is now optional, can be disabled (-nooverlapsub)
arpi
parents:
7982
diff
changeset
|
26 extern int suboverlap_enabled; |
9126
7a06258271d6
Add a command line option (-sub-no-text-pp) to disable subtitles
arpi
parents:
8733
diff
changeset
|
27 extern int sub_no_text_pp; // disable text post-processing |
9893 | 28 extern int sub_match_fuzziness; |
2912 | 29 |
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 | |
11873 | 39 #define SUB_PJS 7 |
2912 | 40 #define SUB_MPSUB 8 |
41 #define SUB_AQTITLE 9 | |
6012 | 42 #define SUB_SUBVIEWER2 10 |
6076
eff64fb1ffea
patch fixes broken detecniou of AQTitle subtiles and adds support for subtitles created by subrip 0.9 - by Jiri.Svoboda@seznam.cz
arpi
parents:
6012
diff
changeset
|
43 #define SUB_SUBRIP09 11 |
7982
eac680483e6c
JACOSub is another subtitling format, whose specifications are at:
arpi
parents:
7460
diff
changeset
|
44 #define SUB_JACOSUB 12 |
12138
eb3ad04675e1
MPL2 subreader, patch by Cezary Jackiewicz (cjackiewicz@poczta.onet.pl)
alex
parents:
11873
diff
changeset
|
45 #define SUB_MPL2 13 |
2912 | 46 |
47 // One of the SUB_* constant above | |
48 extern int sub_format; | |
49 | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
50 #define MAX_SUBTITLE_FILES 128 |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
51 |
17308
59452efe579c
Improved handling of text subs in Matroska files with adjacent newlines (\N) resulting in more than SUB_MAX_TEXT lines to display. Patch by Robert Henney (robh () rut ! org).
mosu
parents:
13679
diff
changeset
|
52 #define SUB_MAX_TEXT 12 |
13343
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
53 #define SUB_ALIGNMENT_BOTTOMLEFT 1 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
54 #define SUB_ALIGNMENT_BOTTOMCENTER 2 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
55 #define SUB_ALIGNMENT_BOTTOMRIGHT 3 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
56 #define SUB_ALIGNMENT_MIDDLELEFT 4 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
57 #define SUB_ALIGNMENT_MIDDLECENTER 5 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
58 #define SUB_ALIGNMENT_MIDDLERIGHT 6 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
59 #define SUB_ALIGNMENT_TOPLEFT 7 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
60 #define SUB_ALIGNMENT_TOPCENTER 8 |
1a4b6e575484
This time is a patch to improve subtitle alignment management. It
faust3
parents:
12930
diff
changeset
|
61 #define SUB_ALIGNMENT_TOPRIGHT 9 |
258 | 62 |
63 typedef struct { | |
64 | |
65 int lines; | |
66 | |
67 unsigned long start; | |
68 unsigned long end; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
69 |
258 | 70 char *text[SUB_MAX_TEXT]; |
21827
b0bc0d81f91b
Subtitle handling cleanup: factor out code for parsing embedded subtitles
reimar
parents:
18980
diff
changeset
|
71 double endpts[SUB_MAX_TEXT]; |
10916
c36db88bfbc4
Subtitle alignment & smart splitting by Salvatore Falco
henry
parents:
9893
diff
changeset
|
72 unsigned char alignment; |
258 | 73 } subtitle; |
74 | |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
75 typedef struct { |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
76 subtitle *subtitles; |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
77 char *filename; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27393
diff
changeset
|
78 int sub_uses_time; |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
79 int sub_num; // number of subtitle structs |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
80 int sub_errs; |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
81 } sub_data; |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
82 |
13679
59bb11213d11
correctly display the commas of most hebrew subtitles on the left side
faust3
parents:
13343
diff
changeset
|
83 extern char *fribidi_charset; |
59bb11213d11
correctly display the commas of most hebrew subtitles on the left side
faust3
parents:
13343
diff
changeset
|
84 extern int flip_hebrew; |
59bb11213d11
correctly display the commas of most hebrew subtitles on the left side
faust3
parents:
13343
diff
changeset
|
85 extern int fribidi_flip_commas; |
59bb11213d11
correctly display the commas of most hebrew subtitles on the left side
faust3
parents:
13343
diff
changeset
|
86 |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
87 sub_data* sub_read_file (char *filename, float pts); |
22805 | 88 subtitle* subcp_recode (subtitle *sub); |
12909
dc8eba991005
fixes a crash and unchecked string-handling in ENCA code.
reimar
parents:
12443
diff
changeset
|
89 // enca_fd is the file enca uses to determine the codepage. |
dc8eba991005
fixes a crash and unchecked string-handling in ENCA code.
reimar
parents:
12443
diff
changeset
|
90 // setting to NULL disables enca. |
31179 | 91 struct stream; |
92 void subcp_open (struct stream *st); /* for demux_ogg.c */ | |
8733
478561617705
compiler warning fixes by Dominik Mierzejewski <dominik@rangers.eu.org>
arpi
parents:
8618
diff
changeset
|
93 void subcp_close (void); /* for demux_ogg.c */ |
27393 | 94 #ifdef CONFIG_ENCA |
25400
fb8ad8ae4dfd
The function parameter 'preferred_language' should be const char *.
ulion
parents:
24851
diff
changeset
|
95 const char* guess_buffer_cp(unsigned char* buffer, int buflen, const char *preferred_language, const char *fallback); |
31179 | 96 const char* guess_cp(struct stream *st, const char *preferred_language, const char *fallback); |
12930
b200b94ebc4b
missing guess_cp declaration (patch by Ismail D«Ónmez)
henry
parents:
12910
diff
changeset
|
97 #endif |
18980
ed69754aa58d
Marks several string parameters as const when they are not modified in the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
18936
diff
changeset
|
98 char ** sub_filenames(const char *path, char *fname); |
9870
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
99 void list_sub_file(sub_data* subd); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
100 void dump_srt(sub_data* subd, float fps); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
101 void dump_mpsub(sub_data* subd, float fps); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
102 void dump_microdvd(sub_data* subd, float fps); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
103 void dump_jacosub(sub_data* subd, float fps); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
104 void dump_sami(sub_data* subd, float fps); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
105 void sub_free( sub_data * subd ); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
106 void find_sub(sub_data* subd,int key); |
09d630a4f991
support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents:
9126
diff
changeset
|
107 void step_sub(sub_data *subd, float pts, int movement); |
31686
b41cbf02f854
subtitles: convert SRT/MicroDVD markup into ASS markup
greg
parents:
31179
diff
changeset
|
108 void sub_add_text(subtitle *sub, const char *txt, int len, double endpts, int strip_markup); |
21827
b0bc0d81f91b
Subtitle handling cleanup: factor out code for parsing embedded subtitles
reimar
parents:
18980
diff
changeset
|
109 int sub_clear_text(subtitle *sub, double pts); |
25535
3baf6a2283da
Add explanatory comments to the #endif part of multiple inclusion guards.
diego
parents:
25400
diff
changeset
|
110 |
3baf6a2283da
Add explanatory comments to the #endif part of multiple inclusion guards.
diego
parents:
25400
diff
changeset
|
111 #endif /* MPLAYER_SUBREADER_H */ |