mirror of
https://github.com/WinampDesktop/winamp.git
synced 2025-06-10 11:59:58 -05:00
Initial community commit
This commit is contained in:
49
Src/Plugins/Input/in_wmvdrm/WaitLayer.cpp
Normal file
49
Src/Plugins/Input/in_wmvdrm/WaitLayer.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "main.h"
|
||||
#include "WaitLayer.h"
|
||||
#include "util.h"
|
||||
|
||||
WaitLayer::WaitLayer(IWMReader *_reader)
|
||||
: reader(_reader), stopEvent(0)
|
||||
{
|
||||
reader->AddRef();
|
||||
openEvent = CreateEvent(0, TRUE, FALSE, 0);
|
||||
}
|
||||
|
||||
WaitLayer::~WaitLayer()
|
||||
{
|
||||
reader->Release();
|
||||
reader=0;
|
||||
}
|
||||
|
||||
void WaitLayer::Opened()
|
||||
{
|
||||
SetEvent(openEvent);
|
||||
WMHandler::Opened();
|
||||
}
|
||||
|
||||
bool WaitLayer::IsOpen()
|
||||
{
|
||||
return WaitForSingleObject(openEvent, 0) == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
void WaitLayer::OpenCalled()
|
||||
{
|
||||
SetEvent(openEvent);
|
||||
WMHandler::OpenCalled();
|
||||
}
|
||||
|
||||
void WaitLayer::OpenFailed()
|
||||
{
|
||||
SetEvent(openEvent);
|
||||
WMHandler::OpenFailed();
|
||||
}
|
||||
|
||||
bool WaitLayer::WaitForOpen(int time_ms)
|
||||
{
|
||||
return WaitForSingleObject(openEvent, time_ms) == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
void WaitLayer::ResetForOpen()
|
||||
{
|
||||
ResetEvent(openEvent);
|
||||
}
|
Reference in New Issue
Block a user