Mercurial > mplayer.hg
comparison libmpdemux/vcd_read_nbsd.h @ 16547:aa15d627a00b
Prints the numbers of start and end tracks and MSF length for each
track of a VCD when -identify is given.
Patch by kiriuja < mplayer TIREH patches AH en TIREH directo POIS net >
Original Thread:
Date: Sep 11, 2005 3:30 AM
Subject: [MPlayer-dev-eng] [PATCH] -identify VCD tracks
author | gpoirier |
---|---|
date | Thu, 22 Sep 2005 08:46:05 +0000 |
parents | b2419eef04da |
children | 4231482179b6 |
comparison
equal
deleted
inserted
replaced
16546:f9b93c7c6b92 | 16547:aa15d627a00b |
---|---|
82 mp_vcd_priv_t* | 82 mp_vcd_priv_t* |
83 vcd_read_toc(int fd) | 83 vcd_read_toc(int fd) |
84 { | 84 { |
85 struct ioc_toc_header tochdr; | 85 struct ioc_toc_header tochdr; |
86 mp_vcd_priv_t* vcd; | 86 mp_vcd_priv_t* vcd; |
87 int i; | 87 int i, min = 0, sec = 0, frame = 0; |
88 if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) { | 88 if (ioctl(fd, CDIOREADTOCHEADER, &tochdr) == -1) { |
89 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); | 89 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc header: %s\n",strerror(errno)); |
90 return; | 90 return; |
91 } | 91 } |
92 for (i = tochdr.starting_track; i <= tochdr.ending_track; i++) { | 92 if (identify) |
93 { | |
94 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_START_TRACK=%d\n", tochdr.starting_track); | |
95 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_END_TRACK=%d\n", tochdr.ending_track); | |
96 } | |
97 for (i = tochdr.starting_track; i <= tochdr.ending_track + 1; i++) { | |
93 struct ioc_read_toc_entry tocentry; | 98 struct ioc_read_toc_entry tocentry; |
94 struct cd_toc_entry tocentry_data; | 99 struct cd_toc_entry tocentry_data; |
95 | 100 |
96 tocentry.starting_track = i; | 101 tocentry.starting_track = i<=tochdr.ending_track ? i : CDROM_LEADOUT; |
97 tocentry.address_format = CD_MSF_FORMAT; | 102 tocentry.address_format = CD_MSF_FORMAT; |
98 tocentry.data_len = sizeof(struct cd_toc_entry); | 103 tocentry.data_len = sizeof(struct cd_toc_entry); |
99 tocentry.data = &tocentry_data; | 104 tocentry.data = &tocentry_data; |
100 | 105 |
101 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { | 106 if (ioctl(fd, CDIOREADTOCENTRYS, &tocentry) == -1) { |
102 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); | 107 mp_msg(MSGT_OPEN,MSGL_ERR,"read CDROM toc entry: %s\n",strerror(errno)); |
103 return NULL; | 108 return NULL; |
104 } | 109 } |
110 if (i <= tochdr.ending_track) | |
105 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", | 111 mp_msg(MSGT_OPEN,MSGL_INFO,"track %02d: adr=%d ctrl=%d format=%d %02d:%02d:%02d\n", |
106 (int) tocentry.starting_track, | 112 (int) tocentry.starting_track, |
107 (int) tocentry.data->addr_type, | 113 (int) tocentry.data->addr_type, |
108 (int) tocentry.data->control, | 114 (int) tocentry.data->control, |
109 (int) tocentry.address_format, | 115 (int) tocentry.address_format, |
110 (int) tocentry.data->addr.msf.minute, | 116 (int) tocentry.data->addr.msf.minute, |
111 (int) tocentry.data->addr.msf.second, | 117 (int) tocentry.data->addr.msf.second, |
112 (int) tocentry.data->addr.msf.frame | 118 (int) tocentry.data->addr.msf.frame |
113 ); | 119 ); |
120 | |
121 if (identify) | |
122 { | |
123 if (i > tochdr.starting_track) | |
124 { | |
125 min = tocentry.data->addr.msf.minute - min; | |
126 sec = tocentry.data->addr.msf.second - sec; | |
127 frame = tocentry.data->addr.msf.frame - frame; | |
128 if ( frame < 0 ) | |
129 { | |
130 frame += 75; | |
131 sec --; | |
132 } | |
133 if ( sec < 0 ) | |
134 { | |
135 sec += 60; | |
136 min --; | |
137 } | |
138 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_VCD_TRACK_%d_MSF=%02d:%02d:%02d\n", i - 1, min, sec, frame); | |
139 } | |
140 min = tocentry.data->addr.msf.minute; | |
141 sec = tocentry.data->addr.msf.second; | |
142 frame = tocentry.data->addr.msf.frame; | |
143 } | |
114 } | 144 } |
115 vcd = malloc(sizeof(mp_vcd_priv_t)); | 145 vcd = malloc(sizeof(mp_vcd_priv_t)); |
116 vcd->fd = fd; | 146 vcd->fd = fd; |
117 return vcd; | 147 return vcd; |
118 } | 148 } |