Mercurial > mplayer.hg
annotate libmpdemux/open.c @ 10843:60f58eadd666
10l, debug code broke compile with mmx disabled
author | rfelker |
---|---|
date | Mon, 08 Sep 2003 17:12:31 +0000 |
parents | fb66c426cd91 |
children | e7c8200ffdc5 |
rev | line source |
---|---|
1467 | 1 |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
2 #include <ctype.h> |
1467 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
6 #include <unistd.h> | |
7 #include <fcntl.h> | |
9746 | 8 #include <string.h> |
1467 | 9 |
10 #include "config.h" | |
1567 | 11 #include "mp_msg.h" |
1584 | 12 #include "help_mp.h" |
1467 | 13 |
1468 | 14 #ifdef __FreeBSD__ |
15 #include <sys/cdrio.h> | |
16 #endif | |
17 | |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10560
diff
changeset
|
18 #include "../m_option.h" |
1467 | 19 #include "stream.h" |
1482 | 20 #include "demuxer.h" |
4551 | 21 #include "mf.h" |
1467 | 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 | 24 #include "url.h" |
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 | 30 static URL_t* url; |
31 #endif | |
32 | |
9746 | 33 /// We keep these 2 for the gui atm, but they will be removed. |
1596 | 34 int dvd_title=0; |
9746 | 35 int vcd_track=0; |
36 | |
1596 | 37 int dvd_chapter=1; |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
38 int dvd_last_chapter=0; |
1596 | 39 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
|
40 char* dvd_device=NULL; |
de7eddb3fd70
Change to use cdrom-device and dvd-device options needed for DVD/TV/VCD
albeu
parents:
4146
diff
changeset
|
41 char* cdrom_device=NULL; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
42 |
5381 | 43 #ifdef USE_DVDNAV |
5472 | 44 #include "dvdnav_stream.h" |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
45 #endif |
1596 | 46 |
47 #ifdef USE_DVDREAD | |
48 | |
1875 | 49 #define DVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro)) |
50 | |
51 /* | |
52 * Try to autodetect the libdvd-0.9.0 library | |
53 * (0.9.0 removed the <dvdread/dvd_udf.h> header, and moved the two defines | |
54 * DVD_VIDEO_LB_LEN and MAX_UDF_FILE_NAME_LEN from it to | |
55 * <dvdread/dvd_reader.h>) | |
56 */ | |
57 #if defined(DVD_VIDEO_LB_LEN) && defined(MAX_UDF_FILE_NAME_LEN) | |
58 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,9,0) | |
59 #else | |
60 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,8,0) | |
61 #endif | |
62 | |
2935 | 63 char * dvd_audio_stream_types[8] = |
64 { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" }; | |
1596 | 65 |
6651 | 66 char * dvd_audio_stream_channels[6] = |
10482
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
67 { "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" }; |
1596 | 68 #endif |
69 | |
8812 | 70 #include "cue_read.h" |
1467 | 71 |
9610 | 72 |
73 | |
7630
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
74 // Define function about auth the libsmbclient library |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
75 // 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
|
76 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
77 #ifdef LIBSMBCLIENT |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
78 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
79 #include "libsmbclient.h" |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
80 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
81 static char smb_password[15]; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
82 static char smb_username[15]; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
83 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
84 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
|
85 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
|
86 char *password, int pwmaxlen) |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
87 { |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
88 char temp[128]; |
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 strcpy(temp, "LAN"); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
91 if (temp[strlen(temp) - 1] == 0x0a) |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
92 temp[strlen(temp) - 1] = 0x00; |
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 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
|
95 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
96 strcpy(temp, smb_username); |
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(username, temp, unmaxlen - 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_password); |
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(password, temp, pwmaxlen - 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 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
109 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
110 #endif |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
111 |
1467 | 112 // Open a new stream (stdin/file/vcd/url) |
113 | |
9795 | 114 stream_t* open_stream(char* filename,char** options, int* file_format){ |
1467 | 115 stream_t* stream=NULL; |
116 int f=-1; | |
117 off_t len; | |
9746 | 118 *file_format = DEMUXER_TYPE_UNKNOWN; |
119 if(!filename) { | |
120 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n"); | |
121 return NULL; | |
122 } | |
1467 | 123 |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
124 // for opening of vcds in bincue files |
9746 | 125 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
|
126 int ret,ret2; |
9746 | 127 char* p = filename + 6; |
128 vcd_track = 1; | |
129 p = strchr(p,':'); | |
130 if(p && p[1] != '\0') { | |
131 vcd_track = strtol(p+1,NULL,0); | |
132 if(vcd_track < 1){ | |
133 mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid cue track %s\n",p+1); | |
134 return NULL; | |
135 } | |
136 p[0] = '\0'; | |
137 } | |
138 f = cue_read_cue (filename + 6); | |
139 if(p && p[1] != '\0') p[0] = ':'; | |
140 if (f == -1) return NULL; | |
8782
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
141 cue_vcd_read_toc(); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
142 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
|
143 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
|
144 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
|
145 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
|
146 |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
147 stream=new_stream(f,STREAMTYPE_VCDBINCUE); |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
148 stream->start_pos=ret; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
149 stream->end_pos=ret2; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
150 return stream; |
6af7a6595cc9
cdrwin-style bin/cue VCD image support (-vcd <track> -cuefile file.cue)
arpi
parents:
8712
diff
changeset
|
151 } |
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 |
1596 | 154 //============ Open DVD title ============== |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
155 #ifdef USE_DVDNAV |
9746 | 156 if(strncmp("dvdnav://",filename,9) == 0){ |
5472 | 157 dvdnav_priv_t *dvdnav_priv; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
158 int event,len,tmplen=0; |
9746 | 159 char* name = (filename[9] == '\0') ? NULL : filename + 9; |
160 | |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
161 stream=new_stream(-1,STREAMTYPE_DVDNAV); |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
162 if (!stream) { |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
163 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
|
164 return NULL; |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
165 } |
5472 | 166 |
9746 | 167 if(!name) name=DEFAULT_DVD_DEVICE; |
168 if (!(dvdnav_priv=new_dvdnav_stream(name))) { | |
169 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name); | |
5472 | 170 return NULL; |
171 } | |
172 | |
173 stream->priv=(void*)dvdnav_priv; | |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
174 return stream; |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
175 } |
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
176 #endif |
1596 | 177 #ifdef USE_DVDREAD |
9746 | 178 if(strncmp("dvd://",filename,6) == 0){ |
2050 | 179 // int ret,ret2; |
5380
8a01cde9cf39
DVDnav support patch by David Holm and Kees Cook <mplayer@outflux.net>
arpi
parents:
4729
diff
changeset
|
180 dvd_priv_t *d; |
1596 | 181 int ttn,pgc_id,pgn; |
182 dvd_reader_t *dvd; | |
183 dvd_file_t *title; | |
184 ifo_handle_t *vmg_file; | |
185 tt_srpt_t *tt_srpt; | |
186 ifo_handle_t *vts_file; | |
9746 | 187 dvd_title = filename[6] == '\0' ? 1 : strtol(filename + 6,NULL,0); |
1596 | 188 /** |
189 * Open the disc. | |
190 */ | |
8649
0c258b964b08
fixes (ok, just workarounds) sig11 in playtree/cfgparser's free()
arpi
parents:
8528
diff
changeset
|
191 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
|
192 #ifdef SYS_DARWIN |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
193 /* 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
|
194 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
|
195 int i; |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
196 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
|
197 |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
198 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
|
199 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
|
200 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
|
201 if (!dvd) { |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
202 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
|
203 } else { |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
204 free(temp_device); |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
205 break; |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
206 } |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
207 } |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
208 |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
209 if (!dvd) |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
210 return NULL; |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
211 } else |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
212 #endif /* SYS_DARWIN */ |
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 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
|
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 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
|
217 return NULL; |
aa0dd1f998d9
Dynamic decision of DVD device Darwin patch by (danchr at daimi dot au dot dk)
michael
parents:
8812
diff
changeset
|
218 } |
1596 | 219 } |
220 | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
221 mp_msg(MSGT_OPEN,MSGL_INFO,MSGTR_DVDwait); |
1596 | 222 |
223 /** | |
224 * Load the video manager to find out the information about the titles on | |
225 * this disc. | |
226 */ | |
227 vmg_file = ifoOpen( dvd, 0 ); | |
228 if( !vmg_file ) { | |
229 mp_msg(MSGT_OPEN,MSGL_ERR, "Can't open VMG info!\n"); | |
230 DVDClose( dvd ); | |
231 return NULL; | |
232 } | |
233 tt_srpt = vmg_file->tt_srpt; | |
234 /** | |
235 * Make sure our title number is valid. | |
236 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
237 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumTitles, |
1596 | 238 tt_srpt->nr_of_srpts ); |
239 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
|
240 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidTitle, dvd_title); |
1596 | 241 ifoClose( vmg_file ); |
242 DVDClose( dvd ); | |
243 return NULL; | |
244 } | |
245 --dvd_title; // remap 1.. -> 0.. | |
246 /** | |
247 * Make sure the chapter number is valid for this title. | |
248 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
249 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumChapters, |
1596 | 250 tt_srpt->title[dvd_title].nr_of_ptts ); |
251 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
|
252 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidChapter, dvd_chapter); |
1596 | 253 ifoClose( vmg_file ); |
254 DVDClose( dvd ); | |
255 return NULL; | |
256 } | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
257 if( dvd_last_chapter>0 ) { |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
258 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
|
259 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
|
260 ifoClose( vmg_file ); |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
261 DVDClose( dvd ); |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
262 return NULL; |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
263 } |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
264 } |
1596 | 265 --dvd_chapter; // remap 1.. -> 0.. |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
266 /* XXX No need to remap dvd_last_chapter */ |
1596 | 267 /** |
268 * Make sure the angle number is valid for this title. | |
269 */ | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
270 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDnumAngles, |
1596 | 271 tt_srpt->title[dvd_title].nr_of_angles ); |
272 if( dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles ) { | |
1977 | 273 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle); |
1596 | 274 ifoClose( vmg_file ); |
275 DVDClose( dvd ); | |
276 return NULL; | |
277 } | |
1617 | 278 --dvd_angle; // remap 1.. -> 0.. |
1596 | 279 /** |
280 * Load the VTS information for the title set our title is in. | |
281 */ | |
282 vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr ); | |
283 if( !vts_file ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
284 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoIFO, |
1596 | 285 tt_srpt->title[dvd_title].title_set_nr ); |
286 ifoClose( vmg_file ); | |
287 DVDClose( dvd ); | |
288 return NULL; | |
289 } | |
290 /** | |
291 * We've got enough info, time to open the title set data. | |
292 */ | |
293 title = DVDOpenFile( dvd, tt_srpt->title[dvd_title].title_set_nr, | |
294 DVD_READ_TITLE_VOBS ); | |
295 if( !title ) { | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
296 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDnoVOBs, |
1596 | 297 tt_srpt->title[dvd_title].title_set_nr ); |
298 ifoClose( vts_file ); | |
299 ifoClose( vmg_file ); | |
300 DVDClose( dvd ); | |
301 return NULL; | |
302 } | |
303 | |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1899
diff
changeset
|
304 mp_msg(MSGT_OPEN,MSGL_INFO, MSGTR_DVDopenOk); |
1596 | 305 // store data |
306 d=malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t)); | |
307 d->dvd=dvd; | |
308 d->title=title; | |
309 d->vmg_file=vmg_file; | |
310 d->tt_srpt=tt_srpt; | |
311 d->vts_file=vts_file; | |
312 | |
313 /** | |
2935 | 314 * Check number of audio channels and types |
315 */ | |
316 { | |
317 int ac3aid = 128; | |
318 int mpegaid = 0; | |
319 int pcmaid = 160; | |
320 | |
321 d->nr_of_channels=0; | |
322 | |
323 if ( vts_file->vts_pgcit ) | |
324 { | |
325 int i; | |
326 for ( i=0;i<8;i++ ) | |
327 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000 ) | |
328 { | |
329 audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i]; | |
330 int language = 0; | |
331 char tmp[] = "unknown"; | |
332 | |
333 if ( audio->lang_type == 1 ) | |
334 { | |
335 language=audio->lang_code; | |
336 tmp[0]=language>>8; | |
337 tmp[1]=language&0xff; | |
338 tmp[2]=0; | |
339 } | |
340 | |
341 d->audio_streams[d->nr_of_channels].language=language; | |
342 d->audio_streams[d->nr_of_channels].id=0; | |
343 switch ( audio->audio_format ) | |
344 { | |
345 case 0: // ac3 | |
10482
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
346 d->audio_streams[d->nr_of_channels].id=ac3aid; |
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
347 ac3aid++; |
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
348 break; |
2935 | 349 case 6: // dts |
10482
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
350 d->audio_streams[d->nr_of_channels].id=ac3aid+8; |
2935 | 351 ac3aid++; |
352 break; | |
353 case 2: // mpeg layer 1/2/3 | |
354 case 3: // mpeg2 ext | |
355 d->audio_streams[d->nr_of_channels].id=mpegaid; | |
356 mpegaid++; | |
357 break; | |
358 case 4: // lpcm | |
359 d->audio_streams[d->nr_of_channels].id=pcmaid; | |
360 pcmaid++; | |
361 break; | |
362 } | |
363 | |
6651 | 364 d->audio_streams[d->nr_of_channels].type=audio->audio_format; |
365 // Pontscho: to my mind, tha channels: | |
366 // 1 - stereo | |
367 // 5 - 5.1 | |
368 d->audio_streams[d->nr_of_channels].channels=audio->channels; | |
369 mp_msg(MSGT_OPEN,MSGL_V,"[open] audio stream: %d audio format: %s (%s) language: %s aid: %d\n", | |
2935 | 370 d->nr_of_channels, |
371 dvd_audio_stream_types[ audio->audio_format ], | |
6651 | 372 dvd_audio_stream_channels[ audio->channels ], |
2935 | 373 tmp, |
374 d->audio_streams[d->nr_of_channels].id | |
375 ); | |
3753 | 376 |
2935 | 377 d->nr_of_channels++; |
378 } | |
379 } | |
3048 | 380 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of audio channels on disk: %d.\n",d->nr_of_channels ); |
381 } | |
382 | |
383 /** | |
384 * Check number of subtitles and language | |
385 */ | |
386 { | |
387 int i; | |
388 | |
389 d->nr_of_subtitles=0; | |
390 for ( i=0;i<32;i++ ) | |
391 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->subp_control[i] & 0x80000000 ) | |
392 { | |
393 subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i]; | |
394 int language = 0; | |
395 char tmp[] = "unknown"; | |
396 | |
397 if ( subtitle->type == 1 ) | |
398 { | |
399 language=subtitle->lang_code; | |
400 tmp[0]=language>>8; | |
401 tmp[1]=language&0xff; | |
402 tmp[2]=0; | |
403 } | |
404 | |
405 d->subtitles[ d->nr_of_subtitles ].language=language; | |
406 d->subtitles[ d->nr_of_subtitles ].id=d->nr_of_subtitles; | |
407 | |
408 mp_msg(MSGT_OPEN,MSGL_V,"[open] subtitle ( sid ): %d language: %s\n", | |
409 d->nr_of_subtitles, | |
410 tmp | |
411 ); | |
412 d->nr_of_subtitles++; | |
413 } | |
414 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of subtitles on disk: %d\n",d->nr_of_subtitles ); | |
2935 | 415 } |
416 | |
417 /** | |
1596 | 418 * Determine which program chain we want to watch. This is based on the |
419 * chapter number. | |
420 */ | |
421 ttn = tt_srpt->title[ dvd_title ].vts_ttn; // local | |
422 pgc_id = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgcn; // local | |
423 pgn = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgn; // local | |
424 d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; | |
425 d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here | |
426 d->packs_left=-1; // for Navi stuff | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
427 d->angle_seek=0; |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
428 /* 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
|
429 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
|
430 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
|
431 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
|
432 } |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
433 else |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
434 d->last_cell=d->cur_pgc->nr_of_cells; |
1596 | 435 |
6651 | 436 if( d->cur_pgc->cell_playback[d->cur_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; |
1596 | 437 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; |
438 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
439 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); | |
440 | |
441 // ... (unimplemented) | |
442 // return NULL; | |
443 stream=new_stream(-1,STREAMTYPE_DVD); | |
444 stream->start_pos=(off_t)d->cur_pack*2048; | |
4390 | 445 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
|
446 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 | 447 stream->priv=(void*)d; |
448 return stream; | |
449 } | |
450 #endif | |
451 | |
9610 | 452 |
10121
d42177a0da2a
Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents:
10067
diff
changeset
|
453 #ifdef MPLAYER_NETWORK |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
454 #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
|
455 // 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
|
456 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
|
457 filename += 6; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
458 #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
|
459 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
|
460 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
461 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
|
462 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
463 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
|
464 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
465 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
|
466 if (len == -1) |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
467 return NULL; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
468 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
469 #ifdef _LARGEFILE_SOURCE |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
470 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
|
471 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
472 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
|
473 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
474 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
|
475 } |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
476 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
477 |
10697
f0cddd635519
added a workaround to get rid of 'Unable to open URL: mf://*.jpg' and such nonsense (tv,mf,vcd)
alex
parents:
10601
diff
changeset
|
478 // FIXME: to avoid nonsense error messages... |
f0cddd635519
added a workaround to get rid of 'Unable to open URL: mf://*.jpg' and such nonsense (tv,mf,vcd)
alex
parents:
10601
diff
changeset
|
479 if (strncmp("tv://", filename, 5) && strncmp("mf://", filename, 5) && |
10735
8a10d5d0ce86
serious bugs - 1l absinth (changed to absinth against cola inflation)
alex
parents:
10697
diff
changeset
|
480 strncmp("vcd://", filename, 6) && strncmp("dvb://", filename, 6) && |
10807
fb66c426cd91
cdda && cddb aren't uris too (hopefully all the pseudo urls are catched before url_new())
alex
parents:
10735
diff
changeset
|
481 strncmp("cdda://", filename, 7) && strncmp("cddb://", filename, 7) && |
10735
8a10d5d0ce86
serious bugs - 1l absinth (changed to absinth against cola inflation)
alex
parents:
10697
diff
changeset
|
482 strstr(filename, "://")) |
10697
f0cddd635519
added a workaround to get rid of 'Unable to open URL: mf://*.jpg' and such nonsense (tv,mf,vcd)
alex
parents:
10601
diff
changeset
|
483 url = url_new(filename); |
1467 | 484 if(url) { |
7630
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
485 if (strcmp(url->protocol, "smb")==0){ |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
486 #ifdef LIBSMBCLIENT |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
487 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
488 // we need init of libsmbclient |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
489 int err; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
490 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
491 // 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
|
492 // 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
|
493 // i cannot thing other way... |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
494 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
|
495 // libsmbclient using |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
496 if (err < 0) { |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
497 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
|
498 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
499 } |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
500 f=smbc_open(filename, O_RDONLY, 0666); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
501 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
502 // cannot open the file, outputs that |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
503 // MSGTR_FileNotFound -> MSGTR_SMBFileNotFound |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
504 if(f<0){ |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
505 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
|
506 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
507 } |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
508 len=smbc_lseek(f,0,SEEK_END); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
509 smbc_lseek(f,0,SEEK_SET); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
510 // 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
|
511 // if (len == -1) |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
512 // 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
|
513 url_free(url); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
514 stream=new_stream(f,STREAMTYPE_SMB); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
515 stream->end_pos=len; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
516 return stream; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
517 #else |
10735
8a10d5d0ce86
serious bugs - 1l absinth (changed to absinth against cola inflation)
alex
parents:
10697
diff
changeset
|
518 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_SMBNotCompiled); |
7630
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
519 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
520 #endif |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
521 } |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
522 stream=new_stream(f,STREAMTYPE_STREAM); |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4551
diff
changeset
|
523 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
|
524 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename); |
9795 | 525 //url_free(url); |
526 //return NULL; | |
527 } else { | |
1584 | 528 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
|
529 url_free(url); |
2315 | 530 return stream; |
1467 | 531 } |
9795 | 532 } |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
533 #endif |
1467 | 534 |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
535 //============ 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
|
536 |
9795 | 537 return open_stream_full(filename,STREAM_READ,options,file_format); |
1467 | 538 } |
1596 | 539 |
10594
57bdcdb061d7
Removed the historic cfgparser and switched full to the new config parser (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies.
alex
parents:
10560
diff
changeset
|
540 int dvd_parse_chapter_range(m_option_t *conf, const char *range){ |
7472
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7432
diff
changeset
|
541 const char *s; |
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7432
diff
changeset
|
542 char *t; |
10601
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
543 if (!range) |
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
544 return M_OPT_MISSING_PARAM; |
4344 | 545 s = range; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
546 dvd_chapter = 1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
547 dvd_last_chapter = 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
548 if (*range && isdigit(*range)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
549 dvd_chapter = strtol(range, &s, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
550 if (range == s) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
551 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
10601
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
552 return M_OPT_INVALID; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
553 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
554 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
555 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
556 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
557 else if (*s != '-') { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
558 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
10601
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
559 return M_OPT_INVALID; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
560 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
561 ++s; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
562 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
563 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
564 if (! isdigit(*s)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
565 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
10601
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
566 return M_OPT_INVALID; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
567 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
568 dvd_last_chapter = strtol(s, &t, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
569 if (s == t || *t) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
570 mp_msg(MSGT_OPEN, MSGL_ERR, "Invalid chapter range specification %s\n", range); |
10601
57b5e42f6a35
Fixed segfault with (dvd://1 -chapter). Bug reported by Gabucino, initial fix by Pierre.
alex
parents:
10594
diff
changeset
|
571 return M_OPT_INVALID; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
572 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
573 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
574 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
575 |
3753 | 576 #ifdef USE_DVDREAD |
7854 | 577 int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) |
578 { | |
579 pgc_t * cur_pgc; | |
580 ptt_info_t* ptt; | |
581 int chapter = cell; | |
582 int pgc_id,pgn; | |
583 if(title < 0 || cell < 0){ | |
584 return 0; | |
585 } | |
586 /* for most DVD's chapter == cell */ | |
587 /* but there are more complecated cases... */ | |
588 if(chapter >= dvd->vmg_file->tt_srpt->title[title].nr_of_ptts){ | |
589 chapter = dvd->vmg_file->tt_srpt->title[title].nr_of_ptts-1; | |
590 } | |
591 title = dvd->tt_srpt->title[title].vts_ttn-1; | |
592 ptt = dvd->vts_file->vts_ptt_srpt->title[title].ptt; | |
593 while(chapter >= 0){ | |
594 pgc_id = ptt[chapter].pgcn; | |
595 pgn = ptt[chapter].pgn; | |
596 cur_pgc = dvd->vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; | |
597 if(cell >= cur_pgc->program_map[pgn-1]-1){ | |
598 return chapter; | |
599 } | |
600 --chapter; | |
601 } | |
602 /* didn't find a chapter ??? */ | |
603 return chapter; | |
604 } | |
1596 | 605 |
3753 | 606 int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){ |
607 dvd_priv_t *d=stream->priv; | |
608 int code,i; | |
10550
7860a71ba82c
For a request by Gabu, i've cut & fix a part of Joey's dvd aid switching
gabucino
parents:
10482
diff
changeset
|
609 if(lang){ |
7860a71ba82c
For a request by Gabu, i've cut & fix a part of Joey's dvd aid switching
gabucino
parents:
10482
diff
changeset
|
610 while(strlen(lang)>=2){ |
3753 | 611 code=lang[1]|(lang[0]<<8); |
612 for(i=0;i<d->nr_of_channels;i++){ | |
613 if(d->audio_streams[i].language==code){ | |
614 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n", | |
615 d->audio_streams[i].id, lang[0],lang[1]); | |
616 return d->audio_streams[i].id; | |
617 } | |
618 // printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]); | |
619 } | |
620 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
621 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
622 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n"); |
10550
7860a71ba82c
For a request by Gabu, i've cut & fix a part of Joey's dvd aid switching
gabucino
parents:
10482
diff
changeset
|
623 } |
7860a71ba82c
For a request by Gabu, i've cut & fix a part of Joey's dvd aid switching
gabucino
parents:
10482
diff
changeset
|
624 return d->nr_of_channels ? d->audio_streams[0].id : -1; |
3753 | 625 } |
626 | |
627 int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){ | |
628 dvd_priv_t *d=stream->priv; | |
629 int code,i; | |
630 while(lang && strlen(lang)>=2){ | |
631 code=lang[1]|(lang[0]<<8); | |
632 for(i=0;i<d->nr_of_subtitles;i++){ | |
633 if(d->subtitles[i].language==code){ | |
634 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", | |
635 d->subtitles[i].id, lang[0],lang[1]); | |
636 return d->subtitles[i].id; | |
637 } | |
638 } | |
639 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
640 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
641 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n"); |
3753 | 642 return -1; |
643 } | |
1596 | 644 |
645 static int dvd_next_cell(dvd_priv_t *d){ | |
646 int next_cell=d->cur_cell; | |
1616 | 647 |
648 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next1=0x%X \n",next_cell); | |
1596 | 649 |
650 if( d->cur_pgc->cell_playback[ next_cell ].block_type | |
651 == BLOCK_TYPE_ANGLE_BLOCK ) { | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
652 while(next_cell<d->last_cell){ |
1596 | 653 if( d->cur_pgc->cell_playback[next_cell].block_mode |
654 == BLOCK_MODE_LAST_CELL ) break; | |
655 ++next_cell; | |
656 } | |
657 } | |
1616 | 658 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell); |
1596 | 659 |
660 ++next_cell; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
661 if(next_cell>=d->last_cell) return -1; // EOF |
1596 | 662 if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){ |
663 next_cell+=dvd_angle; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
664 if(next_cell>=d->last_cell) return -1; // EOF |
1596 | 665 } |
1616 | 666 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell); |
1596 | 667 return next_cell; |
668 } | |
669 | |
670 int dvd_read_sector(dvd_priv_t *d,unsigned char* data){ | |
671 int len; | |
672 | |
673 if(d->packs_left==0){ | |
674 /** | |
675 * If we're not at the end of this cell, we can determine the next | |
676 * VOBU to display using the VOBU_SRI information section of the | |
677 * DSI. Using this value correctly follows the current angle, | |
678 * avoiding the doubled scenes in The Matrix, and makes our life | |
679 * really happy. | |
680 * | |
681 * Otherwise, we set our next address past the end of this cell to | |
682 * force the code above to go to the next cell in the program. | |
683 */ | |
684 if( d->dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) { | |
685 d->cur_pack= d->dsi_pack.dsi_gi.nv_pck_lbn + | |
686 ( d->dsi_pack.vobu_sri.next_vobu & 0x7fffffff ); | |
687 mp_msg(MSGT_DVD,MSGL_DBG2, "Navi new pos=0x%X \n",d->cur_pack); | |
688 } else { | |
689 // end of cell! find next cell! | |
690 mp_msg(MSGT_DVD,MSGL_V, "--- END OF CELL !!! ---\n"); | |
691 d->cur_pack=d->cell_last_pack+1; | |
692 } | |
693 } | |
694 | |
695 read_next: | |
696 | |
697 if(d->cur_pack>d->cell_last_pack){ | |
698 // end of cell! | |
699 int next=dvd_next_cell(d); | |
700 if(next>=0){ | |
701 d->cur_cell=next; | |
702 | |
1615 | 703 // if( d->cur_pgc->cell_playback[d->cur_cell].block_type |
704 // == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
1596 | 705 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; |
706 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
707 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); | |
708 | |
709 } else return -1; // EOF | |
710 } | |
711 | |
712 len = DVDReadBlocks( d->title, d->cur_pack, 1, data ); | |
713 if(!len) return -1; //error | |
714 | |
715 if(data[38]==0 && data[39]==0 && data[40]==1 && data[41]==0xBF && | |
716 data[1024]==0 && data[1025]==0 && data[1026]==1 && data[1027]==0xBF){ | |
717 // found a Navi packet!!! | |
1875 | 718 #if LIBDVDREAD_VERSION >= DVDREAD_VERSION(0,9,0) |
719 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]) ); | |
720 #else | |
1596 | 721 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]), sizeof(dsi_t) ); |
1875 | 722 #endif |
1596 | 723 if(d->cur_pack != d->dsi_pack.dsi_gi.nv_pck_lbn ){ |
724 mp_msg(MSGT_DVD,MSGL_V, "Invalid NAVI packet! lba=0x%X navi=0x%X \n", | |
725 d->cur_pack,d->dsi_pack.dsi_gi.nv_pck_lbn); | |
726 } else { | |
727 // process! | |
728 d->packs_left = d->dsi_pack.dsi_gi.vobu_ea; | |
729 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
|
730 //navPrint_DSI(&d->dsi_pack); |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
731 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
|
732 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
|
733 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
|
734 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
|
735 |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
736 if(d->angle_seek){ |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
737 int i,skip=0; |
10067
f9eac474eb74
this is a important patch for hpux 11.00, because it avoid the
diego
parents:
9901
diff
changeset
|
738 #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
|
739 // 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
|
740 // 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
|
741 // 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
|
742 // signal. |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
743 // |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
744 // 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
|
745 // 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
|
746 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
|
747 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
|
748 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
|
749 if((skip=tmp_addr)!=0) break; |
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 #else |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
752 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
|
753 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
|
754 #endif |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
755 if(skip){ |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
756 // 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
|
757 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
|
758 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
|
759 d->angle_seek=0; |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
760 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
|
761 } else { |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
762 // 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
|
763 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
|
764 (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
|
765 d->angle_seek=0; |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
766 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
|
767 } else { |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
768 // wrong angle, skip this vobu: |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
769 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
|
770 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
|
771 d->angle_seek=2; // DEBUG |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
772 } |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
773 } |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
774 } |
1596 | 775 } |
776 ++d->cur_pack; | |
777 goto read_next; | |
778 } | |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
779 |
1596 | 780 ++d->cur_pack; |
781 if(d->packs_left>=0) --d->packs_left; | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
782 |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
783 if(d->angle_seek){ |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
784 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
|
785 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
|
786 } |
1596 | 787 |
788 return d->cur_pack-1; | |
789 } | |
790 | |
791 void dvd_seek(dvd_priv_t *d,int pos){ | |
792 d->packs_left=-1; | |
793 d->cur_pack=pos; | |
794 | |
795 // 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
|
796 if(d->cur_pack>d->cell_last_pack || |
1596 | 797 d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ |
798 | |
799 // ok, cell change, find the right cell! | |
800 d->cur_cell=0; | |
801 if( d->cur_pgc->cell_playback[d->cur_cell].block_type | |
802 == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
803 | |
804 while(1){ | |
805 int next; | |
806 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
807 if(d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ | |
808 d->cur_pack=d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; | |
809 break; | |
810 } | |
811 if(d->cur_pack<=d->cell_last_pack) break; // ok, we find it! :) | |
812 next=dvd_next_cell(d); | |
813 if(next<0){ | |
814 // d->cur_pack=d->cell_last_pack+1; | |
815 break; // we're after the last cell | |
816 } | |
817 d->cur_cell=next; | |
818 } | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
819 |
1596 | 820 } |
821 | |
822 mp_msg(MSGT_DVD,MSGL_V, "DVD Seek! lba=0x%X cell=%d packs: 0x%X-0x%X \n", | |
823 d->cur_pack,d->cur_cell,d->cur_pgc->cell_playback[ d->cur_cell ].first_sector,d->cell_last_pack); | |
824 | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
825 // if we're in interleaved multi-angle cell, find the right angle chain! |
1596 | 826 // (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
|
827 d->angle_seek=1; |
1596 | 828 |
829 } | |
830 | |
6479 | 831 void dvd_close(dvd_priv_t *d) { |
832 ifoClose(d->vts_file); | |
833 ifoClose(d->vmg_file); | |
834 DVDCloseFile(d->title); | |
835 DVDClose(d->dvd); | |
9712 | 836 dvd_chapter = 1; |
837 dvd_last_chapter = 0; | |
6479 | 838 } |
839 | |
1596 | 840 #endif |