some optimizations in video decoder

This commit is contained in:
Alexander Eckart committed 2012-02-20 20:29:39 +01:00
1 parent b81cbcc7b8
commit a649299c88
1 file changed
+11 -5
+11 -5
View File
@@ -244,6 +244,7 @@ namespace Vocaluxe.Lib.Video
private bool _Paused = false; private bool _Paused = false;
private bool _NoMoreFrames = false; private bool _NoMoreFrames = false;
private bool _Finished = false; private bool _Finished = false;
private bool _BeforeLoop = false;
private int _Width = 0; private int _Width = 0;
@@ -314,7 +315,10 @@ namespace Vocaluxe.Lib.Video
public bool Finished public bool Finished
{ {
get { return _Finished; } get
{
return _Finished;
}
} }
public bool Open(string FileName) public bool Open(string FileName)
@@ -395,6 +399,7 @@ namespace Vocaluxe.Lib.Video
_VideoSkipTime = _Gap; _VideoSkipTime = _Gap;
_NegativeSkipTime = _Start + _Gap; _NegativeSkipTime = _Start + _Gap;
_SkipTime = _Start + _Gap; _SkipTime = _Start + _Gap;
_BeforeLoop = false;
} }
if (_SkipTime > 0) if (_SkipTime > 0)
@@ -575,7 +580,7 @@ namespace Vocaluxe.Lib.Video
return; return;
int FrameFinished = 0; int FrameFinished = 0;
if (DropFrame) if (DropFrame && !_BeforeLoop)
{ {
try try
{ {
@@ -588,7 +593,7 @@ namespace Vocaluxe.Lib.Video
} }
if (!DropFrame || FrameFinished != 0) if (!_BeforeLoop && (!DropFrame || FrameFinished != 0))
{ {
lock (MutexFrame) lock (MutexFrame)
{ {
@@ -608,14 +613,15 @@ namespace Vocaluxe.Lib.Video
{ {
if (_Loop) if (_Loop)
{ {
bool doskip = false; _BeforeLoop = true;
bool doskip = true;
float tm = 0f; float tm = 0f;
int num = -1; int num = -1;
lock (MutexFramebuffer) lock (MutexFramebuffer)
{ {
for (int i = 0; i < _FrameBuffer.Length; i++) for (int i = 0; i < _FrameBuffer.Length; i++)
{ {
if (_FrameBuffer[i].time > tm) if (_FrameBuffer[i].time > tm && !_FrameBuffer[i].displayed)
{ {
tm = _FrameBuffer[i].time; tm = _FrameBuffer[i].time;
num = i; num = i;