Mercurial > mplayer.hg
annotate stream/vcd_read.h @ 34116:5f7c090e5ae8
Support H264 from QNAP Systems.
author | cehoyos |
---|---|
date | Sat, 15 Oct 2011 16:33:05 +0000 |
parents | 3ab3212fb624 |
children | cc42d1d53695 |
rev | line source |
---|---|
30426
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
1 /* |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
3 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
8 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
13 * |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
17 */ |
ce0122361a39
Add license header to all files missing it in the stream subdirectory.
diego
parents:
29263
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_VCD_READ_H |
20 #define MPLAYER_VCD_READ_H | |
26012 | 21 |
26184
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
22 #include <stdlib.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
23 #include <string.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
24 #include <errno.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
25 #include <sys/ioctl.h> |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
26 #include "mp_msg.h" |
7ee4ae1648e6
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26029
diff
changeset
|
27 #include "stream.h" |
23920 | 28 #include "libavutil/intreadwrite.h" |
1 | 29 //=================== VideoCD ========================== |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
30 #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
|
31 |
9887 | 32 typedef struct mp_vcd_priv_st mp_vcd_priv_t; |
33 | |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
34 #if defined(__linux__) |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
35 #include <linux/cdrom.h> |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
36 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
37 #include <sys/cdio.h> |
9887 | 38 static int sun_vcd_read(mp_vcd_priv_t*, int*); |
2089 | 39 #elif defined(__bsdi__) |
40 #include <dvd.h> | |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
41 #endif |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
42 |
9887 | 43 struct mp_vcd_priv_st { |
44 int fd; | |
45 struct cdrom_tocentry entry; | |
46 char buf[VCD_SECTOR_SIZE]; | |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
47 struct cdrom_tochdr tochdr; |
9887 | 48 }; |
1 | 49 |
9887 | 50 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
|
51 sect += 150; |
9887 | 52 vcd->entry.cdte_addr.msf.frame=sect%75; |
1 | 53 sect=sect/75; |
9887 | 54 vcd->entry.cdte_addr.msf.second=sect%60; |
1 | 55 sect=sect/60; |
9887 | 56 vcd->entry.cdte_addr.msf.minute=sect; |
1 | 57 } |
58 | |
9887 | 59 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd){ |
60 return vcd->entry.cdte_addr.msf.frame + | |
61 (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
|
62 vcd->entry.cdte_addr.msf.minute*60)*75 - 150; |
1 | 63 } |
64 | |
33349
3ab3212fb624
Make vcd_seek_to_track static, the GUI no longer needs to
reimar
parents:
30981
diff
changeset
|
65 static int vcd_seek_to_track(mp_vcd_priv_t* vcd,int track){ |
9887 | 66 vcd->entry.cdte_format = CDROM_MSF; |
67 vcd->entry.cdte_track = track; | |
68 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { | |
69 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
|
70 return -1; |
1 | 71 } |
9887 | 72 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
1 | 73 } |
74 | |
30670
fbd6ba7e0e14
Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents:
30426
diff
changeset
|
75 static int vcd_get_track_end(mp_vcd_priv_t* vcd,int track){ |
9887 | 76 vcd->entry.cdte_format = CDROM_MSF; |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
77 vcd->entry.cdte_track = track<vcd->tochdr.cdth_trk1?(track+1):CDROM_LEADOUT; |
9887 | 78 if (ioctl(vcd->fd, CDROMREADTOCENTRY, &vcd->entry)) { |
79 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); | |
598 | 80 return -1; |
81 } | |
9887 | 82 return VCD_SECTOR_DATA*vcd_get_msf(vcd); |
598 | 83 } |
84 | |
30670
fbd6ba7e0e14
Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents:
30426
diff
changeset
|
85 static mp_vcd_priv_t* vcd_read_toc(int fd){ |
1 | 86 struct cdrom_tochdr tochdr; |
9887 | 87 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
|
88 int i, min = 0, sec = 0, frame = 0; |
9887 | 89 if (ioctl(fd,CDROMREADTOCHDR,&tochdr)==-1) { |
90 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | |
91 return NULL; | |
92 } | |
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
|
93 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
|
94 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
|
95 for (i=tochdr.cdth_trk0 ; i<=tochdr.cdth_trk1 + 1; i++){ |
1 | 96 struct cdrom_tocentry tocentry; |
97 | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
98 tocentry.cdte_track = i<=tochdr.cdth_trk1 ? i : CDROM_LEADOUT; |
1 | 99 tocentry.cdte_format = CDROM_MSF; |
100 | |
9887 | 101 if (ioctl(fd,CDROMREADTOCENTRY,&tocentry)==-1) { |
102 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | |
103 return NULL; | |
104 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
105 |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
106 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
|
107 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d mode: %d\n", |
1 | 108 (int)tocentry.cdte_track, |
109 (int)tocentry.cdte_adr, | |
110 (int)tocentry.cdte_ctrl, | |
111 (int)tocentry.cdte_format, | |
112 (int)tocentry.cdte_addr.msf.minute, | |
113 (int)tocentry.cdte_addr.msf.second, | |
114 (int)tocentry.cdte_addr.msf.frame, | |
115 (int)tocentry.cdte_datamode | |
116 ); | |
16547
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
117 |
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
|
118 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
|
119 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
120 if (i > tochdr.cdth_trk0) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
121 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
122 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
|
123 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
|
124 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
|
125 if ( frame < 0 ) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
126 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
127 frame += 75; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
128 sec --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
129 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
130 if ( sec < 0 ) |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
131 { |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
132 sec += 60; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
133 min --; |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
134 } |
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
|
135 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
|
136 } |
aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents:
10300
diff
changeset
|
137 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
|
138 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
|
139 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
|
140 } |
1 | 141 } |
9887 | 142 vcd = malloc(sizeof(mp_vcd_priv_t)); |
143 vcd->fd = fd; | |
25411
aef6ff061c9a
Caching toc header in vcd private structure for later use.
ulion
parents:
23921
diff
changeset
|
144 vcd->tochdr = tochdr; |
9887 | 145 return vcd; |
1 | 146 } |
147 | |
30981 | 148 static int vcd_end_track(mp_vcd_priv_t* vcd) |
149 { | |
150 return vcd->tochdr.cdth_trk1; | |
151 } | |
152 | |
9887 | 153 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
|
154 #if defined(__linux__) || defined(__bsdi__) |
9887 | 155 memcpy(vcd->buf,&vcd->entry.cdte_addr.msf,sizeof(struct cdrom_msf)); |
156 if(ioctl(vcd->fd,CDROMREADRAW,vcd->buf)==-1) return 0; // EOF? | |
157 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
|
158 #elif defined(sun) |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
159 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
160 int offset; |
23919
440d23a28592
big 10L of r9888 located: passed fd instead of pointer to sun_vcd_read
reimar
parents:
19271
diff
changeset
|
161 if (sun_vcd_read(vcd, &offset) <= 0) return 0; |
9887 | 162 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
|
163 } |
1020
72cacd3b8f30
Solaris 8 support - patch by Marcus Comstedt <marcus@idonex.se>
arpi_esp
parents:
598
diff
changeset
|
164 #endif |
1 | 165 |
9887 | 166 vcd->entry.cdte_addr.msf.frame++; |
167 if (vcd->entry.cdte_addr.msf.frame==75){ | |
168 vcd->entry.cdte_addr.msf.frame=0; | |
169 vcd->entry.cdte_addr.msf.second++; | |
170 if (vcd->entry.cdte_addr.msf.second==60){ | |
171 vcd->entry.cdte_addr.msf.second=0; | |
172 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
|
173 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
174 } |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
175 |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
176 return VCD_SECTOR_DATA; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
177 } |
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 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
180 #ifdef sun |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
181 #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
|
182 #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
|
183 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
184 #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
|
185 #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
|
186 #define SUN_SCSIREAD 3 |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
187 #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
|
188 |
9887 | 189 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
|
190 { |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
191 #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
|
192 struct cdrom_cdxa cdxa; |
9887 | 193 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
|
194 cdxa.cdxa_length = 1; |
9887 | 195 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
|
196 cdxa.cdxa_format = CDROM_XA_SECTOR_DATA; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
27250
diff
changeset
|
197 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
198 if(ioctl(vcd->fd,CDROMCDXA,&cdxa)==-1) { |
9887 | 199 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
|
200 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
201 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
202 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
203 #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
|
204 struct cdrom_read cdread; |
9887 | 205 cdread.cdread_lba = 4*vcd_get_msf(vcd); |
206 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
|
207 cdread.cdread_buflen = 2336; |
1 | 208 |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
209 if(ioctl(vcd->fd,CDROMREADMODE2,&cdread)==-1) { |
9887 | 210 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
|
211 return 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
212 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
213 *offset = 8; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
214 #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
|
215 struct uscsi_cmd sc; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
216 union scsi_cdb cdb; |
9887 | 217 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
|
218 int blocks = 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 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
|
221 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
|
222 cdb.scc_cmd = 0xBE; |
23920 | 223 cdb.cdb_opaque[1] = 5 << 2; // mode2 / form2 |
224 AV_WB32(&cdb.cdb_opaque[2], lba); | |
225 AV_WB24(&cdb.cdb_opaque[6], blocks); | |
226 cdb.cdb_opaque[9] = 1 << 4; // user data only | |
227 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
|
228 |
1061 | 229 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
|
230 sc.uscsi_cdblen = 12; |
9887 | 231 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
|
232 sc.uscsi_buflen = 2336; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
233 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
|
234 sc.uscsi_timeout = 20; |
10300
134e4332f550
solaris fix by Gtz Waschk <waschk@informatik.uni-rostock.de>
alex
parents:
9887
diff
changeset
|
235 if (ioctl(vcd->fd, USCSICMD, &sc)) { |
9887 | 236 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
|
237 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
238 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
239 if (sc.uscsi_status) { |
9887 | 240 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
|
241 return -1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
242 } |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
243 *offset = 0; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
244 return 1; |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
245 #else |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
246 #error SUN_VCDREAD |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
247 #endif |
1 | 248 } |
1038
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
249 #endif /*sun*/ |
b36fb1ae4b53
applied solaris8/netbsd/other fixes patch by J¸«ärgen Keil <jk@tools.de>
arpi_esp
parents:
1020
diff
changeset
|
250 |
27250
dcf62171257b
Remove -std=gnu99/gnu89/default dialect linux define, as it violates the
michael
parents:
26184
diff
changeset
|
251 #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
|
252 |
3261 | 253 #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
|
254 |
3261 | 255 #endif |
26012 | 256 |
26029 | 257 #endif /* MPLAYER_VCD_READ_H */ |