cv_time_fix.patch
src/highgui/cvcap_ffmpeg.cpp (working copy) | ||
---|---|---|
620 | 620 |
switch( property_id ) |
621 | 621 |
{ |
622 | 622 |
case CV_CAP_PROP_POS_MSEC: |
623 |
if(video_st->parser && video_st->parser->dts != AV_NOPTS_VALUE_) |
|
624 |
return (((double)video_st->parser->dts-1) *1000.0f) * av_q2d (video_st->time_base); |
|
623 | 625 |
if(video_st->cur_dts != AV_NOPTS_VALUE_) |
624 | 626 |
return (((double)video_st->cur_dts-1) *1000.0f * av_q2d (video_st->time_base)); |
625 | 627 |
// return (((double)video_st->cur_dts-1) *1000) / av_q2d (video_st->r_frame_rate); |
626 | 628 |
break; |
627 | 629 |
case CV_CAP_PROP_POS_FRAMES: |
630 |
if(video_st->parser && video_st->parser->dts != AV_NOPTS_VALUE_) |
|
631 |
return (double)video_st->parser->dts-1; |
|
628 | 632 |
if(video_st->cur_dts != AV_NOPTS_VALUE_) |
629 | 633 |
return (double)video_st->cur_dts-1; |
630 | 634 |
break; |
631 | 635 |
case CV_CAP_PROP_POS_AVI_RATIO: |
636 |
if(video_st->parser && video_st->parser->dts != AV_NOPTS_VALUE_) |
|
637 |
return (double)(video_st->parser->dts-1)/(double)video_st->duration; |
|
632 | 638 |
if(video_st->cur_dts != AV_NOPTS_VALUE_ && video_st->duration != AV_NOPTS_VALUE_) |
633 | 639 |
return (double)(video_st->cur_dts-1)/(double)video_st->duration; |
634 | 640 |
break; |