Mercurial > mplayer.hg
annotate libmpdemux/open.c @ 6455:c4078c1f9d53
Added a function prototype for reuse outside of network.c
author | bertrand |
---|---|
date | Mon, 17 Jun 2002 08:18:45 +0000 |
parents | f0b933918a22 |
children | 654b26c941e5 |
rev | line source |
---|---|
1467 | 1 |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
2 #include <ctype.h> |
1467 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <unistd.h> | |
7 #include <fcntl.h> | |
8 | |
9 #include "config.h" | |
1567 | 10 #include "mp_msg.h" |
1584 | 11 #include "help_mp.h" |
1467 | 12 |
1468 | 13 #ifdef __FreeBSD__ |
14 #include <sys/cdrio.h> | |
15 #endif | |
16 | |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
17 #include "../cfgparser.h" |
1467 | 18 #include "stream.h" |
1482 | 19 #include "demuxer.h" |
4551 | 20 #include "mf.h" |
1467 | 21 |
22 #ifdef STREAMING | |
23 #include "url.h" | |
24 #include "network.h" | |
25 static URL_t* url; | |
26 #endif | |
27 | |
1596 | 28 int dvd_title=0; |
29 int dvd_chapter=1; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
30 int dvd_last_chapter=0; |
1596 | 31 int dvd_angle=1; |
4222
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
32 char* dvd_device=NULL; |
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
33 char* cdrom_device=NULL; |
5472 | 34 int dvd_nav=0; /* use libdvdnav? */ |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
35 |
5381 | 36 #ifdef USE_DVDNAV |
5472 | 37 #include "dvdnav_stream.h" |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
38 #endif |
1596 | 39 |
40 #ifdef USE_DVDREAD | |
41 | |
1875 | 42 #define DVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro)) |
43 | |
44 /* | |
45 * Try to autodetect the libdvd-0.9.0 library | |
46 * (0.9.0 removed the <dvdread/dvd_udf.h> header, and moved the two defines | |
47 * DVD_VIDEO_LB_LEN and MAX_UDF_FILE_NAME_LEN from it to | |
48 * <dvdread/dvd_reader.h>) | |
49 */ | |
50 #if defined(DVD_VIDEO_LB_LEN) && defined(MAX_UDF_FILE_NAME_LEN) | |
51 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,9,0) | |
52 #else | |
53 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,8,0) | |
54 #endif | |
55 | |
2935 | 56 char * dvd_audio_stream_types[8] = |
57 { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" }; | |
1596 | 58 |
59 #endif | |
60 | |
1467 | 61 extern int vcd_get_track_end(int fd,int track); |
62 | |
2790 | 63 #ifdef USE_TV |
64 #include "tv.h" | |
2802 | 65 tvi_handle_t *tv_handler; |
2931 | 66 |
67 extern int stream_open_tv(stream_t *stream, tvi_handle_t *tvh); | |
2790 | 68 #endif |
69 | |
6384
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
70 #ifdef HAVE_CDDA |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
71 stream_t* open_cdda(char* dev,char* track); |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
72 #endif |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
73 |
1467 | 74 // Open a new stream (stdin/file/vcd/url) |
75 | |
76 stream_t* open_stream(char* filename,int vcd_track,int* file_format){ | |
77 stream_t* stream=NULL; | |
78 int f=-1; | |
79 off_t len; | |
80 #ifdef VCD_CACHE | |
81 int vcd_cache_size=128; | |
82 #endif | |
83 #ifdef __FreeBSD__ | |
84 int bsize = VCD_SECTOR_SIZE; | |
85 #endif | |
86 | |
6384
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
87 #ifdef HAVE_CDDA |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
88 if(strncmp("cdda://",filename,7) == 0) |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
89 return open_cdda(cdrom_device ? cdrom_device : DEFAULT_CDROM_DEVICE,filename+7); |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
90 #endif |
f0b933918a22
Support for playing audio cds using cdparanoia. Include a raw audio
albeu
parents:
6320
diff
changeset
|
91 |
1467 | 92 //============ Open VideoCD track ============== |
3261 | 93 #ifdef HAVE_VCD |
1467 | 94 if(vcd_track){ |
95 int ret,ret2; | |
4222
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
96 if(!cdrom_device) cdrom_device=DEFAULT_CDROM_DEVICE; |
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
97 f=open(cdrom_device,O_RDONLY); |
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
98 if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CdDevNotfound,cdrom_device);return NULL; } |
1467 | 99 vcd_read_toc(f); |
100 ret2=vcd_get_track_end(f,vcd_track); | |
1584 | 101 if(ret2<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (get)\n");return NULL;} |
1467 | 102 ret=vcd_seek_to_track(f,vcd_track); |
1584 | 103 if(ret<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");return NULL;} |
1467 | 104 // seek_to_byte+=ret; |
1567 | 105 mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X end: 0x%X\n",ret,ret2); |
1467 | 106 #ifdef VCD_CACHE |
107 vcd_cache_init(vcd_cache_size); | |
108 #endif | |
109 #ifdef __FreeBSD__ | |
110 if (ioctl (f, CDRIOCSETBLOCKSIZE, &bsize) == -1) { | |
111 perror ( "Error in CDRIOCSETBLOCKSIZE"); | |
112 } | |
113 #endif | |
114 stream=new_stream(f,STREAMTYPE_VCD); | |
115 stream->start_pos=ret; | |
116 stream->end_pos=ret2; | |
117 return stream; | |
118 } | |
3261 | 119 #endif |
1467 | 120 |
1596 | 121 //============ Open DVD title ============== |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
122 #ifdef USE_DVDNAV |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
123 if(dvd_nav){ |
5472 | 124 dvdnav_priv_t *dvdnav_priv; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
125 int event,len,tmplen=0; |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
126 |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
127 stream=new_stream(-1,STREAMTYPE_DVDNAV); |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
128 if (!stream) { |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
129 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_Exit_error); |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
130 return NULL; |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
131 } |
5472 | 132 |
133 if(!filename) filename=DEFAULT_DVD_DEVICE; | |
134 if (!(dvdnav_priv=new_dvdnav_stream(filename))) { | |
135 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,filename); | |
136 return NULL; | |
137 } | |
138 | |
139 stream->priv=(void*)dvdnav_priv; | |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
140 return stream; |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
141 } |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
142 #endif |
1596 | 143 #ifdef USE_DVDREAD |
144 if(dvd_title){ | |
2050 | 145 // int ret,ret2; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
146 dvd_priv_t *d; |
1596 | 147 int ttn,pgc_id,pgn; |
148 dvd_reader_t *dvd; | |
149 dvd_file_t *title; | |
150 ifo_handle_t *vmg_file; | |
151 tt_srpt_t *tt_srpt; | |
152 ifo_handle_t *vts_file; | |
153 /** | |
154 * Open the disc. | |
155 */ | |
4222
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
156 if(!dvd_device) dvd_device=DEFAULT_DVD_DEVICE; |
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
157 dvd = DVDOpen(dvd_device); |
1596 | 158 if( !dvd ) { |
4222
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
159 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device); |
1596 | 160 return NULL; |
161 } | |
162 | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
163 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDwait); |
1596 | 164 |
165 /** | |
166 * Load the video manager to find out the information about the titles on | |
167 * this disc. | |
168 */ | |
169 vmg_file = ifoOpen( dvd, 0 ); | |
170 if( !vmg_file ) { | |
171 mp_msg(MSGT_OPEN,MSGL_ERR, "Can't open VMG info!\n"); | |
172 DVDClose( dvd ); | |
173 return NULL; | |
174 } | |
175 tt_srpt = vmg_file->tt_srpt; | |
176 /** | |
177 * Make sure our title number is valid. | |
178 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
179 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumTitles, |
1596 | 180 tt_srpt->nr_of_srpts ); |
181 if( dvd_title < 1 || dvd_title > tt_srpt->nr_of_srpts ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
182 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidTitle, dvd_title); |
1596 | 183 ifoClose( vmg_file ); |
184 DVDClose( dvd ); | |
185 return NULL; | |
186 } | |
187 --dvd_title; // remap 1.. -> 0.. | |
188 /** | |
189 * Make sure the chapter number is valid for this title. | |
190 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
191 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumChapters, |
1596 | 192 tt_srpt->title[dvd_title].nr_of_ptts ); |
193 if( dvd_chapter<1 || dvd_chapter>tt_srpt->title[dvd_title].nr_of_ptts ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
194 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidChapter, dvd_chapter); |
1596 | 195 ifoClose( vmg_file ); |
196 DVDClose( dvd ); | |
197 return NULL; | |
198 } | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
199 if( dvd_last_chapter>0 ) { |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
200 if ( dvd_last_chapter<dvd_chapter || dvd_last_chapter>tt_srpt->title[dvd_title].nr_of_ptts ) { |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
201 mp_msg(MSGT_OPEN,MSGL_ERR, "Invalid DVD last chapter number: %d\n", dvd_last_chapter); |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
202 ifoClose( vmg_file ); |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
203 DVDClose( dvd ); |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
204 return NULL; |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
205 } |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
206 } |
1596 | 207 --dvd_chapter; // remap 1.. -> 0.. |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
208 /* XXX No need to remap dvd_last_chapter */ |
1596 | 209 /** |
210 * Make sure the angle number is valid for this title. | |
211 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
212 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumAngles, |
1596 | 213 tt_srpt->title[dvd_title].nr_of_angles ); |
214 if( dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles ) { | |
1977 | 215 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle); |
1596 | 216 ifoClose( vmg_file ); |
217 DVDClose( dvd ); | |
218 return NULL; | |
219 } | |
1617 | 220 --dvd_angle; // remap 1.. -> 0.. |
1596 | 221 /** |
222 * Load the VTS information for the title set our title is in. | |
223 */ | |
224 vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr ); | |
225 if( !vts_file ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
226 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoIFO, |
1596 | 227 tt_srpt->title[dvd_title].title_set_nr ); |
228 ifoClose( vmg_file ); | |
229 DVDClose( dvd ); | |
230 return NULL; | |
231 } | |
232 /** | |
233 * We've got enough info, time to open the title set data. | |
234 */ | |
235 title = DVDOpenFile( dvd, tt_srpt->title[dvd_title].title_set_nr, | |
236 DVD_READ_TITLE_VOBS ); | |
237 if( !title ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
238 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVOBs, |
1596 | 239 tt_srpt->title[dvd_title].title_set_nr ); |
240 ifoClose( vts_file ); | |
241 ifoClose( vmg_file ); | |
242 DVDClose( dvd ); | |
243 return NULL; | |
244 } | |
245 | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
246 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDopenOk); |
1596 | 247 // store data |
248 d=malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t)); | |
249 d->dvd=dvd; | |
250 d->title=title; | |
251 d->vmg_file=vmg_file; | |
252 d->tt_srpt=tt_srpt; | |
253 d->vts_file=vts_file; | |
254 | |
255 /** | |
2935 | 256 * Check number of audio channels and types |
257 */ | |
258 { | |
259 int ac3aid = 128; | |
260 int mpegaid = 0; | |
261 int pcmaid = 160; | |
262 | |
263 d->nr_of_channels=0; | |
264 | |
265 if ( vts_file->vts_pgcit ) | |
266 { | |
267 int i; | |
268 for ( i=0;i<8;i++ ) | |
269 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000 ) | |
270 { | |
271 audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i]; | |
272 int language = 0; | |
273 char tmp[] = "unknown"; | |
274 | |
275 if ( audio->lang_type == 1 ) | |
276 { | |
277 language=audio->lang_code; | |
278 tmp[0]=language>>8; | |
279 tmp[1]=language&0xff; | |
280 tmp[2]=0; | |
281 } | |
282 | |
283 d->audio_streams[d->nr_of_channels].language=language; | |
284 d->audio_streams[d->nr_of_channels].id=0; | |
285 switch ( audio->audio_format ) | |
286 { | |
287 case 0: // ac3 | |
288 case 6: // dts | |
289 d->audio_streams[d->nr_of_channels].id=ac3aid; | |
290 ac3aid++; | |
291 break; | |
292 case 2: // mpeg layer 1/2/3 | |
293 case 3: // mpeg2 ext | |
294 d->audio_streams[d->nr_of_channels].id=mpegaid; | |
295 mpegaid++; | |
296 break; | |
297 case 4: // lpcm | |
298 d->audio_streams[d->nr_of_channels].id=pcmaid; | |
299 pcmaid++; | |
300 break; | |
301 } | |
302 | |
303 mp_msg(MSGT_OPEN,MSGL_V,"[open] audio stream: %d audio format: %s language: %s aid: %d\n", | |
304 d->nr_of_channels, | |
305 dvd_audio_stream_types[ audio->audio_format ], | |
306 tmp, | |
307 d->audio_streams[d->nr_of_channels].id | |
308 ); | |
3753 | 309 |
2935 | 310 d->nr_of_channels++; |
311 } | |
312 } | |
3048 | 313 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of audio channels on disk: %d.\n",d->nr_of_channels ); |
314 } | |
315 | |
316 /** | |
317 * Check number of subtitles and language | |
318 */ | |
319 { | |
320 int i; | |
321 | |
322 d->nr_of_subtitles=0; | |
323 for ( i=0;i<32;i++ ) | |
324 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->subp_control[i] & 0x80000000 ) | |
325 { | |
326 subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i]; | |
327 int language = 0; | |
328 char tmp[] = "unknown"; | |
329 | |
330 if ( subtitle->type == 1 ) | |
331 { | |
332 language=subtitle->lang_code; | |
333 tmp[0]=language>>8; | |
334 tmp[1]=language&0xff; | |
335 tmp[2]=0; | |
336 } | |
337 | |
338 d->subtitles[ d->nr_of_subtitles ].language=language; | |
339 d->subtitles[ d->nr_of_subtitles ].id=d->nr_of_subtitles; | |
340 | |
341 mp_msg(MSGT_OPEN,MSGL_V,"[open] subtitle ( sid ): %d language: %s\n", | |
342 d->nr_of_subtitles, | |
343 tmp | |
344 ); | |
345 d->nr_of_subtitles++; | |
346 } | |
347 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of subtitles on disk: %d\n",d->nr_of_subtitles ); | |
2935 | 348 } |
349 | |
350 /** | |
1596 | 351 * Determine which program chain we want to watch. This is based on the |
352 * chapter number. | |
353 */ | |
354 ttn = tt_srpt->title[ dvd_title ].vts_ttn; // local | |
355 pgc_id = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgcn; // local | |
356 pgn = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgn; // local | |
357 d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; | |
358 d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here | |
359 d->packs_left=-1; // for Navi stuff | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
360 d->angle_seek=0; |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
361 /* XXX dvd_last_chapter is in the range 1..nr_of_ptts */ |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
362 if ( dvd_last_chapter > 0 && dvd_last_chapter < tt_srpt->title[ttn-1].nr_of_ptts ) { |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
363 pgn=vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_last_chapter].pgn; |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
364 d->last_cell=d->cur_pgc->program_map[pgn-1] - 1; |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
365 } |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
366 else |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
367 d->last_cell=d->cur_pgc->nr_of_cells; |
1596 | 368 |
369 if( d->cur_pgc->cell_playback[d->cur_cell].block_type | |
370 == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
371 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; | |
372 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
373 mp_msg(MSGT_DVD,MSGL_V, "DVD start cell: %d pack: 0x%X-0x%X \n",d->cur_cell,d->cur_pack,d->cell_last_pack); | |
374 | |
375 // ... (unimplemented) | |
376 // return NULL; | |
377 stream=new_stream(-1,STREAMTYPE_DVD); | |
378 stream->start_pos=(off_t)d->cur_pack*2048; | |
4390 | 379 stream->end_pos=(off_t)(d->cur_pgc->cell_playback[d->last_cell-1].last_sector)*2048; |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
380 mp_msg(MSGT_DVD,MSGL_V,"DVD start=%d end=%d \n",d->cur_pack,d->cur_pgc->cell_playback[d->last_cell-1].last_sector); |
1596 | 381 stream->priv=(void*)d; |
382 return stream; | |
383 } | |
384 #endif | |
385 | |
2790 | 386 #ifdef USE_TV |
387 //============ Check for TV-input ==== | |
2931 | 388 if (tv_param_on == 1) |
2790 | 389 { |
2931 | 390 /* create stream */ |
391 stream = new_stream(-1, STREAMTYPE_TV); | |
392 if (!stream) | |
393 return(NULL); | |
394 | |
395 /* create tvi handler */ | |
2790 | 396 tv_handler = tv_begin(); |
397 if (!tv_handler) | |
398 return(NULL); | |
2931 | 399 |
400 /* preinit */ | |
401 if (!tv_init(tv_handler)) | |
402 goto tv_err; | |
403 | |
404 if (!stream_open_tv(stream, tv_handler)) | |
405 goto tv_err; | |
406 | |
407 return(stream); | |
408 | |
409 /* something went wrong - uninit */ | |
410 tv_err: | |
2837 | 411 tv_uninit(tv_handler); |
2802 | 412 return(NULL); |
2790 | 413 } |
414 #endif | |
415 | |
4551 | 416 //============ Check for multi file-input ==== |
417 if (mf_support == 1) | |
418 { | |
419 /* create stream */ | |
420 stream = new_stream(-1, STREAMTYPE_MF); | |
421 if (!stream) | |
422 return(NULL); | |
423 | |
424 if (!stream_open_mf(filename, stream)) | |
425 return(NULL); | |
426 | |
427 return(stream); | |
428 } | |
1467 | 429 |
430 #ifdef STREAMING | |
431 url = url_new(filename); | |
432 if(url) { | |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
433 stream=new_stream(f,STREAMTYPE_STREAM); |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4551
diff
changeset
|
434 if( streaming_start( stream, file_format, url )<0){ |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
435 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename); |
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
436 url_free(url); |
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
437 return NULL; |
4046
f732854e3d16
Kept the HTTP connection open after autodetect, so
bertrand
parents:
3753
diff
changeset
|
438 } |
1584 | 439 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ConnToServer, url->hostname ); |
3045
6c14fd789ba5
Changed the order of processing the network opening.
bertrand
parents:
2935
diff
changeset
|
440 url_free(url); |
2315 | 441 return stream; |
1467 | 442 } |
443 #endif | |
444 | |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
445 //============ Open STDIN or plain FILE ============ |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
446 if(!strcmp(filename,"-")){ |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
447 // read from stdin |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
448 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_ReadSTDIN); |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
449 f=0; // 0=stdin |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
450 } else { |
1467 | 451 f=open(filename,O_RDONLY); |
1584 | 452 if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);return NULL; } |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
453 } |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
454 |
1467 | 455 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET); |
456 if (len == -1) | |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
457 return new_stream(f,STREAMTYPE_STREAM); // open as stream |
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
458 |
1467 | 459 #ifdef _LARGEFILE_SOURCE |
1567 | 460 mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len); |
1467 | 461 #else |
1567 | 462 mp_msg(MSGT_OPEN,MSGL_V,"File size is %u bytes\n", (unsigned int)len); |
1467 | 463 #endif |
464 stream=new_stream(f,STREAMTYPE_FILE); | |
465 stream->end_pos=len; | |
466 return stream; | |
467 } | |
1596 | 468 |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
469 int dvd_parse_chapter_range(struct config *conf, const char *range){ |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
470 char *s, *t; |
4344 | 471 conf; /* prevent warning from GCC */ |
472 s = range; | |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
473 dvd_chapter = 1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
474 dvd_last_chapter = 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
475 if (*range && isdigit(*range)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
476 dvd_chapter = strtol(range, &s, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
477 if (range == s) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
478 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
479 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
480 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
481 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
482 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
483 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
484 else if (*s != '-') { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
485 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
486 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
487 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
488 ++s; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
489 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
490 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
491 if (! isdigit(*s)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
492 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
493 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
494 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
495 dvd_last_chapter = strtol(s, &t, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
496 if (s == t || *t) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
497 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
498 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
499 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
500 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
501 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
502 |
3753 | 503 #ifdef USE_DVDREAD |
1596 | 504 |
3753 | 505 int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){ |
506 dvd_priv_t *d=stream->priv; | |
507 int code,i; | |
508 while(lang && strlen(lang)>=2){ | |
509 code=lang[1]|(lang[0]<<8); | |
510 for(i=0;i<d->nr_of_channels;i++){ | |
511 if(d->audio_streams[i].language==code){ | |
512 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n", | |
513 d->audio_streams[i].id, lang[0],lang[1]); | |
514 return d->audio_streams[i].id; | |
515 } | |
516 // printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]); | |
517 } | |
518 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
519 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
520 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n"); |
3753 | 521 return -1; |
522 } | |
523 | |
524 int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){ | |
525 dvd_priv_t *d=stream->priv; | |
526 int code,i; | |
527 while(lang && strlen(lang)>=2){ | |
528 code=lang[1]|(lang[0]<<8); | |
529 for(i=0;i<d->nr_of_subtitles;i++){ | |
530 if(d->subtitles[i].language==code){ | |
531 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", | |
532 d->subtitles[i].id, lang[0],lang[1]); | |
533 return d->subtitles[i].id; | |
534 } | |
535 } | |
536 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
537 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
538 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n"); |
3753 | 539 return -1; |
540 } | |
1596 | 541 |
542 static int dvd_next_cell(dvd_priv_t *d){ | |
543 int next_cell=d->cur_cell; | |
1616 | 544 |
545 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next1=0x%X \n",next_cell); | |
1596 | 546 |
547 if( d->cur_pgc->cell_playback[ next_cell ].block_type | |
548 == BLOCK_TYPE_ANGLE_BLOCK ) { | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
549 while(next_cell<d->last_cell){ |
1596 | 550 if( d->cur_pgc->cell_playback[next_cell].block_mode |
551 == BLOCK_MODE_LAST_CELL ) break; | |
552 ++next_cell; | |
553 } | |
554 } | |
1616 | 555 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell); |
1596 | 556 |
557 ++next_cell; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
558 if(next_cell>=d->last_cell) return -1; // EOF |
1596 | 559 if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){ |
560 next_cell+=dvd_angle; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
561 if(next_cell>=d->last_cell) return -1; // EOF |
1596 | 562 } |
1616 | 563 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell); |
1596 | 564 return next_cell; |
565 } | |
566 | |
567 int dvd_read_sector(dvd_priv_t *d,unsigned char* data){ | |
568 int len; | |
569 | |
570 if(d->packs_left==0){ | |
571 /** | |
572 * If we're not at the end of this cell, we can determine the next | |
573 * VOBU to display using the VOBU_SRI information section of the | |
574 * DSI. Using this value correctly follows the current angle, | |
575 * avoiding the doubled scenes in The Matrix, and makes our life | |
576 * really happy. | |
577 * | |
578 * Otherwise, we set our next address past the end of this cell to | |
579 * force the code above to go to the next cell in the program. | |
580 */ | |
581 if( d->dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) { | |
582 d->cur_pack= d->dsi_pack.dsi_gi.nv_pck_lbn + | |
583 ( d->dsi_pack.vobu_sri.next_vobu & 0x7fffffff ); | |
584 mp_msg(MSGT_DVD,MSGL_DBG2, "Navi new pos=0x%X \n",d->cur_pack); | |
585 } else { | |
586 // end of cell! find next cell! | |
587 mp_msg(MSGT_DVD,MSGL_V, "--- END OF CELL !!! ---\n"); | |
588 d->cur_pack=d->cell_last_pack+1; | |
589 } | |
590 } | |
591 | |
592 read_next: | |
593 | |
594 if(d->cur_pack>d->cell_last_pack){ | |
595 // end of cell! | |
596 int next=dvd_next_cell(d); | |
597 if(next>=0){ | |
598 d->cur_cell=next; | |
599 | |
1615 | 600 // if( d->cur_pgc->cell_playback[d->cur_cell].block_type |
601 // == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
1596 | 602 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; |
603 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
604 mp_msg(MSGT_DVD,MSGL_V, "DVD next cell: %d pack: 0x%X-0x%X \n",d->cur_cell,d->cur_pack,d->cell_last_pack); | |
605 | |
606 } else return -1; // EOF | |
607 } | |
608 | |
609 len = DVDReadBlocks( d->title, d->cur_pack, 1, data ); | |
610 if(!len) return -1; //error | |
611 | |
612 if(data[38]==0 && data[39]==0 && data[40]==1 && data[41]==0xBF && | |
613 data[1024]==0 && data[1025]==0 && data[1026]==1 && data[1027]==0xBF){ | |
614 // found a Navi packet!!! | |
1875 | 615 #if LIBDVDREAD_VERSION >= DVDREAD_VERSION(0,9,0) |
616 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]) ); | |
617 #else | |
1596 | 618 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]), sizeof(dsi_t) ); |
1875 | 619 #endif |
1596 | 620 if(d->cur_pack != d->dsi_pack.dsi_gi.nv_pck_lbn ){ |
621 mp_msg(MSGT_DVD,MSGL_V, "Invalid NAVI packet! lba=0x%X navi=0x%X \n", | |
622 d->cur_pack,d->dsi_pack.dsi_gi.nv_pck_lbn); | |
623 } else { | |
624 // process! | |
625 d->packs_left = d->dsi_pack.dsi_gi.vobu_ea; | |
626 mp_msg(MSGT_DVD,MSGL_DBG2, "Found NAVI packet! lba=0x%X len=%d \n",d->cur_pack,d->packs_left); | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
627 if(d->angle_seek){ |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
628 int skip=d->dsi_pack.sml_agli.data[dvd_angle].address; |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
629 if(skip) d->cur_pack=d->dsi_pack.dsi_gi.nv_pck_lbn+skip; |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
630 d->angle_seek=0; |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
631 mp_msg(MSGT_DVD,MSGL_V, "Angle-seek synced! skip=%d new_lba=0x%X \n",skip,d->cur_pack); |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
632 } |
1596 | 633 } |
634 ++d->cur_pack; | |
635 goto read_next; | |
636 } | |
637 | |
638 ++d->cur_pack; | |
639 if(d->packs_left>=0) --d->packs_left; | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
640 |
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
641 if(d->angle_seek) goto read_next; // searching for Navi packet |
1596 | 642 |
643 return d->cur_pack-1; | |
644 } | |
645 | |
646 void dvd_seek(dvd_priv_t *d,int pos){ | |
647 d->packs_left=-1; | |
648 d->cur_pack=pos; | |
649 | |
650 // check if we stay in current cell (speedup things, and avoid angle skip) | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
651 if(d->cur_pack>d->cell_last_pack || |
1596 | 652 d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ |
653 | |
654 // ok, cell change, find the right cell! | |
655 d->cur_cell=0; | |
656 if( d->cur_pgc->cell_playback[d->cur_cell].block_type | |
657 == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
658 | |
659 while(1){ | |
660 int next; | |
661 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
662 if(d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ | |
663 d->cur_pack=d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; | |
664 break; | |
665 } | |
666 if(d->cur_pack<=d->cell_last_pack) break; // ok, we find it! :) | |
667 next=dvd_next_cell(d); | |
668 if(next<0){ | |
669 // d->cur_pack=d->cell_last_pack+1; | |
670 break; // we're after the last cell | |
671 } | |
672 d->cur_cell=next; | |
673 } | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
674 |
1596 | 675 } |
676 | |
677 mp_msg(MSGT_DVD,MSGL_V, "DVD Seek! lba=0x%X cell=%d packs: 0x%X-0x%X \n", | |
678 d->cur_pack,d->cur_cell,d->cur_pgc->cell_playback[ d->cur_cell ].first_sector,d->cell_last_pack); | |
679 | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
680 // if we're in interleaved multi-angle cell, find the right angle chain! |
1596 | 681 // (read Navi block, and use the seamless angle jump table) |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
682 d->angle_seek=1; |
1596 | 683 |
684 } | |
685 | |
686 #endif |