Esempio n. 1
0
// 设置伴音
void CVideoPane::PlayAudio(BOOL bPlay)
{
	if (m_bEnableAudio)
	{
		m_bHaveSound = bPlay;
		//if(!m_bHaveSound)
		//{
		//	return;
		//}
		CString strOcxPath = eLTE_Tool::GetOcxPath();
		strOcxPath.Append(IMG_RESOURCE_PATH);
		if (bPlay)
		{
			m_AudioBtn.LoadImages(strOcxPath + IMG_UNMUTE_NORMAL, strOcxPath + IMG_UNMUTE_SELECT,
				strOcxPath + IMG_UNMUTE_FOCUS, strOcxPath + IMG_UNMUTE_DISABLE, ImgState_Normal);
			m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_MUTE)));
		}
		else
		{
			m_AudioBtn.LoadImages(strOcxPath + IMG_MUTE_NORMAL, strOcxPath + IMG_MUTE_SELECT,
				strOcxPath + IMG_MUTE_FOCUS, strOcxPath + IMG_MUTE_DISABLE, ImgState_Normal);
			m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_UNMUTE)));
		}
		// 刷新工具栏
		if (NULL != m_hWnd)
		{
			CRect rt;
			GetClientRect(rt);
			rt.top = rt.bottom - VIDEO_TOOLBAR_WIDTH;
			InvalidateRect(rt, TRUE);
		}
	}
}
Esempio n. 2
0
void CVideoPane::CreateToolBar(const CRect& rect, const CString& strOcxPath)
{
	// 设置按钮坐标
	CRect rtSnapshot,rtChangePlay,rtAudio,rtFullScreen;
	rtSnapshot.left = rect.left + VIDEO_IMG_BTN_SPACE;
	rtSnapshot.top = (rect.bottom - VIDEO_TOOLBAR_WIDTH) + ((VIDEO_TOOLBAR_WIDTH - VIDEO_IMG_BTN_WIDTH)/2);
	rtSnapshot.right = rtSnapshot.left + VIDEO_IMG_BTN_WIDTH;
	rtSnapshot.bottom = rtSnapshot.top + VIDEO_IMG_BTN_WIDTH;

	rtChangePlay.left = rtSnapshot.right + VIDEO_IMG_BTN_SPACE;
	rtChangePlay.top = rtSnapshot.top;
	rtChangePlay.right = rtChangePlay.left + VIDEO_IMG_BTN_WIDTH;
	rtChangePlay.bottom = rtChangePlay.top + VIDEO_IMG_BTN_WIDTH;

	rtAudio.left = rect.right - ((2*VIDEO_IMG_BTN_SPACE) + (2*VIDEO_IMG_BTN_WIDTH));
	rtAudio.top = rtSnapshot.top;
	rtAudio.right = rtAudio.left + VIDEO_IMG_BTN_WIDTH;
	rtAudio.bottom = rtAudio.top + VIDEO_IMG_BTN_WIDTH;

	rtFullScreen.left = rect.right - (VIDEO_IMG_BTN_SPACE + VIDEO_IMG_BTN_WIDTH);
	rtFullScreen.top = rtSnapshot.top;
	rtFullScreen.right = rtFullScreen.left + VIDEO_IMG_BTN_WIDTH;
	rtFullScreen.bottom = rtFullScreen.top + VIDEO_IMG_BTN_WIDTH;

	// 创建按钮
	m_SnapshotBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtSnapshot, this, IDC_BTN_SNAPSHOT);
	m_ReversePlayBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtChangePlay, this, IDC_BTN_REVERSEPLAY);
	m_AudioBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtAudio, this, IDC_BTN_VOLUME);
	m_FullScreenBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtFullScreen, this, IDC_BTN_FULLSCREEN);

	// 增加状态图片
	CString strToolBar(strOcxPath);
	strToolBar.Append(IMG_RESOURCE_PATH);
	m_SnapshotBtn.LoadImages(strToolBar + IMG_SNAPSHOT_NORMAL, strToolBar + IMG_SNAPSHOT_SELECT,
		strToolBar + IMG_SNAPSHOT_FOCUS, strToolBar + IMG_SNAPSHOT_DISABLE);
	m_ReversePlayBtn.LoadImages(strToolBar + IMG_REVERSEPLAY_NORMAL, strToolBar + IMG_REVERSEPLAY_SELECT,
		strToolBar + IMG_REVERSEPLAY_FOCUS, strToolBar + IMG_REVERSEPLAY_DISABLE);
	m_AudioBtn.LoadImages(strToolBar + IMG_UNMUTE_NORMAL, strToolBar + IMG_UNMUTE_SELECT,
		strToolBar + IMG_UNMUTE_FOCUS, strToolBar + IMG_UNMUTE_DISABLE);
	m_FullScreenBtn.LoadImages(strToolBar + IMG_FULLSCREEN_NORMAL, strToolBar + IMG_FULLSCREEN_SELECT,
		strToolBar + IMG_FULLSCREEN_FOCUS, strToolBar + IMG_FULLSCREEN_DISABLE);

	// 创建工具提示
	m_SnapshotBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_SNAPSHOT)));
	m_ReversePlayBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_REVERSEPLAY)));
	m_AudioBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_MUTE)));
	m_FullScreenBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_FULLSCREEN)));
}
Esempio n. 3
0
// 激活关闭伴音
void CVideoPane::EnableAudio(BOOL bEnable)
{
	m_bEnableAudio = bEnable;

	if (NULL != m_AudioBtn.GetSafeHwnd())
	{
		CString strOcxPath = eLTE_Tool::GetOcxPath();
		strOcxPath.Append(IMG_RESOURCE_PATH);
		m_AudioBtn.LoadImages(strOcxPath + IMG_MUTE_NORMAL, strOcxPath + IMG_MUTE_SELECT,
			strOcxPath + IMG_MUTE_FOCUS, strOcxPath + IMG_MUTE_DISABLE, ImgState_Disable);
		m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_UNMUTE)));
		m_AudioBtn.Invalidate(TRUE);
	}
}
Esempio n. 4
0
void CVideoPane::SetLanguage(int ilang)
{
	int iLangId = GetUserDefaultLangID();
	
	switch (ilang)
	{
	case eLTE_LANG_zh_CN:
		{
			iLangId = 2052;	// 中文
		}
		break;
	case eLTE_LANG_en_US:
		{
			iLangId = 1033;	// 英文
		}
		break;
	case eLTE_LANG_es_ES:
		{
			iLangId = 1034;	// 西班牙
		}
		break;
	default:
		{

		}
		break;
	}
	m_Language.LoadLanguage(iLangId);

	// 刷新提示文本
	if (NULL != m_hWnd)
	{
		m_SnapshotBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_SNAPSHOT)));
		m_ReversePlayBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_REVERSEPLAY)));
		m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_UNMUTE)));
		m_FullScreenBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_FULLSCREEN)));
		m_CloseBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_CLOSEVIDEO)));
		if (m_bHaveSound)
		{
			m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_MUTE)));
		}
		else
		{
			m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_UNMUTE)));
		}
	}
}
Esempio n. 5
0
void CVideoPane::CreateCaption(const CRect& rect, const CString& strOcxPath)
{
	// 设置资源路径
	CString strCaptionPath(strOcxPath);
	strCaptionPath.Append(IMG_CAPTION_PATH);

	// 设置坐标
	CRect rtCaption(rect);
	rtCaption.bottom = CAPTION_HEIGHT;

	// 加载资源图片
	m_pImgCaption = Gdiplus::Image::FromFile(strCaptionPath + IMG_CAPTION);
	if (NULL == m_pImgCaption)
	{
		LOG_RUN_INFO("m_pImgCaption is null.");
	}
	else
	{
		if (Gdiplus::Ok != m_pImgCaption->GetLastStatus())
		{
			LOG_RUN_INFO("Gdiplus::Image::FromFile failed.");
			m_pImgCaption = NULL;
		}
	}

	// 标题栏关闭按钮
	CRect rtClose;
	rtClose.left = (rect.right - BTN_CLOSE_SPACE) - BTN_CLOSE_WIDTH;
	rtClose.top = (CAPTION_HEIGHT - BTN_CLOSE_HEIGHT)/2;
	rtClose.right = rtClose.left + BTN_CLOSE_WIDTH;
	rtClose.bottom = rtClose.top + BTN_CLOSE_HEIGHT;
	m_CloseBtn.Create(_T(""), WS_CHILD | WS_VISIBLE, rtClose, this, IDC_BTN_CLOSEVIDEO);
	m_CloseBtn.LoadImages(strCaptionPath + IMG_CLOSE_NORMAL, strCaptionPath + IMG_CLOSE_SELECT,
		strCaptionPath + IMG_CLOSE_FOCUS, strCaptionPath + IMG_CLOSE_DISABLE);
	m_CloseBtn.AddToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_CLOSEVIDEO)));
}
Esempio n. 6
0
LRESULT CVideoPane::OnMsgImgBtnClicked(WPARAM wParam, LPARAM /*lParam*/)
{
	int iImgBtnID = (int)wParam;
	CeLTE_PlayerCtrl* pCeLTE_PlayerCtrl = dynamic_cast<CeLTE_PlayerCtrl*>(m_pCeLTE_PlayerCtrl);
	if (NULL == pCeLTE_PlayerCtrl)
	{
		LOG_RUN_ERROR("pCeLTE_PlayerCtrl is null.");
		return -1L;
	}

	switch (iImgBtnID)
	{
		// 抓图
	case IDC_BTN_SNAPSHOT:
		{
			(void)pCeLTE_PlayerCtrl->ToolBarSnapshot();
		}
		break;
		// 摄像头切换
	case IDC_BTN_REVERSEPLAY:
		{
			(void)pCeLTE_PlayerCtrl->ToolBarReversePlayer();
		}
		break;
		// 伴音
	case IDC_BTN_VOLUME:
		{
			m_bHaveSound = !m_bHaveSound;
			CString strOcxPath = eLTE_Tool::GetOcxPath();
			strOcxPath.Append(IMG_RESOURCE_PATH);
			if (m_bHaveSound)
			{
				m_AudioBtn.LoadImages(strOcxPath + IMG_UNMUTE_NORMAL, strOcxPath + IMG_UNMUTE_SELECT,
					strOcxPath + IMG_UNMUTE_FOCUS, strOcxPath + IMG_UNMUTE_DISABLE);
				m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_MUTE)));

				// 播放伴音
				(void)pCeLTE_PlayerCtrl->ToolBarPlayAudio(TRUE);
			}
			else
			{
				m_AudioBtn.LoadImages(strOcxPath + IMG_MUTE_NORMAL, strOcxPath + IMG_MUTE_SELECT,
					strOcxPath + IMG_MUTE_FOCUS, strOcxPath + IMG_MUTE_DISABLE);
				m_AudioBtn.UpdateToolTip(m_Language.GetString(GET_STRING_PARAM(IDS_UNMUTE)));

				// 关闭伴音
				(void)pCeLTE_PlayerCtrl->ToolBarPlayAudio(FALSE);
			}
		}
		break;
		// 全屏
	case IDC_BTN_FULLSCREEN:
		{
			if (NULL == m_VideoStatic.GetSafeHwnd())
			{
				LOG_RUN_ERROR("VideoStatic had been destory.");
				return eLTE_ERR_FAILED;
			}
			int iRet = m_VideoStatic.SetFullScreen();
			if (eLTE_ERR_SUCCESS == iRet)
			{
				// 播放器全屏事件
				pCeLTE_PlayerCtrl->PostMessage(WM_ELTE_POST_PLAYER_EVENT, (WPARAM)eLTE_PLAYER_FULLSCREEN, NULL);
			}
		}
		break;
		// 关闭
	case IDC_BTN_CLOSEVIDEO:
		{
			PostMessage(WM_CLOSE);
		}
		break;
	default:
		{
			LOG_RUN_ERROR("Invalid btn ID.");
		}
		break;
	}

	return 0L;
}
Esempio n. 7
0
/*
 * Initialise a HOTP authentication stack.
 *
 */
dynalogin_result_t dynalogin_init(dynalogin_session_t **session,
		apr_pool_t *pool, apr_hash_t *config)
{
	apr_status_t ret;
	dynalogin_session_t *h;
	char *ds_module_name;
	char *ds_module_filename;
	char *ds_sym_name;

	*session = NULL;

	if(oath_init() != OATH_OK)
	{
		ERRMSG("libhotp init failed");
		return DYNALOGIN_ERROR;
	}

	if(pool == NULL)
	{
		return DYNALOGIN_ERROR;
	}

	/* pool is not required, APR will create a root pool if it
	 * is NULL.
	 * Maybe we don't need a config and can run on defaults? */
	if(config == NULL)
	{
		ERRMSG("no config");
		return DYNALOGIN_ERROR;
	}

	if((h = (dynalogin_session_t *)apr_pcalloc(pool, sizeof(dynalogin_session_t)))
			== NULL)
		return DYNALOGIN_ERROR;
	h->pool = pool;

	syslog(LOG_DEBUG, "looking in %s for modules", PKGLIBDIR);

	GET_STRING_PARAM(ds_module_name, config, DYNALOGIN_PARAM_DSNAME)

	ds_module_filename = apr_psprintf(h->pool, "%s%c%s.so",
			PKGLIBDIR, DIR_SEPARATOR, ds_module_name);
	ds_sym_name = apr_psprintf(h->pool, "%s_module", ds_module_name);
	if(ds_module_filename==NULL || ds_sym_name==NULL)
		return DYNALOGIN_ERROR;

	if(apr_dso_load(&h->dso_handle,
			ds_module_filename, h->pool)!=APR_SUCCESS)
		return DYNALOGIN_ERROR;

	if(apr_dso_sym((apr_dso_handle_sym_t *)&(h->datasource), h->dso_handle, ds_sym_name)
			!=APR_SUCCESS)
	{
		apr_dso_unload(h->dso_handle);
		return DYNALOGIN_ERROR;
	}

	if(h->datasource->init != NULL)
		if(h->datasource->init(h->pool, config) != DYNALOGIN_SUCCESS)
		{
			apr_dso_unload(h->dso_handle);
			return DYNALOGIN_ERROR;
		}

	GET_INT_PARAM_DEF(h->hotp_digits, config, DYNALOGIN_PARAM_HOTP_DIGITS, DEFAULT_HOTP_DIGITS)
	GET_INT_PARAM_DEF(h->hotp_window, config, DYNALOGIN_PARAM_HOTP_WINDOW, DEFAULT_HOTP_WINDOW)

	GET_INT_PARAM_DEF(h->totp_digits, config, DYNALOGIN_PARAM_TOTP_DIGITS, DEFAULT_TOTP_DIGITS)
	GET_INT_PARAM_DEF(h->totp_window, config, DYNALOGIN_PARAM_TOTP_WINDOW, DEFAULT_TOTP_WINDOW)
	GET_INT_PARAM_DEF(h->totp_x, config, DYNALOGIN_PARAM_TOTP_X, DEFAULT_TOTP_X)
	GET_INT_PARAM_DEF(h->totp_t0, config, DYNALOGIN_PARAM_TOTP_T0, DEFAULT_TOTP_T0)

	*session = h;

	return DYNALOGIN_SUCCESS;
}