Hi all.

I had a small problem with xineliboutput, i didn't find a way to start playing a file with mediaplayer from the beginning if the file had been earlier watched till the end. Media player always started from end of file.

So i made a small patch, which saves resume position to 0 seconds if there was less than 10 seconds till the end of file.

Regards
Matti


--- vdr-1.4.6-vanilla/PLUGINS/src/xineliboutput-1.0.0rc1/media_player.c 2007-03-17 14:41:20.000000000 +0200 +++ vdr-1.4.6/PLUGINS/src/xineliboutput-1.0.0rc1/media_player.c 2007-03-31 21:50:42.000000000 +0300
@@ -228,7 +228,7 @@

 void cXinelibPlayer::Activate(bool On)
 {
-  int pos = 0, fd = -1;
+  int pos = 0, fd = -1, len = 0;
   if(On) {
     if(m_UseResume && !*m_ResumeFile)
       m_ResumeFile = cString::sprintf("%s.resume", *m_File);
@@ -267,6 +267,12 @@
       pos = cXinelibDevice::Instance().PlayFileCtrl("GETPOS");
       if(pos>=0) {
        pos /= 1000;
+       len = cXinelibDevice::Instance().PlayFileCtrl("GETLENGTH");
+       len /= 1000;
+       len -= 10;
+       if( pos > len )
+    pos = 0;
+
        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)) {



_______________________________________________
vdr mailing list
vdr@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/vdr

Reply via email to