Ignore:
Timestamp:
Mar 25, 2011 8:38:26 AM (13 years ago)
Author:
bennylp
Message:

Re #1213 (Video devices):

  • Video device now opens in "best effort" mode, i.e. it may open with different size and fps than requested. The actual size and fps will be reflected in the "param" upon return. The vidport must check this against any differences, and create converter accordingly.
  • Removed const for param argument in vid_create_stream() API
  • Currently converter in vidport will not work if vidport is opened in bidir. Converter for renderer is untested
File:
1 edited

Legend:

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

    r3420 r3489  
    610610/* API: Open video stream object using the specified parameters. */ 
    611611PJ_DEF(pj_status_t) pjmedia_vid_dev_stream_create( 
    612                                         const pjmedia_vid_param *prm, 
     612                                        pjmedia_vid_param *prm, 
    613613                                        const pjmedia_vid_cb *cb, 
    614614                                        void *user_data, 
     
    616616{ 
    617617    pjmedia_vid_dev_factory *cap_f=NULL, *rend_f=NULL, *f=NULL; 
    618     pjmedia_vid_param param; 
    619618    pj_status_t status; 
    620619 
     
    626625                     PJ_EINVAL); 
    627626 
    628     /* Must make copy of param because we're changing device ID */ 
    629     pj_memcpy(&param, prm, sizeof(param)); 
    630  
    631627    /* Normalize cap_id */ 
    632     if (param.dir & PJMEDIA_DIR_CAPTURE) { 
     628    if (prm->dir & PJMEDIA_DIR_CAPTURE) { 
    633629        unsigned index; 
    634630 
    635         if (param.cap_id < 0) 
    636             param.cap_id = PJMEDIA_VID_DEFAULT_CAPTURE_DEV; 
    637  
    638         status = lookup_dev(param.cap_id, &cap_f, &index); 
     631        if (prm->cap_id < 0) 
     632            prm->cap_id = PJMEDIA_VID_DEFAULT_CAPTURE_DEV; 
     633 
     634        status = lookup_dev(prm->cap_id, &cap_f, &index); 
    639635        if (status != PJ_SUCCESS) 
    640636            return status; 
    641637 
    642         param.cap_id = index; 
     638        prm->cap_id = index; 
    643639        f = cap_f; 
    644640    } 
    645641 
    646642    /* Normalize rend_id */ 
    647     if (param.dir & PJMEDIA_DIR_RENDER) { 
     643    if (prm->dir & PJMEDIA_DIR_RENDER) { 
    648644        unsigned index; 
    649645 
    650         if (param.rend_id < 0) 
    651             param.rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV; 
    652  
    653         status = lookup_dev(param.rend_id, &rend_f, &index); 
     646        if (prm->rend_id < 0) 
     647            prm->rend_id = PJMEDIA_VID_DEFAULT_RENDER_DEV; 
     648 
     649        status = lookup_dev(prm->rend_id, &rend_f, &index); 
    654650        if (status != PJ_SUCCESS) 
    655651            return status; 
    656652 
    657         param.rend_id = index; 
     653        prm->rend_id = index; 
    658654        f = rend_f; 
    659655    } 
     
    662658 
    663659    /* For now, cap_id and rend_id must belong to the same factory */ 
    664     PJ_ASSERT_RETURN((param.dir != PJMEDIA_DIR_CAPTURE_RENDER) ||  
     660    PJ_ASSERT_RETURN((prm->dir != PJMEDIA_DIR_CAPTURE_RENDER) || 
    665661                     (cap_f == rend_f), 
    666662                     PJMEDIA_EVID_INVDEV); 
    667663 
    668664    /* Create the stream */ 
    669     status = f->op->create_stream(f, &param, cb, 
     665    status = f->op->create_stream(f, prm, cb, 
    670666                                  user_data, p_vid_strm); 
    671667    if (status != PJ_SUCCESS) 
Note: See TracChangeset for help on using the changeset viewer.