Ignore:
Timestamp:
Mar 17, 2011 11:25:19 AM (13 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/dshow_dev.c

    r3420 r3459  
    6666    {PJMEDIA_FORMAT_RGB24, &MEDIASUBTYPE_RGB24} , 
    6767    {PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} , 
     68    //{PJMEDIA_FORMAT_IYUV, &MEDIASUBTYPE_IYUV} , 
    6869}; 
    6970 
     
    113114        AM_MEDIA_TYPE       *mediatype; 
    114115    } dgraph[2]; 
     116 
     117    pj_timestamp             cap_ts; 
     118    unsigned                 cap_ts_inc; 
    115119}; 
    116120 
     
    287291    ddi = &df->dev_info[df->dev_count++]; 
    288292    pj_bzero(ddi, sizeof(*ddi)); 
    289     strncpy(ddi->info.name,  "Video Mixing Renderer", 
    290             sizeof(ddi->info.name)); 
     293    pj_ansi_strncpy(ddi->info.name,  "Video Mixing Renderer", 
     294                    sizeof(ddi->info.name)); 
    291295    ddi->info.name[sizeof(ddi->info.name)-1] = '\0'; 
    292     strncpy(ddi->info.driver, "dshow", sizeof(ddi->info.driver)); 
     296    pj_ansi_strncpy(ddi->info.driver, "dshow", sizeof(ddi->info.driver)); 
    293297    ddi->info.driver[sizeof(ddi->info.driver)-1] = '\0'; 
    294298    ddi->info.dir = PJMEDIA_DIR_RENDER; 
     
    410414    struct dshow_stream *strm = (struct dshow_stream*)user_data; 
    411415    unsigned char *buffer; 
    412     pjmedia_frame frame; 
     416    pjmedia_frame frame = {0}; 
    413417 
    414418    if (strm->quit_flag) { 
     
    435439    frame.size = IMediaSample_GetActualDataLength(pMediaSample); 
    436440    frame.bit_info = 0; 
     441    frame.timestamp = strm->cap_ts; 
     442    strm->cap_ts.u64 += strm->cap_ts_inc; 
    437443    if (strm->vid_cb.capture_cb) 
    438444        (*strm->vid_cb.capture_cb)(&strm->base, strm->user_data, &frame); 
     
    454460        if (stream->dgraph[i].csource_filter) { 
    455461            HRESULT hr = SourceFilter_Deliver(stream->dgraph[i].csource_filter, 
    456                 frame->buf, frame->size); 
     462                                              frame->buf, frame->size); 
    457463 
    458464            if (FAILED(hr)) { 
     
    727733    /* Create capture stream here */ 
    728734    if (param->dir & PJMEDIA_DIR_CAPTURE) { 
     735        const pjmedia_video_format_detail *vfd; 
     736 
    729737        status = create_filter_graph(PJMEDIA_DIR_CAPTURE, param->cap_id, 
    730738                                     df, strm, &strm->dgraph[ngraph++]); 
    731739        if (status != PJ_SUCCESS) 
    732740            goto on_error; 
     741         
     742        vfd = pjmedia_format_get_video_format_detail(&param->fmt, PJ_TRUE); 
     743        strm->cap_ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 
    733744    } 
    734745 
Note: See TracChangeset for help on using the changeset viewer.