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