diff options
author | phintuka <phintuka> | 2007-04-02 14:36:18 +0000 |
---|---|---|
committer | phintuka <phintuka> | 2007-04-02 14:36:18 +0000 |
commit | fd29b8409d629cbc2919ec6a339539ee89f4f6da (patch) | |
tree | eceb0d4414bfcc37d70b07509f5175c27188efd1 | |
parent | a9ed7bd5056af656821ee11b6ccb71b5b39415ae (diff) | |
download | xineliboutput-fd29b8409d629cbc2919ec6a339539ee89f4f6da.tar.gz xineliboutput-fd29b8409d629cbc2919ec6a339539ee89f4f6da.tar.bz2 |
Do not create resume file if file was replayed (almost) to end (Reported by Matti Horila)
Save resume position to 10 seconds before ("VDR style")
-rw-r--r-- | media_player.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/media_player.c b/media_player.c index 0b15f5ef..2c8cc7f0 100644 --- a/media_player.c +++ b/media_player.c @@ -4,7 +4,7 @@ * See the main source file 'xineliboutput.c' for copyright information and * how to reach the author. * - * $Id: media_player.c,v 1.23 2007-03-14 14:39:48 phintuka Exp $ + * $Id: media_player.c,v 1.24 2007-04-02 14:36:18 phintuka Exp $ * */ @@ -228,7 +228,7 @@ bool cXinelibPlayer::NextFile(int step) void cXinelibPlayer::Activate(bool On) { - int pos = 0, fd = -1; + int pos = 0, len = 0, fd = -1; if(On) { if(m_UseResume && !*m_ResumeFile) m_ResumeFile = cString::sprintf("%s.resume", *m_File); @@ -265,8 +265,9 @@ void cXinelibPlayer::Activate(bool On) } else { if(m_UseResume && *m_ResumeFile) { pos = cXinelibDevice::Instance().PlayFileCtrl("GETPOS"); - if(pos>=0) { - pos /= 1000; + len = cXinelibDevice::Instance().PlayFileCtrl("GETLENGTH"); + if(pos>=0 && pos < (len-10000)) { + pos = (pos/1000) - 10; // skip back 10 seconds ("VDR style") if(0 <= (fd = open(m_ResumeFile, O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) { if(write(fd, &pos, sizeof(int)) != sizeof(int)) { |