comparison stream/vcd_read_darwin.h @ 23896:ae9ebf311ffd

Make VCD work on little-endian macs
author reimar
date Sun, 29 Jul 2007 15:37:30 +0000
parents 5ebab6056efc
children 3a5f766397b5
comparison
equal deleted inserted replaced
23895:5ebab6056efc 23896:ae9ebf311ffd
2 #include <CoreFoundation/CFBase.h> 2 #include <CoreFoundation/CFBase.h>
3 #include <IOKit/IOKitLib.h> 3 #include <IOKit/IOKitLib.h>
4 #include <IOKit/storage/IOCDTypes.h> 4 #include <IOKit/storage/IOCDTypes.h>
5 #include <IOKit/storage/IOCDMedia.h> 5 #include <IOKit/storage/IOCDMedia.h>
6 #include <IOKit/storage/IOCDMediaBSDClient.h> 6 #include <IOKit/storage/IOCDMediaBSDClient.h>
7 #include "mpbswap.h"
7 8
8 //=================== VideoCD ========================== 9 //=================== VideoCD ==========================
9 #define CDROM_LEADOUT 0xAA 10 #define CDROM_LEADOUT 0xAA
10 11
11 typedef struct 12 typedef struct
54 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry)) 55 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
55 { 56 {
56 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno)); 57 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
57 return -1; 58 return -1;
58 } 59 }
59 vcd->msf = CDConvertLBAToMSF(entry.trackStartAddress); 60 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
60 return VCD_SECTOR_DATA*vcd_get_msf(vcd); 61 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
61 } 62 }
62 63
63 int vcd_get_track_end(mp_vcd_priv_t* vcd, int track) 64 int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
64 { 65 {
88 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry)) 89 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
89 { 90 {
90 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno)); 91 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
91 return -1; 92 return -1;
92 } 93 }
93 vcd->msf = CDConvertLBAToMSF(entry.trackStartAddress); 94 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
94 return VCD_SECTOR_DATA*vcd_get_msf(vcd); 95 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
95 } 96 }
96 97
97 mp_vcd_priv_t* vcd_read_toc(int fd) 98 mp_vcd_priv_t* vcd_read_toc(int fd)
98 { 99 {
132 { 133 {
133 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); 134 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
134 return NULL; 135 return NULL;
135 } 136 }
136 137
137 trackMSF = CDConvertLBAToMSF(entry.trackStartAddress); 138 trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
138 139
139 //mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", 140 //mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
140 if (i<=hdr.lastTrackNumberInLastSessionLSB) 141 if (i<=hdr.lastTrackNumberInLastSessionLSB)
141 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: format=%d %02d:%02d:%02d\n", 142 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: format=%d %02d:%02d:%02d\n",
142 (int)tocentry.address, 143 (int)tocentry.address,