Changeset 3580
- Timestamp:
- Jun 9, 2011 4:08:47 AM (13 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/colorbar_dev.c
r3489 r3580 379 379 PJ_ASSERT_RETURN(f && param && p_vid_strm, PJ_EINVAL); 380 380 PJ_ASSERT_RETURN(param->fmt.type == PJMEDIA_TYPE_VIDEO && 381 param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO, 381 param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO && 382 param->dir == PJMEDIA_DIR_CAPTURE, 382 383 PJ_EINVAL); 383 384 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/dshow_dev.c
r3511 r3580 66 66 {PJMEDIA_FORMAT_YUY2, &MEDIASUBTYPE_YUY2} , 67 67 {PJMEDIA_FORMAT_RGB24, &MEDIASUBTYPE_RGB24} , 68 {PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} ,68 // {PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} , 69 69 //{PJMEDIA_FORMAT_IYUV, &MEDIASUBTYPE_IYUV} , 70 70 }; … … 114 114 IBaseFilter *rend_filter; 115 115 AM_MEDIA_TYPE *mediatype; 116 } dgraph [2];116 } dgraph; 117 117 118 118 pj_timestamp cap_ts; … … 384 384 385 385 pj_bzero(param, sizeof(*param)); 386 if (di->info.dir & PJMEDIA_DIR_CAPTURE_RENDER) { 387 param->dir = PJMEDIA_DIR_CAPTURE_RENDER; 388 param->cap_id = index; 389 param->rend_id = index; 390 } else if (di->info.dir & PJMEDIA_DIR_CAPTURE) { 386 if (di->info.dir & PJMEDIA_DIR_CAPTURE) { 391 387 param->dir = PJMEDIA_DIR_CAPTURE; 392 388 param->cap_id = index; … … 402 398 /* Set the device capabilities here */ 403 399 param->clock_rate = DEFAULT_CLOCK_RATE; 404 //param->frame_rate.num = DEFAULT_FPS;405 //param->frame_rate.denum = 1;406 400 param->flags = PJMEDIA_VID_DEV_CAP_FORMAT; 407 401 … … 451 445 { 452 446 struct dshow_stream *stream = (struct dshow_stream*)strm; 453 unsigned i;447 HRESULT hr; 454 448 455 449 if (stream->quit_flag) { … … 458 452 } 459 453 460 for (i = 0; i < 2; i++) { 461 if (stream->dgraph[i].csource_filter) { 462 HRESULT hr = SourceFilter_Deliver(stream->dgraph[i].csource_filter, 463 frame->buf, frame->size); 464 465 if (FAILED(hr)) { 466 return hr; 467 } 468 break; 469 } 470 } 454 hr = SourceFilter_Deliver(stream->dgraph.csource_filter, 455 frame->buf, frame->size); 456 if (FAILED(hr)) 457 return hr; 471 458 472 459 return PJ_SUCCESS; … … 728 715 static void destroy_filter_graph(struct dshow_stream * stream) 729 716 { 730 unsigned i; 731 732 for (i = 0; i < 2; i++) { 733 if (stream->dgraph[i].source_filter) { 734 IBaseFilter_Release(stream->dgraph[i].source_filter); 735 stream->dgraph[i].source_filter = NULL; 736 } 737 if (stream->dgraph[i].rend_filter) { 738 IBaseFilter_Release(stream->dgraph[i].rend_filter); 739 stream->dgraph[i].rend_filter = NULL; 740 } 741 if (stream->dgraph[i].media_filter) { 742 IMediaFilter_Release(stream->dgraph[i].media_filter); 743 stream->dgraph[i].media_filter = NULL; 744 } 745 if (stream->dgraph[i].filter_graph) { 746 IFilterGraph_Release(stream->dgraph[i].filter_graph); 747 stream->dgraph[i].filter_graph = NULL; 748 } 717 if (stream->dgraph.source_filter) { 718 IBaseFilter_Release(stream->dgraph.source_filter); 719 stream->dgraph.source_filter = NULL; 720 } 721 if (stream->dgraph.rend_filter) { 722 IBaseFilter_Release(stream->dgraph.rend_filter); 723 stream->dgraph.rend_filter = NULL; 724 } 725 if (stream->dgraph.media_filter) { 726 IMediaFilter_Release(stream->dgraph.media_filter); 727 stream->dgraph.media_filter = NULL; 728 } 729 if (stream->dgraph.filter_graph) { 730 IFilterGraph_Release(stream->dgraph.filter_graph); 731 stream->dgraph.filter_graph = NULL; 749 732 } 750 733 } … … 761 744 pj_pool_t *pool; 762 745 struct dshow_stream *strm; 763 unsigned ngraph = 0;764 746 pj_status_t status; 747 748 PJ_ASSERT_RETURN(param->dir == PJMEDIA_DIR_CAPTURE || 749 param->dir == PJMEDIA_DIR_RENDER, PJ_EINVAL); 765 750 766 751 if (!get_dshow_format_info(param->fmt.id)) … … 777 762 strm->user_data = user_data; 778 763 779 /* Create capture stream here */780 764 if (param->dir & PJMEDIA_DIR_CAPTURE) { 781 765 const pjmedia_video_format_detail *vfd; 782 766 767 /* Create capture stream here */ 783 768 status = create_filter_graph(PJMEDIA_DIR_CAPTURE, param->cap_id, 784 769 PJ_FALSE, PJ_FALSE, df, strm, 785 &strm->dgraph [ngraph++]);770 &strm->dgraph); 786 771 if (status != PJ_SUCCESS) { 787 772 destroy_filter_graph(strm); … … 790 775 status = create_filter_graph(PJMEDIA_DIR_CAPTURE, param->cap_id, 791 776 PJ_FALSE, PJ_TRUE, df, strm, 792 &strm->dgraph [ngraph]);777 &strm->dgraph); 793 778 794 779 if (status != PJ_SUCCESS) { … … 801 786 param->cap_id, 802 787 PJ_TRUE, PJ_TRUE, df, strm, 803 &strm->dgraph [ngraph]);788 &strm->dgraph); 804 789 } 805 790 … … 811 796 vfd = pjmedia_format_get_video_format_detail(¶m->fmt, PJ_TRUE); 812 797 strm->cap_ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 813 } 814 815 /* Create render stream here */ 816 if (param->dir & PJMEDIA_DIR_RENDER) { 798 } else if (param->dir & PJMEDIA_DIR_RENDER) { 799 /* Create render stream here */ 817 800 status = create_filter_graph(PJMEDIA_DIR_RENDER, param->rend_id, 818 801 PJ_FALSE, PJ_FALSE, df, strm, 819 &strm->dgraph [ngraph++]);802 &strm->dgraph); 820 803 if (status != PJ_SUCCESS) 821 804 goto on_error; … … 903 886 { 904 887 struct dshow_stream *stream = (struct dshow_stream*)strm; 905 unsigned i;888 HRESULT hr; 906 889 907 890 stream->quit_flag = PJ_FALSE; … … 909 892 stream->rend_thread_exited = PJ_FALSE; 910 893 911 for (i = 0; i < 2; i++) { 912 HRESULT hr; 913 914 if (!stream->dgraph[i].media_filter) 915 continue; 916 hr = IMediaFilter_Run(stream->dgraph[i].media_filter, 0); 917 if (FAILED(hr)) { 918 char msg[80]; 919 if (AMGetErrorText(hr, msg, sizeof(msg))) { 920 PJ_LOG(4,(THIS_FILE, "Error starting media: %s", msg)); 921 } 922 return PJ_EUNKNOWN; 894 hr = IMediaFilter_Run(stream->dgraph.media_filter, 0); 895 if (FAILED(hr)) { 896 char msg[80]; 897 if (AMGetErrorText(hr, msg, sizeof(msg))) { 898 PJ_LOG(4,(THIS_FILE, "Error starting media: %s", msg)); 923 899 } 900 return PJ_EUNKNOWN; 924 901 } 925 902 … … 943 920 pj_thread_sleep(10); 944 921 945 for (i = 0; i < 2; i++) { 946 if (!stream->dgraph[i].media_filter) 947 continue; 948 IMediaFilter_Stop(stream->dgraph[i].media_filter); 949 } 922 IMediaFilter_Stop(stream->dgraph.media_filter); 950 923 951 924 PJ_LOG(4, (THIS_FILE, "Stopping dshow video stream")); -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c
r3578 r3580 392 392 393 393 pj_bzero(param, sizeof(*param)); 394 if (di->info.dir == PJMEDIA_DIR_CAPTURE_RENDER) { 395 param->dir = PJMEDIA_DIR_CAPTURE_RENDER; 396 param->cap_id = index; 397 param->rend_id = index; 398 } else if (di->info.dir & PJMEDIA_DIR_CAPTURE) { 399 param->dir = PJMEDIA_DIR_CAPTURE; 400 param->cap_id = index; 401 param->rend_id = PJMEDIA_VID_INVALID_DEV; 402 } else if (di->info.dir & PJMEDIA_DIR_RENDER) { 403 param->dir = PJMEDIA_DIR_RENDER; 404 param->rend_id = index; 405 param->cap_id = PJMEDIA_VID_INVALID_DEV; 406 } else { 407 return PJMEDIA_EVID_INVDEV; 408 } 394 param->dir = PJMEDIA_DIR_RENDER; 395 param->rend_id = index; 396 param->cap_id = PJMEDIA_VID_INVALID_DEV; 409 397 410 398 /* Set the device capabilities here */ … … 412 400 param->fmt.type = PJMEDIA_TYPE_VIDEO; 413 401 param->clock_rate = DEFAULT_CLOCK_RATE; 414 pjmedia_format_init_video(¶m->fmt, sdl_fmts[0].fmt_id, 415 DEFAULT_WIDTH, DEFAULT_HEIGHT, 416 DEFAULT_FPS, 1); 402 pj_memcpy(¶m->fmt, &di->info.fmt[0], sizeof(param->fmt)); 417 403 418 404 return PJ_SUCCESS; … … 1018 1004 pj_status_t status; 1019 1005 1006 PJ_ASSERT_RETURN(param->dir == PJMEDIA_DIR_RENDER, PJ_EINVAL); 1007 1020 1008 /* Create and Initialize stream descriptor */ 1021 1009 pool = pj_pool_create(sf->pf, "sdl-dev", 1000, 1000, NULL); … … 1027 1015 pj_memcpy(&strm->vid_cb, cb, sizeof(*cb)); 1028 1016 strm->user_data = user_data; 1029 1030 /* Create capture stream here */1031 if (param->dir & PJMEDIA_DIR_CAPTURE) {1032 }1033 1017 1034 1018 /* Create render stream here */ -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/v4l2_dev.c
r3489 r3580 532 532 PJ_ASSERT_RETURN(f && param && p_vid_strm, PJ_EINVAL); 533 533 PJ_ASSERT_RETURN(param->fmt.type == PJMEDIA_TYPE_VIDEO && 534 param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO, 534 param->fmt.detail_type == PJMEDIA_FORMAT_DETAIL_VIDEO && 535 param->dir == PJMEDIA_DIR_CAPTURE, 535 536 PJ_EINVAL); 536 537 PJ_ASSERT_RETURN(param->cap_id >= 0 && param->cap_id < cf->dev_count, -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/videoport.c
r3539 r3580 141 141 PJ_ASSERT_RETURN(pool && prm && p_vid_port, PJ_EINVAL); 142 142 PJ_ASSERT_RETURN(prm->vidparam.fmt.type == PJMEDIA_TYPE_VIDEO && 143 prm->vidparam.dir != PJMEDIA_DIR_NONE, 143 prm->vidparam.dir != PJMEDIA_DIR_NONE && 144 prm->vidparam.dir != PJMEDIA_DIR_CAPTURE_RENDER, 144 145 PJ_EINVAL); 145 146
Note: See TracChangeset
for help on using the changeset viewer.