Ignore:
Timestamp:
Dec 14, 2010 1:03:10 PM (13 years ago)
Author:
ming
Message:

Fixed #1183

  • QT capture device for Mac
  • iOS device for iOS (capture device only works for iOS 4.0 or above)
  • Add NSAutoReleasePool for sdl_dev (Mac)
  • Add NSAutoReleasePool for vid_dev_test (Mac)
  • build system for compilation of Obj-C files (.m)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/sdl_dev.c

    r3394 r3395  
    2525#if PJMEDIA_VIDEO_DEV_HAS_SDL 
    2626 
     27#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     28#   include <Foundation/NSAutoreleasePool.h> 
     29#endif 
     30 
    2731#include <SDL.h> 
    2832 
     
    324328    pjmedia_video_format_detail *vfd; 
    325329 
     330#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     331    NSAutoreleasePool *apool = [[NSAutoreleasePool alloc] init]; 
     332#endif 
     333  
    326334    vfi = pjmedia_get_video_format_info(pjmedia_video_format_mgr_instance(), 
    327335                                        strm->param.fmt.id); 
    328336    if (!vfi || !sdl_info) { 
    329337        strm->status = PJMEDIA_EVID_BADFORMAT; 
    330         return strm->status; 
     338        goto on_return; 
    331339    } 
    332340 
     
    335343    if (vfi->apply_fmt(vfi, &strm->vafp) != PJ_SUCCESS) { 
    336344        strm->status = PJMEDIA_EVID_BADFORMAT; 
    337         return strm->status; 
     345        goto on_return; 
    338346    } 
    339347 
     
    342350        PJ_LOG(4, (THIS_FILE, "Cannot initialize SDL")); 
    343351        strm->status = PJMEDIA_EVID_INIT; 
    344         return strm->status; 
     352        goto on_return; 
    345353    } 
    346354 
     
    355363    if (strm->screen == NULL) { 
    356364        strm->status = PJMEDIA_EVID_SYSERR; 
    357         return strm->status; 
     365        goto on_return; 
    358366    } 
    359367    SDL_WM_SetCaption("pjmedia-SDL video", NULL); 
     
    369377        if (strm->surf == NULL) { 
    370378            strm->status = PJMEDIA_EVID_SYSERR; 
    371             return strm->status; 
     379            goto on_return; 
    372380        } 
    373381    } else if (vfi->color_model == PJMEDIA_COLOR_MODEL_YUV) { 
     
    377385        if (strm->overlay == NULL) { 
    378386            strm->status = PJMEDIA_EVID_SYSERR; 
    379             return strm->status; 
     387            goto on_return; 
    380388        } 
    381389    } 
     
    390398            switch(sevent.type) { 
    391399                case SDL_USEREVENT: 
    392                     return 0; 
     400                    goto on_return; 
    393401                case SDL_MOUSEBUTTONDOWN: 
    394402                    pevent.event_type = PJMEDIA_EVENT_MOUSEBUTTONDOWN; 
     
    449457                        /* Destroy the stream */ 
    450458                        sdl_stream_destroy(&strm->base); 
    451                         return 0; 
     459                        goto on_return; 
    452460                    } 
    453461 
     
    461469                    SDL_Quit(); 
    462470                    strm->screen = NULL; 
    463                     return 0; 
     471                    goto on_return; 
    464472                default: 
    465473                    break; 
     
    469477    } 
    470478 
    471     return 0; 
     479on_return: 
     480#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     481    [apool release]; 
     482#endif 
     483     
     484    return strm->status; 
    472485} 
    473486 
     
    599612{ 
    600613    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   
    602619    if (!stream->is_running) { 
    603620        stream->render_exited = PJ_TRUE; 
    604         return PJ_SUCCESS; 
     621        goto on_return; 
    605622    } 
    606623 
     
    609626            if (SDL_LockSurface(stream->surf) < 0) { 
    610627                PJ_LOG(3, (THIS_FILE, "Unable to lock SDL surface")); 
    611                 return PJMEDIA_EVID_NOTREADY; 
     628                status = PJMEDIA_EVID_NOTREADY; 
     629                goto on_return; 
    612630            } 
    613631        } 
     
    625643        if (SDL_LockYUVOverlay(stream->overlay) < 0) { 
    626644            PJ_LOG(3, (THIS_FILE, "Unable to lock SDL overlay")); 
    627             return PJMEDIA_EVID_NOTREADY; 
     645            status = PJMEDIA_EVID_NOTREADY; 
     646            goto on_return; 
    628647        } 
    629648 
     
    639658    } 
    640659 
    641     return PJ_SUCCESS; 
     660on_return: 
     661#if defined(PJ_DARWINOS) && PJ_DARWINOS!=0 
     662    [apool release]; 
     663#endif 
     664     
     665    return status; 
    642666} 
    643667 
Note: See TracChangeset for help on using the changeset viewer.