comparison dvdsubdec.c @ 9999:c78fd9154378 libavcodec

Change av_log() calls surrounded by '#ifdef DEBUG' into dprintf macros.
author diego
date Thu, 30 Jul 2009 21:00:08 +0000
parents b8a9cfe64488
children a1b42791b13d
comparison
equal deleted inserted replaced
9998:6b229807a182 9999:c78fd9154378
192 cmd_pos = READ_OFFSET(buf + cmd_pos); 192 cmd_pos = READ_OFFSET(buf + cmd_pos);
193 193
194 while ((cmd_pos + 2 + offset_size) < buf_size) { 194 while ((cmd_pos + 2 + offset_size) < buf_size) {
195 date = AV_RB16(buf + cmd_pos); 195 date = AV_RB16(buf + cmd_pos);
196 next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2); 196 next_cmd_pos = READ_OFFSET(buf + cmd_pos + 2);
197 #ifdef DEBUG 197 dprintf(NULL, "cmd_pos=0x%04x next=0x%04x date=%d\n",
198 av_log(NULL, AV_LOG_INFO, "cmd_pos=0x%04x next=0x%04x date=%d\n", 198 cmd_pos, next_cmd_pos, date);
199 cmd_pos, next_cmd_pos, date);
200 #endif
201 pos = cmd_pos + 2 + offset_size; 199 pos = cmd_pos + 2 + offset_size;
202 offset1 = -1; 200 offset1 = -1;
203 offset2 = -1; 201 offset2 = -1;
204 x1 = y1 = x2 = y2 = 0; 202 x1 = y1 = x2 = y2 = 0;
205 while (pos < buf_size) { 203 while (pos < buf_size) {
206 cmd = buf[pos++]; 204 cmd = buf[pos++];
207 #ifdef DEBUG 205 dprintf(NULL, "cmd=%02x\n", cmd);
208 av_log(NULL, AV_LOG_INFO, "cmd=%02x\n", cmd);
209 #endif
210 switch(cmd) { 206 switch(cmd) {
211 case 0x00: 207 case 0x00:
212 /* menu subpicture */ 208 /* menu subpicture */
213 is_menu = 1; 209 is_menu = 1;
214 break; 210 break;
237 alpha[3] = buf[pos] >> 4; 233 alpha[3] = buf[pos] >> 4;
238 alpha[2] = buf[pos] & 0x0f; 234 alpha[2] = buf[pos] & 0x0f;
239 alpha[1] = buf[pos + 1] >> 4; 235 alpha[1] = buf[pos + 1] >> 4;
240 alpha[0] = buf[pos + 1] & 0x0f; 236 alpha[0] = buf[pos + 1] & 0x0f;
241 pos += 2; 237 pos += 2;
242 #ifdef DEBUG 238 dprintf(NULL, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
243 av_log(NULL, AV_LOG_INFO, "alpha=%x%x%x%x\n", alpha[0],alpha[1],alpha[2],alpha[3]);
244 #endif
245 break; 239 break;
246 case 0x05: 240 case 0x05:
247 case 0x85: 241 case 0x85:
248 if ((buf_size - pos) < 6) 242 if ((buf_size - pos) < 6)
249 goto fail; 243 goto fail;
251 x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2]; 245 x2 = ((buf[pos + 1] & 0x0f) << 8) | buf[pos + 2];
252 y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4); 246 y1 = (buf[pos + 3] << 4) | (buf[pos + 4] >> 4);
253 y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5]; 247 y2 = ((buf[pos + 4] & 0x0f) << 8) | buf[pos + 5];
254 if (cmd & 0x80) 248 if (cmd & 0x80)
255 is_8bit = 1; 249 is_8bit = 1;
256 #ifdef DEBUG 250 dprintf(NULL, "x1=%d x2=%d y1=%d y2=%d\n", x1, x2, y1, y2);
257 av_log(NULL, AV_LOG_INFO, "x1=%d x2=%d y1=%d y2=%d\n",
258 x1, x2, y1, y2);
259 #endif
260 pos += 6; 251 pos += 6;
261 break; 252 break;
262 case 0x06: 253 case 0x06:
263 if ((buf_size - pos) < 4) 254 if ((buf_size - pos) < 4)
264 goto fail; 255 goto fail;
265 offset1 = AV_RB16(buf + pos); 256 offset1 = AV_RB16(buf + pos);
266 offset2 = AV_RB16(buf + pos + 2); 257 offset2 = AV_RB16(buf + pos + 2);
267 #ifdef DEBUG 258 dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
268 av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
269 #endif
270 pos += 4; 259 pos += 4;
271 break; 260 break;
272 case 0x86: 261 case 0x86:
273 if ((buf_size - pos) < 8) 262 if ((buf_size - pos) < 8)
274 goto fail; 263 goto fail;
275 offset1 = AV_RB32(buf + pos); 264 offset1 = AV_RB32(buf + pos);
276 offset2 = AV_RB32(buf + pos + 4); 265 offset2 = AV_RB32(buf + pos + 4);
277 #ifdef DEBUG 266 dprintf(NULL, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
278 av_log(NULL, AV_LOG_INFO, "offset1=0x%04x offset2=0x%04x\n", offset1, offset2);
279 #endif
280 pos += 8; 267 pos += 8;
281 break; 268 break;
282 269
283 case 0x83: 270 case 0x83:
284 /* HD set palette */ 271 /* HD set palette */
297 break; 284 break;
298 285
299 case 0xff: 286 case 0xff:
300 goto the_end; 287 goto the_end;
301 default: 288 default:
302 #ifdef DEBUG 289 dprintf(NULL, "unrecognised subpicture command 0x%x\n", cmd);
303 av_log(NULL, AV_LOG_INFO, "unrecognised subpicture command 0x%x\n", cmd);
304 #endif
305 goto the_end; 290 goto the_end;
306 } 291 }
307 } 292 }
308 the_end: 293 the_end:
309 if (offset1 >= 0) { 294 if (offset1 >= 0) {
493 } 478 }
494 if (!is_menu && find_smallest_bounding_rectangle(sub) == 0) 479 if (!is_menu && find_smallest_bounding_rectangle(sub) == 0)
495 goto no_subtitle; 480 goto no_subtitle;
496 481
497 #if defined(DEBUG) 482 #if defined(DEBUG)
498 av_log(NULL, AV_LOG_INFO, "start=%d ms end =%d ms\n", 483 dprintf(NULL, "start=%d ms end =%d ms\n",
499 sub->start_display_time, 484 sub->start_display_time,
500 sub->end_display_time); 485 sub->end_display_time);
501 ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0], 486 ppm_save("/tmp/a.ppm", sub->rects[0]->pict.data[0],
502 sub->rects[0]->w, sub->rects[0]->h, sub->rects[0]->pict.data[1]); 487 sub->rects[0]->w, sub->rects[0]->h, sub->rects[0]->pict.data[1]);
503 #endif 488 #endif
504 489
505 *data_size = 1; 490 *data_size = 1;