annotate stream/vcd_read_darwin.h @ 33066:fd4d66a6add6

Don't start GUI in case of window name error.
author ib
date Wed, 30 Mar 2011 11:06:57 +0000
parents 9bab99cfdff2
children 3ab3212fb624
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
30426
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
diff changeset
1 /*
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
diff changeset
2 * This file is part of MPlayer.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
diff changeset
3 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
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: 30165
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: 30165
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: 30165
diff changeset
7 * (at your option) any later version.
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
diff changeset
8 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
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: 30165
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: 30165
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: 30165
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: 30165
diff changeset
13 *
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
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: 30165
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: 30165
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: 30165
diff changeset
17 */
ce0122361a39 Add license header to all files missing it in the stream subdirectory.
diego
parents: 30165
diff changeset
18
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 26012
diff changeset
19 #ifndef MPLAYER_VCD_READ_DARWIN_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 26012
diff changeset
20 #define MPLAYER_VCD_READ_DARWIN_H
26012
04f59a060070 Add missing multiple inclusion guards.
diego
parents: 25378
diff changeset
21
30165
b4cbeff5153e Add a few missing header #includes and #defines.
diego
parents: 29263
diff changeset
22 #define _XOPEN_SOURCE 500
b4cbeff5153e Add a few missing header #includes and #defines.
diego
parents: 29263
diff changeset
23
26184
7ee4ae1648e6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
24 #include <stdlib.h>
7ee4ae1648e6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
25 #include <string.h>
7ee4ae1648e6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
26 #include <errno.h>
13842
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
27 #include <sys/types.h>
26186
49df679a7c1a Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26184
diff changeset
28 #include <sys/uio.h>
49df679a7c1a Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26184
diff changeset
29 #include <unistd.h>
13842
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
30 #include <CoreFoundation/CFBase.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
31 #include <IOKit/IOKitLib.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
32 #include <IOKit/storage/IOCDTypes.h>
78e5886bc211 fix build on darwin ppc
nplourde
parents: 13682
diff changeset
33 #include <IOKit/storage/IOCDMedia.h>
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
34 #include <IOKit/storage/IOCDMediaBSDClient.h>
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
35 #include "mpbswap.h"
26184
7ee4ae1648e6 Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26029
diff changeset
36 #include "mp_msg.h"
26186
49df679a7c1a Add missing header #includes to fix 'make checkheaders'.
diego
parents: 26184
diff changeset
37 #include "stream.h"
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
38
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
39 //=================== VideoCD ==========================
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
40 #define CDROM_LEADOUT 0xAA
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
41
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
42 typedef struct
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
43 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
44 uint8_t sync [12];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
45 uint8_t header [4];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
46 uint8_t subheader [8];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
47 uint8_t data [2324];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
48 uint8_t spare [4];
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
49 } cdsector_t;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
50
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
51 typedef struct mp_vcd_priv_st
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
52 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
53 int fd;
25376
382aeacc771f The buffer used for pread need be aligned, but currently it got an offset 23
ulion
parents: 25375
diff changeset
54 cdsector_t buf;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
55 dk_cd_read_track_info_t entry;
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
56 struct CDDiscInfo hdr;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
57 CDMSF msf;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
58 } mp_vcd_priv_t;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
59
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
60 static inline void vcd_set_msf(mp_vcd_priv_t* vcd, unsigned int sect)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
61 {
23898
3a5f766397b5 Simplify and fix missing offset for Darwin vcd_get/set_msf functions
reimar
parents: 23896
diff changeset
62 vcd->msf = CDConvertLBAToMSF(sect);
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
63 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
64
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
65 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
66 {
23898
3a5f766397b5 Simplify and fix missing offset for Darwin vcd_get/set_msf functions
reimar
parents: 23896
diff changeset
67 return CDConvertMSFToLBA(vcd->msf);
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
68 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
69
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
70 int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
71 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
72 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
73
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
74 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
75 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
76 vcd->entry.address = track;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
77 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
78 vcd->entry.buffer = &entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
79
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
80 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
81 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
82 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
83 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
84 }
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
85 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
86 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
87 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
88
30670
fbd6ba7e0e14 Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents: 30426
diff changeset
89 static int vcd_get_track_end(mp_vcd_priv_t* vcd, int track)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
90 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
91 struct CDTrackInfo entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
92
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
93 if (track > vcd->hdr.lastTrackNumberInLastSessionLSB) {
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
94 mp_msg(MSGT_OPEN, MSGL_ERR,
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
95 "track number %d greater than last track number %d\n",
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
96 track, vcd->hdr.lastTrackNumberInLastSessionLSB);
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
97 return -1;
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
98 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
99
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
100 //read track info
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
101 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
102 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
103 vcd->entry.address = track<vcd->hdr.lastTrackNumberInLastSessionLSB?track+1:vcd->hdr.lastTrackNumberInLastSessionLSB;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
104 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
105 vcd->entry.buffer = &entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
106
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
107 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
108 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
109 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
110 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
111 }
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
112 if (track == vcd->hdr.lastTrackNumberInLastSessionLSB)
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
113 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress) +
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
114 be2me_32(entry.trackSize));
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
115 else
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
116 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
117 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
118 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
119
30670
fbd6ba7e0e14 Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents: 30426
diff changeset
120 static mp_vcd_priv_t* vcd_read_toc(int fd)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
121 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
122 dk_cd_read_disc_info_t tochdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
123 struct CDDiscInfo hdr;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
124
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
125 dk_cd_read_track_info_t tocentry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
126 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
127 CDMSF trackMSF;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
128
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
129 mp_vcd_priv_t* vcd;
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
130 int i, min = 0, sec = 0, frame = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
131
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
132 //read toc header
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
133 memset(&tochdr, 0, sizeof(tochdr));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
134 tochdr.buffer = &hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
135 tochdr.bufferLength = sizeof(hdr);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
136
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
137 if (ioctl(fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
138 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
139 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
140 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
141 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
142
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
143 //print all track info
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
144 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", hdr.firstTrackNumberInLastSessionLSB);
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
145 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", hdr.lastTrackNumberInLastSessionLSB);
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
146 for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
147 {
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
148 if (i <= hdr.lastTrackNumberInLastSessionLSB) {
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
149 memset( &tocentry, 0, sizeof(tocentry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
150 tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
151 tocentry.address = i;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
152 tocentry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
153 tocentry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
154
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
155 if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
156 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
157 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
158 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
159 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
160
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
161 trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
162 }
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
163 else
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
164 trackMSF = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress)
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
165 + be2me_32(entry.trackSize));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
166
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
167 //mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n",
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
168 if (i<=hdr.lastTrackNumberInLastSessionLSB)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
169 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: format=%d %02d:%02d:%02d\n",
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
170 (int)tocentry.address,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
171 //(int)tocentry.entry.addr_type,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
172 //(int)tocentry.entry.control,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
173 (int)tocentry.addressType,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
174 (int)trackMSF.minute,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
175 (int)trackMSF.second,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
176 (int)trackMSF.frame
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
177 );
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
178
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
179 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: 13842
diff changeset
180 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
181 if (i > hdr.firstTrackNumberInLastSessionLSB)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
182 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
183 min = trackMSF.minute - min;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
184 sec = trackMSF.second - sec;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
185 frame = trackMSF.frame - frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
186 if ( frame < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
187 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
188 frame += 75;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
189 sec --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
190 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
191 if ( sec < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
192 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
193 sec += 60;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
194 min --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
195 }
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
196 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: 13842
diff changeset
197 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
198 min = trackMSF.minute;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
199 sec = trackMSF.second;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
200 frame = trackMSF.frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
201 }
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
202 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
203
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
204 vcd = malloc(sizeof(mp_vcd_priv_t));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
205 vcd->fd = fd;
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
206 vcd->hdr = hdr;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
207 vcd->msf = trackMSF;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
208 return vcd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
209 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
210
30981
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
211 static int vcd_end_track(mp_vcd_priv_t* vcd)
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
212 {
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
213 return vcd->hdr.lastTrackNumberInLastSessionLSB;
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
214 }
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
215
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
216 static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
217 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
218 if (pread(vcd->fd,&vcd->buf,VCD_SECTOR_SIZE,vcd_get_msf(vcd)*VCD_SECTOR_SIZE) != VCD_SECTOR_SIZE)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
219 return 0; // EOF?
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
220
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
221 vcd->msf.frame++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
222 if (vcd->msf.frame==75)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
223 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
224 vcd->msf.frame=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
225 vcd->msf.second++;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
226
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
227 if (vcd->msf.second==60)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
228 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
229 vcd->msf.second=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
230 vcd->msf.minute++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
231 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
232 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
233
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
234 memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
235 return VCD_SECTOR_DATA;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
236 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
237
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 26012
diff changeset
238 #endif /* MPLAYER_VCD_READ_DARWIN_H */