Changeset 4922
- Timestamp:
- Sep 15, 2014 9:02:15 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/dshow_dev.c
r4722 r4922 272 272 const GUID *dshow_fmt, 273 273 AM_MEDIA_TYPE **pMediatype, 274 int width, 275 int height, 274 276 IPin **pSrcpin, 275 pj _bool_t *sup_fmt)277 pjmedia_vid_dev_info *vdi) 276 278 { 277 279 IEnumPins *pEnum; 278 280 AM_MEDIA_TYPE *mediatype = NULL; 281 pj_bool_t match_wh = PJ_FALSE; 279 282 HRESULT hr; 280 283 … … 334 337 rpcstatus2 == RPC_S_OK) 335 338 { 339 VIDEOINFOHEADER *vi; 340 341 vi = (VIDEOINFOHEADER *)mediatype->pbFormat; 336 342 if (!dshow_fmt) 337 343 dshow_fmts[j].enabled = PJ_TRUE; 338 if (sup_fmt) 339 sup_fmt[j] = PJ_TRUE; 340 if (pSrcpin) { 344 345 if (vdi && vdi->fmt_cnt < 346 PJMEDIA_VID_DEV_INFO_FMT_CNT) 347 { 348 unsigned fps_num=DEFAULT_FPS, fps_denum=1; 349 350 if (vi->AvgTimePerFrame != 0) { 351 fps_num = 10000000; 352 fps_denum=(unsigned)vi->AvgTimePerFrame; 353 } 354 355 pjmedia_format_init_video( 356 &vdi->fmt[vdi->fmt_cnt++], 357 dshow_fmts[j].pjmedia_format, 358 vi->bmiHeader.biWidth, 359 vi->bmiHeader.biHeight, 360 fps_num, fps_denum); 361 } 362 363 if (pSrcpin) { 364 if ((width == 0 && height == 0 ) || 365 (vi->bmiHeader.biWidth == width && 366 vi->bmiHeader.biHeight == height)) 367 { 368 match_wh = PJ_TRUE; 369 } 341 370 *pSrcpin = pPin; 342 371 *pMediatype = mediatype; … … 344 373 } 345 374 } 346 if (pSrcpin && *pSrcpin )375 if (pSrcpin && *pSrcpin && match_wh) 347 376 break; 348 377 } … … 378 407 } 379 408 409 for (c = 0; c < sizeof(dshow_fmts) / sizeof(dshow_fmts[0]); c++) { 410 dshow_fmts[c].enabled = PJ_FALSE; 411 } 412 380 413 df->dev_count = 0; 381 414 df->dev_pool = pj_pool_create(df->pf, "dshow video", 500, 500, NULL); … … 447 480 hr = get_cap_device(df, df->dev_count-1, &filter); 448 481 if (SUCCEEDED(hr)) { 449 unsigned j;450 pj_bool_t sup_fmt[sizeof(dshow_fmts)/sizeof(dshow_fmts[0])];451 452 pj_bzero(sup_fmt, sizeof(sup_fmt));453 enum_dev_cap(filter, ddi->info.dir, NULL, NULL, NULL, sup_fmt);454 455 482 ddi->info.fmt_cnt = 0; 456 for (j = 0; 457 j < sizeof(dshow_fmts)/sizeof(dshow_fmts[0]); 458 j++) 459 { 460 if (!sup_fmt[j]) 461 continue; 462 pjmedia_format_init_video( 463 &ddi->info.fmt[ddi->info.fmt_cnt++], 464 dshow_fmts[j].pjmedia_format, 465 DEFAULT_WIDTH, DEFAULT_HEIGHT, 466 DEFAULT_FPS, 1); 467 } 483 enum_dev_cap(filter, ddi->info.dir, NULL, NULL, 484 0, 0, NULL, &ddi->info); 468 485 } 469 486 } … … 736 753 enum_dev_cap(graph->source_filter, dir, 737 754 get_dshow_format_info(strm->param.fmt.id)->dshow_format, 738 &mediatype, &srcpin, NULL); 755 &mediatype, (use_def_size? 0: vfd->size.w), 756 (use_def_size? 0: vfd->size.h), &srcpin, NULL); 739 757 graph->mediatype = mediatype; 740 758
Note: See TracChangeset
for help on using the changeset viewer.