Example #1
0
BOOL 
CNdasDevice::IsAnyUnitDevicesMounted()
{
	ximeta::CAutoLock autolock(this);

	for (DWORD i = 0; i < MAX_NDAS_UNITDEVICE_COUNT; ++i) 
	{
		CNdasUnitDevice* pUnitDevice = m_pUnitDevices[i];
		if (NULL != pUnitDevice &&
			NDAS_UNITDEVICE_STATUS_MOUNTED == pUnitDevice->GetStatus())
		{
			return TRUE;
		}
	}
	return FALSE;
}
Example #2
0
VOID
CNdasLogicalDevice::OnMounted()
{
	ximeta::CAutoLock autolock(this);

	DBGPRT_INFO(_FT("Logical device %s is MOUNTED.\n"), ToString());

	DWORD dwTick = ::GetTickCount();
	m_dwMountTick = (dwTick == 0) ? 1: dwTick; // 0 is used for special purpose

	SetLastMountAccess(m_MountedAccess);

	SetRiskyMountFlag(TRUE);

	SetStatus(NDAS_LOGICALDEVICE_STATUS_MOUNTED);
}
Example #3
0
BOOL
CNdasDeviceRegistrar::Unregister(DWORD SlotNo)
{
	InstanceAutoLock autolock(this);

	DeviceSlotMap::iterator slot_itr = m_deviceSlotMap.find(SlotNo);

	if (m_deviceSlotMap.end() == slot_itr) 
	{
		// TODO: Make more specific error code
		::SetLastError(NDASSVC_ERROR_DEVICE_ENTRY_NOT_FOUND);
		return FALSE;
	}

	CNdasDevicePtr pDevice = slot_itr->second;

	if (NDAS_DEVICE_STATUS_DISABLED != pDevice->GetStatus()) 
	{
		// TODO: ::SetLastError(NDAS_ERROR_CANNOT_UNREGISTER_ENABLED_DEVICE);
		// TODO: Make more specific error code
		::SetLastError(NDASSVC_ERROR_CANNOT_UNREGISTER_ENABLED_DEVICE);
		return FALSE;
	}

	DeviceIdMap::iterator id_itr = m_deviceIdMap.find(pDevice->GetDeviceId());

	XTLASSERT(m_deviceIdMap.end() != id_itr);

	m_deviceIdMap.erase(id_itr);
	m_deviceSlotMap.erase(slot_itr);
	m_slotbit[SlotNo] = FALSE;

	XTL::CStaticStringBuffer<30> containerName(_T("Devices\\%04d"), SlotNo);
	BOOL fSuccess = _NdasSystemCfg.DeleteContainer(containerName, FALSE);
	
	if (!fSuccess) 
	{
		XTLTRACE2(NDASSVC_NDASDEVICEREGISTRAR, TRACE_LEVEL_WARNING,
			"Deleting registration entry from the registry failed at %ls, error=0x%X\n", 
			containerName, GetLastError());
	}

	(void) m_service.GetEventPublisher().DeviceEntryChanged();

	return TRUE;

}
Example #4
0
//
// status check event handler
// to reconcile the status 
//
// to be connected status, broadcast packet
// should be received within MAX_ALLOWED_HEARTBEAT_INTERVAL
// 
// returns TRUE to detach from the monitor
// FALSE otherwise.
//
BOOL
CNdasDevice::OnStatusCheck()
{
	ximeta::CAutoLock autolock(this);

	//
	// Only when the device is connected!
	//
	if (NDAS_DEVICE_STATUS_CONNECTED != m_status) {
//		_ASSERTE(FALSE && "OnStatusCheck should be called when connected!");
		DBGPRT_WARN(_FT("OnStatusCheck is called on connected. Detaching.\n"));
		// Detach from the monitor
		return TRUE;
	}

	DWORD dwCurrentTick = ::GetTickCount();
	DWORD dwElapsed = dwCurrentTick - m_dwLastHeartbeatTick;

	if (dwElapsed > MAX_ALLOWED_HEARTBEAT_INTERVAL) {

		//
		// When just a single unit device is mounted,
		// status will not be changed to DISCONNECTED!
		//

		if (IsAnyUnitDevicesMounted()) {
			return FALSE;
		}

		//
		// Do not disconnect the device when the debugger is attached
		//
		if (::IsDebuggerPresent()) {
			return FALSE;
		}

		BOOL fSuccess = DestroyAllUnitDevices();
		if (!fSuccess) {
			return FALSE;
		}

		ChangeStatus(NDAS_DEVICE_STATUS_DISCONNECTED);
		return TRUE;
	}

	return FALSE;
}
status_t OMXNodeInstance::createInputSurface(
        OMX_U32 portIndex, sp<IGraphicBufferProducer> *bufferProducer) {
    Mutex::Autolock autolock(mLock);
    status_t err;

    const sp<GraphicBufferSource>& surfaceCheck = getGraphicBufferSource();
    if (surfaceCheck != NULL) {
        return ALREADY_EXISTS;
    }

    // Input buffers will hold meta-data (gralloc references).
    err = storeMetaDataInBuffers_l(portIndex, OMX_TRUE);
    if (err != OK) {
        return err;
    }

    // Retrieve the width and height of the graphic buffer, set when the
    // codec was configured.
    OMX_PARAM_PORTDEFINITIONTYPE def;
    def.nSize = sizeof(def);
    def.nVersion.s.nVersionMajor = 1;
    def.nVersion.s.nVersionMinor = 0;
    def.nVersion.s.nRevision = 0;
    def.nVersion.s.nStep = 0;
    def.nPortIndex = portIndex;
    OMX_ERRORTYPE oerr = OMX_GetParameter(
            mHandle, OMX_IndexParamPortDefinition, &def);
    CHECK(oerr == OMX_ErrorNone);

    if (def.format.video.eColorFormat != OMX_COLOR_FormatAndroidOpaque) {
        ALOGE("createInputSurface requires COLOR_FormatSurface "
              "(AndroidOpaque) color format");
        return INVALID_OPERATION;
    }

    GraphicBufferSource* bufferSource = new GraphicBufferSource(
            this, def.format.video.nFrameWidth, def.format.video.nFrameHeight,
            def.nBufferCountActual);
    if ((err = bufferSource->initCheck()) != OK) {
        delete bufferSource;
        return err;
    }
    setGraphicBufferSource(bufferSource);

    *bufferProducer = bufferSource->getIGraphicBufferProducer();
    return OK;
}
LRESULT _etk_set_window_background(EWin32GraphicsEngine *win32Engine, etk_win32_gdi_callback_t *callback)
{
	if(win32Engine == NULL || callback == NULL ||
	   callback->command != WM_ETK_MESSAGE_SET_WINDOW_BACKGROUND || callback->win == NULL ||
	   callback->win->win32Window == NULL) return FALSE;

	EAutolock <EWin32GraphicsEngine> autolock(win32Engine);
	if(autolock.IsLocked() == false || win32Engine->InitCheck() != E_OK) return FALSE;

	HBRUSH hbrBackground = CreateSolidBrush(RGB(callback->bkColor.red, callback->bkColor.green, callback->bkColor.blue));
	if(hbrBackground == NULL) return FALSE;

	if(callback->win->hbrBackground) DeleteObject(callback->win->hbrBackground);
	callback->win->hbrBackground = hbrBackground;

	return TRUE;
}
Example #7
0
void
TBarApp::Unsubscribe(const BMessenger &subscriber)
{
	BAutolock autolock(sSubscriberLock);
	if (!autolock.IsLocked())
		return;

	int32 count = sSubscribers.CountItems();
	for (int32 i = 0; i < count; i++) {
		BMessenger* messenger = (BMessenger*)sSubscribers.ItemAt(i);
		if (*messenger == subscriber) {
			sSubscribers.RemoveItem(i);
			delete messenger;
			break;
		}
	}
}
void SecG2dC110::destroyAllInstance(void)
{
    Mutex::Autolock autolock(m_instanceLock);

    for (int i = 0; i < NUMBER_G2D_LIST; i++) {
        if (m_ptrG2dList[i] != NULL) {
            if (   m_ptrG2dList[i]->flagCreate() == true
                && m_ptrG2dList[i]->destroy()    == false) {
                LOGE("%s::destroy() fail", __func__);
            } else {
                SecG2dC110 *tempSecG2dC110 = (SecG2dC110 *)m_ptrG2dList[i];
                delete tempSecG2dC110;
                m_ptrG2dList[i] = NULL;
            }
        }
    }
}
Example #9
0
void CPublicManage::ConnectClose(char* userID,char* Customer)
{
	CLock m_csLock;
	CAutoLock autolock(&m_csLock);
	std::list<CUser*>::iterator itpUser = m_listUser.begin();
	CCustomer pCust(Customer);
	while(strcmp(Customer,"") && itpUser != m_listUser.end()){
		if (!strcmp(userID,(*itpUser)->GetName())){
			(*itpUser)->SetState(FALSE);
			(*itpUser)->Notify();
			(*itpUser)->Detach(&pCust);
			delete (*itpUser);
			m_listUser.erase(itpUser++);
		}
		else ++itpUser;
	}
}
Example #10
0
VOID
CNdasDevice::SetGrantedAccess(ACCESS_MASK access)
{
	ximeta::CAutoLock autolock(this);

	// only GENERIC_READ and GENERIC_WRITE are acceptable
	m_grantedAccess = (access & (GENERIC_READ | GENERIC_WRITE));

	const DWORD cbData = sizeof(m_grantedAccess) + sizeof(m_deviceId);
	BYTE lpbData[cbData] = {0};

	::CopyMemory(lpbData, &m_grantedAccess, sizeof(m_grantedAccess));
	::CopyMemory(lpbData + sizeof(m_grantedAccess), &m_deviceId, sizeof(m_deviceId));

	(VOID) SetConfigValueSecure(_T("GrantedAccess"), lpbData, cbData);
	(VOID) pGetNdasEventPublisher()->DevicePropertyChanged(m_dwSlotNo);
}
Example #11
0
bool
CNdasUnitDevice::RegisterToLogicalDeviceManager()
{
	InstanceAutoLock autolock(this);

	CNdasLogicalDeviceManager& manager = pGetNdasLogicalDeviceManager();
	m_pLogicalDevice = manager.Register(shared_from_this());
	if (CNdasLogicalDeviceNullPtr == m_pLogicalDevice) 
	{
		XTLTRACE2(NDASSVC_NDASUNITDEVICE, TRACE_LEVEL_ERROR, 
			"Failed to register a unit device to the LDM, error=0x%X\n",
			GetLastError());
		return false;
	}

	return true;
}
_IMPEXP_ETK bool etk_font_freetype2_init(void)
{
	EAutolock <ELocker> autolock(&etk_ft2_font_locker);

	if(!_etk_ft2_initialized_)
	{
		FT_Error error = FT_Init_FreeType(&_etk_ft2_library_);
		if(error)
		{
			ETK_WARNING("[FONT]: %s --- CAN NOT initialize freetype engine %d\n", __PRETTY_FUNCTION__, error);
			return false;
		}
		_etk_ft2_initialized_ = true;
	}

	return true;
}
Example #13
0
NDASHEAR_LINKAGE
BOOL
NDASHEARAPI
NdasHeartbeatUnregisterNotification(HANDLE h)
{
	if (::IsBadNdasHearHandle(h))
	{
		::SetLastError(ERROR_INVALID_HANDLE);
		return FALSE;
	}

	CAutoLock autolock(&SharedData.cs);
	::DestroyNdasHearHandle(h);
	::ReleaseListener();

	return TRUE;
}
Example #14
0
VOID
CNdasDevice::SetName(LPCTSTR szName)
{
	ximeta::CAutoLock autolock(this);

	HRESULT hr = ::StringCchCopy(
		m_szDeviceName, 
		MAX_NDAS_DEVICE_NAME_LEN, 
		szName);

	_ASSERTE(SUCCEEDED(hr));

	(VOID) SetConfigValue(_T("DeviceName"), szName);

	CNdasEventPublisher* pEventPublisher = pGetNdasEventPublisher();
	(VOID) pEventPublisher->DevicePropertyChanged(m_dwSlotNo);
}
Example #15
0
CByteArray CPkiCard::ReadUncachedFile(const std::string & csPath,
    unsigned long ulOffset, unsigned long ulMaxLen)
{
    CByteArray oData(ulMaxLen);

	CAutoLock autolock(this);

    tFileInfo fileInfo = SelectFile(csPath, true);

    // Loop until we've read ulMaxLen bytes or until EOF (End Of File)
    bool bEOF = false;
    for (unsigned long i = 0; i < ulMaxLen && !bEOF; i += MAX_APDU_READ_LEN)
    {
        unsigned long ulLen = ulMaxLen - i <= MAX_APDU_READ_LEN ?
            ulMaxLen - i : MAX_APDU_READ_LEN;

        CByteArray oResp = ReadBinary(ulOffset + i, ulLen);

        unsigned long ulSW12 = getSW12(oResp);
		// If the file is a multiple of the block read size, you will get
		// an SW12 = 6B00 (at least with BE eID) but that OK then..
        if (ulSW12 == 0x9000 || (i != 0 && ulSW12 == 0x6B00))
            oData.Append(oResp.GetBytes(), oResp.Size() - 2);
		else if (ulSW12 == 0x6982) {
			throw CNotAuthenticatedException(
				EIDMW_ERR_NOT_AUTHENTICATED, fileInfo.lReadPINRef);
		}
		else if (ulSW12 == 0x6B00)
			throw CMWEXCEPTION(EIDMW_ERR_PARAM_RANGE);
		else if (ulSW12 == 0x6D00)
			throw CMWEXCEPTION(EIDMW_ERR_NOT_ACTIVATED);
		else
            throw CMWEXCEPTION(m_poContext->m_oPCSC.SW12ToErr(ulSW12));

        // If the driver/reader itself did the 6CXX handling,
        // we assume we're at the EOF
        if (oResp.Size() < MAX_APDU_READ_LEN)
            bEOF = true;
    }

	MWLOG(LEV_INFO, MOD_CAL, L"   Read file %ls (%d bytes) from card",
		utilStringWiden(csPath).c_str(), oData.Size());

    return oData;
}
Example #16
0
BOOL
CNdasLogicalDevice::Initialize()
{
	ximeta::CAutoLock autolock(this);

	if (NDAS_LOGICALDEVICE_STATUS_NOT_INITIALIZED != m_status) {
		// Already initialized
		return TRUE;
	}

	if (NULL == m_hDisconnectedEvent) {
		m_hDisconnectedEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
		if (NULL == m_hDisconnectedEvent) {
			DBGPRT_ERR_EX(_FT("Disconnect event creation failed: "));
			return FALSE;
		}
	}

	if (NULL == m_hAlarmEvent) {
		m_hAlarmEvent = ::CreateEvent(NULL, TRUE, FALSE, NULL);
		if (NULL == m_hAlarmEvent) {
			DBGPRT_ERR_EX(_FT("Alarm event creation failed: "));
			::CloseHandle(m_hDisconnectedEvent);
			return FALSE;
		}
	}

	ACCESS_MASK lastMountAccess = GetLastMountAccess();

	BOOL fRiskyMountFlag = GetRiskyMountFlag();

	if (fRiskyMountFlag) {
		m_fRiskyMount = fRiskyMountFlag;
	}

	if ((lastMountAccess > 0) && !IsRiskyMount()) {
		SetMountOnReady(lastMountAccess, FALSE);
	}

	SetStatus(NDAS_LOGICALDEVICE_STATUS_UNMOUNTED);

	DBGPRT_INFO(_FT("Logical Device %d initialized successfully.\n"), m_logicalDeviceId);

	return TRUE;
}
Example #17
0
STDMETHODIMP
CNdasLogicalUnitManager::get_NdasLogicalUnit(
	NDAS_LOGICALDEVICE_GROUP* config, 
	INdasLogicalUnit** ppNdasLogicalUnit)
{
	*ppNdasLogicalUnit = 0;

	CAutoLock autolock(this);

	LogicalDeviceGroupMap::const_iterator citr = m_LogicalUnitDefinitionMap.find(*config);
	if (m_LogicalUnitDefinitionMap.end() == citr) 
	{
		return E_FAIL;
	}
	CComPtr<INdasLogicalUnit> pNdasLogicalUnit = citr->second;
	*ppNdasLogicalUnit = pNdasLogicalUnit.Detach();
	return S_OK;
}
Example #18
0
STDMETHODIMP
CNdasLogicalUnitManager::OnSystemShutdown()
{
	//
	// Clear the risky mount flag on shutdown
	// if the shutdown is initiated before the
	// monitor will clear the flag
	//
	CAutoLock autolock(this);
	CInterfaceArray<INdasLogicalUnit> ndasLogicalUnits;
	get_NdasLogicalUnits(NDAS_ENUM_DEFAULT, ndasLogicalUnits);
	autolock.Release();

	// Call shutdown
	AtlForEach(ndasLogicalUnits, NdasLogicalUnitFireShutdownEvent());

	return S_OK;
}
Example #19
0
VOID
CNdasUnitDevice::UpdatePrimaryHostInfo(
	CONST NDAS_UNITDEVICE_PRIMARY_HOST_INFO& info)
{
	ximeta::CAutoLock autolock(this);

	::CopyMemory(
		&m_PrimaryHostInfo,
		&info,
		sizeof(NDAS_UNITDEVICE_PRIMARY_HOST_INFO));

	m_PrimaryHostInfo.LastUpdate = ::GetTickCount();

	DBGPRT_NOISE(
		_FT("Primary Host Usage Updated: %s, Timestamp %d\n"), 
		this->ToString(),
		m_PrimaryHostInfo.LastUpdate);
}
Example #20
0
void
CNdasUnitDevice::UpdatePrimaryHostInfo(
	const NDAS_UNITDEVICE_PRIMARY_HOST_INFO& info)
{
	InstanceAutoLock autolock(this);

	::CopyMemory(
		&m_PrimaryHostInfo,
		&info,
		sizeof(NDAS_UNITDEVICE_PRIMARY_HOST_INFO));

	m_PrimaryHostInfo.LastUpdate = ::GetTickCount();

	XTLTRACE2(NDASSVC_NDASUNITDEVICE, TRACE_LEVEL_VERBOSE,
		"Primary Host Usage Updated: %s, Timestamp %d\n", 
		this->ToStringA(),
		m_PrimaryHostInfo.LastUpdate);
}
LRESULT _etk_hide_window(EWin32GraphicsEngine *win32Engine, etk_win32_gdi_callback_t *callback)
{
	if(win32Engine == NULL || callback == NULL ||
	   callback->command != WM_ETK_MESSAGE_HIDE_WINDOW || callback->win == NULL ||
	   callback->win->win32Window == NULL) return FALSE;

	EAutolock <EWin32GraphicsEngine> autolock(win32Engine);
	if(autolock.IsLocked() == false || win32Engine->InitCheck() != E_OK) return FALSE;

	ShowWindowAsync(callback->win->win32Window, SW_HIDE);

	GUITHREADINFO info;
	info.cbSize = sizeof(GUITHREADINFO);
	GetGUIThreadInfo(win32Engine->win32ThreadID, &info);
	if(info.hwndCapture == callback->win->win32Window) ReleaseCapture();

	return TRUE;
}
Example #22
0
STDMETHODIMP
CNdasLogicalUnitManager::get_NdasLogicalUnitByNdasLocation(
	NDAS_LOCATION location, 
	INdasLogicalUnit** ppNdasLogicalUnit)
{
	*ppNdasLogicalUnit = 0;

	CAutoLock autolock(this);

	LocationMap::const_iterator citr = m_NdasLocationMap.find(location);
	if (m_NdasLocationMap.end() == citr) 
	{
		return E_FAIL;
	}
	CComPtr<INdasLogicalUnit> pNdasLogicalUnit = citr->second;
	*ppNdasLogicalUnit = pNdasLogicalUnit.Detach();
	return S_OK;
}
Example #23
0
	void Clear()
	{
		CAutoMutex autolock(&_mutex);

		POOL_DATA * p;
		POOL_DATA * t;

		p = m_pDataFirst;

		while (p)
		{
			t = p;
			p = p->pNext;
			delete t;
		}

		m_pDataFirst = NULL;
	}
Example #24
0
BOOL 
CNdasDeviceRegistrar::Unregister(const NDAS_DEVICE_ID& DeviceId)
{
	InstanceAutoLock autolock(this);

	XTLTRACE2(NDASSVC_NDASDEVICEREGISTRAR, TRACE_LEVEL_INFORMATION,
		"Unregister device %s\n", CNdasDeviceId(DeviceId).ToStringA());

	DeviceIdMap::iterator itrId = m_deviceIdMap.find(DeviceId);
	if (m_deviceIdMap.end() == itrId) 
	{
		::SetLastError(NDASSVC_ERROR_DEVICE_ENTRY_NOT_FOUND);
	}

	CNdasDevicePtr pDevice = itrId->second;
	
	if (pDevice->GetStatus() != NDAS_DEVICE_STATUS_DISABLED) 
	{
		::SetLastError(NDASSVC_ERROR_CANNOT_UNREGISTER_ENABLED_DEVICE);
		return FALSE;
	}

	DWORD SlotNo = pDevice->GetSlotNo();
	XTLASSERT(0 != SlotNo);

	DeviceSlotMap::iterator itrSlot = m_deviceSlotMap.find(SlotNo);

	m_deviceIdMap.erase(itrId);
	m_deviceSlotMap.erase(itrSlot);
	m_slotbit[SlotNo] = false;

	XTL::CStaticStringBuffer<30> containerName(_T("Devices\\%04d"), SlotNo);
	BOOL fSuccess = _NdasSystemCfg.DeleteContainer(containerName, TRUE);
	if (!fSuccess) 
	{
		XTLTRACE2(NDASSVC_NDASDEVICEREGISTRAR, TRACE_LEVEL_WARNING,
			"Deleting registration entry from the registry failed at %ls, error=0x%X\n", 
			containerName, GetLastError());
	}

	(void) m_service.GetEventPublisher().DeviceEntryChanged();

	return TRUE;
}
Example #25
0
ACCESS_MASK
CNdasLogicalDevice::GetLastMountAccess()
{
	ximeta::CAutoLock autolock(this);

	ACCESS_MASK mountMask = 0;

	BOOL fSuccess = _NdasSystemCfg.GetValueEx(
		m_szRegContainer,
		_T("MountMask"),
		(LPDWORD)&mountMask);

	if (!fSuccess) 
	{
		return 0;
	}

	return mountMask;
}
Example #26
0
VOID
CNdasEventMonitor::Detach(CNdasDevice* pDevice)
{
	ximeta::CAutoLock autolock(this);

	_ASSERTE(!m_bIterating && 
		"You must not call Detach from OnStatusCheck" &&
		"Return TRUE to detach during OnStatusCheck instead!");

	DPInfo(_FT("Detaching device %s from the monitor\n"),
		CNdasDeviceId(pDevice->GetDeviceId()).ToString());

	PCNdasDeviceSet::size_type nErased = m_hbMonDevices.erase(pDevice);
	_ASSERTE(0 == nErased || 1 == nErased);

	if (nErased == 1) {
		pDevice->Release();
	}
}
Example #27
0
BOOL
CNdasUnitDiskDevice::IsBitmapClean()
{
	ximeta::CAutoLock autolock(this);

	CNdasDeviceComm devComm(*m_pParentDevice, m_unitDeviceId.UnitNo);

	BOOL fSuccess = devComm.Initialize(FALSE);
	if(!fSuccess) {
		return FALSE;
	}

	NDAS_UNITDEVICE_INFORMATION unitDevInfo;
	fSuccess = devComm.GetUnitDeviceInformation(&unitDevInfo);
	if (!fSuccess) {
		DPErrorEx(_FT("GetUnitDeviceInformation of %s failed: "), this->ToString());
		return FALSE;
	}

	BYTE BitmapData[128 * 512] = {0};

	// 1MB from NDAS_BLOCK_LOCATION_BITMAP
	for(INT i = 0; i < 16; i++)  {
		fSuccess = devComm.ReadDiskBlock(BitmapData, 
			NDAS_BLOCK_LOCATION_BITMAP + (i * 128), 128);

		if(!fSuccess) {
			return FALSE;
		}

		INT j = 0;
		PULONG pBitmapData = (PULONG)BitmapData;
		for(; j < 128 * 512 / 4; ++j) {
			if(*pBitmapData) {
				return FALSE;
			}
			pBitmapData++;
		}
	}	

	return TRUE;
}
Example #28
0
VOID
CNdasLogicalDevice::SetMountOnReady(
	ACCESS_MASK access, 
	BOOL fReducedMountOnReadyAccess)
{
	ximeta::CAutoLock autolock(this);

	if (0 == access) 
	{
		m_mountOnReadyAccess = 0;
		m_fMountOnReady = FALSE;
		m_fReducedMountOnReadyAccess = fReducedMountOnReadyAccess;
	}
	else 
	{
		m_mountOnReadyAccess = access;
		m_fMountOnReady = TRUE;
		m_fReducedMountOnReadyAccess = fReducedMountOnReadyAccess;
	}
}
void VideoEditorAudioDecoderSource::storeBuffer(MediaBuffer *buffer) {
    Mutex::Autolock autolock(mLock);
    VideoEditorAudioDecoder_Context* pDecContext =
     (VideoEditorAudioDecoder_Context *)mDecShellContext;

    LOGV("VideoEditorAudioDecoderSource::storeBuffer begin");

    // If the user didn't give us a buffer, get it from the reader.
    if(buffer == NULL) {
        MediaBuffer* newBuffer = readBufferFromReader(pDecContext);
        if (!newBuffer) {
            pDecContext->readerErrCode = M4WAR_NO_MORE_AU;
            return;
        }
        buffer = newBuffer;
    }

    mBuffers.push(buffer);
    LOGV("VideoEditorAudioDecoderSource::storeBuffer END");
}
Example #30
0
BOOL
CNdasUnitDiskDevice::HasSameDIBInfo(
	CNdasUnitDiskDevice &NdasUnitDiskDevice)
{
	InstanceAutoLock autolock(this);
	//
	// TODO: Changed to the actual size!!
	//

	// In some communication/HW error cases, m_pDIBv2 is NULL
	if (NdasUnitDiskDevice.m_pDIBv2 == NULL || m_pDIBv2 == NULL) {
		XTLTRACE2(NDASSVC_NDASUNITDEVICE, TRACE_LEVEL_ERROR,
			"DIB is NULL: This unit DIB - %p, Target unit DIB - %p, error=0x%X\n", 
			m_pDIBv2, NdasUnitDiskDevice.m_pDIBv2,
			GetLastError());
		return FALSE;
	}	
	return (0 == memcmp(m_pDIBv2, NdasUnitDiskDevice.m_pDIBv2,
		sizeof(NDAS_DIB_V2))) ? TRUE : FALSE;
}