diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2013-02-20 09:10:19 +0100 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2013-02-20 09:10:19 +0100 |
commit | 680838947bb5765664be84a98344f5758b99211f (patch) | |
tree | 8feed2987b39c9589a2309a412f4359a2cc75b54 /dvbplayer.c | |
parent | f13e8a156e50e8bd7a1ed96bc4936acea0eb2304 (diff) | |
download | vdr-680838947bb5765664be84a98344f5758b99211f.tar.gz vdr-680838947bb5765664be84a98344f5758b99211f.tar.bz2 |
Fixed stuttering or asynchronous audio after changing the audio track
Diffstat (limited to 'dvbplayer.c')
-rw-r--r-- | dvbplayer.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/dvbplayer.c b/dvbplayer.c index c9c8fa03..fda02158 100644 --- a/dvbplayer.c +++ b/dvbplayer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbplayer.c 2.30 2013/02/12 10:50:10 kls Exp $ + * $Id: dvbplayer.c 2.31 2013/02/20 09:03:49 kls Exp $ */ #include "dvbplayer.h" @@ -220,6 +220,7 @@ private: cFrame *readFrame; cFrame *playFrame; cFrame *dropFrame; + bool resyncAfterPause; void TrickSpeed(int Increment); void Empty(void); bool NextFile(uint16_t FileNumber = 0, off_t FileOffset = -1); @@ -240,6 +241,7 @@ public: void SkipSeconds(int Seconds); void Goto(int Position, bool Still = false); virtual double FramesPerSecond(void) { return framesPerSecond; } + virtual void SetAudioTrack(eTrackType Type, const tTrackId *TrackId); virtual bool GetIndex(int &Current, int &Total, bool SnapToIFrame = false); virtual bool GetReplayMode(bool &Play, bool &Forward, int &Speed); }; @@ -270,6 +272,7 @@ cDvbPlayer::cDvbPlayer(const char *FileName, bool PauseLive) readFrame = NULL; playFrame = NULL; dropFrame = NULL; + resyncAfterPause = false; isyslog("replay %s", FileName); fileName = new cFileName(FileName, false, false, isPesRecording); replayFile = fileName->Open(); @@ -636,7 +639,13 @@ void cDvbPlayer::Play(void) DevicePlay(); playMode = pmPlay; playDir = pdForward; - } + if (resyncAfterPause) { + int Current, Total; + if (GetIndex(Current, Total, true)) + Goto(Current); + resyncAfterPause = false; + } + } } void cDvbPlayer::Forward(void) @@ -799,6 +808,17 @@ void cDvbPlayer::Goto(int Index, bool Still) } } +void cDvbPlayer::SetAudioTrack(eTrackType Type, const tTrackId *TrackId) +{ + if (playMode == pmPlay) { + int Current, Total; + if (GetIndex(Current, Total, true)) + Goto(Current); + } + else if (playMode == pmPause) + resyncAfterPause = true; +} + bool cDvbPlayer::GetIndex(int &Current, int &Total, bool SnapToIFrame) { if (index) { |