summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2011-12-14 18:01:03 +0100
committerJohns <johns98@gmx.net>2011-12-14 18:01:03 +0100
commit5ca9bedda810e84b7bc1dc476c39c817563ad353 (patch)
tree5d67f42322eee373436c221867f78a87dada9f73 /video.c
parent4bd1d0ba3f19e7aa7119ed7d6fbcd4cd91b5f47a (diff)
downloadvdr-plugin-softhddevice-5ca9bedda810e84b7bc1dc476c39c817563ad353.tar.gz
vdr-plugin-softhddevice-5ca9bedda810e84b7bc1dc476c39c817563ad353.tar.bz2
Initial support of replay.
Diffstat (limited to 'video.c')
-rw-r--r--video.c35
1 files changed, 33 insertions, 2 deletions
diff --git a/video.c b/video.c
index 82a6d9e..f209dd5 100644
--- a/video.c
+++ b/video.c
@@ -3122,11 +3122,15 @@ static void *VideoDisplayHandlerThread(void *dummy)
decoder->StartTime.tv_nsec)) > delay)) {
if (!(decoder->FrameCounter % (50 * 10))) {
+ static int64_t last_video_clock;
+
Debug(3,
- "video: %09" PRIx64 "-%09" PRIx64 " pts %+dms %" PRId64
- "\n", audio_clock, video_clock,
+ "video: %09" PRIx64 "-%09" PRIx64 " %4" PRId64
+ " pts %+dms %" PRId64 "\n", audio_clock, video_clock,
+ video_clock - last_video_clock,
(int)(audio_clock - video_clock) / 90,
AudioGetDelay() / 90);
+ last_video_clock = video_clock;
}
if (0 && audio_clock < video_clock + 2000) {
err = 1;
@@ -3562,6 +3566,33 @@ void VideoDisplayHandler(void)
#endif
+/**
+** Get video clock.
+**
+** @note this isn't monoton, decoding reorders frames.
+*/
+int64_t VideoGetClock(void)
+{
+#ifdef USE_VAAPI
+ if (VideoVaapiEnabled) {
+ // pts is the timestamp of the latest decoded frame
+ // FIXME: +-20ms which field is currently displayed
+ if ((uint64_t) VaapiDecoders[0]->PTS == AV_NOPTS_VALUE) {
+ return AV_NOPTS_VALUE;
+ }
+ return VaapiDecoders[0]->PTS -
+ (VaapiDecoders[0]->Interlaced ? 40 : 20) * 90 *
+ atomic_read(&VaapiDecoders[0]->SurfacesFilled);
+ }
+#endif
+#ifdef USE_VDPAU
+ if (VideoVdpauEnabled) {
+ return 0L;
+ }
+#endif
+ return 0L;
+}
+
//----------------------------------------------------------------------------
// Setup
//----------------------------------------------------------------------------