Changeset 4018
- Timestamp:
- Apr 4, 2012 5:45:46 AM (12 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 2 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, -
pjproject/trunk/pjsip-apps/src/samples/aviplay.c
r3905 r4018 85 85 {PJMEDIA_FORMAT_H263 , "h263" , 86 86 PJ_FALSE, 0}, 87 {PJMEDIA_FORMAT_XVID , "xvid"}, 87 {PJMEDIA_FORMAT_MPEG4, "mp4v"}, 88 {PJMEDIA_FORMAT_H264 , "h264"} 88 89 }; 89 90 … … 270 271 } 271 272 273 pjmedia_format_copy(&codec_param.enc_fmt, ¶m.vidparam.fmt); 274 272 275 pjmedia_vid_dev_get_info(param.vidparam.rend_id, &rdr_info); 273 276 for (i=0; i<codec_info->dec_fmt_id_cnt; ++i) { … … 276 279 { 277 280 param.vidparam.fmt.id = codec_info->dec_fmt_id[i]; 281 i = codec_info->dec_fmt_id_cnt; 282 break; 278 283 } 279 284 } … … 293 298 294 299 pjmedia_format_copy(&codec_param.dec_fmt, ¶m.vidparam.fmt); 300 codec_param.dir = PJMEDIA_DIR_DECODING; 295 301 codec_param.packing = PJMEDIA_VID_PACKING_WHOLE; 296 302 status = pjmedia_vid_codec_open(codec, &codec_param);
Note: See TracChangeset
for help on using the changeset viewer.