Changeset 3724
- Timestamp:
- Aug 25, 2011 11:59:39 AM (13 years ago)
- Location:
- pjproject/trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/sdl_dev.c
r3720 r3724 705 705 if (!((strm->param.flags & PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE) && 706 706 strm->param.window_hide)) 707 { 707 708 flags |= SDL_WINDOW_SHOWN; 709 } else { 710 flags &= ~SDL_WINDOW_SHOWN; 711 flags |= SDL_WINDOW_HIDDEN; 712 } 708 713 709 714 #if PJMEDIA_VIDEO_DEV_SDL_HAS_OPENGL -
pjproject/trunk/pjsip-apps/src/vidgui/vidgui.cpp
r3721 r3724 29 29 30 30 #define LOG_FILE "vidgui.log" 31 #define THIS_FILE "vidgui.cpp" 31 32 32 33 // These configure SIP registration … … 84 85 /* Right pane */ 85 86 vbox_right->addWidget((localUri_ = new QLabel)); 86 vbox_right->addWidget((previewButton_=new QPushButton(tr("Start Preview"))));87 vbox_right->addWidget((previewButton_=new QPushButton(tr("Start &Preview")))); 87 88 vbox_right->addWidget((callButton_=new QPushButton(tr("Call")))); 88 89 vbox_right->addWidget((hangupButton_=new QPushButton(tr("Hangup")))); … … 121 122 //statusBar_->showMessage(msg); 122 123 statusBar_->setText(msg); 123 PJ_LOG(3,( "vidgui.cpp", "%s", msg));124 PJ_LOG(3,(THIS_FILE, "%s", msg)); 124 125 } 125 126 … … 177 178 pjsua_vid_preview_stop(DEFAULT_CAP_DEV); 178 179 179 previewButton_->setText(tr("Start Preview")); 180 showStatus("Preview stopped"); 181 previewButton_->setText(tr("Start &Preview")); 180 182 } else { 181 183 pjsua_vid_win_id wid; … … 184 186 pj_status_t status; 185 187 186 pj _bzero(&pre_param, sizeof(pre_param));188 pjsua_vid_preview_param_default(&pre_param); 187 189 pre_param.rend_id = DEFAULT_REND_DEV; 190 pre_param.show = PJ_FALSE; 188 191 189 192 status = pjsua_vid_preview_start(DEFAULT_CAP_DEV, &pre_param); … … 199 202 video_prev_ = new VidWin(&wi.hwnd); 200 203 vbox_left->addWidget(video_prev_, 1); 201 202 previewButton_->setText(tr("Stop Preview")); 204 //Using this will cause SDL window to display blank 205 //screen sometimes, probably because it's using different 206 //X11 Display 207 //status = pjsua_vid_win_set_show(wid, PJ_TRUE); 208 video_prev_->show(); 209 showStatus("Preview started"); 210 211 previewButton_->setText(tr("Stop &Preview")); 203 212 } 204 213 preview_on = !preview_on; -
pjproject/trunk/pjsip-apps/src/vidgui/vidwin.cpp
r3715 r3724 141 141 } 142 142 143 void VidWin::show(bool visible) 144 { 145 if (!hwnd.info.win.hwnd) return; 146 147 ShowWindow(hwnd.info.win.hwnd, visible ? SW_SHOW : SW_HIDE); 148 } 149 143 150 #elif defined(__APPLE__) 144 151 … … 204 211 } 205 212 213 void VidWin::show(bool visible) 214 { 215 if (!hwnd.info.cocoa.window) return; 216 217 NSWindow *w = (NSWindow*)hwnd.info.cocoa.window; 218 219 if (visible) { 220 if (![w isMiniaturized]) { 221 [w makeKeyAndOrderFront:nil]; 222 } 223 } else { 224 [w orderOut:nil]; 225 } 226 } 206 227 207 228 #elif defined(linux) || defined(__linux) … … 212 233 #include <stdio.h> 213 234 235 #define GET_DISPLAY() QX11Info::display() 236 //#define GET_DISPLAY() (Display*)hwnd.info.x11.display 237 214 238 void VidWin::attach() 215 239 { … … 221 245 // the window failing to embed to this QWidget. 222 246 //Display *d = (Display*)hwnd.info.x11.display; 223 Display *d = QX11Info::display();247 Display *d = GET_DISPLAY(); 224 248 Window w = (Window)hwnd.info.x11.window; 225 249 Window parent = (Window)this->winId(); … … 240 264 241 265 /* Update position and size */ 242 Display *d = QX11Info::display();266 Display *d = GET_DISPLAY(); 243 267 Window w = (Window)hwnd.info.x11.window; 244 268 QRect qr = rect(); … … 253 277 if (!hwnd.info.x11.window) return; 254 278 255 Display *d = QX11Info::display();279 Display *d = GET_DISPLAY(); 256 280 Window w = (Window)hwnd.info.x11.window; 257 281 … … 262 286 } 263 287 288 void VidWin::show(bool visible) 289 { 290 if (!hwnd.info.x11.window) return; 291 292 Display *d = GET_DISPLAY(); 293 Window w = (Window)hwnd.info.x11.window; 294 295 if (visible) { 296 XMapRaised(d, w); 297 } else { 298 XUnmapWindow(d, w); 299 } 300 301 XFlush(d); 302 } 303 264 304 #endif 265 305 -
pjproject/trunk/pjsip-apps/src/vidgui/vidwin.h
r3715 r3724 33 33 virtual ~VidWin(); 34 34 QSize sizeHint() const { return size_hint; } 35 void show(bool visible=true); 35 36 36 37 protected: -
pjproject/trunk/pjsip/include/pjsua-lib/pjsua.h
r3694 r3724 5438 5438 * Device ID for the video renderer to be used for rendering the 5439 5439 * capture stream for preview. 5440 * 5441 * Default: PJMEDIA_VID_DEFAULT_RENDER_DEV 5440 5442 */ 5441 5443 pjmedia_vid_dev_index rend_id; 5444 5445 /** 5446 * Show window initially. 5447 * 5448 * Default: PJ_TRUE. 5449 */ 5450 pj_bool_t show; 5451 5442 5452 } pjsua_vid_preview_param; 5443 5453 5454 5455 /** 5456 * Initialize pjsua_vid_preview_param 5457 * 5458 * @param p The parameter to be initialized. 5459 */ 5460 PJ_DECL(void) pjsua_vid_preview_param_default(pjsua_vid_preview_param *p); 5444 5461 5445 5462 /** … … 5448 5465 * @param id The capture device ID where its preview will be 5449 5466 * started. 5450 * @param p rmOptional video preview parameters. Specify NULL5467 * @param p Optional video preview parameters. Specify NULL 5451 5468 * to use default values. 5452 5469 * … … 5454 5471 */ 5455 5472 PJ_DECL(pj_status_t) pjsua_vid_preview_start(pjmedia_vid_dev_index id, 5456 pjsua_vid_preview_param *prm);5473 const pjsua_vid_preview_param *p); 5457 5474 5458 5475 /** -
pjproject/trunk/pjsip/src/pjsua-lib/pjsua_vid.c
r3694 r3724 117 117 } 118 118 119 PJ_DEF(void) pjsua_vid_preview_param_default(pjsua_vid_preview_param *p) 120 { 121 p->rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV; 122 p->show = PJ_TRUE; 123 } 124 125 119 126 /***************************************************************************** 120 127 * Devices. … … 339 346 if (wid != PJSUA_INVALID_ID) { 340 347 /* Yes, it exists */ 341 342 /* Show window if requested */ 343 if (show) { 344 pjmedia_vid_dev_stream *rdr; 345 pj_bool_t hide = PJ_FALSE; 346 347 rdr = pjmedia_vid_port_get_stream(pjsua_var.win[wid].vp_rend); 348 pj_assert(rdr); 349 status = pjmedia_vid_dev_stream_set_cap( 350 rdr, 351 PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE, 352 &hide); 353 } 348 /* Show/hide window */ 349 pjmedia_vid_dev_stream *rdr; 350 pj_bool_t hide = !show; 351 352 rdr = pjmedia_vid_port_get_stream(pjsua_var.win[wid].vp_rend); 353 pj_assert(rdr); 354 status = pjmedia_vid_dev_stream_set_cap( 355 rdr, PJMEDIA_VID_DEV_CAP_OUTPUT_HIDE, 356 &hide); 354 357 355 358 /* Done */ … … 833 836 */ 834 837 PJ_DEF(pj_status_t) pjsua_vid_preview_start(pjmedia_vid_dev_index id, 835 pjsua_vid_preview_param *prm)838 const pjsua_vid_preview_param *prm) 836 839 { 837 840 pjsua_vid_win_id wid; 838 841 pjsua_vid_win *w; 839 842 pjmedia_vid_dev_index rend_id; 843 pjsua_vid_preview_param default_param; 840 844 pj_status_t status; 841 845 842 846 PJSUA_LOCK(); 843 847 844 if (prm) { 845 rend_id = prm->rend_id; 846 } else { 847 rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV; 848 } 848 if (!prm) { 849 pjsua_vid_preview_param_default(&default_param); 850 prm = &default_param; 851 } 852 853 rend_id = prm->rend_id; 849 854 850 855 status = create_vid_win(PJSUA_WND_TYPE_PREVIEW, NULL, rend_id, id, 851 PJ_TRUE, &wid);856 prm->show, &wid); 852 857 if (status != PJ_SUCCESS) { 853 858 PJSUA_UNLOCK();
Note: See TracChangeset
for help on using the changeset viewer.