//BonDriverをロードしてチャンネル情報などを取得(ファイル名で指定) //戻り値: // エラーコード //引数: // bonDriverFile [IN]EnumBonDriverで取得されたBonDriverのファイル名 DWORD CBonCtrl::OpenBonDriver( LPCWSTR bonDriverFile, int openWait ) { if( Lock(L"OpenBonDriver-2") == FALSE ) return ERR_FALSE; _CloseBonDriver(); DWORD ret = this->bonUtil.OpenBonDriver(bonDriverFile, openWait); wstring bonFile = this->bonUtil.GetOpenBonDriverFileName(); if( ret == NO_ERR ){ ret = _OpenBonDriver(); this->tsOut.ResetChChange(); this->tsOut.SetBonDriver(bonFile); } if( bonFile.empty() == false ){ wstring settingPath; GetSettingPath(settingPath); wstring bonFileTitle; GetFileTitle(bonFile, bonFileTitle); wstring tunerName = this->bonUtil.GetTunerName(); CheckFileName(tunerName); this->chUtil.LoadChSet( settingPath + L"\\" + bonFileTitle + L"(" + tunerName + L").ChSet4.txt", settingPath + L"\\ChSet5.txt" ); } UnLock(); return ret; }
//ロードしているBonDriverの開放 //戻り値: // エラーコード DWORD CBonCtrl::CloseBonDriver() { if( Lock(L"CloseBonDriver") == FALSE ) return ERR_FALSE; StopBackgroundEpgCap(); DWORD ret = _CloseBonDriver(); UnLock(); return ret; }
//BonDriverをロードしてチャンネル情報などを取得(ファイル名で指定) //戻り値: // エラーコード //引数: // bonDriverFile [IN]EnumBonDriverで取得されたBonDriverのファイル名 DWORD CBonCtrl::OpenBonDriver( LPCWSTR bonDriverFile, int openWait ) { if( Lock(L"OpenBonDriver-2") == FALSE ) return ERR_FALSE; _CloseBonDriver(); DWORD ret = this->bonUtil.OpenBonDriver(bonDriverFile, openWait); if( ret == NO_ERR ){ ret = _OpenBonDriver(); this->tsOut.ResetChChange(); wstring bonFile; bonFile = this->bonUtil.GetOpenBonDriverFileName(); this->tsOut.SetBonDriver(bonFile); } if( this->bonUtil.GetOpenBonDriverIndex() != -1 ){ this->chUtil.LoadChSet( this->bonUtil.GetChSet4Path(), this->bonUtil.GetChSet5Path() ); } UnLock(); return ret; }
CBonCtrl::~CBonCtrl(void) { _CloseBonDriver(); if( this->chScanThread != NULL ){ ::SetEvent(this->chScanStopEvent); // スレッド終了待ち if ( ::WaitForSingleObject(this->chScanThread, 15000) == WAIT_TIMEOUT ){ ::TerminateThread(this->chScanThread, 0xffffffff); } CloseHandle(this->chScanThread); this->chScanThread = NULL; } if( this->chScanStopEvent != NULL ){ CloseHandle(this->chScanStopEvent); this->chScanStopEvent = NULL; } if( this->epgCapThread != NULL ){ ::SetEvent(this->epgCapStopEvent); // スレッド終了待ち if ( ::WaitForSingleObject(this->epgCapThread, 15000) == WAIT_TIMEOUT ){ ::TerminateThread(this->epgCapThread, 0xffffffff); } CloseHandle(this->epgCapThread); this->epgCapThread = NULL; } if( this->epgCapStopEvent != NULL ){ CloseHandle(this->epgCapStopEvent); this->epgCapStopEvent = NULL; } if( this->epgCapBackThread != NULL ){ ::SetEvent(this->epgCapBackStopEvent); // スレッド終了待ち if ( ::WaitForSingleObject(this->epgCapBackThread, 15000) == WAIT_TIMEOUT ){ ::TerminateThread(this->epgCapBackThread, 0xffffffff); } CloseHandle(this->epgCapBackThread); this->epgCapBackThread = NULL; } if( this->epgCapBackStopEvent != NULL ){ CloseHandle(this->epgCapBackStopEvent); this->epgCapBackStopEvent = NULL; } if( this->analyzeThread != NULL ){ ::SetEvent(this->analyzeStopEvent); // スレッド終了待ち if ( ::WaitForSingleObject(this->analyzeThread, 15000) == WAIT_TIMEOUT ){ ::TerminateThread(this->analyzeThread, 0xffffffff); } CloseHandle(this->analyzeThread); this->analyzeThread = NULL; } if( this->analyzeStopEvent != NULL ){ CloseHandle(this->analyzeStopEvent); this->analyzeStopEvent = NULL; } if( this->recvThread != NULL ){ ::SetEvent(this->recvStopEvent); // スレッド終了待ち if ( ::WaitForSingleObject(this->recvThread, 15000) == WAIT_TIMEOUT ){ ::TerminateThread(this->recvThread, 0xffffffff); } CloseHandle(this->recvThread); this->recvThread = NULL; } if( this->recvStopEvent != NULL ){ CloseHandle(this->recvStopEvent); this->recvStopEvent = NULL; } if( this->lockEvent != NULL ){ UnLock(); CloseHandle(this->lockEvent); this->lockEvent = NULL; } if( this->buffLockEvent != NULL ){ CloseHandle(this->buffLockEvent); this->buffLockEvent = NULL; } }