Revision 0ff4f0c0
ffmpeg.c | ||
---|---|---|
312 | 312 |
int64_t next_pts; /* synthetic pts for cases where pkt.pts |
313 | 313 |
is not defined */ |
314 | 314 |
int64_t pts; /* current pts */ |
315 |
PtsCorrectionContext pts_ctx; |
|
315 | 316 |
int is_start; /* is 1 at the start and after a discontinuity */ |
316 | 317 |
int showed_multi_packet_warning; |
317 | 318 |
int is_past_recording_time; |
... | ... | |
1542 | 1543 |
void *buffer_to_free; |
1543 | 1544 |
static unsigned int samples_size= 0; |
1544 | 1545 |
AVSubtitle subtitle, *subtitle_to_free; |
1546 |
int64_t pkt_pts = AV_NOPTS_VALUE; |
|
1545 | 1547 |
#if CONFIG_AVFILTER |
1546 | 1548 |
int frame_available; |
1547 | 1549 |
#endif |
... | ... | |
1564 | 1566 |
|
1565 | 1567 |
if(pkt->dts != AV_NOPTS_VALUE) |
1566 | 1568 |
ist->next_pts = ist->pts = av_rescale_q(pkt->dts, ist->st->time_base, AV_TIME_BASE_Q); |
1569 |
if(pkt->pts != AV_NOPTS_VALUE) |
|
1570 |
pkt_pts = av_rescale_q(pkt->pts, ist->st->time_base, AV_TIME_BASE_Q); |
|
1567 | 1571 |
|
1568 | 1572 |
//while we have more to decode or while the decoder did output something on EOF |
1569 | 1573 |
while (avpkt.size > 0 || (!pkt && ist->next_pts != ist->pts)) { |
... | ... | |
1616 | 1620 |
decoded_data_size = (ist->st->codec->width * ist->st->codec->height * 3) / 2; |
1617 | 1621 |
/* XXX: allocate picture correctly */ |
1618 | 1622 |
avcodec_get_frame_defaults(&picture); |
1623 |
ist->st->codec->reordered_opaque = pkt_pts; |
|
1624 |
pkt_pts = AV_NOPTS_VALUE; |
|
1619 | 1625 |
|
1620 | 1626 |
ret = avcodec_decode_video2(ist->st->codec, |
1621 | 1627 |
&picture, &got_picture, &avpkt); |
... | ... | |
1626 | 1632 |
/* no picture yet */ |
1627 | 1633 |
goto discard_packet; |
1628 | 1634 |
} |
1635 |
ist->next_pts = ist->pts = guess_correct_pts(&ist->pts_ctx, picture.reordered_opaque, ist->pts); |
|
1629 | 1636 |
if (ist->st->codec->time_base.num != 0) { |
1630 | 1637 |
int ticks= ist->st->parser ? ist->st->parser->repeat_pict+1 : ist->st->codec->ticks_per_frame; |
1631 | 1638 |
ist->next_pts += ((int64_t)AV_TIME_BASE * |
... | ... | |
2414 | 2421 |
st= ist->st; |
2415 | 2422 |
ist->pts = st->avg_frame_rate.num ? - st->codec->has_b_frames*AV_TIME_BASE / av_q2d(st->avg_frame_rate) : 0; |
2416 | 2423 |
ist->next_pts = AV_NOPTS_VALUE; |
2424 |
init_pts_correction(&ist->pts_ctx); |
|
2417 | 2425 |
ist->is_start = 1; |
2418 | 2426 |
} |
2419 | 2427 |
|
Also available in: Unified diff