History

ffmpeg: use reordered duration for stream PTS.

Nicolas George committed 9 years ago

Commit 36c111c1 parent dfed8e21 file · +5 −3Browse files

Unified · Split

ffmpeg.c+5−3
@@ -2368,7 +2368,7 @@ static int decode_audio(InputStream *ist, AVPacket *pkt, int *got_output, · 2367 unmodified lines
2368 return err < 0 ? err : ret;2368 return err < 0 ? err : ret;
2369}2369}
2370 2370
2371static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eof,2371static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int64_t *duration_pts, int eof,
2372 int *decode_failed)2372 int *decode_failed)
2373{2373{
2374 AVFrame *decoded_frame;2374 AVFrame *decoded_frame;
@@ -2459,6 +2459,7 @@ static int decode_video(InputStream *ist, AVPacket *pkt, int *got_output, int eo · 84 unmodified lines
2459 ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;2459 ist->hwaccel_retrieved_pix_fmt = decoded_frame->format;
2460 2460
2461 best_effort_timestamp= decoded_frame->best_effort_timestamp;2461 best_effort_timestamp= decoded_frame->best_effort_timestamp;
2462 *duration_pts = decoded_frame->pkt_duration;
2462 2463
2463 if (ist->framerate.num)2464 if (ist->framerate.num)
2464 best_effort_timestamp = ist->cfr_next_pts++;2465 best_effort_timestamp = ist->cfr_next_pts++;
@@ -2629,6 +2630,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 164 unmodified lines
2629 // while we have more to decode or while the decoder did output something on EOF2630 // while we have more to decode or while the decoder did output something on EOF
2630 while (ist->decoding_needed) {2631 while (ist->decoding_needed) {
2631 int64_t duration_dts = 0;2632 int64_t duration_dts = 0;
2633 int64_t duration_pts = 0;
2632 int got_output = 0;2634 int got_output = 0;
2633 int decode_failed = 0;2635 int decode_failed = 0;
2634 2636
@@ -2641,7 +2643,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 6 unmodified lines
2641 &decode_failed);2643 &decode_failed);
2642 break;2644 break;
2643 case AVMEDIA_TYPE_VIDEO:2645 case AVMEDIA_TYPE_VIDEO:
2644 ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, !pkt,2646 ret = decode_video (ist, repeating ? NULL : &avpkt, &got_output, &duration_pts, !pkt,
2645 &decode_failed);2647 &decode_failed);
2646 if (!repeating || !pkt || got_output) {2648 if (!repeating || !pkt || got_output) {
2647 if (pkt && pkt->duration) {2649 if (pkt && pkt->duration) {
@@ -2660,7 +2662,7 @@ static int process_input_packet(InputStream *ist, const AVPacket *pkt, int no_eo · 12 unmodified lines
2660 }2662 }
2661 2663
2662 if (got_output)2664 if (got_output)
2663 ist->next_pts += duration_dts; //FIXME the duration is not correct in some cases2665 ist->next_pts += av_rescale_q(duration_pts, ist->st->time_base, AV_TIME_BASE_Q);
2664 break;2666 break;
2665 case AVMEDIA_TYPE_SUBTITLE:2667 case AVMEDIA_TYPE_SUBTITLE:
2666 if (repeating)2668 if (repeating)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t