Changeset 4018 for pjproject/trunk/pjmedia/src/pjmedia/avi_player.c
- Timestamp:
- Apr 4, 2012 5:45:46 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia/avi_player.c
r4014 r4018 92 92 #endif 93 93 94 typedef struct avi_fmt_info 95 { 96 pjmedia_format_id fmt_id; 97 pjmedia_format_id eff_fmt_id; 98 } avi_fmt_info; 99 100 static avi_fmt_info avi_fmts[] = 101 { 102 {PJMEDIA_FORMAT_MJPEG}, {PJMEDIA_FORMAT_H264}, 103 {PJMEDIA_FORMAT_UYVY}, {PJMEDIA_FORMAT_YUY2}, 104 {PJMEDIA_FORMAT_IYUV}, {PJMEDIA_FORMAT_I420}, 105 {PJMEDIA_FORMAT_DIB}, {PJMEDIA_FORMAT_RGB24}, 106 {PJMEDIA_FORMAT_RGB32}, 107 {PJMEDIA_FORMAT_PACK('X','V','I','D'), PJMEDIA_FORMAT_MPEG4}, 108 {PJMEDIA_FORMAT_PACK('x','v','i','d'), PJMEDIA_FORMAT_MPEG4}, 109 {PJMEDIA_FORMAT_PACK('D','I','V','X'), PJMEDIA_FORMAT_MPEG4}, 110 }; 111 94 112 struct pjmedia_avi_streams 95 113 { … … 347 365 PJMEDIA_AVI_VIDS_TAG)) 348 366 { 349 /* Check supported video formats here */ 350 if (avi_hdr.strl_hdr[i].flags & AVISF_VIDEO_PALCHANGES || 351 (avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_MJPEG && 352 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_XVID && 353 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_UYVY && 354 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_YUY2 && 355 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_IYUV && 356 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_I420 && 357 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_DIB && 358 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_RGB24 && 359 avi_hdr.strl_hdr[i].codec != PJMEDIA_FORMAT_RGB32)) 360 { 367 int j; 368 369 if (avi_hdr.strl_hdr[i].flags & AVISF_VIDEO_PALCHANGES) { 361 370 PJ_LOG(4, (THIS_FILE, "Unsupported video stream")); 362 371 continue; 363 372 } 373 364 374 fmt_id = avi_hdr.strl_hdr[i].codec; 375 for (j = sizeof(avi_fmts)/sizeof(avi_fmts[0])-1; j >= 0; j--) { 376 /* Check supported video formats here */ 377 if (fmt_id == avi_fmts[j].fmt_id) { 378 if (avi_fmts[j].eff_fmt_id) 379 fmt_id = avi_fmts[j].eff_fmt_id; 380 break; 381 } 382 } 383 384 if (j < 0) { 385 PJ_LOG(4, (THIS_FILE, "Unsupported video stream")); 386 continue; 387 } 365 388 } else { 366 389 /* Check supported audio formats here */ … … 380 403 } 381 404 382 if (nstr == 0) { 383 fport[0]->stream_id = i; 384 nstr++; 385 continue; 386 } 387 388 /* Create fport instance. */ 389 fport[nstr] = create_avi_port(pool); 390 if (!fport[nstr]) { 391 status = PJ_ENOMEM; 392 goto on_error; 405 if (nstr > 0) { 406 /* Create fport instance. */ 407 fport[nstr] = create_avi_port(pool); 408 if (!fport[nstr]) { 409 status = PJ_ENOMEM; 410 goto on_error; 411 } 412 413 /* Open file. */ 414 status = pj_file_open(pool, filename, PJ_O_RDONLY, 415 &fport[nstr]->fd); 416 if (status != PJ_SUCCESS) 417 goto on_error; 418 419 /* Set the file position */ 420 status = pj_file_setpos(fport[nstr]->fd, pos, PJ_SEEK_SET); 421 if (status != PJ_SUCCESS) { 422 goto on_error; 423 } 393 424 } 394 425 395 426 fport[nstr]->stream_id = i; 396 427 fport[nstr]->fmt_id = fmt_id; 397 398 /* Open file. */399 status = pj_file_open(pool, filename, PJ_O_RDONLY, &fport[nstr]->fd);400 if (status != PJ_SUCCESS)401 goto on_error;402 403 /* Set the file position */404 status = pj_file_setpos(fport[nstr]->fd, pos, PJ_SEEK_SET);405 if (status != PJ_SUCCESS) {406 goto on_error;407 }408 428 409 429 nstr++; … … 435 455 fport[i]->bits_per_sample = (vfi ? vfi->bpp : 0); 436 456 pjmedia_format_init_video(&fport[i]->base.info.fmt, 437 strl_hdr->codec,457 fport[i]->fmt_id, 438 458 strf_hdr->biWidth, 439 459 strf_hdr->biHeight,
Note: See TracChangeset
for help on using the changeset viewer.