From fe0c37b00715e17d84b524b0f6f57d910a82806d Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 20 Mar 2015 22:07:26 +0100 Subject: player: better handling of video with no timestamps Trying to handle such video is almost worthless, but it was requested by at least 2 users. If there are no timestamps, enable byte seeking by setting ts_resets_possible. Use the video FPS (wherever it comes from) and the audio samplerate for timing. The latter was already done by making the first packet emit DTS=0; remove this again and do it "properly" in a higher level. --- video/decode/dec_video.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'video/decode') diff --git a/video/decode/dec_video.c b/video/decode/dec_video.c index a0bd6cb047..c578ccadcc 100644 --- a/video/decode/dec_video.c +++ b/video/decode/dec_video.c @@ -200,6 +200,12 @@ bool video_init_best_codec(struct dec_video *d_video, char* video_decoders) d_video->header->codec ? d_video->header->codec : ""); } + if (d_video->header->missing_timestamps) { + MP_WARN(d_video, "This stream has no timestamps!\n"); + MP_WARN(d_video, "Making up playback time using %f FPS.\n", d_video->fps); + MP_WARN(d_video, "Seeking will probably fail badly.\n"); + } + talloc_free(list); return !!d_video->vd_driver; } @@ -351,7 +357,7 @@ struct mp_image *video_decode(struct dec_video *d_video, pts = retrieve_sorted_pts(d_video, pts); if (!opts->correct_pts || pts == MP_NOPTS_VALUE) { - if (opts->correct_pts) + if (opts->correct_pts && !d_video->header->missing_timestamps) MP_WARN(d_video, "No video PTS! Making something up.\n"); double frame_time = 1.0f / (d_video->fps > 0 ? d_video->fps : 25); -- cgit v1.2.3