Ignore:
Timestamp:
Apr 6, 2011 11:30:18 AM (13 years ago)
Author:
ming
Message:

Re #1213:
Add OpenGL support for SDL renderer

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m

    r3489 r3499  
    2424#if PJMEDIA_VIDEO_DEV_HAS_QT 
    2525 
     26#include <Foundation/NSAutoreleasePool.h> 
    2627#include <QTKit/QTKit.h> 
    2728 
     
    4243static qt_fmt_info qt_fmts[] = 
    4344{ 
    44     {PJMEDIA_FORMAT_YUY2, kCVPixelFormatType_422YpCbCr8_yuvs} , 
     45    {PJMEDIA_FORMAT_YUY2, kCVPixelFormatType_422YpCbCr8_yuvs}, 
     46    {PJMEDIA_FORMAT_UYVY, kCVPixelFormatType_422YpCbCr8}, 
    4547}; 
    4648 
     
    8385    void                   *user_data;      /**< Application data.     */ 
    8486 
     87    pj_bool_t               cap_thread_exited; 
     88    pj_bool_t               cap_thread_initialized; 
     89    pj_thread_desc          cap_thread_desc; 
     90    pj_thread_t            *cap_thread; 
     91     
     92    NSAutoreleasePool                   *apool; 
    8593    QTCaptureSession                    *cap_session; 
    8694    QTCaptureDeviceInput                *dev_input; 
     
    171179    struct qt_dev_info *qdi; 
    172180    unsigned i, dev_count = 0; 
     181    NSAutoreleasePool *apool = [[NSAutoreleasePool alloc]init]; 
    173182    NSArray *dev_array; 
    174183 
     
    245254    } 
    246255 
     256    [apool release]; 
     257     
    247258    PJ_LOG(4, (THIS_FILE, "qt video initialized with %d devices", 
    248259               qf->dev_count)); 
     
    317328    pjmedia_frame frame; 
    318329 
     330    if (stream->cap_thread_initialized == 0 || !pj_thread_is_registered()) 
     331    { 
     332        pj_thread_register("qt_cap", stream->cap_thread_desc, 
     333                           &stream->cap_thread); 
     334        stream->cap_thread_initialized = 1; 
     335        PJ_LOG(5,(THIS_FILE, "Capture thread started")); 
     336    } 
     337     
    319338    if (!videoFrame) 
    320339        return; 
     
    380399    pj_memcpy(&strm->vid_cb, cb, sizeof(*cb)); 
    381400    strm->user_data = user_data; 
     401    strm->apool = [[NSAutoreleasePool alloc]init]; 
    382402     
    383403    /* Create player stream here */ 
     
    447467        strm->cap_ts_inc = PJMEDIA_SPF2(strm->param.clock_rate, &vfd->fps, 1); 
    448468         
    449         [strm->video_output setMinimumVideoFrameInterval: 
    450                             (1.0f * vfd->fps.denum / (double)vfd->fps.num)]; 
    451          
    452         strm->vout_delegate = [VOutDelegate alloc]; 
     469        if ([strm->video_output 
     470             respondsToSelector:@selector(setMinimumVideoFrameInterval)]) 
     471        { 
     472            [strm->video_output setMinimumVideoFrameInterval: 
     473                                (1.0f * vfd->fps.denum / 
     474                                 (double)vfd->fps.num)]; 
     475        } 
     476         
     477        strm->vout_delegate = [[VOutDelegate alloc]init]; 
    453478        strm->vout_delegate->stream = strm; 
    454479        [strm->video_output setDelegate:strm->vout_delegate]; 
     
    547572        if (![stream->cap_session isRunning]) 
    548573            return PJ_EUNKNOWN; 
    549     } 
    550      
    551     CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); 
    552      
     574         
     575        CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, false); 
     576    } 
     577 
    553578    return PJ_SUCCESS; 
    554579} 
     
    599624    } 
    600625 
     626//    [stream->apool release]; 
    601627    pj_pool_release(stream->pool); 
    602628 
Note: See TracChangeset for help on using the changeset viewer.