本文整理汇总了C++中CSingleLock类的典型用法代码示例。如果您正苦于以下问题:C++ CSingleLock类的具体用法?C++ CSingleLock怎么用?C++ CSingleLock使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CSingleLock类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
// close all active modal dialogs
g_windowManager.CloseInternalModalDialogs(true);
CGUIWindow::OnMessage(message);
CSettings::GetInstance().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
return true;
}
case GUI_MSG_SETFOCUS:
case GUI_MSG_LOSTFOCUS:
if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true;
break;
}
return CGUIWindow::OnMessage(message);
}
示例2: lock
bool CPingMsgContainer::GetPingMsg( CPingMsg & msg )
{
CSingleLock lock (&m_Mutex);
lock.Lock();
if (m_arrPingMsg.empty())
{
lock.Unlock();
return false;
}
CPingMsg ret_msg = m_arrPingMsg.front();
m_arrPingMsg.pop_front();
msg = ret_msg;
return true;
}
示例3: while
void CCdgReader::Process()
{
double fCurTime = 0.0f;
double fNewTime=0.f;
CStdString strExt;
CUtil::GetExtension(m_pLoader->GetFileName(),strExt);
strExt = m_pLoader->GetFileName().substr(0,m_pLoader->GetFileName().size()-strExt.size());
while (!CThread::m_bStop)
{
CSingleLock lock (m_CritSection);
double fDiff;
const CMusicInfoTag* tag = g_infoManager.GetCurrentSongTag();
if (!tag || tag->GetURL().substr(0,strExt.size()) != strExt)
{
Sleep(15);
if (CThread::m_bStop)
return;
CUtil::GetExtension(m_pLoader->GetFileName(),strExt);
strExt = m_pLoader->GetFileName().substr(0,m_pLoader->GetFileName().size()-strExt.size());
fDiff = 0.f;
}
else
{
fNewTime=m_pLyrics->getSongTime();
fDiff = fNewTime-fCurTime-m_fAVDelay;
}
if (fDiff < -0.3f)
{
CStdString strFile = m_pLoader->GetFileName();
m_pLoader->StopStream();
while (m_pLoader->GetCurSubCode()) {}
m_pLoader->StreamFile(strFile);
m_uiNumReadSubCodes = 0;
m_Cdg.ClearDisplay();
fNewTime = m_pLyrics->getSongTime();
SkipUpToTime((float)fNewTime-m_fAVDelay);
}
else
ReadUpToTime((float)fNewTime-m_fAVDelay);
fCurTime = fNewTime;
lock.Leave();
Sleep(15);
}
}
示例4: CEvent
void CApplicationMessenger::SendMsg(ThreadMessage&& message, bool wait)
{
std::shared_ptr<CEvent> waitEvent;
if (wait)
{ // check that we're not being called from our application thread, else we'll be waiting
// forever!
if (!g_application.IsCurrentThread())
{
message.waitEvent.reset(new CEvent(true));
waitEvent = message.waitEvent;
}
else
{
//OutputDebugString("Attempting to wait on a SendMessage() from our application thread will cause lockup!\n");
//OutputDebugString("Sending immediately\n");
ProcessMessage(&message);
return;
}
}
if (g_application.m_bStop)
return;
ThreadMessage* msg = new ThreadMessage(std::move(message));
CSingleLock lock (m_critSection);
if (msg->dwMessage == TMSG_GUI_MESSAGE)
m_vecWindowMessages.push(msg);
else
m_vecMessages.push(msg);
lock.Leave(); // this releases the lock on the vec of messages and
// allows the ProcessMessage to execute and therefore
// delete the message itself. Therefore any accesss
// of the message itself after this point consittutes
// a race condition (yarc - "yet another race condition")
//
if (waitEvent) // ... it just so happens we have a spare reference to the
// waitEvent ... just for such contingencies :)
{
// ensure the thread doesn't hold the graphics lock
CSingleExit exit(g_graphicsContext);
waitEvent->Wait();
}
}
示例5: lock
void CApplicationMessenger::ProcessWindowMessages()
{
CSingleLock lock (m_critSection);
//message type is window, process window messages
while (m_vecWindowMessages.size() > 0)
{
ThreadMessage* pMsg = m_vecWindowMessages.front();
//first remove the message from the queue, else the message could be processed more then once
m_vecWindowMessages.pop();
// leave here in case we make more thread messages from this one
lock.Leave();
ProcessMessage(pMsg);
if (pMsg->hWaitEvent)
SetEvent(pMsg->hWaitEvent);
delete pMsg;
lock.Enter();
}
}
示例6: lock
void CApplicationMessenger::ProcessWindowMessages()
{
CSingleLock lock (m_critSection);
//message type is window, process window messages
while (!m_vecWindowMessages.empty())
{
ThreadMessage* pMsg = m_vecWindowMessages.front();
//first remove the message from the queue, else the message could be processed more then once
m_vecWindowMessages.pop();
// leave here in case we make more thread messages from this one
std::shared_ptr<CEvent> waitEvent = pMsg->waitEvent;
lock.Leave(); // <- see the large comment in SendMessage ^
ProcessMessage(pMsg);
if (waitEvent)
waitEvent->Set();
delete pMsg;
lock.Enter();
}
}
示例7: GetSystemTime
void CPingMsgContainer::AddPingMsg(CPingMsg &msg)
{
GetSystemTime(& msg.m_stReply);
m_nPingCnt ++;
CSingleLock lock (&m_Mutex);
lock.Lock();
if (m_arrPingMsg.size() >= MAX_COMM_MSG_CNT)
{
lock.Unlock();
return;
}
msg.m_nIdx = m_nPingCnt;
if (msg.m_nStatus)
{
m_nLostCnt++;
}
else
{
m_nReplyCnt ++;
}
m_arrPingMsg.push_back(msg);
lock.Unlock();
}
示例8: while
void CApplicationRenderer::Process()
{
#ifndef HAS_SDL
int iWidth = 0;
int iHeight = 0;
int iLeft = 0;
int iTop = 0;
LPDIRECT3DSURFACE8 lpSurfaceBack = NULL;
LPDIRECT3DSURFACE8 lpSurfaceFront = NULL;
while (!m_bStop)
{
if (!m_enabled || g_graphicsContext.IsFullScreenVideo())
{
Sleep(50);
continue;
}
if (!m_pWindow || iWidth == 0 || iHeight == 0 || m_Resolution != g_graphicsContext.GetVideoResolution())
{
m_pWindow = (CGUIDialogBusy*)m_gWindowManager.GetWindow(WINDOW_DIALOG_BUSY);
if (m_pWindow)
{
m_pWindow->Initialize();//need to load the window to determine size.
if (m_pWindow->GetID() == WINDOW_INVALID)
{
//busywindow couldn't be loaded so stop this thread.
m_pWindow = NULL;
m_bStop = true;
break;
}
SAFE_RELEASE(m_lpSurface);
FRECT rect = m_pWindow->GetScaledBounds();
m_pWindow->ClearAll(); //unload
iLeft = (int)floor(rect.left);
iTop = (int)floor(rect.top);
iWidth = (int)ceil(rect.right - rect.left);
iHeight = (int)ceil(rect.bottom - rect.top);
m_Resolution = g_graphicsContext.GetVideoResolution();
}
}
float t0 = (1000.0f/g_graphicsContext.GetFPS());
float t1 = m_time + t0; //time when we expect a new render
float t2 = (float)timeGetTime();
if (t1 < t2) //we're late rendering
{
try
{
if (timeGetTime() >= (m_time + g_advancedSettings.m_busyDialogDelay))
{
CSingleLock lockg (g_graphicsContext);
if (m_prevbusycount != m_busycount)
{
Sleep(1);
continue;
}
if (!m_pWindow || iWidth == 0 || iHeight == 0)
{
Sleep(1000);
continue;
}
if (m_Resolution != g_graphicsContext.GetVideoResolution())
{
continue;
}
if (m_busycount > 0) m_busycount--;
//no busy indicator if a progress dialog is showing
if ((m_gWindowManager.HasModalDialog() && (m_gWindowManager.GetTopMostModalDialogID() != WINDOW_VIDEO_INFO) && (m_gWindowManager.GetTopMostModalDialogID() != WINDOW_MUSIC_INFO)) || (m_gWindowManager.GetTopMostModalDialogID() == WINDOW_DIALOG_PROGRESS))
{
//TODO: render progress dialog here instead of in dialog::Progress
m_time = timeGetTime();
lockg.Leave();
Sleep(1);
continue;
}
if (m_lpSurface == NULL)
{
D3DSURFACE_DESC desc;
g_application.RenderNoPresent();
HRESULT result = g_graphicsContext.Get3DDevice()->GetBackBuffer( 0, D3DBACKBUFFER_TYPE_MONO, &lpSurfaceFront);
if (SUCCEEDED(result))
{
lpSurfaceFront->GetDesc( &desc );
iLeft = 0;
iTop = 0;
iWidth = desc.Width;
iHeight = desc.Height;
}
else
{
lockg.Leave();
Sleep(1000);
continue;
}
if (!SUCCEEDED(g_graphicsContext.Get3DDevice()->CreateImageSurface(iWidth, iHeight, desc.Format, &m_lpSurface)))
{
SAFE_RELEASE(lpSurfaceFront);
lockg.Leave();
//.........这里部分代码省略.........
示例9: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
m_bGroupSelectShow = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update(false);
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
if (CUtil::IsUsingTTFSubtitles())
{
CSingleLock lock (m_fontLock);
CStdString fontPath = "special://xbmc/media/Fonts/";
fontPath += g_guiSettings.GetString("subtitles.font");
// We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
RESOLUTION_INFO pal(720, 576, 0);
CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true);
CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true);
if (!subFont || !borderFont)
CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font");
else
m_subsLayout = new CGUITextLayout(subFont, true, 0, borderFont);
}
else
m_subsLayout = NULL;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIWindow::OnMessage(message);
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (slider) slider->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
FreeResources(true);
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update(false);
#endif
CSingleLock lockFont(m_fontLock);
if (m_subsLayout)
{
g_fontManager.Unload("__subtitle__");
g_fontManager.Unload("__subtitleborder__");
delete m_subsLayout;
m_subsLayout = NULL;
}
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
//.........这里部分代码省略.........
示例10: FATAL_MIKTEX_ERROR
bool
ProgressDialogImpl::StartProgressDialog (/*[in]*/ HWND hwndParent)
{
if (haveProgressDialog)
{
FATAL_MIKTEX_ERROR ("ProgressDialogImpl::StartProgressDialog",
T_("A progress dialog window is already open."),
0);
}
CWnd * pParent = 0;
if (hwndParent != 0)
{
pParent = CWnd::FromHandlePermanent(hwndParent);
if (pParent == 0)
{
INVALID_ARGUMENT ("ProgressDialogImpl::StartProgressDialog", 0);
}
}
pParent = CWnd::GetSafeOwner(pParent, 0);
if (pParent != 0)
{
hwndParent = pParent->GetSafeHwnd();
}
hParentWindow = hwndParent;
// disable mouse and keyboard input in the parent window
if (hParentWindow != 0)
{
EnableWindow (hParentWindow, FALSE);
}
// create the user interface thread
pThread = new ProgressUIThread(0, &readyEvent);
pThread->CreateThread ();
// wait for the progress window to become available
CSingleLock singleLock (&readyEvent);
if (! singleLock.Lock(1000))
{
FATAL_MIKTEX_ERROR ("ProgressDialogImpl::StartProgressDialog",
T_("The progress window is not available."),
0);
}
hWindow = pThread->GetProgressWindow();
MIKTEX_ASSERT (IsWindow(hWindow));
haveProgressDialog = true;
// set the window texts
SetTitle (title.c_str());
SetLine (1, lines[0].c_str());
SetLine (2, lines[1].c_str());
// make the progress window visible
ShowWindow (hWindow, SW_SHOW);
return (true);
}
示例11: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update(false);
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
if (CUtil::IsUsingTTFSubtitles())
{
CSingleLock lock (m_fontLock);
CStdString fontPath = "special://xbmc/media/Fonts/";
fontPath += g_guiSettings.GetString("subtitles.font");
// We scale based on PAL4x3 - this at least ensures all sizing is constant across resolutions.
RESOLUTION_INFO pal(720, 576, 0);
CGUIFont *subFont = g_fontManager.LoadTTF("__subtitle__", fontPath, color[g_guiSettings.GetInt("subtitles.color")], 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), false, 1.0f, 1.0f, &pal, true);
CGUIFont *borderFont = g_fontManager.LoadTTF("__subtitleborder__", fontPath, 0xFF000000, 0, g_guiSettings.GetInt("subtitles.height"), g_guiSettings.GetInt("subtitles.style"), true, 1.0f, 1.0f, &pal, true);
if (!subFont || !borderFont)
CLog::Log(LOGERROR, "CGUIWindowFullScreen::OnMessage(WINDOW_INIT) - Unable to load subtitle font");
else
m_subsLayout = new CGUITextLayout(subFont, true, 0, borderFont);
}
else
m_subsLayout = NULL;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIWindow::OnMessage(message);
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
CGUIDialogSlider *slider = (CGUIDialogSlider *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (slider) slider->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
FreeResources(true);
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update(false);
#endif
CSingleLock lockFont(m_fontLock);
if (m_subsLayout)
{
g_fontManager.Unload("__subtitle__");
g_fontManager.Unload("__subtitleborder__");
delete m_subsLayout;
m_subsLayout = NULL;
}
return true;
}
case GUI_MSG_SETFOCUS:
case GUI_MSG_LOSTFOCUS:
if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true;
break;
}
return CGUIWindow::OnMessage(message);
}
示例12: lock
int COMXVideo::Decode(uint8_t *pData, int iSize, double dts, double pts, bool &settings_changed)
{
CSingleLock lock (m_critSection);
OMX_ERRORTYPE omx_err;
if( m_drop_state || !m_is_open )
return true;
unsigned int demuxer_bytes = (unsigned int)iSize;
uint8_t *demuxer_content = pData;
if (demuxer_content && demuxer_bytes > 0)
{
OMX_U32 nFlags = 0;
if(m_setStartTime)
{
nFlags |= OMX_BUFFERFLAG_STARTTIME;
CLog::Log(LOGDEBUG, "OMXVideo::Decode VDec : setStartTime %f\n", (pts == DVD_NOPTS_VALUE ? 0.0 : pts) / DVD_TIME_BASE);
m_setStartTime = false;
}
if (pts == DVD_NOPTS_VALUE && dts == DVD_NOPTS_VALUE)
nFlags |= OMX_BUFFERFLAG_TIME_UNKNOWN;
else if (pts == DVD_NOPTS_VALUE)
nFlags |= OMX_BUFFERFLAG_TIME_IS_DTS;
while(demuxer_bytes)
{
// 500ms timeout
OMX_BUFFERHEADERTYPE *omx_buffer = m_omx_decoder.GetInputBuffer(500);
if(omx_buffer == NULL)
{
CLog::Log(LOGERROR, "OMXVideo::Decode timeout\n");
return false;
}
omx_buffer->nFlags = nFlags;
omx_buffer->nOffset = 0;
omx_buffer->nTimeStamp = ToOMXTime((uint64_t)(pts != DVD_NOPTS_VALUE ? pts : dts != DVD_NOPTS_VALUE ? dts : 0));
omx_buffer->nFilledLen = std::min((OMX_U32)demuxer_bytes, omx_buffer->nAllocLen);
memcpy(omx_buffer->pBuffer, demuxer_content, omx_buffer->nFilledLen);
demuxer_bytes -= omx_buffer->nFilledLen;
demuxer_content += omx_buffer->nFilledLen;
if(demuxer_bytes == 0)
omx_buffer->nFlags |= OMX_BUFFERFLAG_ENDOFFRAME;
omx_err = m_omx_decoder.EmptyThisBuffer(omx_buffer);
if (omx_err != OMX_ErrorNone)
{
CLog::Log(LOGERROR, "%s::%s - OMX_EmptyThisBuffer() failed with result(0x%x)\n", CLASSNAME, __func__, omx_err);
m_omx_decoder.DecoderEmptyBufferDone(m_omx_decoder.GetComponent(), omx_buffer);
return false;
}
//CLog::Log(LOGINFO, "VideD: dts:%.0f pts:%.0f size:%d)\n", dts, pts, iSize);
ResolutionUpdateInfo resinfo = {};
omx_err = m_omx_decoder.WaitForEvent(OMX_EventPortSettingsChanged, 0);
if (omx_err == OMX_ErrorNone)
{
if(!PortSettingsChanged(resinfo))
{
CLog::Log(LOGERROR, "%s::%s - error PortSettingsChanged omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
return false;
}
}
omx_err = m_omx_decoder.WaitForEvent(OMX_EventParamOrConfigChanged, 0);
if (omx_err == OMX_ErrorNone)
{
if(!PortSettingsChanged(resinfo))
{
CLog::Log(LOGERROR, "%s::%s - error PortSettingsChanged (EventParamOrConfigChanged) omx_err(0x%08x)\n", CLASSNAME, __func__, omx_err);
}
}
lock.Leave();
if (resinfo.changed && m_res_callback)
m_res_callback(m_res_ctx, resinfo.width, resinfo.height, resinfo.framerate, resinfo.display_aspect);
}
settings_changed = m_settings_changed;
return true;
}
return false;
}
示例13: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SUBTITLES);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
g_renderManager.FrameFinish();
#endif
return true;
}
case GUI_MSG_SETFOCUS:
case GUI_MSG_LOSTFOCUS:
if (message.GetSenderId() != WINDOW_FULLSCREEN_VIDEO) return true;
break;
}
return CGUIWindow::OnMessage(message);
}
示例14: switch
bool CGUIWindowFullScreen::OnMessage(CGUIMessage& message)
{
switch (message.GetMessage())
{
case GUI_MSG_WINDOW_INIT:
{
// check whether we've come back here from a window during which time we've actually
// stopped playing videos
if (message.GetParam1() == WINDOW_INVALID && !g_application.m_pPlayer->IsPlayingVideo())
{ // why are we here if nothing is playing???
g_windowManager.PreviousWindow();
return true;
}
g_infoManager.SetShowInfo(false);
g_infoManager.SetShowCodec(false);
m_bShowCurrentTime = false;
m_bGroupSelectShow = false;
g_infoManager.SetDisplayAfterSeek(0); // Make sure display after seek is off.
// switch resolution
g_graphicsContext.SetFullScreenVideo(true);
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
// now call the base class to load our windows
CGUIWindow::OnMessage(message);
m_bShowViewModeInfo = false;
return true;
}
case GUI_MSG_WINDOW_DEINIT:
{
CGUIDialog *pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_OSD_TELETEXT);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SLIDER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_VIDEO_OSD);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_FULLSCREEN_INFO);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CHANNELS);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_GUIDE);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_DIRECTOR);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_PVR_OSD_CUTTER);
if (pDialog) pDialog->Close(true);
pDialog = (CGUIDialog *)g_windowManager.GetWindow(WINDOW_DIALOG_SUBTITLES);
if (pDialog) pDialog->Close(true);
CGUIWindow::OnMessage(message);
CSettings::Get().Save();
CSingleLock lock (g_graphicsContext);
g_graphicsContext.SetFullScreenVideo(false);
lock.Leave();
#ifdef HAS_VIDEO_PLAYBACK
// make sure renderer is uptospeed
g_renderManager.Update();
#endif
return true;
}
case GUI_MSG_CLICKED:
{
unsigned int iControl = message.GetSenderId();
if (iControl == CONTROL_GROUP_CHOOSER && g_PVRManager.IsStarted())
{
// Get the currently selected label of the Select button
CGUIMessage msg(GUI_MSG_ITEM_SELECTED, GetID(), iControl);
OnMessage(msg);
CStdString strLabel = msg.GetLabel();
CPVRChannelPtr playingChannel;
if (g_PVRManager.GetCurrentChannel(playingChannel))
{
CPVRChannelGroupPtr selectedGroup = g_PVRChannelGroups->Get(playingChannel->IsRadio())->GetByName(strLabel);
if (selectedGroup)
{
g_PVRManager.SetPlayingGroup(selectedGroup);
CLog::Log(LOGDEBUG, "%s - switched to group '%s'", __FUNCTION__, selectedGroup->GroupName().c_str());
if (!selectedGroup->IsGroupMember(*playingChannel))
{
CLog::Log(LOGDEBUG, "%s - channel '%s' is not a member of '%s', switching to channel 1 of the new group",
__FUNCTION__, playingChannel->ChannelName().c_str(), selectedGroup->GroupName().c_str());
CFileItemPtr switchChannel = selectedGroup->GetByChannelNumber(1);
if (switchChannel && switchChannel->HasPVRChannelInfoTag())
g_application.OnAction(CAction(ACTION_CHANNEL_SWITCH, (float) switchChannel->GetPVRChannelInfoTag()->ChannelNumber()));
else
{
CLog::Log(LOGERROR, "%s - cannot find channel '1' in group %s", __FUNCTION__, selectedGroup->GroupName().c_str());
CApplicationMessenger::Get().MediaStop(false);
}
//.........这里部分代码省略.........
示例15: _tmain
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
int nRetCode = 0;
HMODULE hModule = ::GetModuleHandle(NULL);
if (hModule != NULL)
{
// Initialise MFC et affiche un message d'erreur en cas d'échec
if (!AfxWinInit(hModule, NULL, ::GetCommandLine(), 0))
{
// TODO: modifiez le code d'erreur selon les besoins
_tprintf(_T("Erreur irrécupérable : l'initialisation MFC a échoué\n"));
nRetCode = 1;
}
else
{
// TODO: codez le comportement de l'application à cet emplacement.
// Windsock initialization.
WSADATA WSAData;
WSAStartup(MAKEWORD(2,2), &WSAData);
// Events initialization.
CEvent* ptrDataRecvEvent = new CEvent(false, true , NULL, NULL); // A packet has been received
CEvent* ptrDataSentEvent = new CEvent(true, true , NULL, NULL); // A packet has been sent
CEvent* ptrStopEvent = new CEvent(false, true , NULL, NULL); // Client order to stop application
// This variable indicate if the downloading has completed.
BOOL downloadingCompleted = false;
// ClientSocket creation and connection.
ClientSocket* ptrClientSocket = new ClientSocket(ptrStopEvent, &downloadingCompleted); // Socket to communicate with the server
if (ptrClientSocket->openConnection() == 1){
getchar();
return 1;
}
// File creation
HANDLE file; // File received by downloading
file = CreateFile(_T("IAG0010ObjClient_pohikiri.doc"),GENERIC_READ | GENERIC_WRITE, 0, NULL,CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (file == INVALID_HANDLE_VALUE) {
_tcout << "Unable to create file, error " << GetLastError() << endl;
getchar();
return 1;
}
// Thread creation and starting.
ReadingKeyboardThread* ptrReadingKeyboardThread = new ReadingKeyboardThread(ptrStopEvent); // Thread to received the "exit" command throw the terminal.
ptrReadingKeyboardThread->CreateThread(); // Call Run.
ReceivingThread* ptrReceivingThread = new ReceivingThread(ptrClientSocket, ptrDataRecvEvent, ptrDataSentEvent, ptrStopEvent, &downloadingCompleted, &file); // Thread to receive data from the server.
ptrReceivingThread->CreateThread(); // Call Run.
SendingThread* ptrSendingThread = new SendingThread(ptrClientSocket, ptrDataRecvEvent, ptrDataSentEvent, ptrStopEvent, &downloadingCompleted); // Thread to send data to the server.
ptrSendingThread->CreateThread(); // Call Run.
CSingleLock* ptrStopEventLock = new CSingleLock(ptrStopEvent); // Wait stopEvent.
// Application closing
ptrStopEventLock->Lock(INFINITE);
Sleep(5000);
ptrClientSocket->closeConnection();
CloseHandle(file);
WSACleanup();
if(downloadingCompleted)
system("IAG0010ObjClient_pohikiri.doc");
// TODO: Until there.
}
}
else
{
// TODO: modifiez le code d'erreur selon les besoins
_tprintf(_T("Erreur irrécupérable : échec de GetModuleHandle\n"));
nRetCode = 1;
}
return nRetCode;
}