annotate sub/find_sub.c @ 33040:a6be6a134ac0

Fix XVMC decoding (avcodec_open would fail if thread_count is set) and simplify code a bit in the process.
author reimar
date Sun, 27 Mar 2011 13:09:27 +0000
parents fbe5c829c69b
children 25880d57740d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30429
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
1 /*
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
2 * .SUB
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
3 *
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
4 * This file is part of MPlayer.
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
5 *
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
6 * MPlayer is free software; you can redistribute it and/or modify
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
7 * 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: 29684
diff changeset
8 * the Free Software Foundation; either version 2 of the License, or
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
9 * (at your option) any later version.
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
10 *
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
11 * MPlayer is distributed in the hope that it will be useful,
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
14 * GNU General Public License for more details.
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
15 *
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
16 * 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: 29684
diff changeset
17 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
c1a3f1bbba26 Add license header to all top-level files missing them.
diego
parents: 29684
diff changeset
19 */
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
20
1422
d02e0dcaf077 libvo2 support
arpi
parents: 1203
diff changeset
21 #include "config.h"
d02e0dcaf077 libvo2 support
arpi
parents: 1203
diff changeset
22
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
23 #include <stdio.h>
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
24
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
25 #include "libvo/video_out.h"
32467
fbe5c829c69b Move libvo/sub.[ch] from libvo to sub.
cigaes
parents: 32464
diff changeset
26 #include "sub.h"
32464
22888a8cb312 Do not use a path for including files in the same directory.
reimar
parents: 32455
diff changeset
27 #include "subreader.h"
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
28
13699
11b249ef87b0 printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents: 9974
diff changeset
29 #include "mp_msg.h"
11b249ef87b0 printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents: 9974
diff changeset
30 #include "help_mp.h"
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
31 #include "mpcommon.h"
13699
11b249ef87b0 printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>
diego
parents: 9974
diff changeset
32
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
33 static int current_sub=0;
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
34
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
35 //static subtitle* subtitles=NULL;
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
36 static int nosub_range_start=-1;
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
37 static int nosub_range_end=-1;
24829
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
38 static const sub_data *last_sub_data = NULL;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
39
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
40
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
41 void step_sub(sub_data *subd, float pts, int movement) {
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
42 subtitle *subs;
9974
henry
parents: 9870
diff changeset
43 int key;
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
44
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
45 if (subd == NULL) return;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
46 subs = subd->subtitles;
9974
henry
parents: 9870
diff changeset
47 key = (pts+sub_delay) * (subd->sub_uses_time ? 100 : sub_fps);
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
48
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
49 /* Tell the OSD subsystem that the OSD contents will change soon */
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
50 vo_osd_changed(OSDTYPE_SUBTITLE);
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
51
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
52 /* If we are moving forward, don't count the next (current) subtitle
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
53 * if we haven't displayed it yet. Same when moving other direction.
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
54 */
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
55 if (movement > 0 && key < subs[current_sub].start)
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
56 movement--;
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
57 if (movement < 0 && key >= subs[current_sub].end)
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
58 movement++;
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
59
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
60 /* Never move beyond first or last subtitle. */
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
61 if (current_sub+movement < 0)
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
62 movement = 0-current_sub;
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
63 if (current_sub+movement >= subd->sub_num)
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
64 movement = subd->sub_num - current_sub - 1;
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
65
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
66 current_sub += movement;
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
67 sub_delay = subs[current_sub].start / (subd->sub_uses_time ? 100 : sub_fps) - pts;
8365
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
68 }
423a19edc0a4 This patch makes it possible to navigate among the subtitles while
arpi
parents: 7112
diff changeset
69
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
70 void find_sub(sub_data* subd,int key){
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
71 subtitle *subs;
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
72 subtitle *new_sub = NULL;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
73 int i,j;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
74
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
75 if ( !subd || subd->sub_num == 0) return;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
76 subs = subd->subtitles;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
77
24829
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
78 if (last_sub_data != subd) {
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
79 // Sub data changed, reset nosub range.
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
80 last_sub_data = subd;
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
81 nosub_range_start = -1;
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
82 nosub_range_end = -1;
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
83 }
8f846cea9940 Reset two static variables for nosub range when subdata changed/switched.
ulion
parents: 21161
diff changeset
84
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
85 if(vo_sub){
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
86 if(key>=vo_sub->start && key<=vo_sub->end) return; // OK!
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
87 } else {
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
88 if(key>nosub_range_start && key<nosub_range_end) return; // OK!
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
89 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
90 // sub changed!
1203
5f0d9239c5b2 sub at key=0 fixed
arpi_esp
parents: 584
diff changeset
91
4807
156482788caf osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents: 3543
diff changeset
92 /* Tell the OSD subsystem that the OSD contents will change soon */
5638
86663f1b9b00 new osd code, use osd objs to follow changes and do minimal updates
arpi
parents: 4807
diff changeset
93 vo_osd_changed(OSDTYPE_SUBTITLE);
4807
156482788caf osd outside movie support for vo_sdl, patch by Fredrik Kuivinen
atmos4
parents: 3543
diff changeset
94
1203
5f0d9239c5b2 sub at key=0 fixed
arpi_esp
parents: 584
diff changeset
95 if(key<=0){
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
96 // no sub here
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
97 goto update;
1203
5f0d9239c5b2 sub at key=0 fixed
arpi_esp
parents: 584
diff changeset
98 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
99
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
100 // printf("\r---- sub changed ----\n");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
101
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
102 // check next sub.
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
103 if(current_sub>=0 && current_sub+1 < subd->sub_num){
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
104 if(key>subs[current_sub].end && key<subs[current_sub+1].start){
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
105 // no sub
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
106 nosub_range_start=subs[current_sub].end;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
107 nosub_range_end=subs[current_sub+1].start;
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
108 goto update;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
109 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
110 // next sub?
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
111 ++current_sub;
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
112 new_sub=&subs[current_sub];
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
113 if(key>=new_sub->start && key<=new_sub->end) goto update; // OK!
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
114 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
115
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
116 // printf("\r---- sub log search... ----\n");
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
117
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
118 // use logarithmic search:
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
119 i=0;
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
120 j = subd->sub_num - 1;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
121 // printf("Searching %d in %d..%d\n",key,subs[i].start,subs[j].end);
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
122 while(j>=i){
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
123 current_sub=(i+j+1)/2;
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
124 new_sub=&subs[current_sub];
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
125 if(key<new_sub->start) j=current_sub-1;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
126 else if(key>new_sub->end) i=current_sub+1;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
127 else goto update; // found!
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
128 }
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
129 // if(key>=new_sub->start && key<=new_sub->end) return; // OK!
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
130
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
131 // check where are we...
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
132 if(key<new_sub->start){
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
133 if(current_sub<=0){
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
134 // before the first sub
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
135 nosub_range_start=key-1; // tricky
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
136 nosub_range_end=new_sub->start;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
137 // printf("FIRST... key=%d end=%d \n",key,new_sub->start);
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
138 new_sub=NULL;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
139 goto update;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
140 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
141 --current_sub;
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
142 if(key>subs[current_sub].end && key<subs[current_sub+1].start){
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
143 // no sub
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
144 nosub_range_start=subs[current_sub].end;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
145 nosub_range_end=subs[current_sub+1].start;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
146 // printf("No sub... 1 \n");
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
147 new_sub=NULL;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
148 goto update;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
149 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
150 printf("HEH???? ");
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
151 } else {
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
152 if(key<=new_sub->end) printf("JAJJ! "); else
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
153 if(current_sub+1 >= subd->sub_num){
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
154 // at the end?
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
155 nosub_range_start=new_sub->end;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
156 nosub_range_end=0x7FFFFFFF; // MAXINT
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
157 // printf("END!?\n");
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
158 new_sub=NULL;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
159 goto update;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
160 } else
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
161 if(key>subs[current_sub].end && key<subs[current_sub+1].start){
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
162 // no sub
9870
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
163 nosub_range_start=subs[current_sub].end;
09d630a4f991 support for multiple subtitle files by Marcin Wojdyr <wojdyr@unipress.waw.pl>
henry
parents: 8369
diff changeset
164 nosub_range_end=subs[current_sub+1].start;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
165 // printf("No sub... 2 \n");
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
166 new_sub=NULL;
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
167 goto update;
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
168 }
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
169 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 24829
diff changeset
170
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
171 mp_msg(MSGT_FIXME,MSGL_FIXME,"SUB ERROR: %d ? %d --- %d [%d] \n",key,(int)new_sub->start,(int)new_sub->end,current_sub);
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
172
29684
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
173 new_sub=NULL; // no sub here
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
174 update:
23c0da51c660 Call set_osd_subtitle also for external subs (i.e. in find_subs).
reimar
parents: 29263
diff changeset
175 set_osd_subtitle(new_sub);
584
9bdb59e8887d find_sub() moved out from mplayer.c
arpi_esp
parents:
diff changeset
176 }