]> git.vomp.tv Git - vompclient.git/commitdiff
The end of a/v sync problems?! Probably not, but I can hope!
authorChris Tallon <chris@vomp.tv>
Tue, 5 Jul 2005 21:25:10 +0000 (21:25 +0000)
committerChris Tallon <chris@vomp.tv>
Tue, 5 Jul 2005 21:25:10 +0000 (21:25 +0000)
afeed.cc
player.cc
video.cc

index bfdfe1cbc9ccf439c0c4ead4c67e8bb5d7afccc0..53808ef823b183966ab4c44027249771790c9ee1 100644 (file)
--- a/afeed.cc
+++ b/afeed.cc
@@ -68,6 +68,8 @@ void AFeed::threadMethod()
 
   while(1)
   {
+    threadCheckExit();
+
     if (audioEnabled)
     {
       alen = Demuxer::getInstance()->writeAudio(fd); // FIXME ?
@@ -84,7 +86,10 @@ void AFeed::threadMethod()
     }
     else
     {
-      Demuxer::getInstance()->flushAudio(); // FIXME, no delay here now
+      Demuxer::getInstance()->flushAudio();
+      usleep(100000);
+
+      // FIXME, no delay here now
 //      if (demux_get_audio(demuxHandle, buffer, 1000) != 1000) nanosleep(&delayTime, NULL);
     }
   }
index d77d5aa4ef86efd8ad2ffac14c33f22d1a9bc246..e7d7d04de9847a1417daee705ae4210e433630f6 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -123,6 +123,7 @@ int Player::play()
   {
     Log::getInstance()->log("Player", Log::DEBUG, "DOING RESYNC");
 
+/*
     vfeed.stop();
     afeed.stop();
     video->reset();
@@ -138,6 +139,15 @@ int Player::play()
     video->sync();
     audio->sync();
     call();
+*/
+
+    // resync method 2..
+
+    video->pause();
+    usleep(500000);
+    video->play();
+    video->sync();
+
 
     return 1;
   }
@@ -153,10 +163,17 @@ int Player::play()
   threadStart();
   vfeed.start();
   afeed.start();
-  video->play();
   audio->play();
+  video->play();
   video->sync();
   audio->sync();
+
+  video->pause();
+      usleep(500000); // SYNC
+  video->sync();
+  video->unPause();
+  video->sync();
+
 // ------------------------ This one doesn't work, but it should, and would allow for prebuffering.
 
 /*
@@ -237,7 +254,7 @@ void Player::test()
 {
   Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST");
 
-  video->test();
+//  video->test();
 
 //  static int flipflop = 0;
 
@@ -246,6 +263,7 @@ void Player::test()
 
 //  flipflop = !flipflop;
 
+
 }
 
 void Player::test2()
@@ -290,10 +308,16 @@ void Player::skipForward(int seconds)
   vfeed.start();
   afeed.start();
   threadStart();
+  audio->play();
+  video->play();
   video->sync();
   audio->sync();
-  video->play();
-  audio->play();
+
+  video->pause();
+      usleep(500000); // SYNC
+  video->sync();
+  video->unPause();
+  video->sync();
 
 }
 
@@ -319,10 +343,17 @@ void Player::skipBackward(int seconds)
   vfeed.start();
   afeed.start();
   threadStart();
-  video->play();
   audio->play();
+  video->play();
   video->sync();
   audio->sync();
+
+  video->pause();
+      usleep(500000); // SYNC
+  video->sync();
+  video->unPause();
+  video->sync();
+
 }
 
 void Player::toggleFastForward()
@@ -336,12 +367,46 @@ void Player::toggleFastForward()
   if (ffwd)
   {
     ffwd = 0;
+//    video->unFastForward();
+
+
+    threadStop();
+    vfeed.stop();
+    afeed.stop();
+    video->stop();
+    audio->stop();
+    video->reset();
+    audio->reset();
+    demuxer.flush();
+//    demuxer.seek();
+    vfeed.start();
     afeed.enable();
-    video->unFastForward();
+    afeed.start();
+    threadStart();
+    video->play();
+    audio->play();
+    video->sync();
+    audio->sync();
+
+    audio->systemMuteOff();
+
+    video->pause();
+        usleep(500000); // SYNC
+    video->sync();
+    video->unPause();
+    video->sync();
+
+/*
+    demuxer.flushAudio();
     audio->reset();
+    afeed.enable();
+    //video->reset();
+    audio->play();
+    video->play();
     video->sync();
     audio->sync();
     audio->systemMuteOff();
+*/
   }
   else
   {
@@ -400,10 +465,16 @@ void Player::jumpToPercent(int percent)
   vfeed.start();
   afeed.start();
   threadStart();
-  video->play();
   audio->play();
+  video->play();
   video->sync();
   audio->sync();
+
+  video->pause();
+      usleep(500000); // SYNC
+  video->sync();
+  video->unPause();
+  video->sync();
 }
 
 
index 608f7b3d2587a6bccfe533d936fca04ef8eaab9a..53907ad93357269007986c5f22f03f30a399e575 100644 (file)
--- a/video.cc
+++ b/video.cc
@@ -256,7 +256,7 @@ int Video::pause()
   return 1;
 }
 
-int Video::unPause()
+int Video::unPause() // FIXME get rid - same as play!!
 {
   if (!initted) return 0;
   if (ioctl(fdVideo, AV_SET_VID_PLAY, 0) != 0) return 0;