annotate stream/vcd_read_darwin.h @ 36915:91ec74c16463

Fix typo.
author ib
date Thu, 13 Mar 2014 15:42:10 +0000
parents 3a192d8ecc56
children
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;
36433
3a192d8ecc56 Revise and fix stream control for VCD.
ib
parents: 33349
diff changeset
58 unsigned int track;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
59 } mp_vcd_priv_t;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
60
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
61 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
62 {
23898
3a5f766397b5 Simplify and fix missing offset for Darwin vcd_get/set_msf functions
reimar
parents: 23896
diff changeset
63 vcd->msf = CDConvertLBAToMSF(sect);
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
64 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
65
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
66 static inline unsigned int vcd_get_msf(mp_vcd_priv_t* vcd)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
67 {
23898
3a5f766397b5 Simplify and fix missing offset for Darwin vcd_get/set_msf functions
reimar
parents: 23896
diff changeset
68 return CDConvertMSFToLBA(vcd->msf);
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
69 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
70
33349
3ab3212fb624 Make vcd_seek_to_track static, the GUI no longer needs to
reimar
parents: 30981
diff changeset
71 static int vcd_seek_to_track(mp_vcd_priv_t* vcd, int track)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
72 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
73 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
74
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
75 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
76 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
77 vcd->entry.address = track;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
78 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
79 vcd->entry.buffer = &entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
80
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
81 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
82 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
83 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif1: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
84 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
85 }
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
86 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
87 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
88 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
89
30670
fbd6ba7e0e14 Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents: 30426
diff changeset
90 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
91 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
92 struct CDTrackInfo entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
93
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
94 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
95 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
96 "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
97 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
98 return -1;
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
99 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
100
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
101 //read track info
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
102 memset( &vcd->entry, 0, sizeof(vcd->entry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
103 vcd->entry.addressType = kCDTrackInfoAddressTypeTrackNumber;
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
104 vcd->entry.address = track<vcd->hdr.lastTrackNumberInLastSessionLSB?track+1:vcd->hdr.lastTrackNumberInLastSessionLSB;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
105 vcd->entry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
106 vcd->entry.buffer = &entry;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
107
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
108 if (ioctl(vcd->fd, DKIOCCDREADTRACKINFO, &vcd->entry))
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
109 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
110 mp_msg(MSGT_STREAM,MSGL_ERR,"ioctl dif2: %s\n",strerror(errno));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
111 return -1;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
112 }
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
113 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
114 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
115 be2me_32(entry.trackSize));
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
116 else
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
117 vcd->msf = CDConvertLBAToMSF(be2me_32(entry.trackStartAddress));
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
118 return VCD_SECTOR_DATA*vcd_get_msf(vcd);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
119 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
120
30670
fbd6ba7e0e14 Mark vcd_get_track_end () and vcd_read_toc() as static.
diego
parents: 30426
diff changeset
121 static mp_vcd_priv_t* vcd_read_toc(int fd)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
122 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
123 dk_cd_read_disc_info_t tochdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
124 struct CDDiscInfo hdr;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
125
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
126 dk_cd_read_track_info_t tocentry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
127 struct CDTrackInfo entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
128 CDMSF trackMSF;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
129
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
130 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
131 int i, min = 0, sec = 0, frame = 0;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
132
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
133 //read toc header
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
134 memset(&tochdr, 0, sizeof(tochdr));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
135 tochdr.buffer = &hdr;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
136 tochdr.bufferLength = sizeof(hdr);
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
137
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
138 if (ioctl(fd, DKIOCCDREADDISCINFO, &tochdr) < 0)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
139 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
140 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
141 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
142 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
143
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
144 //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
145 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
146 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
147 for (i=hdr.firstTrackNumberInLastSessionLSB ; i<=hdr.lastTrackNumberInLastSessionLSB + 1; i++)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
148 {
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
149 if (i <= hdr.lastTrackNumberInLastSessionLSB) {
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
150 memset( &tocentry, 0, sizeof(tocentry));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
151 tocentry.addressType = kCDTrackInfoAddressTypeTrackNumber;
25375
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
152 tocentry.address = i;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
153 tocentry.bufferLength = sizeof(entry);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
154 tocentry.buffer = &entry;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
155
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
156 if (ioctl(fd,DKIOCCDREADTRACKINFO,&tocentry)==-1)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
157 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
158 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
159 return NULL;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
160 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
161
23896
ae9ebf311ffd Make VCD work on little-endian macs
reimar
parents: 23895
diff changeset
162 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
163 }
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
164 else
e1884244ba98 Get end position of last track by adding its starting address with track size.
ulion
parents: 23898
diff changeset
165 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
166 + be2me_32(entry.trackSize));
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
167
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
168 //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
169 if (i<=hdr.lastTrackNumberInLastSessionLSB)
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
170 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
171 (int)tocentry.address,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
172 //(int)tocentry.entry.addr_type,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
173 //(int)tocentry.entry.control,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
174 (int)tocentry.addressType,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
175 (int)trackMSF.minute,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
176 (int)trackMSF.second,
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
177 (int)trackMSF.frame
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
178 );
16547
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
179
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
180 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
181 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
182 if (i > hdr.firstTrackNumberInLastSessionLSB)
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
183 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
184 min = trackMSF.minute - min;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
185 sec = trackMSF.second - sec;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
186 frame = trackMSF.frame - frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
187 if ( frame < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
188 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
189 frame += 75;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
190 sec --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
191 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
192 if ( sec < 0 )
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
193 {
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
194 sec += 60;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
195 min --;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
196 }
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
197 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
198 }
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
199 min = trackMSF.minute;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
200 sec = trackMSF.second;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
201 frame = trackMSF.frame;
aa15d627a00b Prints the numbers of start and end tracks and MSF length for each
gpoirier
parents: 13842
diff changeset
202 }
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
203 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
204
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
205 vcd = malloc(sizeof(mp_vcd_priv_t));
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
206 vcd->fd = fd;
25378
f0f03ec41cd3 Only read disc info once and save it for later using.
ulion
parents: 25376
diff changeset
207 vcd->hdr = hdr;
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
208 vcd->msf = trackMSF;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
209 return vcd;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
210 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
211
30981
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
212 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
213 {
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
214 return vcd->hdr.lastTrackNumberInLastSessionLSB;
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
215 }
9bab99cfdff2 Try to fix VCD compilation on non-Linux systems.
reimar
parents: 30670
diff changeset
216
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
217 static int vcd_read(mp_vcd_priv_t* vcd,char *mem)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
218 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
219 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
220 return 0; // EOF?
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
221
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
222 vcd->msf.frame++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
223 if (vcd->msf.frame==75)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
224 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
225 vcd->msf.frame=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
226 vcd->msf.second++;
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
227
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
228 if (vcd->msf.second==60)
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
229 {
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
230 vcd->msf.second=0;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
231 vcd->msf.minute++;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
232 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
233 }
29263
0f1b5b68af32 whitespace cosmetics: Remove all trailing whitespace.
diego
parents: 26186
diff changeset
234
13682
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
235 memcpy(mem,vcd->buf.data,VCD_SECTOR_DATA);
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
236 return VCD_SECTOR_DATA;
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
237 }
aedf94d36d2a support function for vcd on darwin
nplourde
parents:
diff changeset
238
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 26012
diff changeset
239 #endif /* MPLAYER_VCD_READ_DARWIN_H */