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 | |
parent | f13e8a156e50e8bd7a1ed96bc4936acea0eb2304 (diff) | |
download | vdr-680838947bb5765664be84a98344f5758b99211f.tar.gz vdr-680838947bb5765664be84a98344f5758b99211f.tar.bz2 |
Fixed stuttering or asynchronous audio after changing the audio track
-rw-r--r-- | HISTORY | 4 | ||||
-rw-r--r-- | dvbplayer.c | 24 |
2 files changed, 25 insertions, 3 deletions
@@ -7645,7 +7645,7 @@ Video Disk Recorder Revision History - Expanded tabs in PLUGINS/src/dvbhddevice/setup.c. - Some formatting fixes. -2013-02-19: Version 1.7.39 +2013-02-20: Version 1.7.39 - Updated the Finnish OSD texts (thanks to Rolf Ahrenberg). - Updated the Polish OSD texts (thanks to Marek Nazarko). @@ -7664,3 +7664,5 @@ Video Disk Recorder Revision History - The demos in the "osddemo" plugin can now also be ended with the "Back" key. - Fixed flashing OSD in "high level OSD" mode of the TT S2-6400 in case a menu is open while subtitles are being displayed. +- Fixed stuttering or asynchronous audio after changing the audio track. This is done + by doing a "jump" to the current position, which clears all buffers. 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) { |