1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed stuttering or asynchronous audio after changing the audio track

This commit is contained in:
Klaus Schmidinger 2013-02-20 09:10:19 +01:00
parent f13e8a156e
commit 680838947b
2 changed files with 25 additions and 3 deletions

View File

@ -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.

View File

@ -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) {