- Timestamp:
- Dec 14, 2010 1:03:10 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c
r3394 r3395 25 25 #if PJMEDIA_VIDEO_DEV_HAS_SDL 26 26 27 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 28 # include <Foundation/NSAutoreleasePool.h> 29 #endif 30 27 31 #include <SDL.h> 28 32 … … 324 328 pjmedia_video_format_detail *vfd; 325 329 330 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 331 NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init]; 332 #endif 333 326 334 vfi = pjmedia_get_video_format_info(pjmedia_video_format_mgr_instance(), 327 335 strm->param.fmt.id); 328 336 if (!vfi || !sdl_info) { 329 337 strm->status = PJMEDIA_EVID_BADFORMAT; 330 return strm->status;338 goto on_return; 331 339 } 332 340 … … 335 343 if (vfi->apply_fmt(vfi, &strm->vafp) != PJ_SUCCESS) { 336 344 strm->status = PJMEDIA_EVID_BADFORMAT; 337 return strm->status;345 goto on_return; 338 346 } 339 347 … … 342 350 PJ_LOG(4, (THIS_FILE, "Cannot initialize SDL")); 343 351 strm->status = PJMEDIA_EVID_INIT; 344 return strm->status;352 goto on_return; 345 353 } 346 354 … … 355 363 if (strm->screen == NULL) { 356 364 strm->status = PJMEDIA_EVID_SYSERR; 357 return strm->status;365 goto on_return; 358 366 } 359 367 SDL_WM_SetCaption("pjmedia-SDL video", NULL); … … 369 377 if (strm->surf == NULL) { 370 378 strm->status = PJMEDIA_EVID_SYSERR; 371 return strm->status;379 goto on_return; 372 380 } 373 381 } else if (vfi->color_model == PJMEDIA_COLOR_MODEL_YUV) { … … 377 385 if (strm->overlay == NULL) { 378 386 strm->status = PJMEDIA_EVID_SYSERR; 379 return strm->status;387 goto on_return; 380 388 } 381 389 } … … 390 398 switch(sevent.type) { 391 399 case SDL_USEREVENT: 392 return 0;400 goto on_return; 393 401 case SDL_MOUSEBUTTONDOWN: 394 402 pevent.event_type = PJMEDIA_EVENT_MOUSEBUTTONDOWN; … … 449 457 /* Destroy the stream */ 450 458 sdl_stream_destroy(&strm->base); 451 return 0;459 goto on_return; 452 460 } 453 461 … … 461 469 SDL_Quit(); 462 470 strm->screen = NULL; 463 return 0;471 goto on_return; 464 472 default: 465 473 break; … … 469 477 } 470 478 471 return 0; 479 on_return: 480 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 481 [apool release]; 482 #endif 483 484 return strm->status; 472 485 } 473 486 … … 599 612 { 600 613 struct sdl_stream *stream = (struct sdl_stream*)strm; 601 614 pj_status_t status = PJ_SUCCESS; 615 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 616 NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init]; 617 #endif 618 602 619 if (!stream->is_running) { 603 620 stream->render_exited = PJ_TRUE; 604 return PJ_SUCCESS;621 goto on_return; 605 622 } 606 623 … … 609 626 if (SDL_LockSurface(stream->surf) < 0) { 610 627 PJ_LOG(3, (THIS_FILE, "Unable to lock SDL surface")); 611 return PJMEDIA_EVID_NOTREADY; 628 status = PJMEDIA_EVID_NOTREADY; 629 goto on_return; 612 630 } 613 631 } … … 625 643 if (SDL_LockYUVOverlay(stream->overlay) < 0) { 626 644 PJ_LOG(3, (THIS_FILE, "Unable to lock SDL overlay")); 627 return PJMEDIA_EVID_NOTREADY; 645 status = PJMEDIA_EVID_NOTREADY; 646 goto on_return; 628 647 } 629 648 … … 639 658 } 640 659 641 return PJ_SUCCESS; 660 on_return: 661 #if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 662 [apool release]; 663 #endif 664 665 return status; 642 666 } 643 667
Note: See TracChangeset
for help on using the changeset viewer.