Mercurial > mplayer.hg
annotate libmpdemux/open.c @ 10543:4e9418dc7c28
some updates (all shown by help_diff.sh)...
author | jonas |
---|---|
date | Fri, 08 Aug 2003 22:56:32 +0000 |
parents | 3a88897db327 |
children | 7860a71ba82c |
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 | |
9712 | 18 #include "../m_config.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 | |
9610 | 33 int dvbin_param_on=0; |
34 | |
9746 | 35 /// We keep these 2 for the gui atm, but they will be removed. |
1596 | 36 int dvd_title=0; |
9746 | 37 int vcd_track=0; |
38 | |
1596 | 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 | 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 | 45 #ifdef USE_DVDNAV |
5472 | 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 | 48 |
49 #ifdef USE_DVDREAD | |
50 | |
1875 | 51 #define DVDREAD_VERSION(maj,min,micro) ((maj)*10000 + (min)*100 + (micro)) |
52 | |
53 /* | |
54 * Try to autodetect the libdvd-0.9.0 library | |
55 * (0.9.0 removed the <dvdread/dvd_udf.h> header, and moved the two defines | |
56 * DVD_VIDEO_LB_LEN and MAX_UDF_FILE_NAME_LEN from it to | |
57 * <dvdread/dvd_reader.h>) | |
58 */ | |
59 #if defined(DVD_VIDEO_LB_LEN) && defined(MAX_UDF_FILE_NAME_LEN) | |
60 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,9,0) | |
61 #else | |
62 #define LIBDVDREAD_VERSION DVDREAD_VERSION(0,8,0) | |
63 #endif | |
64 | |
2935 | 65 char * dvd_audio_stream_types[8] = |
66 { "ac3","unknown","mpeg1","mpeg2ext","lpcm","unknown","dts" }; | |
1596 | 67 |
6651 | 68 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
|
69 { "mono", "stereo", "unknown", "unknown", "5.1/6.1", "5.1" }; |
1596 | 70 #endif |
71 | |
8812 | 72 #include "cue_read.h" |
1467 | 73 |
9610 | 74 #ifdef HAS_DVBIN_SUPPORT |
75 #include "dvbin.h" | |
76 #endif | |
77 | |
78 | |
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 | 118 // Open a new stream (stdin/file/vcd/url) |
119 | |
9795 | 120 stream_t* open_stream(char* filename,char** options, int* file_format){ |
1467 | 121 stream_t* stream=NULL; |
122 int f=-1; | |
123 off_t len; | |
9746 | 124 *file_format = DEMUXER_TYPE_UNKNOWN; |
125 if(!filename) { | |
126 mp_msg(MSGT_OPEN,MSGL_ERR,"NULL filename, report this bug\n"); | |
127 return NULL; | |
128 } | |
1467 | 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 | 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 | 133 char* p = filename + 6; |
134 vcd_track = 1; | |
135 p = strchr(p,':'); | |
136 if(p && p[1] != '\0') { | |
137 vcd_track = strtol(p+1,NULL,0); | |
138 if(vcd_track < 1){ | |
139 mp_msg(MSGT_OPEN,MSGL_ERR,"Invalid cue track %s\n",p+1); | |
140 return NULL; | |
141 } | |
142 p[0] = '\0'; | |
143 } | |
144 f = cue_read_cue (filename + 6); | |
145 if(p && p[1] != '\0') p[0] = ':'; | |
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 | 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 | 162 if(strncmp("dvdnav://",filename,9) == 0){ |
5472 | 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 | 165 char* name = (filename[9] == '\0') ? NULL : filename + 9; |
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 | 172 |
9746 | 173 if(!name) name=DEFAULT_DVD_DEVICE; |
174 if (!(dvdnav_priv=new_dvdnav_stream(name))) { | |
175 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_CantOpenDVD,name); | |
5472 | 176 return NULL; |
177 } | |
178 | |
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 | 183 #ifdef USE_DVDREAD |
9746 | 184 if(strncmp("dvd://",filename,6) == 0){ |
2050 | 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 | 187 int ttn,pgc_id,pgn; |
188 dvd_reader_t *dvd; | |
189 dvd_file_t *title; | |
190 ifo_handle_t *vmg_file; | |
191 tt_srpt_t *tt_srpt; | |
192 ifo_handle_t *vts_file; | |
9746 | 193 dvd_title = filename[6] == '\0' ? 1 : strtol(filename + 6,NULL,0); |
1596 | 194 /** |
195 * Open the disc. | |
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 | 225 } |
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 | 228 |
229 /** | |
230 * Load the video manager to find out the information about the titles on | |
231 * this disc. | |
232 */ | |
233 vmg_file = ifoOpen( dvd, 0 ); | |
234 if( !vmg_file ) { | |
235 mp_msg(MSGT_OPEN,MSGL_ERR, "Can't open VMG info!\n"); | |
236 DVDClose( dvd ); | |
237 return NULL; | |
238 } | |
239 tt_srpt = vmg_file->tt_srpt; | |
240 /** | |
241 * Make sure our title number is valid. | |
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 | 244 tt_srpt->nr_of_srpts ); |
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 | 247 ifoClose( vmg_file ); |
248 DVDClose( dvd ); | |
249 return NULL; | |
250 } | |
251 --dvd_title; // remap 1.. -> 0.. | |
252 /** | |
253 * Make sure the chapter number is valid for this title. | |
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 | 256 tt_srpt->title[dvd_title].nr_of_ptts ); |
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 | 259 ifoClose( vmg_file ); |
260 DVDClose( dvd ); | |
261 return NULL; | |
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 | 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 | 273 /** |
274 * Make sure the angle number is valid for this title. | |
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 | 277 tt_srpt->title[dvd_title].nr_of_angles ); |
278 if( dvd_angle<1 || dvd_angle>tt_srpt->title[dvd_title].nr_of_angles ) { | |
1977 | 279 mp_msg(MSGT_OPEN,MSGL_ERR, MSGTR_DVDinvalidAngle, dvd_angle); |
1596 | 280 ifoClose( vmg_file ); |
281 DVDClose( dvd ); | |
282 return NULL; | |
283 } | |
1617 | 284 --dvd_angle; // remap 1.. -> 0.. |
1596 | 285 /** |
286 * Load the VTS information for the title set our title is in. | |
287 */ | |
288 vts_file = ifoOpen( dvd, tt_srpt->title[dvd_title].title_set_nr ); | |
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 | 291 tt_srpt->title[dvd_title].title_set_nr ); |
292 ifoClose( vmg_file ); | |
293 DVDClose( dvd ); | |
294 return NULL; | |
295 } | |
296 /** | |
297 * We've got enough info, time to open the title set data. | |
298 */ | |
299 title = DVDOpenFile( dvd, tt_srpt->title[dvd_title].title_set_nr, | |
300 DVD_READ_TITLE_VOBS ); | |
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 | 303 tt_srpt->title[dvd_title].title_set_nr ); |
304 ifoClose( vts_file ); | |
305 ifoClose( vmg_file ); | |
306 DVDClose( dvd ); | |
307 return NULL; | |
308 } | |
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 | 311 // store data |
312 d=malloc(sizeof(dvd_priv_t)); memset(d,0,sizeof(dvd_priv_t)); | |
313 d->dvd=dvd; | |
314 d->title=title; | |
315 d->vmg_file=vmg_file; | |
316 d->tt_srpt=tt_srpt; | |
317 d->vts_file=vts_file; | |
318 | |
319 /** | |
2935 | 320 * Check number of audio channels and types |
321 */ | |
322 { | |
323 int ac3aid = 128; | |
324 int mpegaid = 0; | |
325 int pcmaid = 160; | |
326 | |
327 d->nr_of_channels=0; | |
328 | |
329 if ( vts_file->vts_pgcit ) | |
330 { | |
331 int i; | |
332 for ( i=0;i<8;i++ ) | |
333 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->audio_control[i] & 0x8000 ) | |
334 { | |
335 audio_attr_t * audio = &vts_file->vtsi_mat->vts_audio_attr[i]; | |
336 int language = 0; | |
337 char tmp[] = "unknown"; | |
338 | |
339 if ( audio->lang_type == 1 ) | |
340 { | |
341 language=audio->lang_code; | |
342 tmp[0]=language>>8; | |
343 tmp[1]=language&0xff; | |
344 tmp[2]=0; | |
345 } | |
346 | |
347 d->audio_streams[d->nr_of_channels].language=language; | |
348 d->audio_streams[d->nr_of_channels].id=0; | |
349 switch ( audio->audio_format ) | |
350 { | |
351 case 0: // ac3 | |
10482
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
352 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
|
353 ac3aid++; |
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
354 break; |
2935 | 355 case 6: // dts |
10482
3a88897db327
dts aid fix by f.stock@t-online.de (Florian-Wolfgang Stock)
alex
parents:
10315
diff
changeset
|
356 d->audio_streams[d->nr_of_channels].id=ac3aid+8; |
2935 | 357 ac3aid++; |
358 break; | |
359 case 2: // mpeg layer 1/2/3 | |
360 case 3: // mpeg2 ext | |
361 d->audio_streams[d->nr_of_channels].id=mpegaid; | |
362 mpegaid++; | |
363 break; | |
364 case 4: // lpcm | |
365 d->audio_streams[d->nr_of_channels].id=pcmaid; | |
366 pcmaid++; | |
367 break; | |
368 } | |
369 | |
6651 | 370 d->audio_streams[d->nr_of_channels].type=audio->audio_format; |
371 // Pontscho: to my mind, tha channels: | |
372 // 1 - stereo | |
373 // 5 - 5.1 | |
374 d->audio_streams[d->nr_of_channels].channels=audio->channels; | |
375 mp_msg(MSGT_OPEN,MSGL_V,"[open] audio stream: %d audio format: %s (%s) language: %s aid: %d\n", | |
2935 | 376 d->nr_of_channels, |
377 dvd_audio_stream_types[ audio->audio_format ], | |
6651 | 378 dvd_audio_stream_channels[ audio->channels ], |
2935 | 379 tmp, |
380 d->audio_streams[d->nr_of_channels].id | |
381 ); | |
3753 | 382 |
2935 | 383 d->nr_of_channels++; |
384 } | |
385 } | |
3048 | 386 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of audio channels on disk: %d.\n",d->nr_of_channels ); |
387 } | |
388 | |
389 /** | |
390 * Check number of subtitles and language | |
391 */ | |
392 { | |
393 int i; | |
394 | |
395 d->nr_of_subtitles=0; | |
396 for ( i=0;i<32;i++ ) | |
397 if ( vts_file->vts_pgcit->pgci_srp[0].pgc->subp_control[i] & 0x80000000 ) | |
398 { | |
399 subp_attr_t * subtitle = &vts_file->vtsi_mat->vts_subp_attr[i]; | |
400 int language = 0; | |
401 char tmp[] = "unknown"; | |
402 | |
403 if ( subtitle->type == 1 ) | |
404 { | |
405 language=subtitle->lang_code; | |
406 tmp[0]=language>>8; | |
407 tmp[1]=language&0xff; | |
408 tmp[2]=0; | |
409 } | |
410 | |
411 d->subtitles[ d->nr_of_subtitles ].language=language; | |
412 d->subtitles[ d->nr_of_subtitles ].id=d->nr_of_subtitles; | |
413 | |
414 mp_msg(MSGT_OPEN,MSGL_V,"[open] subtitle ( sid ): %d language: %s\n", | |
415 d->nr_of_subtitles, | |
416 tmp | |
417 ); | |
418 d->nr_of_subtitles++; | |
419 } | |
420 mp_msg(MSGT_OPEN,MSGL_V,"[open] number of subtitles on disk: %d\n",d->nr_of_subtitles ); | |
2935 | 421 } |
422 | |
423 /** | |
1596 | 424 * Determine which program chain we want to watch. This is based on the |
425 * chapter number. | |
426 */ | |
427 ttn = tt_srpt->title[ dvd_title ].vts_ttn; // local | |
428 pgc_id = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgcn; // local | |
429 pgn = vts_file->vts_ptt_srpt->title[ttn-1].ptt[dvd_chapter].pgn; // local | |
430 d->cur_pgc = vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; | |
431 d->cur_cell = d->cur_pgc->program_map[pgn-1] - 1; // start playback here | |
432 d->packs_left=-1; // for Navi stuff | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
433 d->angle_seek=0; |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
434 /* 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
|
435 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
|
436 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
|
437 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
|
438 } |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
439 else |
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
440 d->last_cell=d->cur_pgc->nr_of_cells; |
1596 | 441 |
6651 | 442 if( d->cur_pgc->cell_playback[d->cur_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; |
1596 | 443 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; |
444 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
445 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); | |
446 | |
447 // ... (unimplemented) | |
448 // return NULL; | |
449 stream=new_stream(-1,STREAMTYPE_DVD); | |
450 stream->start_pos=(off_t)d->cur_pack*2048; | |
4390 | 451 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
|
452 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 | 453 stream->priv=(void*)d; |
454 return stream; | |
455 } | |
456 #endif | |
457 | |
9610 | 458 #ifdef HAS_DVBIN_SUPPORT |
9746 | 459 if(strncmp("dvbin://",filename,8) == 0) |
9610 | 460 { |
461 stream = new_stream(-1, STREAMTYPE_DVB); | |
462 if (!stream) | |
463 return(NULL); | |
464 if (!dvb_streaming_start(stream)) | |
465 return NULL; | |
466 | |
467 return stream; | |
468 } | |
469 #endif | |
470 | |
10121
d42177a0da2a
Changed the STREAMING defines to MPLAYER_NETWORK to avoid name definition clash.
bertrand
parents:
10067
diff
changeset
|
471 #ifdef MPLAYER_NETWORK |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
472 #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
|
473 // 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
|
474 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
|
475 filename += 6; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
476 #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
|
477 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
|
478 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
479 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
|
480 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
481 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
|
482 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
483 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
|
484 if (len == -1) |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
485 return NULL; |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
486 |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
487 #ifdef _LARGEFILE_SOURCE |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
488 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
|
489 #else |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
490 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
|
491 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
492 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
|
493 } |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
494 #endif |
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
495 |
1467 | 496 url = url_new(filename); |
497 if(url) { | |
7630
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
498 if (strcmp(url->protocol, "smb")==0){ |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
499 #ifdef LIBSMBCLIENT |
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 // we need init of libsmbclient |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
502 int err; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
503 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
504 // 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
|
505 // 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
|
506 // i cannot thing other way... |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
507 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
|
508 // libsmbclient using |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
509 if (err < 0) { |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
510 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
|
511 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
512 } |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
513 f=smbc_open(filename, O_RDONLY, 0666); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
514 |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
515 // cannot open the file, outputs that |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
516 // MSGTR_FileNotFound -> MSGTR_SMBFileNotFound |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
517 if(f<0){ |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
518 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
|
519 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
520 } |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
521 len=smbc_lseek(f,0,SEEK_END); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
522 smbc_lseek(f,0,SEEK_SET); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
523 // 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
|
524 // if (len == -1) |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
525 // 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
|
526 url_free(url); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
527 stream=new_stream(f,STREAMTYPE_SMB); |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
528 stream->end_pos=len; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
529 return stream; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
530 #else |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
531 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
|
532 return NULL; |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
533 #endif |
4c51ce16c4a2
smb:// (samba client) support by Vladimir Moushkov <vlindos_mpdev@abv.bg>
arpi
parents:
7559
diff
changeset
|
534 } |
4251
05affdf4bdcd
Moved network related code from open.c to network.c
bertrand
parents:
4222
diff
changeset
|
535 stream=new_stream(f,STREAMTYPE_STREAM); |
4729
f51bd827ed1c
fixed MP3 ICY detection, return detected file format for open_stream
alex
parents:
4551
diff
changeset
|
536 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
|
537 mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_UnableOpenURL, filename); |
9795 | 538 //url_free(url); |
539 //return NULL; | |
540 } else { | |
1584 | 541 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
|
542 url_free(url); |
2315 | 543 return stream; |
1467 | 544 } |
9795 | 545 } |
9878
95727467a091
Moved the "sdp://" test above the URL streaming test, so that SDP files can
rsf
parents:
9801
diff
changeset
|
546 #endif |
1467 | 547 |
6320
12136df07dbd
common code to handle file/stdin/fifo opening, allows using named pipes and
arpi
parents:
5932
diff
changeset
|
548 //============ 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
|
549 |
9795 | 550 return open_stream_full(filename,STREAM_READ,options,file_format); |
1467 | 551 } |
1596 | 552 |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
553 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
|
554 const char *s; |
c4434bdf6e51
tons of warning fixes, also some 10l bugfixes, including Dominik's PVA bug
arpi
parents:
7432
diff
changeset
|
555 char *t; |
8123
9fc45fe0d444
*HUGE* set of compiler warning fixes, unused variables removal
arpi
parents:
7854
diff
changeset
|
556 /* conf; prevent warning from GCC */ |
4344 | 557 s = range; |
4343
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
558 dvd_chapter = 1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
559 dvd_last_chapter = 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
560 if (*range && isdigit(*range)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
561 dvd_chapter = strtol(range, &s, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
562 if (range == s) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
563 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
|
564 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
565 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
566 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
567 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
568 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
569 else if (*s != '-') { |
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); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
571 return -1; |
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 ++s; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
574 if (*s == 0) |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
575 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
576 if (! isdigit(*s)) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
577 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
|
578 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
579 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
580 dvd_last_chapter = strtol(s, &t, 10); |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
581 if (s == t || *t) { |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
582 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
|
583 return -1; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
584 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
585 return 0; |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
586 } |
b0c8eed7473c
Extended DVD chapter specification. Remove -last-chapter option.
kmkaplan
parents:
4291
diff
changeset
|
587 |
3753 | 588 #ifdef USE_DVDREAD |
7854 | 589 int dvd_chapter_from_cell(dvd_priv_t* dvd,int title,int cell) |
590 { | |
591 pgc_t * cur_pgc; | |
592 ptt_info_t* ptt; | |
593 int chapter = cell; | |
594 int pgc_id,pgn; | |
595 if(title < 0 || cell < 0){ | |
596 return 0; | |
597 } | |
598 /* for most DVD's chapter == cell */ | |
599 /* but there are more complecated cases... */ | |
600 if(chapter >= dvd->vmg_file->tt_srpt->title[title].nr_of_ptts){ | |
601 chapter = dvd->vmg_file->tt_srpt->title[title].nr_of_ptts-1; | |
602 } | |
603 title = dvd->tt_srpt->title[title].vts_ttn-1; | |
604 ptt = dvd->vts_file->vts_ptt_srpt->title[title].ptt; | |
605 while(chapter >= 0){ | |
606 pgc_id = ptt[chapter].pgcn; | |
607 pgn = ptt[chapter].pgn; | |
608 cur_pgc = dvd->vts_file->vts_pgcit->pgci_srp[pgc_id-1].pgc; | |
609 if(cell >= cur_pgc->program_map[pgn-1]-1){ | |
610 return chapter; | |
611 } | |
612 --chapter; | |
613 } | |
614 /* didn't find a chapter ??? */ | |
615 return chapter; | |
616 } | |
1596 | 617 |
3753 | 618 int dvd_aid_from_lang(stream_t *stream, unsigned char* lang){ |
619 dvd_priv_t *d=stream->priv; | |
620 int code,i; | |
621 while(lang && strlen(lang)>=2){ | |
622 code=lang[1]|(lang[0]<<8); | |
623 for(i=0;i<d->nr_of_channels;i++){ | |
624 if(d->audio_streams[i].language==code){ | |
625 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD audio channel: %d language: %c%c\n", | |
626 d->audio_streams[i].id, lang[0],lang[1]); | |
627 return d->audio_streams[i].id; | |
628 } | |
629 // printf("%X != %X (%c%c)\n",code,d->audio_streams[i].language,lang[0],lang[1]); | |
630 } | |
631 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
632 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
633 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD audio language found!\n"); |
3753 | 634 return -1; |
635 } | |
636 | |
637 int dvd_sid_from_lang(stream_t *stream, unsigned char* lang){ | |
638 dvd_priv_t *d=stream->priv; | |
639 int code,i; | |
640 while(lang && strlen(lang)>=2){ | |
641 code=lang[1]|(lang[0]<<8); | |
642 for(i=0;i<d->nr_of_subtitles;i++){ | |
643 if(d->subtitles[i].language==code){ | |
644 mp_msg(MSGT_OPEN,MSGL_INFO,"Selected DVD subtitle channel: %d language: %c%c\n", | |
645 d->subtitles[i].id, lang[0],lang[1]); | |
646 return d->subtitles[i].id; | |
647 } | |
648 } | |
649 lang+=2; while (lang[0]==',' || lang[0]==' ') ++lang; | |
650 } | |
5932
1ebeebca86f3
printf to mp_msg + warning msg from MSGL_INFO to MSGT_WARN
albeu
parents:
5819
diff
changeset
|
651 mp_msg(MSGT_OPEN,MSGL_WARN,"No matching DVD subtitle language found!\n"); |
3753 | 652 return -1; |
653 } | |
1596 | 654 |
655 static int dvd_next_cell(dvd_priv_t *d){ | |
656 int next_cell=d->cur_cell; | |
1616 | 657 |
658 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next1=0x%X \n",next_cell); | |
1596 | 659 |
660 if( d->cur_pgc->cell_playback[ next_cell ].block_type | |
661 == BLOCK_TYPE_ANGLE_BLOCK ) { | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
662 while(next_cell<d->last_cell){ |
1596 | 663 if( d->cur_pgc->cell_playback[next_cell].block_mode |
664 == BLOCK_MODE_LAST_CELL ) break; | |
665 ++next_cell; | |
666 } | |
667 } | |
1616 | 668 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next2=0x%X \n",next_cell); |
1596 | 669 |
670 ++next_cell; | |
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 | 672 if( d->cur_pgc->cell_playback[next_cell].block_type == BLOCK_TYPE_ANGLE_BLOCK ){ |
673 next_cell+=dvd_angle; | |
4291
e889d37f25b2
Add option -last-chapter for DVD playing/encoding
kmkaplan
parents:
4251
diff
changeset
|
674 if(next_cell>=d->last_cell) return -1; // EOF |
1596 | 675 } |
1616 | 676 mp_msg(MSGT_DVD,MSGL_V, "dvd_next_cell: next3=0x%X \n",next_cell); |
1596 | 677 return next_cell; |
678 } | |
679 | |
680 int dvd_read_sector(dvd_priv_t *d,unsigned char* data){ | |
681 int len; | |
682 | |
683 if(d->packs_left==0){ | |
684 /** | |
685 * If we're not at the end of this cell, we can determine the next | |
686 * VOBU to display using the VOBU_SRI information section of the | |
687 * DSI. Using this value correctly follows the current angle, | |
688 * avoiding the doubled scenes in The Matrix, and makes our life | |
689 * really happy. | |
690 * | |
691 * Otherwise, we set our next address past the end of this cell to | |
692 * force the code above to go to the next cell in the program. | |
693 */ | |
694 if( d->dsi_pack.vobu_sri.next_vobu != SRI_END_OF_CELL ) { | |
695 d->cur_pack= d->dsi_pack.dsi_gi.nv_pck_lbn + | |
696 ( d->dsi_pack.vobu_sri.next_vobu & 0x7fffffff ); | |
697 mp_msg(MSGT_DVD,MSGL_DBG2, "Navi new pos=0x%X \n",d->cur_pack); | |
698 } else { | |
699 // end of cell! find next cell! | |
700 mp_msg(MSGT_DVD,MSGL_V, "--- END OF CELL !!! ---\n"); | |
701 d->cur_pack=d->cell_last_pack+1; | |
702 } | |
703 } | |
704 | |
705 read_next: | |
706 | |
707 if(d->cur_pack>d->cell_last_pack){ | |
708 // end of cell! | |
709 int next=dvd_next_cell(d); | |
710 if(next>=0){ | |
711 d->cur_cell=next; | |
712 | |
1615 | 713 // if( d->cur_pgc->cell_playback[d->cur_cell].block_type |
714 // == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
1596 | 715 d->cur_pack = d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; |
716 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
717 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); | |
718 | |
719 } else return -1; // EOF | |
720 } | |
721 | |
722 len = DVDReadBlocks( d->title, d->cur_pack, 1, data ); | |
723 if(!len) return -1; //error | |
724 | |
725 if(data[38]==0 && data[39]==0 && data[40]==1 && data[41]==0xBF && | |
726 data[1024]==0 && data[1025]==0 && data[1026]==1 && data[1027]==0xBF){ | |
727 // found a Navi packet!!! | |
1875 | 728 #if LIBDVDREAD_VERSION >= DVDREAD_VERSION(0,9,0) |
729 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]) ); | |
730 #else | |
1596 | 731 navRead_DSI( &d->dsi_pack, &(data[ DSI_START_BYTE ]), sizeof(dsi_t) ); |
1875 | 732 #endif |
1596 | 733 if(d->cur_pack != d->dsi_pack.dsi_gi.nv_pck_lbn ){ |
734 mp_msg(MSGT_DVD,MSGL_V, "Invalid NAVI packet! lba=0x%X navi=0x%X \n", | |
735 d->cur_pack,d->dsi_pack.dsi_gi.nv_pck_lbn); | |
736 } else { | |
737 // process! | |
738 d->packs_left = d->dsi_pack.dsi_gi.vobu_ea; | |
739 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
|
740 //navPrint_DSI(&d->dsi_pack); |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
741 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
|
742 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
|
743 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
|
744 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
|
745 |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
746 if(d->angle_seek){ |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
747 int i,skip=0; |
10067
f9eac474eb74
this is a important patch for hpux 11.00, because it avoid the
diego
parents:
9901
diff
changeset
|
748 #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
|
749 // 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
|
750 // 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
|
751 // 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
|
752 // signal. |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
753 // |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
754 // 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
|
755 // 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
|
756 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
|
757 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
|
758 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
|
759 if((skip=tmp_addr)!=0) break; |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
760 } |
f4710b873abd
SPARC gcc generates bad code accessing an unaligned and packed structure member
jkeil
parents:
6910
diff
changeset
|
761 #else |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
762 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
|
763 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
|
764 #endif |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
765 if(skip){ |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
766 // 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
|
767 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
|
768 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
|
769 d->angle_seek=0; |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
770 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
|
771 } else { |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
772 // 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
|
773 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
|
774 (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
|
775 d->angle_seek=0; |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
776 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
|
777 } else { |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
778 // wrong angle, skip this vobu: |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
779 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
|
780 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
|
781 d->angle_seek=2; // DEBUG |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
782 } |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
783 } |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
784 } |
1596 | 785 } |
786 ++d->cur_pack; | |
787 goto read_next; | |
788 } | |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
789 |
1596 | 790 ++d->cur_pack; |
791 if(d->packs_left>=0) --d->packs_left; | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
792 |
6774
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
793 if(d->angle_seek){ |
3bcd52b7b2ae
Workaround for seeking multiangle discs with missing sml_agli[] table, as a
arpi
parents:
6651
diff
changeset
|
794 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
|
795 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
|
796 } |
1596 | 797 |
798 return d->cur_pack-1; | |
799 } | |
800 | |
801 void dvd_seek(dvd_priv_t *d,int pos){ | |
802 d->packs_left=-1; | |
803 d->cur_pack=pos; | |
804 | |
805 // 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
|
806 if(d->cur_pack>d->cell_last_pack || |
1596 | 807 d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ |
808 | |
809 // ok, cell change, find the right cell! | |
810 d->cur_cell=0; | |
811 if( d->cur_pgc->cell_playback[d->cur_cell].block_type | |
812 == BLOCK_TYPE_ANGLE_BLOCK ) d->cur_cell+=dvd_angle; | |
813 | |
814 while(1){ | |
815 int next; | |
816 d->cell_last_pack=d->cur_pgc->cell_playback[ d->cur_cell ].last_sector; | |
817 if(d->cur_pack<d->cur_pgc->cell_playback[ d->cur_cell ].first_sector){ | |
818 d->cur_pack=d->cur_pgc->cell_playback[ d->cur_cell ].first_sector; | |
819 break; | |
820 } | |
821 if(d->cur_pack<=d->cell_last_pack) break; // ok, we find it! :) | |
822 next=dvd_next_cell(d); | |
823 if(next<0){ | |
824 // d->cur_pack=d->cell_last_pack+1; | |
825 break; // we're after the last cell | |
826 } | |
827 d->cur_cell=next; | |
828 } | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
829 |
1596 | 830 } |
831 | |
832 mp_msg(MSGT_DVD,MSGL_V, "DVD Seek! lba=0x%X cell=%d packs: 0x%X-0x%X \n", | |
833 d->cur_pack,d->cur_cell,d->cur_pgc->cell_playback[ d->cur_cell ].first_sector,d->cell_last_pack); | |
834 | |
1609
84199d075839
ugly seeking bug fixed, correct multiangle seek implemented
arpi
parents:
1596
diff
changeset
|
835 // if we're in interleaved multi-angle cell, find the right angle chain! |
1596 | 836 // (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
|
837 d->angle_seek=1; |
1596 | 838 |
839 } | |
840 | |
6479 | 841 void dvd_close(dvd_priv_t *d) { |
842 ifoClose(d->vts_file); | |
843 ifoClose(d->vmg_file); | |
844 DVDCloseFile(d->title); | |
845 DVDClose(d->dvd); | |
9712 | 846 dvd_chapter = 1; |
847 dvd_last_chapter = 0; | |
6479 | 848 } |
849 | |
1596 | 850 #endif |