Mercurial > mplayer.hg
annotate stream/vcd_read.h @ 24585:096d129bb83a
r24558: Clarify the relationship between -msglevel and MPLAYER_VERBOSE.
r24573: Implement setting gain control for video devices (usually webcams)
r24592: Change outdated note for -subfps
author | voroshil |
---|---|
date | Mon, 24 Sep 2007 18:18:51 +0000 |
parents | 70cc4846c885 |
children | aef6ff061c9a |
rev | line source |
---|---|
23920 | 1 #include "libavutil/intreadwrite.h" |
1 | 2 //=================== VideoCD ========================== |
2089 | 3 #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
|
4 |
9887 | 5 typedef struct mp_vcd_priv_st mp_vcd_priv_t; |
6 | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
7 #if defined(linux) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
8 #include <linux/cdrom.h> |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
9 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
10 #include <sys/cdio.h> |
9887 | 11 static int sun_vcd_read(mp_vcd_priv_t*, int*); |
2089 | 12 #elif defined(__bsdi__) |
13 #include <dvd.h> | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
14 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
15 |
9887 | 16 struct mp_vcd_priv_st { |
17 int fd; | |
18 struct cdrom_tocentry entry; | |
19 char buf[VCD_SECTOR_SIZE]; | |
20 }; | |
1 | 21 |
9887 | 22 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
|
23 sect += 150; |
9887 | 24 vcd->entry.cdte_addr.msf.frame=sect%75; |
1 | 25 sect=sect/75; |
9887 | 26 vcd->entry.cdte_addr.msf.second=sect%60; |
1 | 27 sect=sect/60; |
9887 | 28 vcd->entry.cdte_addr.msf.minute=sect; |
1 | 29 } |
30 | |
9887 | 31 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd){ |
32 return vcd->entry.cdte_addr.msf.frame + | |
33 (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
|
34 vcd->entry.cdte_addr.msf.minute*60)*75 - 150; |
1 | 35 } |
36 | |
9887 | 37 int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){ |
38 vcd->entry.cdte_format = CDROM_MSF; | |
39 vcd->entry.cdte_track = track; | |
40 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { | |
41 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
|
42 return -1; |
1 | 43 } |
9887 | 44 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
1 | 45 } |
46 | |
9887 | 47 int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){ |
598 | 48 struct cdrom_tochdr tochdr; |
9887 | 49 if (ioctl(vcd->fd,CDROMREADTOCHDR,&tochdr)==-1) { |
50 mp_msg(MSGT_STREAM,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | |
51 return -1; | |
52 } | |
53 vcd->entry.cdte_format = CDROM_MSF; | |
54 vcd->entry.cdte_track = track<tochdr.cdth_trk1?(track+1):CDROM_LEADOUT; | |
55 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { | |
56 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); | |
598 | 57 return -1; |
58 } | |
9887 | 59 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
598 | 60 } |
61 | |
9887 | 62 mp_vcd_priv_t* vcd_read_toc(int fd){ |
1 | 63 struct cdrom_tochdr tochdr; |
9887 | 64 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
|
65 int i, min = 0, sec = 0, frame = 0; |
9887 | 66 if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) { |
67 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | |
68 return NULL; | |
69 } | |
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
|
70 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
|
71 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
|
72 for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 + 1; i++){ |
1 | 73 struct cdrom_tocentry tocentry; |
74 | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
75 tocentry.cdte_track = i<=tochdr.cdth_trk1 ? i : CDROM_LEADOUT; |
1 | 76 tocentry.cdte_format = CDROM_MSF; |
77 | |
9887 | 78 if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) { |
79 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | |
80 return NULL; | |
81 } | |
1 | 82 |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
83 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
|
84 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d mode: %d\n", |
1 | 85 (int)tocentry.cdte_track, |
86 (int)tocentry.cdte_adr, | |
87 (int)tocentry.cdte_ctrl, | |
88 (int)tocentry.cdte_format, | |
89 (int)tocentry.cdte_addr.msf.minute, | |
90 (int)tocentry.cdte_addr.msf.second, | |
91 (int)tocentry.cdte_addr.msf.frame, | |
92 (int)tocentry.cdte_datamode | |
93 ); | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
94 |
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
|
95 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
|
96 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
97 if (i > tochdr.cdth_trk0) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
98 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
99 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
|
100 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
|
101 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
|
102 if ( frame < 0 ) |
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 frame += 75; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
105 sec --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
106 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
107 if ( sec < 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 sec += 60; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
110 min --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
111 } |
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
|
112 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
|
113 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
114 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
|
115 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
|
116 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
|
117 } |
1 | 118 } |
9887 | 119 vcd = malloc(sizeof(mp_vcd_priv_t)); |
120 vcd->fd = fd; | |
121 return vcd; | |
1 | 122 } |
123 | |
9887 | 124 static int vcd_read(mp_vcd_priv_t* vcd,char *mem){ |
2089 | 125 #if defined(linux) || defined(__bsdi__) |
9887 | 126 memcpy(vcd->buf,&vcd->entry.cdte_addr.msf,sizeof(struct cdrom_msf)); |
127 if(ioctl(vcd->fd,CDROMREADRAW,vcd->buf)==-1) return 0; // EOF? | |
128 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
|
129 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
130 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
131 int offset; |
23919
440d23a28592
big 10L of r9888 located: passed fd instead of pointer to sun_vcd_read
reimar
parents:
19271
diff
changeset
|
132 if (sun_vcd_read(vcd, &offset) <= 0) return 0; |
9887 | 133 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
|
134 } |
1020
72cacd3b8f30
Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>
arpi_esp
parents:
598
diff
changeset
|
135 #endif |
1 | 136 |
9887 | 137 vcd->entry.cdte_addr.msf.frame++; |
138 if (vcd->entry.cdte_addr.msf.frame==75){ | |
139 vcd->entry.cdte_addr.msf.frame=0; | |
140 vcd->entry.cdte_addr.msf.second++; | |
141 if (vcd->entry.cdte_addr.msf.second==60){ | |
142 vcd->entry.cdte_addr.msf.second=0; | |
143 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
|
144 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
145 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
146 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
147 return VCD_SECTOR_DATA; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
148 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
149 |
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 #ifdef sun |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
152 #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
|
153 #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
|
154 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
155 #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
|
156 #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
|
157 #define SUN_SCSIREAD 3 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
158 #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
|
159 |
9887 | 160 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
|
161 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
162 #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
|
163 struct cdrom_cdxa cdxa; |
9887 | 164 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
|
165 cdxa.cdxa_length = 1; |
9887 | 166 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
|
167 cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
168 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
169 if(ioctl(vcd->fd,CDROMCDXA,&cdxa)==-1) { |
9887 | 170 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
|
171 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
172 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
173 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
174 #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
|
175 struct cdrom_read cdread; |
9887 | 176 cdread.cdread_lba = 4*vcd_get_msf(vcd); |
177 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
|
178 cdread.cdread_buflen = 2336; |
1 | 179 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
180 if(ioctl(vcd->fd,CDROMREADMODE2,&cdread)==-1) { |
9887 | 181 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
|
182 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
183 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
184 *offset = 8; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
185 #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
|
186 struct uscsi_cmd sc; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
187 union scsi_cdb cdb; |
9887 | 188 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
|
189 int blocks = 1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
190 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
191 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
|
192 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
|
193 cdb.scc_cmd = 0xBE; |
23920 | 194 cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2 |
195 AV_WB32(&cdb.cdb_opaque[2], lba); | |
196 AV_WB24(&cdb.cdb_opaque[6], blocks); | |
197 cdb.cdb_opaque[9] = 1 << 4; // user data only | |
198 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
|
199 |
1061 | 200 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
|
201 sc.uscsi_cdblen = 12; |
9887 | 202 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
|
203 sc.uscsi_buflen = 2336; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
204 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
|
205 sc.uscsi_timeout = 20; |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
206 if (ioctl(vcd->fd, USCSICMD, &sc)) { |
9887 | 207 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
|
208 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
209 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
210 if (sc.uscsi_status) { |
9887 | 211 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
|
212 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
213 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
214 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
215 return 1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
216 #else |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
217 #error SUN_VCDREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
218 #endif |
1 | 219 } |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
220 #endif /*sun*/ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
221 |
3261 | 222 #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
|
223 |
3261 | 224 #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
|
225 |
3261 | 226 #endif |