summaryrefslogtreecommitdiff
path: root/video.c
diff options
context:
space:
mode:
authorJohns <johns98@gmx.net>2012-04-21 12:59:04 +0200
committerJohns <johns98@gmx.net>2012-04-21 12:59:04 +0200
commite30e1e5aad2e35f35af248167b8366a75f28234d (patch)
tree527a308179595166fd8190d49e9100bc27fb12dc /video.c
parentd26c34f34f77b860b2ac7faf0fda914ca2eeb39b (diff)
downloadvdr-plugin-softhddevice-e30e1e5aad2e35f35af248167b8366a75f28234d.tar.gz
vdr-plugin-softhddevice-e30e1e5aad2e35f35af248167b8366a75f28234d.tar.bz2
Handle jump in stream like stream start.
Diffstat (limited to 'video.c')
-rw-r--r--video.c37
1 files changed, 33 insertions, 4 deletions
diff --git a/video.c b/video.c
index 762036b..f01debb 100644
--- a/video.c
+++ b/video.c
@@ -1342,6 +1342,7 @@ struct _vaapi_decoder_
int64_t PTS; ///< video PTS clock
int SyncCounter; ///< counter to sync frames
+ int StartCounter; ///< counter for video start
int FramesDuped; ///< number of frames duplicated
int FramesMissed; ///< number of frames missed
int FramesDropped; ///< number of frames dropped
@@ -1862,6 +1863,7 @@ static void VaapiCleanup(VaapiDecoder * decoder)
decoder->SyncCounter = 0;
decoder->FrameCounter = 0;
decoder->FramesDisplayed = 0;
+ decoder->StartCounter = 0;
decoder->Closing = 0;
decoder->PTS = AV_NOPTS_VALUE;
VideoDeltaPTS = 0;
@@ -4303,6 +4305,7 @@ static void VaapiDisplayFrame(void)
decoder = VaapiDecoders[i];
decoder->FramesDisplayed++;
+ decoder->StartCounter++;
filled = atomic_read(&decoder->SurfacesFilled);
// no surface availble show black with possible osd
@@ -4461,12 +4464,12 @@ static void VaapiSyncDecoder(VaapiDecoder * decoder)
decoder->TrickCounter = decoder->TrickSpeed;
}
// at start of new video stream, soft or hard sync video to audio
- if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames
+ if (!VideoSoftStartSync && decoder->StartCounter < VideoSoftStartFrames
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
err =
VaapiMessage(3, "video: initial slow down video, frame %d\n",
- decoder->FramesDisplayed);
+ decoder->StartCounter);
goto out;
}
@@ -5025,6 +5028,7 @@ typedef struct _vdpau_decoder_
int64_t PTS; ///< video PTS clock
int SyncCounter; ///< counter to sync frames
+ int StartCounter; ///< counter for video start
int FramesDuped; ///< number of frames duplicated
int FramesMissed; ///< number of frames missed
int FramesDropped; ///< number of frames dropped
@@ -5742,6 +5746,7 @@ static void VdpauCleanup(VdpauDecoder * decoder)
decoder->SyncCounter = 0;
decoder->FrameCounter = 0;
decoder->FramesDisplayed = 0;
+ decoder->StartCounter = 0;
decoder->Closing = 0;
decoder->PTS = AV_NOPTS_VALUE;
VideoDeltaPTS = 0;
@@ -7542,6 +7547,7 @@ static void VdpauDisplayFrame(void)
decoder = VdpauDecoders[i];
decoder->FramesDisplayed++;
+ decoder->StartCounter++;
filled = atomic_read(&decoder->SurfacesFilled);
// need 1 frame for progressive, 3 frames for interlaced
@@ -7685,12 +7691,12 @@ static void VdpauSyncDecoder(VdpauDecoder * decoder)
decoder->TrickCounter = decoder->TrickSpeed;
}
// at start of new video stream, soft or hard sync video to audio
- if (!VideoSoftStartSync && decoder->FramesDisplayed < VideoSoftStartFrames
+ if (!VideoSoftStartSync && decoder->StartCounter < VideoSoftStartFrames
&& (audio_clock == (int64_t) AV_NOPTS_VALUE
|| video_clock > audio_clock + VideoAudioDelay + 120 * 90)) {
err =
VdpauMessage(3, "video: initial slow down video, frame %d\n",
- decoder->FramesDisplayed);
+ decoder->StartCounter);
goto out;
}
@@ -9188,6 +9194,29 @@ void VideoSetClosing(VideoHwDecoder * hw_decoder)
}
///
+/// Reset start of frame counter.
+///
+/// @param hw_decoder video hardware decoder
+///
+void VideoResetStart(VideoHwDecoder * hw_decoder)
+{
+ Debug(3, "video: reset start\n");
+ // FIXME: test to check if working, than make module function
+#ifdef USE_VDPAU
+ if (VideoUsedModule == &VdpauModule) {
+ hw_decoder->Vdpau.StartCounter = 0;
+ }
+#endif
+#ifdef USE_VAPI
+ if (VideoUsedModule == &VaapiModule) {
+ hw_decoder->Vaapi.StartCounter = 0;
+ }
+#endif
+ // clear clock to trigger new video stream
+ VideoSetClock(hw_decoder, AV_NOPTS_VALUE);
+}
+
+///
/// Set trick play speed.
///
/// @param hw_decoder video hardware decoder