- Timestamp:
- Jul 20, 2016 6:55:11 AM (8 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c
r4722 r5392 635 635 { 636 636 struct sdl_stream *strm = (struct sdl_stream *)data; 637 637 638 638 #if PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL 639 639 if (strm->texture) { … … 653 653 SDL_DestroyRenderer(strm->renderer); 654 654 strm->renderer = NULL; 655 } 656 655 } 657 656 return PJ_SUCCESS; 658 657 } … … 660 659 static pj_status_t sdl_destroy_all(void *data) 661 660 { 662 struct sdl_stream *strm = (struct sdl_stream *)data; 661 struct sdl_stream *strm = (struct sdl_stream *)data; 663 662 664 663 sdl_destroy(data); … … 671 670 strm->window = NULL; 672 671 #endif /* TARGET_OS_IPHONE */ 673 674 return PJ_SUCCESS; 675 } 676 677 static pj_status_t sdl_create_rend(struct sdl_stream * strm, 678 pjmedia_format *fmt) 679 { 680 sdl_fmt_info *sdl_info; 681 const pjmedia_video_format_info *vfi; 682 pjmedia_video_format_detail *vfd; 683 684 sdl_info = get_sdl_format_info(fmt->id); 685 vfi = pjmedia_get_video_format_info(pjmedia_video_format_mgr_instance(), 686 fmt->id); 687 if (!vfi || !sdl_info) 688 return PJMEDIA_EVID_BADFORMAT; 689 690 strm->vafp.size = fmt->det.vid.size; 691 strm->vafp.buffer = NULL; 692 if (vfi->apply_fmt(vfi, &strm->vafp) != PJ_SUCCESS) 693 return PJMEDIA_EVID_BADFORMAT; 694 695 vfd = pjmedia_format_get_video_format_detail(fmt, PJ_TRUE); 696 strm->rect.x = strm->rect.y = 0; 697 strm->rect.w = (Uint16)vfd->size.w; 698 strm->rect.h = (Uint16)vfd->size.h; 699 if (strm->param.disp_size.w == 0) 700 strm->param.disp_size.w = strm->rect.w; 701 if (strm->param.disp_size.h == 0) 702 strm->param.disp_size.h = strm->rect.h; 703 strm->dstrect.x = strm->dstrect.y = 0; 704 strm->dstrect.w = (Uint16)strm->param.disp_size.w; 705 strm->dstrect.h = (Uint16)strm->param.disp_size.h; 706 707 sdl_destroy(strm); 708 709 #if PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL 710 if (strm->param.rend_id == OPENGL_DEV_IDX) { 711 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); 712 } 713 #endif /* PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL */ 714 672 return PJ_SUCCESS; 673 } 674 675 static pj_status_t sdl_create_window(struct sdl_stream *strm, 676 pj_bool_t use_app_win, 677 Uint32 sdl_format, 678 pjmedia_vid_dev_hwnd *hwnd) 679 { 715 680 if (!strm->window) { 716 681 Uint32 flags = 0; … … 737 702 if (strm->param.rend_id == OPENGL_DEV_IDX) 738 703 flags |= SDL_WINDOW_OPENGL; 739 #endif /* PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL */ 740 741 if (strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW) { 742 /* Use the window supplied by the application. */ 743 strm->window = SDL_CreateWindowFrom( 744 strm->param.window.info.window); 704 #endif /* PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL */ 705 if (use_app_win) { 706 /* Use the window supplied by the application. */ 707 strm->window = SDL_CreateWindowFrom(hwnd->info.window); 745 708 if (!strm->window) { 746 709 sdl_log_err("SDL_CreateWindowFrom()"); … … 813 776 #endif /* PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL */ 814 777 { 815 strm->scr_tex = SDL_CreateTexture(strm->renderer, sdl_ info->sdl_format,778 strm->scr_tex = SDL_CreateTexture(strm->renderer, sdl_format, 816 779 SDL_TEXTUREACCESS_STREAMING, 817 780 strm->rect.w, strm->rect.h); … … 821 784 } 822 785 823 strm->pitch = strm->rect.w * SDL_BYTESPERPIXEL(sdl_info->sdl_format); 824 } 825 826 return PJ_SUCCESS; 786 strm->pitch = strm->rect.w * SDL_BYTESPERPIXEL(sdl_format); 787 } 788 789 return PJ_SUCCESS; 790 } 791 792 static pj_status_t sdl_create_rend(struct sdl_stream * strm, 793 pjmedia_format *fmt) 794 { 795 sdl_fmt_info *sdl_info; 796 const pjmedia_video_format_info *vfi; 797 pjmedia_video_format_detail *vfd; 798 799 sdl_info = get_sdl_format_info(fmt->id); 800 vfi = pjmedia_get_video_format_info(pjmedia_video_format_mgr_instance(), 801 fmt->id); 802 if (!vfi || !sdl_info) 803 return PJMEDIA_EVID_BADFORMAT; 804 805 strm->vafp.size = fmt->det.vid.size; 806 strm->vafp.buffer = NULL; 807 if (vfi->apply_fmt(vfi, &strm->vafp) != PJ_SUCCESS) 808 return PJMEDIA_EVID_BADFORMAT; 809 810 vfd = pjmedia_format_get_video_format_detail(fmt, PJ_TRUE); 811 strm->rect.x = strm->rect.y = 0; 812 strm->rect.w = (Uint16)vfd->size.w; 813 strm->rect.h = (Uint16)vfd->size.h; 814 if (strm->param.disp_size.w == 0) 815 strm->param.disp_size.w = strm->rect.w; 816 if (strm->param.disp_size.h == 0) 817 strm->param.disp_size.h = strm->rect.h; 818 strm->dstrect.x = strm->dstrect.y = 0; 819 strm->dstrect.w = (Uint16)strm->param.disp_size.w; 820 strm->dstrect.h = (Uint16)strm->param.disp_size.h; 821 822 sdl_destroy(strm); 823 824 #if PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL 825 if (strm->param.rend_id == OPENGL_DEV_IDX) { 826 SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER,1); 827 } 828 #endif /* PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL */ 829 return sdl_create_window(strm, 830 (strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW), 831 sdl_info->sdl_format, 832 &strm->param.window); 827 833 } 828 834 … … 1166 1172 SDL_SetWindowSize(strm->window, new_size->w, new_size->h); 1167 1173 return resize_disp(strm, new_size); 1174 } else if (cap == PJMEDIA_VID_DEV_CAP_OUTPUT_WINDOW) { 1175 pjmedia_vid_dev_hwnd *hwnd = (pjmedia_vid_dev_hwnd*)pval; 1176 pj_status_t status = PJ_SUCCESS; 1177 sdl_fmt_info *sdl_info = get_sdl_format_info(strm->param.fmt.id); 1178 /* Re-init SDL */ 1179 status = sdl_destroy_all(strm); 1180 if (status != PJ_SUCCESS) 1181 return status; 1182 1183 status = sdl_create_window(strm, PJ_TRUE, sdl_info->sdl_format, hwnd); 1184 PJ_LOG(4, (THIS_FILE, "Re-initializing SDL with native window" 1185 " %d: %s", hwnd->info.window, 1186 (status == PJ_SUCCESS? "success": "failed"))); 1187 return status; 1168 1188 } 1169 1189 -
pjproject/trunk/pjsip-apps/src/swig/java/sample.java
r4997 r5392 85 85 private static MyAppObserver observer = new MyObserver(); 86 86 private static MyAccount account = null; 87 private static AccountConfig accCfg = null; 88 87 private static AccountConfig accCfg = null; 88 89 // Snippet code to set native window to output video 90 /* 91 private void setOutputVidWin() {} 92 VideoWindowHandle vidWH = new VideoWindowHandle(); 93 vidWH.getHandle().setWindow(getNativeWindow()); 94 try { 95 currentCall.vidWin.setWindow(vidWH); 96 } catch (Exception e) { 97 System.out.println(e); 98 } 99 } 100 */ 101 89 102 private static void runWorker() { 90 103 try { -
pjproject/trunk/pjsip-apps/src/swig/pjsua2.i
r5165 r5392 115 115 %template(CodecFmtpVector) std::vector<pj::CodecFmtp>; 116 116 117 %ignore pj::WindowHandle::display; 118 %ignore pj::WindowHandle::window; 119 117 120 /* pj::WindowHandle::setWindow() receives Surface object */ 118 121 #if defined(SWIGJAVA) && defined(__ANDROID__) … … 124 127 #endif 125 128 %} 126 %ignore pj::WindowHandle::display;127 %ignore pj::WindowHandle::window;128 129 %typemap(in) jobject surface { 129 130 $1 = ($input? (jobject)ANativeWindow_fromSurface(jenv, $input): NULL); … … 131 132 %extend pj::WindowHandle { 132 133 void setWindow(jobject surface) { $self->window = surface; } 134 } 135 #else 136 %extend pj::WindowHandle { 137 void setWindow(long long hwnd) { $self->window = (void*)hwnd; } 133 138 } 134 139 #endif
Note: See TracChangeset
for help on using the changeset viewer.