while(1)
{
+ threadCheckExit();
+
if (audioEnabled)
{
alen = Demuxer::getInstance()->writeAudio(fd); // FIXME ?
}
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);
}
}
{
Log::getInstance()->log("Player", Log::DEBUG, "DOING RESYNC");
+/*
vfeed.stop();
afeed.stop();
video->reset();
video->sync();
audio->sync();
call();
+*/
+
+ // resync method 2..
+
+ video->pause();
+ usleep(500000);
+ video->play();
+ video->sync();
+
return 1;
}
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.
/*
{
Log::getInstance()->log("Player", Log::DEBUG, "PLAYER TEST");
- video->test();
+// video->test();
// static int flipflop = 0;
// flipflop = !flipflop;
+
}
void Player::test2()
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();
}
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()
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
{
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();
}
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;