- Timestamp:
- Apr 8, 2015 9:07:00 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjmedia/src/pjmedia-videodev/ios_opengl_dev.m
r5047 r5052 221 221 pjmedia_vid_dev_opengl_draw(stream->gl_buf, stream->vid_size.w, stream->vid_size.h, 222 222 stream->frame->buf); 223 224 [stream->ogl_context presentRenderbuffer:GL_RENDERBUFFER]; 223 225 } 224 226 … … 228 230 * it is called, we can be sure that render() has completed. 229 231 */ 232 } 233 234 - (void)change_format 235 { 236 pjmedia_video_format_detail *vfd; 237 238 vfd = pjmedia_format_get_video_format_detail(&stream->param.fmt, PJ_TRUE); 239 pj_memcpy(&stream->vid_size, &vfd->size, sizeof(vfd->size)); 240 if (stream->param.disp_size.w == 0 || stream->param.disp_size.h == 0) 241 pj_memcpy(&stream->param.disp_size, &vfd->size, sizeof(vfd->size)); 230 242 } 231 243 … … 254 266 strm->ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 255 267 268 rect = CGRectMake(0, 0, strm->param.disp_size.w, strm->param.disp_size.h); 269 strm->gl_view = [[GLView alloc] initWithFrame:rect]; 270 if (!strm->gl_view) 271 return PJ_ENOMEM; 272 strm->gl_view->stream = strm; 273 256 274 /* If OUTPUT_RESIZE flag is not used, set display size to default */ 257 275 if (!(param->flags & PJMEDIA_VID_DEV_CAP_OUTPUT_RESIZE)) { … … 264 282 if (status != PJ_SUCCESS) 265 283 goto on_error; 266 267 rect = CGRectMake(0, 0, strm->param.disp_size.w, strm->param.disp_size.h);268 strm->gl_view = [[GLView alloc] initWithFrame:rect];269 if (!strm->gl_view)270 return PJ_ENOMEM;271 strm->gl_view->stream = strm;272 284 273 285 /* Perform OpenGL buffer initializations in the main thread. */ … … 373 385 if (cap==PJMEDIA_VID_DEV_CAP_FORMAT) { 374 386 const pjmedia_video_format_info *vfi; 375 pjmedia_video_format_detail *vfd;376 387 pjmedia_format *fmt = (pjmedia_format *)pval; 377 388 iosgl_fmt_info *ifi; … … 387 398 pjmedia_format_copy(&strm->param.fmt, fmt); 388 399 389 vfd = pjmedia_format_get_video_format_detail(fmt, PJ_TRUE); 390 pj_memcpy(&strm->vid_size, &vfd->size, sizeof(vfd->size)); 391 if (strm->param.disp_size.w == 0 || strm->param.disp_size.h == 0) 392 pj_memcpy(&strm->param.disp_size, &vfd->size, sizeof(vfd->size)); 400 [strm->gl_view performSelectorOnMainThread:@selector(change_format) 401 withObject:nil waitUntilDone:YES]; 393 402 394 403 return PJ_SUCCESS; … … 460 469 withObject:nil waitUntilDone:YES]; 461 470 462 [stream->ogl_context presentRenderbuffer:GL_RENDERBUFFER];463 464 471 return PJ_SUCCESS; 465 472 }
Note: See TracChangeset
for help on using the changeset viewer.