Mercurial > mplayer.hg
annotate stream/vcd_read.h @ 29570:eb2567b65311
Check setGlWindow return value to fail properly instead of crashing if e.g.
no OpenGL support is available.
author | reimar |
---|---|
date | Tue, 01 Sep 2009 15:20:05 +0000 |
parents | 0f1b5b68af32 |
children | ce0122361a39 |
rev | line source |
---|---|
26029 | 1 #ifndef MPLAYER_VCD_READ_H |
2 #define MPLAYER_VCD_READ_H | |
26012 | 3 |
26184
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
4 #include <stdlib.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
5 #include <string.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
6 #include <errno.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
7 #include <sys/ioctl.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
8 #include "mp_msg.h" |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
9 #include "stream.h" |
23920 | 10 #include "libavutil/intreadwrite.h" |
1 | 11 //=================== VideoCD ========================== |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
12 #if defined(__linux__) || defined(sun) || defined(__bsdi__) |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
13 |
9887 | 14 typedef struct mp_vcd_priv_st mp_vcd_priv_t; |
15 | |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
16 #if defined(__linux__) |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
17 #include <linux/cdrom.h> |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
18 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
19 #include <sys/cdio.h> |
9887 | 20 static int sun_vcd_read(mp_vcd_priv_t*, int*); |
2089 | 21 #elif defined(__bsdi__) |
22 #include <dvd.h> | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
23 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
24 |
9887 | 25 struct mp_vcd_priv_st { |
26 int fd; | |
27 struct cdrom_tocentry entry; | |
28 char buf[VCD_SECTOR_SIZE]; | |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
29 struct cdrom_tochdr tochdr; |
9887 | 30 }; |
1 | 31 |
9887 | 32 static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect){ |
23921
70cc4846c885
Fix hopefully final 150 sector offset VCD bug. Caused no noticeable problems on Linux
reimar
parents:
23920
diff
changeset
|
33 sect += 150; |
9887 | 34 vcd->entry.cdte_addr.msf.frame=sect%75; |
1 | 35 sect=sect/75; |
9887 | 36 vcd->entry.cdte_addr.msf.second=sect%60; |
1 | 37 sect=sect/60; |
9887 | 38 vcd->entry.cdte_addr.msf.minute=sect; |
1 | 39 } |
40 | |
9887 | 41 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd){ |
42 return vcd->entry.cdte_addr.msf.frame + | |
43 (vcd->entry.cdte_addr.msf.second+ | |
23921
70cc4846c885
Fix hopefully final 150 sector offset VCD bug. Caused no noticeable problems on Linux
reimar
parents:
23920
diff
changeset
|
44 vcd->entry.cdte_addr.msf.minute*60)*75 - 150; |
1 | 45 } |
46 | |
9887 | 47 int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){ |
48 vcd->entry.cdte_format = CDROM_MSF; | |
49 vcd->entry.cdte_track = track; | |
50 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { | |
51 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); | |
587
8511095c5283
stage#1 completed: c files no more included from mplayer.c
arpi_esp
parents:
1
diff
changeset
|
52 return -1; |
1 | 53 } |
9887 | 54 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
1 | 55 } |
56 | |
9887 | 57 int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){ |
58 vcd->entry.cdte_format = CDROM_MSF; | |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
59 vcd->entry.cdte_track = track<vcd->tochdr.cdth_trk1?(track+1):CDROM_LEADOUT; |
9887 | 60 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { |
61 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); | |
598 | 62 return -1; |
63 } | |
9887 | 64 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
598 | 65 } |
66 | |
9887 | 67 mp_vcd_priv_t* vcd_read_toc(int fd){ |
1 | 68 struct cdrom_tochdr tochdr; |
9887 | 69 mp_vcd_priv_t* vcd; |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
70 int i, min = 0, sec = 0, frame = 0; |
9887 | 71 if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) { |
72 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | |
73 return NULL; | |
74 } | |
18237
4231482179b6
Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents:
16547
diff
changeset
|
75 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", tochdr.cdth_trk0); |
4231482179b6
Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents:
16547
diff
changeset
|
76 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.cdth_trk1); |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
77 for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 + 1; i++){ |
1 | 78 struct cdrom_tocentry tocentry; |
79 | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
80 tocentry.cdte_track = i<=tochdr.cdth_trk1 ? i : CDROM_LEADOUT; |
1 | 81 tocentry.cdte_format = CDROM_MSF; |
82 | |
9887 | 83 if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) { |
84 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | |
85 return NULL; | |
86 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
87 |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
88 if (i<=tochdr.cdth_trk1) |
1973
5216f108cb4f
all error/warn/info messages moved to help_mp-en.h for translation
arpi
parents:
1105
diff
changeset
|
89 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d mode: %d\n", |
1 | 90 (int)tocentry.cdte_track, |
91 (int)tocentry.cdte_adr, | |
92 (int)tocentry.cdte_ctrl, | |
93 (int)tocentry.cdte_format, | |
94 (int)tocentry.cdte_addr.msf.minute, | |
95 (int)tocentry.cdte_addr.msf.second, | |
96 (int)tocentry.cdte_addr.msf.frame, | |
97 (int)tocentry.cdte_datamode | |
98 ); | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
99 |
18237
4231482179b6
Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents:
16547
diff
changeset
|
100 if (mp_msg_test(MSGT_IDENTIFY, MSGL_INFO)) |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
101 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
102 if (i > tochdr.cdth_trk0) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
103 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
104 min = tocentry.cdte_addr.msf.minute - min; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
105 sec = tocentry.cdte_addr.msf.second - sec; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
106 frame = tocentry.cdte_addr.msf.frame - frame; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
107 if ( frame < 0 ) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
108 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
109 frame += 75; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
110 sec --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
111 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
112 if ( sec < 0 ) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
113 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
114 sec += 60; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
115 min --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
116 } |
18237
4231482179b6
Get ride of the several if(identify) messy lines and rearangment of some of the output, both patches by Kiriuja mplayer-patches AT en-directo_net, his changes are barely unrelated, nevertheless Im commiting them thogeter just for the sake of my mental healt, I had both patches already applied on my local three
reynaldo
parents:
16547
diff
changeset
|
117 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame); |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
118 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
119 min = tocentry.cdte_addr.msf.minute; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
120 sec = tocentry.cdte_addr.msf.second; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
121 frame = tocentry.cdte_addr.msf.frame; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
122 } |
1 | 123 } |
9887 | 124 vcd = malloc(sizeof(mp_vcd_priv_t)); |
125 vcd->fd = fd; | |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
126 vcd->tochdr = tochdr; |
9887 | 127 return vcd; |
1 | 128 } |
129 | |
9887 | 130 static int vcd_read(mp_vcd_priv_t* vcd,char *mem){ |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
131 #if defined(__linux__) || defined(__bsdi__) |
9887 | 132 memcpy(vcd->buf,&vcd->entry.cdte_addr.msf,sizeof(struct cdrom_msf)); |
133 if(ioctl(vcd->fd,CDROMREADRAW,vcd->buf)==-1) return 0; // EOF? | |
134 memcpy(mem,&vcd->buf[VCD_SECTOR_OFFS],VCD_SECTOR_DATA); | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
135 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
136 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
137 int offset; |
23919
440d23a28592
big 10L of r9888 located: passed fd instead of pointer to sun_vcd_read
reimar
parents:
19271
diff
changeset
|
138 if (sun_vcd_read(vcd, &offset) <= 0) return 0; |
9887 | 139 memcpy(mem,&vcd->buf[offset],VCD_SECTOR_DATA); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
140 } |
1020
72cacd3b8f30
Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>
arpi_esp
parents:
598
diff
changeset
|
141 #endif |
1 | 142 |
9887 | 143 vcd->entry.cdte_addr.msf.frame++; |
144 if (vcd->entry.cdte_addr.msf.frame==75){ | |
145 vcd->entry.cdte_addr.msf.frame=0; | |
146 vcd->entry.cdte_addr.msf.second++; | |
147 if (vcd->entry.cdte_addr.msf.second==60){ | |
148 vcd->entry.cdte_addr.msf.second=0; | |
149 vcd->entry.cdte_addr.msf.minute++; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
150 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
151 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
152 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
153 return VCD_SECTOR_DATA; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
154 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
155 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
156 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
157 #ifdef sun |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
158 #include <sys/scsi/generic/commands.h> |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
159 #include <sys/scsi/impl/uscsi.h> |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
160 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
161 #define SUN_XAREAD 1 /*fails on atapi drives*/ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
162 #define SUN_MODE2READ 2 /*fails on atapi drives*/ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
163 #define SUN_SCSIREAD 3 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
164 #define SUN_VCDREAD SUN_SCSIREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
165 |
9887 | 166 static int sun_vcd_read(mp_vcd_priv_t* vcd, int *offset) |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
167 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
168 #if SUN_VCDREAD == SUN_XAREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
169 struct cdrom_cdxa cdxa; |
9887 | 170 cdxa.cdxa_addr = vcd_get_msf(vcd); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
171 cdxa.cdxa_length = 1; |
9887 | 172 cdxa.cdxa_data = vcd->buf; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
173 cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
174 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
175 if(ioctl(vcd->fd,CDROMCDXA,&cdxa)==-1) { |
9887 | 176 mp_msg(MSGT_STREAM,MSGL_ERR,"CDROMCDXA: %s\n",strerror(errno)); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
177 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
178 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
179 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
180 #elif SUN_VCDREAD == SUN_MODE2READ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
181 struct cdrom_read cdread; |
9887 | 182 cdread.cdread_lba = 4*vcd_get_msf(vcd); |
183 cdread.cdread_bufaddr = vcd->buf; | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
184 cdread.cdread_buflen = 2336; |
1 | 185 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
186 if(ioctl(vcd->fd,CDROMREADMODE2,&cdread)==-1) { |
9887 | 187 mp_msg(MSGT_STREAM,MSGL_ERR,"CDROMREADMODE2: %s\n",strerror(errno)); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
188 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
189 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
190 *offset = 8; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
191 #elif SUN_VCDREAD == SUN_SCSIREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
192 struct uscsi_cmd sc; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
193 union scsi_cdb cdb; |
9887 | 194 int lba = vcd_get_msf(vcd); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
195 int blocks = 1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
196 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
197 memset(&cdb, 0, sizeof(cdb)); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
198 memset(&sc, 0, sizeof(sc)); |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
199 cdb.scc_cmd = 0xBE; |
23920 | 200 cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2 |
201 AV_WB32(&cdb.cdb_opaque[2], lba); | |
202 AV_WB24(&cdb.cdb_opaque[6], blocks); | |
203 cdb.cdb_opaque[9] = 1 << 4; // user data only | |
204 cdb.cdb_opaque[10] = 0; // subchannel | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
205 |
1061 | 206 sc.uscsi_cdb = (caddr_t)&cdb; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
207 sc.uscsi_cdblen = 12; |
9887 | 208 sc.uscsi_bufaddr = vcd->buf; |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
209 sc.uscsi_buflen = 2336; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
210 sc.uscsi_flags = USCSI_ISOLATE | USCSI_READ; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
211 sc.uscsi_timeout = 20; |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
212 if (ioctl(vcd->fd, USCSICMD, &sc)) { |
9887 | 213 mp_msg(MSGT_STREAM,MSGL_ERR,"USCSICMD: READ CD: %s\n",strerror(errno)); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
214 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
215 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
216 if (sc.uscsi_status) { |
9887 | 217 mp_msg(MSGT_STREAM,MSGL_ERR,"scsi command failed with status %d\n", sc.uscsi_status); |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
218 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
219 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
220 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
221 return 1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
222 #else |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
223 #error SUN_VCDREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
224 #endif |
1 | 225 } |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
226 #endif /*sun*/ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
227 |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
228 #else /* __linux__ || sun || __bsdi__ */ |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
229 |
3261 | 230 #error vcd is not yet supported on this arch... |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
231 |
3261 | 232 #endif |
26012 | 233 |
26029 | 234 #endif /* MPLAYER_VCD_READ_H */ |