Changeset 3459
- Timestamp:
- Mar 17, 2011 11:25:19 AM (14 years ago)
- Location:
- pjproject/branches/projects/2.0-dev/pjmedia
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/branches/projects/2.0-dev/pjmedia/include/pjmedia/videoport.h
r3431 r3459 57 57 * calls pjmedia_port_put_frame() or pjmedia_port_get_frame() to that 58 58 * media port. 59 * 60 * Default: PJ_TRUE 59 61 */ 60 62 pj_bool_t active; … … 69 71 /** 70 72 * Initialize the parameter with the default values. Note that this typically 71 * would only fill the structure to zeroes. 73 * would only fill the structure to zeroes unless they have different default 74 * values. 72 75 * 73 76 * @param prm The parameter. -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/colorbar_dev.c
r3420 r3459 92 92 pjmedia_video_apply_fmt_param vafp; 93 93 pj_uint8_t *first_line[PJMEDIA_MAX_VIDEO_PLANES]; 94 pj_timestamp ts; 95 unsigned ts_inc; 94 96 }; 95 97 … … 186 188 ddi = &cf->dev_info[0]; 187 189 pj_bzero(ddi, sizeof(*ddi)); 188 strncpy(ddi->info.name, "Colorbar generator",189 190 pj_ansi_strncpy(ddi->info.name, "Colorbar generator", 191 sizeof(ddi->info.name)); 190 192 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)); 192 194 ddi->info.driver[sizeof(ddi->info.driver)-1] = '\0'; 193 195 ddi->info.dir = PJMEDIA_DIR_CAPTURE; … … 206 208 } 207 209 208 PJ_LOG(4, (THIS_FILE, "Colorbar video src initialized with %d device s:",210 PJ_LOG(4, (THIS_FILE, "Colorbar video src initialized with %d device(s):", 209 211 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 } 210 215 211 216 return PJ_SUCCESS; … … 366 371 pj_pool_t *pool; 367 372 struct cbar_stream *strm; 373 const pjmedia_video_format_detail *vfd; 368 374 const pjmedia_video_format_info *vfi; 369 375 pjmedia_video_apply_fmt_param vafp; … … 378 384 pj_bzero(&vafp, sizeof(vafp)); 379 385 386 vfd = pjmedia_format_get_video_format_detail(¶m->fmt, PJ_TRUE); 380 387 vfi = pjmedia_get_video_format_info(NULL, param->fmt.id); 381 388 cbfi = get_cbar_fmt_info(param->fmt.id); … … 399 406 strm->cbfi = cbfi; 400 407 pj_memcpy(&strm->vafp, &vafp, sizeof(vafp)); 408 strm->ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 401 409 402 410 for (i = 0; i < vfi->plane_cnt; ++i) { … … 560 568 struct cbar_stream *stream = (struct cbar_stream*)strm; 561 569 570 frame->timestamp = stream->ts; 571 stream->ts.u64 += stream->ts_inc; 562 572 return spectrum_run(stream, frame->buf, frame->size); 563 573 } -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/dshow_dev.c
r3420 r3459 66 66 {PJMEDIA_FORMAT_RGB24, &MEDIASUBTYPE_RGB24} , 67 67 {PJMEDIA_FORMAT_RGB32, &MEDIASUBTYPE_RGB32} , 68 //{PJMEDIA_FORMAT_IYUV, &MEDIASUBTYPE_IYUV} , 68 69 }; 69 70 … … 113 114 AM_MEDIA_TYPE *mediatype; 114 115 } dgraph[2]; 116 117 pj_timestamp cap_ts; 118 unsigned cap_ts_inc; 115 119 }; 116 120 … … 287 291 ddi = &df->dev_info[df->dev_count++]; 288 292 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)); 291 295 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)); 293 297 ddi->info.driver[sizeof(ddi->info.driver)-1] = '\0'; 294 298 ddi->info.dir = PJMEDIA_DIR_RENDER; … … 410 414 struct dshow_stream *strm = (struct dshow_stream*)user_data; 411 415 unsigned char *buffer; 412 pjmedia_frame frame ;416 pjmedia_frame frame = {0}; 413 417 414 418 if (strm->quit_flag) { … … 435 439 frame.size = IMediaSample_GetActualDataLength(pMediaSample); 436 440 frame.bit_info = 0; 441 frame.timestamp = strm->cap_ts; 442 strm->cap_ts.u64 += strm->cap_ts_inc; 437 443 if (strm->vid_cb.capture_cb) 438 444 (*strm->vid_cb.capture_cb)(&strm->base, strm->user_data, &frame); … … 454 460 if (stream->dgraph[i].csource_filter) { 455 461 HRESULT hr = SourceFilter_Deliver(stream->dgraph[i].csource_filter, 456 462 frame->buf, frame->size); 457 463 458 464 if (FAILED(hr)) { … … 727 733 /* Create capture stream here */ 728 734 if (param->dir & PJMEDIA_DIR_CAPTURE) { 735 const pjmedia_video_format_detail *vfd; 736 729 737 status = create_filter_graph(PJMEDIA_DIR_CAPTURE, param->cap_id, 730 738 df, strm, &strm->dgraph[ngraph++]); 731 739 if (status != PJ_SUCCESS) 732 740 goto on_error; 741 742 vfd = pjmedia_format_get_video_format_detail(¶m->fmt, PJ_TRUE); 743 strm->cap_ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 733 744 } 734 745 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/ios_dev.m
r3399 r3459 93 93 UIImageView *imgView; 94 94 void *buf; 95 96 pj_timestamp frame_ts; 97 unsigned ts_inc; 95 98 }; 96 99 … … 356 359 frame.size = stream->frame_size; 357 360 frame.bit_info = 0; 361 frame.timestamp.u64 = stream->frame_ts.u64; 362 358 363 if (stream->vid_cb.capture_cb) 359 364 (*stream->vid_cb.capture_cb)(&stream->base, stream->user_data, &frame); 360 365 366 stream->frame_ts.u64 += stream->ts_inc; 367 361 368 /* Unlock the pixel buffer */ 362 369 CVPixelBufferUnlockBaseAddress(imageBuffer,0); … … 386 393 pj_pool_t *pool; 387 394 struct ios_stream *strm; 388 pjmedia_video_format_detail *vfd;395 const pjmedia_video_format_detail *vfd; 389 396 const pjmedia_video_format_info *vfi; 390 397 pj_status_t status = PJ_SUCCESS; … … 419 426 strm->bytes_per_row = strm->size.w * strm->bpp / 8; 420 427 strm->frame_size = strm->bytes_per_row * strm->size.h; 428 strm->ts_inc = PJMEDIA_SPF2(param->clock_rate, &vfd->fps, 1); 421 429 422 430 /* Create capture stream here */ -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/qt_dev.m
r3395 r3459 77 77 pj_pool_t *pool; /**< Memory pool. */ 78 78 79 pj_timestamp cap_frame_ts; /**< Captured frame tstamp */ 80 unsigned cap_ts_inc; /**< Increment */ 81 79 82 pjmedia_vid_cb vid_cb; /**< Stream callback. */ 80 83 void *user_data; /**< Application data. */ … … 322 325 frame.size = size; 323 326 frame.bit_info = 0; 327 frame.timestamp.u64 = stream->cap_frame_ts.u64; 328 324 329 if (stream->vid_cb.capture_cb) 325 330 (*stream->vid_cb.capture_cb)(&stream->base, stream->user_data, 326 331 &frame); 332 333 stream->cap_frame_ts.u64 += stream->cap_ts_inc; 327 334 } 328 335 @end … … 380 387 /* Create capture stream here */ 381 388 if (param->dir & PJMEDIA_DIR_CAPTURE) { 382 pjmedia_video_format_detail *vfd;389 const pjmedia_video_format_detail *vfd; 383 390 qt_fmt_info *qfi = get_qt_format_info(param->fmt.id); 384 391 … … 438 445 439 446 pj_assert(vfd->fps.num); 447 strm->cap_ts_inc = PJMEDIA_SPF2(&strm->param.clock_rate, &vfd->fps, 1); 448 440 449 [strm->video_output setMinimumVideoFrameInterval: 441 450 (1.0f * vfd->fps.denum / (double)vfd->fps.num)]; -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia-videodev/v4l2_dev.c
r3447 r3459 677 677 frame->type = PJMEDIA_FRAME_TYPE_VIDEO; 678 678 frame->size = buf.bytesused; 679 frame->timestamp.u64 = PJ_ TIME_VAL_MSEC(time) * stream->param.clock_rate680 / PJ_UINT64(1000);679 frame->timestamp.u64 = PJ_UINT64(1) * PJ_TIME_VAL_MSEC(time) * 680 stream->param.clock_rate / PJ_UINT64(1000); 681 681 pj_memcpy(frame->buf, stream->buffers[buf.index].start, buf.bytesused); 682 682 -
pjproject/branches/projects/2.0-dev/pjmedia/src/pjmedia/videoport.c
r3431 r3459 101 101 { 102 102 pj_bzero(prm, sizeof(*prm)); 103 prm->active = PJ_TRUE; 103 104 } 104 105
Note: See TracChangeset
for help on using the changeset viewer.