Mercurial > mplayer.hg
comparison mplayer.c @ 557:e4aca0d51268
some dvd sub parsing and check added
author | arpi_esp |
---|---|
date | Sat, 21 Apr 2001 02:24:36 +0000 |
parents | 5bfbe42747e5 |
children | 28ae99036574 |
comparison
equal
deleted
inserted
replaced
556:3d1e8b618594 | 557:e4aca0d51268 |
---|---|
181 | 181 |
182 printf("SUB ERROR: %d ? %d --- %d [%d] \n",key,vo_sub->start,vo_sub->end,current_sub); | 182 printf("SUB ERROR: %d ? %d --- %d [%d] \n",key,vo_sub->start,vo_sub->end,current_sub); |
183 | 183 |
184 vo_sub=NULL; // no sub here | 184 vo_sub=NULL; // no sub here |
185 } | 185 } |
186 | |
187 | |
188 | |
189 | |
190 | |
191 void spudec_process_control(unsigned char *control, int size, int* d1, int* d2) | |
192 { | |
193 int off = 2; | |
194 int a,b; /* Temporary vars */ | |
195 | |
196 do { | |
197 int type = control[off]; | |
198 off++; | |
199 printf("cmd=%d ",type); | |
200 | |
201 switch(type) { | |
202 case 0x00: | |
203 /* Menu ID, 1 byte */ | |
204 printf("Menu ID\n"); | |
205 break; | |
206 case 0x01: | |
207 /* Start display */ | |
208 printf("Start display!\n"); | |
209 // gSpudec.geom.bIsVisible = 1; | |
210 break; | |
211 case 0x03: | |
212 /* Palette */ | |
213 printf("Palette\n"); | |
214 // palette[3] = &(gSpudec.clut[(control[off] >> 4)]); | |
215 // palette[2] = &(gSpudec.clut[control[off] & 0xf]); | |
216 // palette[1] = &(gSpudec.clut[(control[off+1] >> 4)]); | |
217 // palette[0] = &(gSpudec.clut[control[off+1] & 0xf]); | |
218 off+=2; | |
219 break; | |
220 case 0x04: | |
221 /* Alpha */ | |
222 printf("Alpha\n"); | |
223 // alpha[3] = control[off] & 0xf0; | |
224 // alpha[2] = (control[off] & 0xf) << 4; | |
225 // alpha[1] = control[off+1] & 0xf0; | |
226 // alpha[0] = (control[off+1] & 0xf) << 4; | |
227 off+=2; | |
228 break; | |
229 case 0x05: | |
230 /* Co-ords */ | |
231 a = (control[off] << 16) + (control[off+1] << 8) + control[off+2]; | |
232 b = (control[off+3] << 16) + (control[off+4] << 8) + control[off+5]; | |
233 | |
234 printf("Coords col: %d - %d row: %d - %d\n",a >> 12,a & 0xfff,b >> 12,b & 0xfff); | |
235 | |
236 // gSpudec.geom.start_col = a >> 12; | |
237 // gSpudec.geom.end_col = a & 0xfff; | |
238 // gSpudec.geom.start_row = b >> 12; | |
239 // gSpudec.geom.end_row = b & 0xfff; | |
240 | |
241 off+=6; | |
242 break; | |
243 case 0x06: | |
244 /* Graphic lines */ | |
245 *(d1) = (control[off] << 8) + control[off+1]; | |
246 *(d2) = (control[off+2] << 8) + control[off+3]; | |
247 printf("Graphic pos color: %d b/w: %d\n",*d1,*d2); | |
248 off+=4; | |
249 break; | |
250 case 0xff: | |
251 /* All done, bye-bye */ | |
252 printf("Done!\n"); | |
253 return; | |
254 break; | |
255 default: | |
256 printf("spudec: Error determining control type 0x%02x.\n",type); | |
257 return; | |
258 break; | |
259 } | |
260 | |
261 /* printf("spudec: Processsed control type 0x%02x.\n",type); */ | |
262 } while(off < size); | |
263 } | |
264 | |
265 | |
186 | 266 |
187 //**************************************************************************// | 267 //**************************************************************************// |
188 // Config file | 268 // Config file |
189 //**************************************************************************// | 269 //**************************************************************************// |
190 | 270 |
2056 find_sub(sub_uses_time?(100*(v_pts+sub_delay)):((v_pts+sub_delay)*sub_fps)); // FIXME! frame counter... | 2136 find_sub(sub_uses_time?(100*(v_pts+sub_delay)):((v_pts+sub_delay)*sub_fps)); // FIXME! frame counter... |
2057 current_module=NULL; | 2137 current_module=NULL; |
2058 } | 2138 } |
2059 | 2139 |
2060 // DVD sub: | 2140 // DVD sub: |
2061 { unsigned char* buf=NULL; | 2141 { unsigned char* packet=NULL; |
2062 int len=ds_get_packet_sub(d_dvdsub,&buf); | 2142 int len=ds_get_packet_sub(d_dvdsub,&packet); |
2063 if(len>0){ | 2143 if(len>=2){ |
2064 printf("\rDVD sub: %d \n",len); | 2144 int len2; |
2145 len2=(packet[0]<<8)+packet[1]; | |
2146 printf("\rDVD sub: %d / %d \n",len,len2); | |
2147 if(len==len2){ | |
2148 | |
2149 //----------------------------------------------------- | |
2150 int x0, x1; | |
2151 int d1, d2; | |
2152 int lifetime; | |
2153 x0 = (packet[2] << 8) + packet[3]; | |
2154 x1 = (packet[x0+2] << 8) + packet[x0+3]; | |
2155 | |
2156 /* /Another/ sanity check. */ | |
2157 if((packet[x1+2]<<8) + packet[x1+3] != x1) { | |
2158 printf("spudec: Incorrect packet.\n"); | |
2159 return; | |
2160 } | |
2161 lifetime= ((packet[x1]<<8) + packet[x1+1]); | |
2162 printf("lifetime=%d\n",lifetime); | |
2163 | |
2164 d1 = d2 = -1; | |
2165 spudec_process_control(packet + x0 + 2, x1-x0-2, &d1, &d2); | |
2166 // if((d1 != -1) && (d2 != -1)) { | |
2167 // spudec_process_data(packet, x0, d1, d2); | |
2168 // } | |
2169 //----------------------------------------------------- | |
2170 | |
2171 } else printf("fragmented dvd-subs not yet supported!!!\n"); | |
2172 } else if(len>=0) { | |
2173 printf("invalud dvd sub\n"); | |
2065 } | 2174 } |
2066 } | 2175 } |
2067 | 2176 |
2068 } | 2177 } |
2069 | 2178 |