Ignore:
Timestamp:
Mar 17, 2011 11:25:19 AM (11 years ago)
Author:
bennylp
Message:

Re #1213 (video devices):

  • fixed devices to correctly increment the frame timestamp
  • minor fix in video port to set default "active" value to 1 in the param
File:
1 edited

Legend:

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

    r3420 r3459  
    9292    pjmedia_video_apply_fmt_param    vafp; 
    9393    pj_uint8_t                      *first_line[PJMEDIA_MAX_VIDEO_PLANES]; 
     94    pj_timestamp                     ts; 
     95    unsigned                         ts_inc; 
    9496}; 
    9597 
     
    186188    ddi = &cf->dev_info[0]; 
    187189    pj_bzero(ddi, sizeof(*ddi)); 
    188     strncpy(ddi->info.name, "Colorbar generator", 
    189             sizeof(ddi->info.name)); 
     190    pj_ansi_strncpy(ddi->info.name, "Colorbar generator", 
     191                    sizeof(ddi->info.name)); 
    190192    ddi->info.driver[sizeof(ddi->info.driver)-1] = '\0'; 
    191     strncpy(ddi->info.driver, "Colorbar", sizeof(ddi->info.driver)); 
     193    pj_ansi_strncpy(ddi->info.driver, "Colorbar", sizeof(ddi->info.driver)); 
    192194    ddi->info.driver[sizeof(ddi->info.driver)-1] = '\0'; 
    193195    ddi->info.dir = PJMEDIA_DIR_CAPTURE; 
     
    206208    } 
    207209 
    208     PJ_LOG(4, (THIS_FILE, "Colorbar video src initialized with %d devices:", 
     210    PJ_LOG(4, (THIS_FILE, "Colorbar video src initialized with %d device(s):", 
    209211               cf->dev_count)); 
     212    for (i = 0; i < cf->dev_count; i++) { 
     213        PJ_LOG(4, (THIS_FILE, "%2d: %s", i, cf->dev_info[i].info.name)); 
     214    } 
    210215 
    211216    return PJ_SUCCESS; 
     
    366371    pj_pool_t *pool; 
    367372    struct cbar_stream *strm; 
     373    const pjmedia_video_format_detail *vfd; 
    368374    const pjmedia_video_format_info *vfi; 
    369375    pjmedia_video_apply_fmt_param vafp; 
     
    378384    pj_bzero(&vafp, sizeof(vafp)); 
    379385 
     386    vfd = pjmedia_format_get_video_format_detail(&param->fmt, PJ_TRUE); 
    380387    vfi = pjmedia_get_video_format_info(NULL, param->fmt.id); 
    381388    cbfi = get_cbar_fmt_info(param->fmt.id); 
     
    399406    strm->cbfi = cbfi; 
    400407    pj_memcpy(&strm->vafp, &vafp, sizeof(vafp)); 
     408    strm->ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 
    401409 
    402410    for (i = 0; i < vfi->plane_cnt; ++i) { 
     
    560568    struct cbar_stream *stream = (struct cbar_stream*)strm; 
    561569 
     570    frame->timestamp = stream->ts; 
     571    stream->ts.u64 += stream->ts_inc; 
    562572    return spectrum_run(stream, frame->buf, frame->size); 
    563573} 
Note: See TracChangeset for help on using the changeset viewer.