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