Showing the changes to libavdevice/decklink_dec.cpp (1 of 4 files). Show all
Unified · Split
| @@ -586,7 +586,8 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, · 585 unmodified lines | |||
| 586 | IDeckLinkAudioInputPacket *audioFrame, | 586 | IDeckLinkAudioInputPacket *audioFrame, |
| 587 | int64_t wallclock, | 587 | int64_t wallclock, |
| 588 | DecklinkPtsSource pts_src, | 588 | DecklinkPtsSource pts_src, |
| 589 | AVRational time_base, int64_t *initial_pts) | 589 | AVRational time_base, int64_t *initial_pts, |
| 590 | int copyts) | ||
| 590 | { | 591 | { |
| 591 | int64_t pts = AV_NOPTS_VALUE; | 592 | int64_t pts = AV_NOPTS_VALUE; |
| 592 | BMDTimeValue bmd_pts; | 593 | BMDTimeValue bmd_pts; |
| @@ -619,10 +620,12 @@ static int64_t get_pkt_pts(IDeckLinkVideoInputFrame *videoFrame, · 26 unmodified lines | |||
| 619 | if (res == S_OK) | 620 | if (res == S_OK) |
| 620 | pts = bmd_pts / time_base.num; | 621 | pts = bmd_pts / time_base.num; |
| 621 | 622 | ||
| 622 | if (pts != AV_NOPTS_VALUE && *initial_pts == AV_NOPTS_VALUE) | 623 | if (!copyts) { |
| 623 | *initial_pts = pts; | 624 | if (pts != AV_NOPTS_VALUE && *initial_pts == AV_NOPTS_VALUE) |
| 624 | if (*initial_pts != AV_NOPTS_VALUE) | 625 | *initial_pts = pts; |
| 625 | pts -= *initial_pts; | 626 | if (*initial_pts != AV_NOPTS_VALUE) |
| 627 | pts -= *initial_pts; | ||
| 628 | } | ||
| 626 | 629 | ||
| 627 | return pts; | 630 | return pts; |
| 628 | } | 631 | } |
| @@ -635,6 +638,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 6 unmodified lines | |||
| 635 | BMDTimeValue frameTime; | 638 | BMDTimeValue frameTime; |
| 636 | BMDTimeValue frameDuration; | 639 | BMDTimeValue frameDuration; |
| 637 | int64_t wallclock = 0; | 640 | int64_t wallclock = 0; |
| 641 | struct decklink_cctx *cctx = (struct decklink_cctx *) avctx->priv_data; | ||
| 638 | 642 | ||
| 639 | if (ctx->autodetect) { | 643 | if (ctx->autodetect) { |
| 640 | if (videoFrame && !(videoFrame->GetFlags() & bmdFrameHasNoInputSource) && | 644 | if (videoFrame && !(videoFrame->GetFlags() & bmdFrameHasNoInputSource) && |
| @@ -694,7 +698,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 53 unmodified lines | |||
| 694 | no_video = 0; | 698 | no_video = 0; |
| 695 | } | 699 | } |
| 696 | 700 | ||
| 697 | pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->video_pts_source, ctx->video_st->time_base, &initial_video_pts); | 701 | pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->video_pts_source, ctx->video_st->time_base, &initial_video_pts, cctx->copyts); |
| 698 | pkt.dts = pkt.pts; | 702 | pkt.dts = pkt.pts; |
| 699 | 703 | ||
| 700 | pkt.duration = frameDuration; | 704 | pkt.duration = frameDuration; |
| @@ -785,7 +789,7 @@ HRESULT decklink_input_callback::VideoInputFrameArrived( · 84 unmodified lines | |||
| 785 | pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->channels * (ctx->audio_depth / 8); | 789 | pkt.size = audioFrame->GetSampleFrameCount() * ctx->audio_st->codecpar->channels * (ctx->audio_depth / 8); |
| 786 | audioFrame->GetBytes(&audioFrameBytes); | 790 | audioFrame->GetBytes(&audioFrameBytes); |
| 787 | audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den); | 791 | audioFrame->GetPacketTime(&audio_pts, ctx->audio_st->time_base.den); |
| 788 | pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->audio_pts_source, ctx->audio_st->time_base, &initial_audio_pts); | 792 | pkt.pts = get_pkt_pts(videoFrame, audioFrame, wallclock, ctx->audio_pts_source, ctx->audio_st->time_base, &initial_audio_pts, cctx->copyts); |
| 789 | pkt.dts = pkt.pts; | 793 | pkt.dts = pkt.pts; |
| 790 | 794 | ||
| 791 | //fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts); | 795 | //fprintf(stderr,"Audio Frame size %d ts %d\n", pkt.size, pkt.pts); |