annotate libmpdemux/open.c @ 10359:772571c63d45

move xv_set_eq to x11_common
author iive
date Tue, 01 Jul 2003 21:37:20 +0000
parents 46ffc1f596ef
children 3a88897db327
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
1
4343
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
2 #include <ctype.h>
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
3 #include <stdio.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
4 #include <stdlib.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
5 #include <string.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
6 #include <unistd.h>
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
7 #include <fcntl.h>
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
8 #include <string.h>
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
9
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
10 #include "config.h"
1567
5c7760aa4f94 printf->mp_msg/mp_dbg
arpi
parents: 1482
diff changeset
11 #include "mp_msg.h"
1584
e49b3927c793 more messages for translator :)
arpi
parents: 1567
diff changeset
12 #include "help_mp.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
13
1468
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
14 #ifdef __FreeBSD__
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
15 #include <sys/cdrio.h>
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
16 #endif
fbed9c34069c freebsd fix
arpi
parents: 1467
diff changeset
17
9712
b320a02fa57b Switch to the new config header
albeu
parents: 9610
diff changeset
18 #include "../m_config.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
19 #include "stream.h"
1482
4800d1c58dab --enable-streaming fix
arpi
parents: 1468
diff changeset
20 #include "demuxer.h"
4551
716b00618bfc add mfi support
pontscho
parents: 4390
diff changeset
21 #include "mf.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
22
10121
d42177a0da2a Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents: 10067
diff changeset
23 #ifdef MPLAYER_NETWORK
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
24 #include "url.h"
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
25 #include "network.h"
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7854
diff changeset
26 extern int streaming_start( stream_t *stream, int *demuxer_type, URL_t *url);
6910
1a747aee653b applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents: 6853
diff changeset
27 #ifdef STREAMING_LIVE_DOT_COM
1a747aee653b applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents: 6853
diff changeset
28 #include "demux_rtp.h"
1a747aee653b applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents: 6853
diff changeset
29 #endif
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
30 static URL_t* url;
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
31 #endif
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
32
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
33 int dvbin_param_on=0;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
34
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
35 /// We keep these 2 for the gui atm, but they will be removed.
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
36 int dvd_title=0;
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
37 int vcd_track=0;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
38
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
39 int dvd_chapter=1;
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
40 int dvd_last_chapter=0;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
41 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
42 char* dvd_device=NULL;
de7eddb3fd70 Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents: 4146
diff changeset
43 char* cdrom_device=NULL;
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
44
5381
9451df83c04b typo, thx to Mark Szabo <mw3@bsd.hu>
arpi
parents: 5380
diff changeset
45 #ifdef USE_DVDNAV
5472
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
46 #include "dvdnav_stream.h"
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
47 #endif
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
48
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
49 #ifdef USE_DVDREAD
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
50
1875
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
51 #define DVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro))
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
52
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
53 /*
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
54 * Try to autodetect the libdvd-0.9.0 library
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
55 * (0.9.0 removed the <dvdread/dvd_udf.h> header, and moved the two defines
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
56 * DVD_VIDEO_LB_LEN and MAX_UDF_FILE_NAME_LEN from it to
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
57 * <dvdread/dvd_reader.h>)
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
58 */
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
59 #if defined(DVD_VIDEO_LB_LEN) && defined(MAX_UDF_FILE_NAME_LEN)
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
60 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,9,0)
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
61 #else
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
62 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,8,0)
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
63 #endif
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
64
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
65 char * dvd_audio_stream_types[8] =
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
66 { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" };
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
67
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
68 char * dvd_audio_stream_channels[6] =
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
69 { "unknown", "stereo", "unknown", "unknown", "unknown", "5.1" };
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
70 #endif
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
71
8812
f6456b177fdc vcd_read_cue.h -> cue_read.c+h
arpi
parents: 8782
diff changeset
72 #include "cue_read.h"
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
73
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
74 #ifdef HAS_DVBIN_SUPPORT
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
75 #include "dvbin.h"
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
76 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
77
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
78
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
79
7630
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
80 // Define function about auth the libsmbclient library
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
81 // FIXME: I really do not not is this function is properly working
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
82
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
83 #ifdef LIBSMBCLIENT
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
84
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
85 #include "libsmbclient.h"
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
86
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
87 static char smb_password[15];
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
88 static char smb_username[15];
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
89
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
90 static void smb_auth_fn(const char *server, const char *share,
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
91 char *workgroup, int wgmaxlen, char *username, int unmaxlen,
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
92 char *password, int pwmaxlen)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
93 {
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
94 char temp[128];
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
95
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
96 strcpy(temp, "LAN");
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
97 if (temp[strlen(temp) - 1] == 0x0a)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
98 temp[strlen(temp) - 1] = 0x00;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
99
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
100 if (temp[0]) strncpy(workgroup, temp, wgmaxlen - 1);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
101
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
102 strcpy(temp, smb_username);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
103 if (temp[strlen(temp) - 1] == 0x0a)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
104 temp[strlen(temp) - 1] = 0x00;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
105
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
106 if (temp[0]) strncpy(username, temp, unmaxlen - 1);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
107
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
108 strcpy(temp, smb_password);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
109 if (temp[strlen(temp) - 1] == 0x0a)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
110 temp[strlen(temp) - 1] = 0x00;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
111
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
112 if (temp[0]) strncpy(password, temp, pwmaxlen - 1);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
113 }
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
114
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
115
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
116 #endif
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
117
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
118 // Open a new stream (stdin/file/vcd/url)
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
119
9795
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
120 stream_t* open_stream(char* filename,char** options, int* file_format){
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
121 stream_t* stream=NULL;
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
122 int f=-1;
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
123 off_t len;
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
124 *file_format = DEMUXER_TYPE_UNKNOWN;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
125 if(!filename) {
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
126 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n");
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
127 return NULL;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
128 }
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
129
8782
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
130 // for opening of vcds in bincue files
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
131 if(strncmp("cue://",filename,6) == 0){
8782
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
132 int ret,ret2;
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
133 char* p = filename + 6;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
134 vcd_track = 1;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
135 p = strchr(p,':');
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
136 if(p && p[1] != '\0') {
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
137 vcd_track = strtol(p+1,NULL,0);
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
138 if(vcd_track < 1){
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
139 mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid cue track %s\n",p+1);
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
140 return NULL;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
141 }
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
142 p[0] = '\0';
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
143 }
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
144 f = cue_read_cue (filename + 6);
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
145 if(p && p[1] != '\0') p[0] = ':';
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
146 if (f == -1) return NULL;
8782
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
147 cue_vcd_read_toc();
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
148 ret2=cue_vcd_get_track_end(vcd_track);
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
149 ret=cue_vcd_seek_to_track(vcd_track);
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
150 if(ret<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_ErrTrackSelect " (seek)\n");return NULL;}
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
151 mp_msg(MSGT_OPEN,MSGL_V,"VCD start byte position: 0x%X end: 0x%X\n",ret,ret2);
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
152
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
153 stream=new_stream(f,STREAMTYPE_VCDBINCUE);
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
154 stream->start_pos=ret;
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
155 stream->end_pos=ret2;
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
156 return stream;
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
157 }
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
158
6af7a6595cc9 cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents: 8712
diff changeset
159
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
160 //============ Open DVD title ==============
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
161 #ifdef USE_DVDNAV
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
162 if(strncmp("dvdnav://",filename,9) == 0){
5472
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
163 dvdnav_priv_t *dvdnav_priv;
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
164 int event,len,tmplen=0;
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
165 char* name = (filename[9] == '\0') ? NULL : filename + 9;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
166
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
167 stream=new_stream(-1,STREAMTYPE_DVDNAV);
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
168 if (!stream) {
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
169 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
170 return NULL;
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
171 }
5472
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
172
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
173 if(!name) name=DEFAULT_DVD_DEVICE;
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
174 if (!(dvdnav_priv=new_dvdnav_stream(name))) {
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
175 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name);
5472
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
176 return NULL;
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
177 }
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
178
4bd766a5632b dvdnav functions moved out to dvdnav_steram.c
arpi
parents: 5381
diff changeset
179 stream->priv=(void*)dvdnav_priv;
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
180 return stream;
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
181 }
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
182 #endif
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
183 #ifdef USE_DVDREAD
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
184 if(strncmp("dvd://",filename,6) == 0){
2050
18f4dd5d568f -Wall warnings fixed
arpi
parents: 1977
diff changeset
185 // int ret,ret2;
5380
8a01cde9cf39 DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents: 4729
diff changeset
186 dvd_priv_t *d;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
187 int ttn,pgc_id,pgn;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
188 dvd_reader_t *dvd;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
189 dvd_file_t *title;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
190 ifo_handle_t *vmg_file;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
191 tt_srpt_t *tt_srpt;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
192 ifo_handle_t *vts_file;
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
193 dvd_title = filename[6] == '\0' ? 1 : strtol(filename + 6,NULL,0);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
194 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
195 * Open the disc.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
196 */
8649
0c258b964b08 fixes (ok, just workarounds) sig11 in playtree/cfgparser's free()
arpi
parents: 8528
diff changeset
197 if(!dvd_device) dvd_device=strdup(DEFAULT_DVD_DEVICE);
9535
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
198 #ifdef SYS_DARWIN
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
199 /* Dynamic DVD drive selection on Darwin */
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
200 if (!strcmp(dvd_device, "/dev/rdiskN")) {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
201 int i;
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
202 char *temp_device = malloc((strlen(dvd_device)+1)*sizeof(char));
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
203
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
204 for (i = 1; i < 10; i++) {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
205 sprintf(temp_device, "/dev/rdisk%d", i);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
206 dvd = DVDOpen(temp_device);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
207 if (!dvd) {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
208 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,temp_device);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
209 } else {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
210 free(temp_device);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
211 break;
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
212 }
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
213 }
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
214
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
215 if (!dvd)
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
216 return NULL;
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
217 } else
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
218 #endif /* SYS_DARWIN */
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
219 {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
220 dvd = DVDOpen(dvd_device);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
221 if( !dvd ) {
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
222 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,dvd_device);
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
223 return NULL;
aa0dd1f998d9 Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents: 8812
diff changeset
224 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
225 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
226
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
227 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDwait);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
228
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
229 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
230 * Load the video manager to find out the information about the titles on
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
231 * this disc.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
232 */
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
233 vmg_file = ifoOpen( dvd, 0 );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
234 if( !vmg_file ) {
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
235 mp_msg(MSGT_OPEN,MSGL_ERR, "Can't open VMG info!\n");
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
236 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
237 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
238 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
239 tt_srpt = vmg_file->tt_srpt;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
240 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
241 * Make sure our title number is valid.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
242 */
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
243 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumTitles,
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
244 tt_srpt->nr_of_srpts );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
245 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
246 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidTitle, dvd_title);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
247 ifoClose( vmg_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
248 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
249 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
250 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
251 --dvd_title; // remap 1.. -> 0..
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
252 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
253 * Make sure the chapter number is valid for this title.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
254 */
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
255 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumChapters,
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
256 tt_srpt->title[dvd_title].nr_of_ptts );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
257 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
258 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidChapter, dvd_chapter);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
259 ifoClose( vmg_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
260 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
261 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
262 }
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
263 if( dvd_last_chapter>0 ) {
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
264 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
265 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
266 ifoClose( vmg_file );
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
267 DVDClose( dvd );
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
268 return NULL;
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
269 }
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
270 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
271 --dvd_chapter; // remap 1.. -> 0..
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
272 /* XXX No need to remap dvd_last_chapter */
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
273 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
274 * Make sure the angle number is valid for this title.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
275 */
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
276 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumAngles,
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
277 tt_srpt->title[dvd_title].nr_of_angles );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
278 if( dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles ) {
1977
63634ecec611 faszom. typo.
arpi
parents: 1973
diff changeset
279 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
280 ifoClose( vmg_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
281 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
282 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
283 }
1617
9e73b71b0cfa argh. yet another ugly bug: missing --dvd_angle
arpi
parents: 1616
diff changeset
284 --dvd_angle; // remap 1.. -> 0..
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
285 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
286 * Load the VTS information for the title set our title is in.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
287 */
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
288 vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
289 if( !vts_file ) {
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
290 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoIFO,
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
291 tt_srpt->title[dvd_title].title_set_nr );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
292 ifoClose( vmg_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
293 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
294 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
295 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
296 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
297 * We've got enough info, time to open the title set data.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
298 */
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
299 title = DVDOpenFile( dvd, tt_srpt->title[dvd_title].title_set_nr,
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
300 DVD_READ_TITLE_VOBS );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
301 if( !title ) {
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
302 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVOBs,
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
303 tt_srpt->title[dvd_title].title_set_nr );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
304 ifoClose( vts_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
305 ifoClose( vmg_file );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
306 DVDClose( dvd );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
307 return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
308 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
309
1973
5216f108cb4f all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents: 1899
diff changeset
310 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDopenOk);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
311 // store data
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
312 d=malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t));
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
313 d->dvd=dvd;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
314 d->title=title;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
315 d->vmg_file=vmg_file;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
316 d->tt_srpt=tt_srpt;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
317 d->vts_file=vts_file;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
318
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
319 /**
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
320 * Check number of audio channels and types
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
321 */
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
322 {
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
323 int ac3aid = 128;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
324 int mpegaid = 0;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
325 int pcmaid = 160;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
326
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
327 d->nr_of_channels=0;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
328
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
329 if ( vts_file->vts_pgcit )
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
330 {
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
331 int i;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
332 for ( i=0;i<8;i++ )
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
333 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000 )
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
334 {
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
335 audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i];
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
336 int language = 0;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
337 char tmp[] = "unknown";
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
338
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
339 if ( audio->lang_type == 1 )
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
340 {
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
341 language=audio->lang_code;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
342 tmp[0]=language>>8;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
343 tmp[1]=language&0xff;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
344 tmp[2]=0;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
345 }
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
346
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
347 d->audio_streams[d->nr_of_channels].language=language;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
348 d->audio_streams[d->nr_of_channels].id=0;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
349 switch ( audio->audio_format )
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
350 {
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
351 case 0: // ac3
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
352 case 6: // dts
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
353 d->audio_streams[d->nr_of_channels].id=ac3aid;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
354 ac3aid++;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
355 break;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
356 case 2: // mpeg layer 1/2/3
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
357 case 3: // mpeg2 ext
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
358 d->audio_streams[d->nr_of_channels].id=mpegaid;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
359 mpegaid++;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
360 break;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
361 case 4: // lpcm
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
362 d->audio_streams[d->nr_of_channels].id=pcmaid;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
363 pcmaid++;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
364 break;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
365 }
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
366
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
367 d->audio_streams[d->nr_of_channels].type=audio->audio_format;
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
368 // Pontscho: to my mind, tha channels:
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
369 // 1 - stereo
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
370 // 5 - 5.1
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
371 d->audio_streams[d->nr_of_channels].channels=audio->channels;
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
372 mp_msg(MSGT_OPEN,MSGL_V,"[open] audio stream: %d audio format: %s (%s) language: %s aid: %d\n",
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
373 d->nr_of_channels,
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
374 dvd_audio_stream_types[ audio->audio_format ],
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
375 dvd_audio_stream_channels[ audio->channels ],
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
376 tmp,
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
377 d->audio_streams[d->nr_of_channels].id
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
378 );
3753
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
379
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
380 d->nr_of_channels++;
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
381 }
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
382 }
3048
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
383 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of audio channels on disk: %d.\n",d->nr_of_channels );
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
384 }
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
385
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
386 /**
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
387 * Check number of subtitles and language
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
388 */
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
389 {
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
390 int i;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
391
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
392 d->nr_of_subtitles=0;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
393 for ( i=0;i<32;i++ )
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
394 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->subp_control[i] & 0x80000000 )
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
395 {
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
396 subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i];
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
397 int language = 0;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
398 char tmp[] = "unknown";
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
399
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
400 if ( subtitle->type == 1 )
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
401 {
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
402 language=subtitle->lang_code;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
403 tmp[0]=language>>8;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
404 tmp[1]=language&0xff;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
405 tmp[2]=0;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
406 }
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
407
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
408 d->subtitles[ d->nr_of_subtitles ].language=language;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
409 d->subtitles[ d->nr_of_subtitles ].id=d->nr_of_subtitles;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
410
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
411 mp_msg(MSGT_OPEN,MSGL_V,"[open] subtitle ( sid ): %d language: %s\n",
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
412 d->nr_of_subtitles,
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
413 tmp
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
414 );
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
415 d->nr_of_subtitles++;
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
416 }
b01551d725d4 add subtitle language detect.
pontscho
parents: 3046
diff changeset
417 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of subtitles on disk: %d\n",d->nr_of_subtitles );
2935
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
418 }
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
419
bc6cb25ad067 add dvd audio stream detect
pontscho
parents: 2931
diff changeset
420 /**
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
421 * Determine which program chain we want to watch. This is based on the
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
422 * chapter number.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
423 */
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
424 ttn = tt_srpt->title[ dvd_title ].vts_ttn; // local
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
425 pgc_id = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgcn; // local
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
426 pgn = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgn; // local
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
427 d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
428 d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
429 d->packs_left=-1; // for Navi stuff
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
430 d->angle_seek=0;
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
431 /* XXX dvd_last_chapter is in the range 1..nr_of_ptts */
6853
c52dc92ebf4b There appears to be a trivial namespace error in determining the valid
arpi
parents: 6774
diff changeset
432 if ( dvd_last_chapter > 0 && dvd_last_chapter < tt_srpt->title[dvd_title].nr_of_ptts ) {
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
433 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
434 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
435 }
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
436 else
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
437 d->last_cell=d->cur_pgc->nr_of_cells;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
438
6651
8f49c75a2824 - add icon (nice, but very ugly hakk:)
pontscho
parents: 6490
diff changeset
439 if( d->cur_pgc->cell_playback[d->cur_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
440 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
441 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
442 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);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
443
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
444 // ... (unimplemented)
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
445 // return NULL;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
446 stream=new_stream(-1,STREAMTYPE_DVD);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
447 stream->start_pos=(off_t)d->cur_pack*2048;
4390
fbbd612779af DVD progress bar fix
arpi
parents: 4344
diff changeset
448 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
449 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
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
450 stream->priv=(void*)d;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
451 return stream;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
452 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
453 #endif
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
454
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
455 #ifdef HAS_DVBIN_SUPPORT
9746
27fff718ede6 Stream cleanup, don't use blah_on options anymore.
albeu
parents: 9712
diff changeset
456 if(strncmp("dvbin://",filename,8) == 0)
9610
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
457 {
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
458 stream = new_stream(-1, STREAMTYPE_DVB);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
459 if (!stream)
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
460 return(NULL);
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
461 if (!dvb_streaming_start(stream))
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
462 return NULL;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
463
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
464 return stream;
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
465 }
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
466 #endif
76c6d8f1ebf5 this is a combo patch that:
arpi
parents: 9535
diff changeset
467
10121
d42177a0da2a Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents: 10067
diff changeset
468 #ifdef MPLAYER_NETWORK
9878
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
469 #ifdef STREAMING_LIVE_DOT_COM
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
470 // Check for a SDP file:
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
471 if (strncmp("sdp://",filename,6) == 0) {
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
472 filename += 6;
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
473 #if defined(__CYGWIN__) || defined(__MINGW32__)
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
474 f=open(filename,O_RDONLY|O_BINARY);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
475 #else
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
476 f=open(filename,O_RDONLY);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
477 #endif
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
478 if(f<0){ mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename);return NULL; }
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
479
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
480 len=lseek(f,0,SEEK_END); lseek(f,0,SEEK_SET);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
481 if (len == -1)
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
482 return NULL;
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
483
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
484 #ifdef _LARGEFILE_SOURCE
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
485 mp_msg(MSGT_OPEN,MSGL_V,"File size is %lld bytes\n", (long long)len);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
486 #else
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
487 mp_msg(MSGT_OPEN,MSGL_V,"File size is %u bytes\n", (unsigned int)len);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
488 #endif
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
489 return stream_open_sdp(f, len, file_format);
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
490 }
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
491 #endif
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
492
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
493 url = url_new(filename);
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
494 if(url) {
7630
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
495 if (strcmp(url->protocol, "smb")==0){
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
496 #ifdef LIBSMBCLIENT
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
497
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
498 // we need init of libsmbclient
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
499 int err;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
500
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
501 // FIXME: HACK: make the username/password global varaibles
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
502 // so the auth_fn function should grab it ...
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
503 // i cannot thing other way...
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
504 err = smbc_init(smb_auth_fn, 10); /* Initialize things */
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
505 // libsmbclient using
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
506 if (err < 0) {
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
507 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBInitError,err);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
508 return NULL;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
509 }
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
510 f=smbc_open(filename, O_RDONLY, 0666);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
511
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
512 // cannot open the file, outputs that
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
513 // MSGTR_FileNotFound -> MSGTR_SMBFileNotFound
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
514 if(f<0){
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
515 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBFileNotFound,filename);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
516 return NULL;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
517 }
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
518 len=smbc_lseek(f,0,SEEK_END);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
519 smbc_lseek(f,0,SEEK_SET);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
520 // FIXME: I really wonder is such situation -> but who cares ;)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
521 // if (len == -1)
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
522 // return new_stream(f,STREAMTYPE_STREAM); // open as stream
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
523 url_free(url);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
524 stream=new_stream(f,STREAMTYPE_SMB);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
525 stream->end_pos=len;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
526 return stream;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
527 #else
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
528 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBNotCompiled,filename);
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
529 return NULL;
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
530 #endif
4c51ce16c4a2 smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents: 7559
diff changeset
531 }
4251
05affdf4bdcd Moved network related code from open.c to network.c
bertrand
parents: 4222
diff changeset
532 stream=new_stream(f,STREAMTYPE_STREAM);
4729
f51bd827ed1c fixed MP3 ICY detection, return detected file format for open_stream
alex
parents: 4551
diff changeset
533 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
534 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename);
9795
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
535 //url_free(url);
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
536 //return NULL;
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
537 } else {
1584
e49b3927c793 more messages for translator :)
arpi
parents: 1567
diff changeset
538 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
539 url_free(url);
2315
c3c73ba53f0e streaming fixed
arpi
parents: 2314
diff changeset
540 return stream;
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
541 }
9795
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
542 }
9878
95727467a091 Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents: 9801
diff changeset
543 #endif
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
544
6320
12136df07dbd common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents: 5932
diff changeset
545 //============ Open STDIN or plain FILE ============
6910
1a747aee653b applied live.com streaming patch (-sdp and rtsp:// support) by Ross Finlayson <finlayson@live.com>
arpi
parents: 6853
diff changeset
546
9795
20f8944a6e0c Remove -sdp
albeu
parents: 9773
diff changeset
547 return open_stream_full(filename,STREAM_READ,options,file_format);
1467
f352e1e951ba stream opening -> open.c, initialframes ignored
arpi
parents:
diff changeset
548 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
549
4343
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
550 int dvd_parse_chapter_range(struct config *conf, const char *range){
7472
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7432
diff changeset
551 const char *s;
c4434bdf6e51 tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents: 7432
diff changeset
552 char *t;
8123
9fc45fe0d444 *HUGE* set of compiler warning fixes, unused variables removal
arpi
parents: 7854
diff changeset
553 /* conf; prevent warning from GCC */
4344
7d9b4c874f73 Don't segfault with empty -chapter spec.
kmkaplan
parents: 4343
diff changeset
554 s = range;
4343
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
555 dvd_chapter = 1;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
556 dvd_last_chapter = 0;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
557 if (*range && isdigit(*range)) {
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
558 dvd_chapter = strtol(range, &s, 10);
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
559 if (range == s) {
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
560 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
561 return -1;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
562 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
563 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
564 if (*s == 0)
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
565 return 0;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
566 else if (*s != '-') {
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
567 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
568 return -1;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
569 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
570 ++s;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
571 if (*s == 0)
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
572 return 0;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
573 if (! isdigit(*s)) {
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
574 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
575 return -1;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
576 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
577 dvd_last_chapter = strtol(s, &t, 10);
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
578 if (s == t || *t) {
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
579 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
580 return -1;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
581 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
582 return 0;
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
583 }
b0c8eed7473c Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents: 4291
diff changeset
584
3753
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
585 #ifdef USE_DVDREAD
7854
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
586 int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell)
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
587 {
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
588 pgc_t * cur_pgc;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
589 ptt_info_t* ptt;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
590 int chapter = cell;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
591 int pgc_id,pgn;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
592 if(title < 0 || cell < 0){
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
593 return 0;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
594 }
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
595 /* for most DVD's chapter == cell */
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
596 /* but there are more complecated cases... */
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
597 if(chapter >= dvd->vmg_file->tt_srpt->title[title].nr_of_ptts){
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
598 chapter = dvd->vmg_file->tt_srpt->title[title].nr_of_ptts-1;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
599 }
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
600 title = dvd->tt_srpt->title[title].vts_ttn-1;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
601 ptt = dvd->vts_file->vts_ptt_srpt->title[title].ptt;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
602 while(chapter >= 0){
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
603 pgc_id = ptt[chapter].pgcn;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
604 pgn = ptt[chapter].pgn;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
605 cur_pgc = dvd->vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
606 if(cell >= cur_pgc->program_map[pgn-1]-1){
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
607 return chapter;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
608 }
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
609 --chapter;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
610 }
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
611 /* didn't find a chapter ??? */
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
612 return chapter;
d6c29d863f15 dvd chapter detect function from Gregory Kovriga
pontscho
parents: 7630
diff changeset
613 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
614
3753
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
615 int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
616 dvd_priv_t *d=stream->priv;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
617 int code,i;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
618 while(lang && strlen(lang)>=2){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
619 code=lang[1]|(lang[0]<<8);
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
620 for(i=0;i<d->nr_of_channels;i++){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
621 if(d->audio_streams[i].language==code){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
622 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n",
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
623 d->audio_streams[i].id, lang[0],lang[1]);
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
624 return d->audio_streams[i].id;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
625 }
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
626 // printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]);
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
627 }
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
628 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
629 }
5932
1ebeebca86f3 printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents: 5819
diff changeset
630 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n");
3753
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
631 return -1;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
632 }
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
633
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
634 int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
635 dvd_priv_t *d=stream->priv;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
636 int code,i;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
637 while(lang && strlen(lang)>=2){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
638 code=lang[1]|(lang[0]<<8);
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
639 for(i=0;i<d->nr_of_subtitles;i++){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
640 if(d->subtitles[i].language==code){
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
641 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n",
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
642 d->subtitles[i].id, lang[0],lang[1]);
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
643 return d->subtitles[i].id;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
644 }
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
645 }
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
646 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
647 }
5932
1ebeebca86f3 printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents: 5819
diff changeset
648 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n");
3753
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
649 return -1;
d3fc41a04cb7 dvd language->aid/sid functions
arpi
parents: 3603
diff changeset
650 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
651
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
652 static int dvd_next_cell(dvd_priv_t *d){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
653 int next_cell=d->cur_cell;
1616
a3b4579e3806 some debug messages
arpi
parents: 1615
diff changeset
654
a3b4579e3806 some debug messages
arpi
parents: 1615
diff changeset
655 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next1=0x%X \n",next_cell);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
656
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
657 if( d->cur_pgc->cell_playback[ next_cell ].block_type
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
658 == BLOCK_TYPE_ANGLE_BLOCK ) {
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
659 while(next_cell<d->last_cell){
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
660 if( d->cur_pgc->cell_playback[next_cell].block_mode
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
661 == BLOCK_MODE_LAST_CELL ) break;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
662 ++next_cell;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
663 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
664 }
1616
a3b4579e3806 some debug messages
arpi
parents: 1615
diff changeset
665 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
666
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
667 ++next_cell;
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
668 if(next_cell>=d->last_cell) return -1; // EOF
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
669 if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
670 next_cell+=dvd_angle;
4291
e889d37f25b2 Add option -last-chapter for DVD playing/encoding
kmkaplan
parents: 4251
diff changeset
671 if(next_cell>=d->last_cell) return -1; // EOF
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
672 }
1616
a3b4579e3806 some debug messages
arpi
parents: 1615
diff changeset
673 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell);
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
674 return next_cell;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
675 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
676
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
677 int dvd_read_sector(dvd_priv_t *d,unsigned char* data){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
678 int len;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
679
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
680 if(d->packs_left==0){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
681 /**
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
682 * If we're not at the end of this cell, we can determine the next
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
683 * VOBU to display using the VOBU_SRI information section of the
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
684 * DSI. Using this value correctly follows the current angle,
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
685 * avoiding the doubled scenes in The Matrix, and makes our life
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
686 * really happy.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
687 *
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
688 * Otherwise, we set our next address past the end of this cell to
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
689 * force the code above to go to the next cell in the program.
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
690 */
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
691 if( d->dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) {
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
692 d->cur_pack= d->dsi_pack.dsi_gi.nv_pck_lbn +
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
693 ( d->dsi_pack.vobu_sri.next_vobu & 0x7fffffff );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
694 mp_msg(MSGT_DVD,MSGL_DBG2, "Navi new pos=0x%X \n",d->cur_pack);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
695 } else {
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
696 // end of cell! find next cell!
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
697 mp_msg(MSGT_DVD,MSGL_V, "--- END OF CELL !!! ---\n");
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
698 d->cur_pack=d->cell_last_pack+1;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
699 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
700 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
701
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
702 read_next:
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
703
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
704 if(d->cur_pack>d->cell_last_pack){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
705 // end of cell!
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
706 int next=dvd_next_cell(d);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
707 if(next>=0){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
708 d->cur_cell=next;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
709
1615
4e4eb37a4b76 removed double +angle stuff
arpi
parents: 1609
diff changeset
710 // if( d->cur_pgc->cell_playback[d->cur_cell].block_type
4e4eb37a4b76 removed double +angle stuff
arpi
parents: 1609
diff changeset
711 // == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
712 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
713 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
714 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);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
715
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
716 } else return -1; // EOF
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
717 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
718
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
719 len = DVDReadBlocks( d->title, d->cur_pack, 1, data );
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
720 if(!len) return -1; //error
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
721
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
722 if(data[38]==0 && data[39]==0 && data[40]==1 && data[41]==0xBF &&
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
723 data[1024]==0 && data[1025]==0 && data[1026]==1 && data[1027]==0xBF){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
724 // found a Navi packet!!!
1875
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
725 #if LIBDVDREAD_VERSION >= DVDREAD_VERSION(0,9,0)
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
726 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]) );
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
727 #else
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
728 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]), sizeof(dsi_t) );
1875
73c771050065 Add support for libdvdread-0.9.0
jkeil
parents: 1617
diff changeset
729 #endif
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
730 if(d->cur_pack != d->dsi_pack.dsi_gi.nv_pck_lbn ){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
731 mp_msg(MSGT_DVD,MSGL_V, "Invalid NAVI packet! lba=0x%X navi=0x%X \n",
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
732 d->cur_pack,d->dsi_pack.dsi_gi.nv_pck_lbn);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
733 } else {
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
734 // process!
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
735 d->packs_left = d->dsi_pack.dsi_gi.vobu_ea;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
736 mp_msg(MSGT_DVD,MSGL_DBG2, "Found NAVI packet! lba=0x%X len=%d \n",d->cur_pack,d->packs_left);
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
737 //navPrint_DSI(&d->dsi_pack);
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
738 mp_msg(MSGT_DVD,MSGL_DBG3,"\r### CELL %d: Navi: %d/%d IFO: %d/%d \n",d->cur_cell,
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
739 d->dsi_pack.dsi_gi.vobu_c_idn,d->dsi_pack.dsi_gi.vobu_vob_idn,
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
740 d->cur_pgc->cell_position[d->cur_cell].cell_nr,
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
741 d->cur_pgc->cell_position[d->cur_cell].vob_id_nr);
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
742
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
743 if(d->angle_seek){
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
744 int i,skip=0;
10067
f9eac474eb74 this is a important patch for hpux 11.00, because it avoid the
diego
parents: 9901
diff changeset
745 #if defined(__GNUC__) && ( defined(__sparc__) || defined(hpux) )
f9eac474eb74 this is a important patch for hpux 11.00, because it avoid the
diego
parents: 9901
diff changeset
746 // workaround for a bug in the sparc/hpux version of gcc 2.95.X ... 3.2,
7296
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
747 // it generates incorrect code for unaligned access to a packed
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
748 // structure member, resulting in an mplayer crash with a SIGBUS
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
749 // signal.
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
750 //
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
751 // See also gcc problem report PR c/7847:
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
752 // http://gcc.gnu.org/cgi-bin/gnatsweb.pl?database=gcc&cmd=view+audit-trail&pr=7847
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
753 for(i=0;i<9;i++){ // check if all values zero:
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
754 typeof(d->dsi_pack.sml_agli.data[i].address) tmp_addr;
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
755 memcpy(&tmp_addr,&d->dsi_pack.sml_agli.data[i].address,sizeof(tmp_addr));
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
756 if((skip=tmp_addr)!=0) break;
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
757 }
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
758 #else
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
759 for(i=0;i<9;i++) // check if all values zero:
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
760 if((skip=d->dsi_pack.sml_agli.data[i].address)!=0) break;
7296
f4710b873abd SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents: 6910
diff changeset
761 #endif
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
762 if(skip){
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
763 // sml_agli table has valid data (at least one non-zero):
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
764 d->cur_pack=d->dsi_pack.dsi_gi.nv_pck_lbn+
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
765 d->dsi_pack.sml_agli.data[dvd_angle].address;
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
766 d->angle_seek=0;
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
767 mp_msg(MSGT_DVD,MSGL_V, "Angle-seek synced using sml_agli map! new_lba=0x%X \n",d->cur_pack);
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
768 } else {
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
769 // check if we're in the right cell, jump otherwise:
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
770 if( (d->dsi_pack.dsi_gi.vobu_c_idn==d->cur_pgc->cell_position[d->cur_cell].cell_nr) &&
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
771 (d->dsi_pack.dsi_gi.vobu_vob_idn==d->cur_pgc->cell_position[d->cur_cell].vob_id_nr) ){
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
772 d->angle_seek=0;
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
773 mp_msg(MSGT_DVD,MSGL_V, "Angle-seek synced by cell/vob IDN search! \n");
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
774 } else {
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
775 // wrong angle, skip this vobu:
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
776 d->cur_pack=d->dsi_pack.dsi_gi.nv_pck_lbn+
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
777 d->dsi_pack.dsi_gi.vobu_ea;
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
778 d->angle_seek=2; // DEBUG
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
779 }
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
780 }
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
781 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
782 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
783 ++d->cur_pack;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
784 goto read_next;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
785 }
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
786
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
787 ++d->cur_pack;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
788 if(d->packs_left>=0) --d->packs_left;
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
789
6774
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
790 if(d->angle_seek){
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
791 if(d->angle_seek==2) mp_msg(MSGT_DVD,MSGL_V, "!!! warning! reading packet while angle_seek !!!\n");
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
792 goto read_next; // searching for Navi packet
3bcd52b7b2ae Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents: 6651
diff changeset
793 }
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
794
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
795 return d->cur_pack-1;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
796 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
797
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
798 void dvd_seek(dvd_priv_t *d,int pos){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
799 d->packs_left=-1;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
800 d->cur_pack=pos;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
801
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
802 // 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
803 if(d->cur_pack>d->cell_last_pack ||
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
804 d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
805
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
806 // ok, cell change, find the right cell!
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
807 d->cur_cell=0;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
808 if( d->cur_pgc->cell_playback[d->cur_cell].block_type
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
809 == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
810
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
811 while(1){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
812 int next;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
813 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
814 if(d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
815 d->cur_pack=d->cur_pgc->cell_playback[ d->cur_cell ].first_sector;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
816 break;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
817 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
818 if(d->cur_pack<=d->cell_last_pack) break; // ok, we find it! :)
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
819 next=dvd_next_cell(d);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
820 if(next<0){
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
821 // d->cur_pack=d->cell_last_pack+1;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
822 break; // we're after the last cell
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
823 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
824 d->cur_cell=next;
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
825 }
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
826
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
827 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
828
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
829 mp_msg(MSGT_DVD,MSGL_V, "DVD Seek! lba=0x%X cell=%d packs: 0x%X-0x%X \n",
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
830 d->cur_pack,d->cur_cell,d->cur_pgc->cell_playback[ d->cur_cell ].first_sector,d->cell_last_pack);
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
831
1609
84199d075839 ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents: 1596
diff changeset
832 // if we're in interleaved multi-angle cell, find the right angle chain!
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
833 // (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
834 d->angle_seek=1;
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
835
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
836 }
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
837
6479
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
838 void dvd_close(dvd_priv_t *d) {
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
839 ifoClose(d->vts_file);
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
840 ifoClose(d->vmg_file);
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
841 DVDCloseFile(d->title);
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
842 DVDClose(d->dvd);
9712
b320a02fa57b Switch to the new config header
albeu
parents: 9610
diff changeset
843 dvd_chapter = 1;
b320a02fa57b Switch to the new config header
albeu
parents: 9610
diff changeset
844 dvd_last_chapter = 0;
6479
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
845 }
45ec7f24de06 Add uninit to the dvd stream.
albeu
parents: 6474
diff changeset
846
1596
fc0e9953bc2d libDVDread support
arpi
parents: 1584
diff changeset
847 #endif