Exemplo n.º 1
0
Device::~Device()
{
	/* stop all the data  */
	Lock();
	SubLock();

	DeviceDelCallbackMap::iterator it = m_DelMap.begin();

	for(; it!=m_DelMap.end(); ++it)
	{
	    void *pParam = (*it).first;
	    DeviceDelCallbackFunctionPtr pFunc = (*it).second;
	    if (pFunc)
	    {
	        pFunc(pParam);
	    }
	}
	SubUnLock();
	UnLock();

	m_vPlay.StopGetData();
	m_vPlay.StopGetRawFrame();
	m_vPlaySubStream.StopGetData();
	m_vPlaySubStream.StopGetRawFrame();
	
	if (m_pHdfsRecord)
	{
		m_pVHdfsdb.FinishRecord(m_pHdfsRecord);
		delete m_pHdfsRecord;
		m_pHdfsRecord = NULL;
	}
	
	Lock();
	SubLock();
	
	if (m_pRecord)
	{
	    u32 endTime = m_pRecord->GetEndTime();
	    if (endTime != 0)
	    {
	    	 m_pVdb.FinishRecord(m_pRecord);
	    }
	    delete m_pRecord;
	    m_pRecord = NULL;
	}
	SubUnLock();
	UnLock();

	delete m_pvPlay;
	delete m_pvPlaySubStream;
}
Exemplo n.º 2
0
BOOL Device::RawHandler1(RawFrame& frame)
{
	SubLock();
	//VDC_DEBUG("RawHandler1 (%d, %d)\n", frame.width, frame.height);	
	/* 1. Send to client */
	DeviceRawCallbackMap::iterator it = m_RawMap.begin();

	for(; it!=m_RawMap.end(); ++it)
	{
	    void *pParam = (*it).first;
	    DeviceRawCallbackFunctionPtr pFunc = (*it).second;
	    if (pFunc)
	    {
	        pFunc(frame, pParam);
	    }
	}
	/* Call the Sub DataHandler if there has no sub stream */
	if (m_param.m_bHasSubStream == FALSE)
	{
		SubRawHandler1(frame);
	}

	SubUnLock();
	return TRUE;
}
Exemplo n.º 3
0
BOOL Device::SubDataHandler1(VideoFrame& frame)
{
	SubLock();
	/* Frist cache the info frame */
	if (frame.streamType == VIDEO_STREAM_INFO)
	{
		memcpy(&m_infoSubData, frame.dataBuf, sizeof(InfoFrame));
		m_bGotInfoSubData = TRUE;
	}
	
	/* 1. Send to client */
	DeviceDataCallbackMap::iterator it = m_SubDataMap.begin();

	for(; it!=m_SubDataMap.end(); ++it)
	{
	    void *pParam = (*it).first;
	    DeviceDataCallbackFunctionPtr pFunc = (*it).second;
	    if (pFunc)
	    {
	        pFunc(frame, pParam);
	    }
	}

	SubUnLock();
	return TRUE;
}
Exemplo n.º 4
0
Camera::~Camera()
{
	/* stop all the data  */
	Lock();
	SubLock();

	CameraDelCallbackMap::iterator it = m_DelMap.begin();

	for(; it!=m_DelMap.end(); ++it)
	{
	    void *pParam = (*it).first;
	    CameraDelCallbackFunctionPtr pFunc = (*it).second;
	    if (pFunc)
	    {
	        pFunc(pParam);
	    }
	}
	SubUnLock();
	UnLock();

	m_vPlay.StopGetData();
	m_vPlaySubStream.StopGetData();

	delete m_pvPlay;
	delete m_pvPlaySubStream;
}
Exemplo n.º 5
0
BOOL Device::UnRegRawCallback(void * pParam)
{
	Lock();
	SubLock();
	m_RawMap.erase(pParam);
	SubUnLock();
	UnLock();
	StopRaw();
	return TRUE;
}
Exemplo n.º 6
0
BOOL Device::RegRawCallback(DeviceRawCallbackFunctionPtr pCallback, void * pParam)
{
	Lock();
	SubLock();
	m_RawMap[pParam] = pCallback;
	SubUnLock();
	UnLock();
	StartRaw();
	return TRUE;
}
Exemplo n.º 7
0
 BOOL Device::StopSubRaw()
{
	Lock();
	SubLock();
	m_nSubRawRef --;
	if (m_nSubRawRef <= 0)
	{
		m_nSubRawRef = 0;
		m_vPlaySubStream.StopGetRawFrame();
	}
	SubUnLock();
	UnLock();
	return TRUE;
}
Exemplo n.º 8
0
 BOOL Device::StartSubRaw()
{
	Lock();
	SubLock();
	if (m_nSubRawRef == 0)
	{
		m_vPlaySubStream.StartGetRawFrame(this, 
			(VPlayRawFrameHandler)Device::SubRawHandler);
	}
	m_nSubRawRef ++;
	SubUnLock();
	UnLock();
	return TRUE;
}
Exemplo n.º 9
0
BOOL Device::UnRegSubRawCallback(void * pParam)
{
	Lock();
	SubLock();
	m_SubRawMap.erase(pParam);
	SubUnLock();
	UnLock();
	if (m_param.m_bHasSubStream == FALSE)
	{
		StopRaw();
	}else
	{
		StopSubRaw();
	}
	return TRUE;
}
Exemplo n.º 10
0
BOOL Device::RegSubRawCallback(DeviceRawCallbackFunctionPtr pCallback, void * pParam)
{
	Lock();
	SubLock();
	m_SubRawMap[pParam] = pCallback;
	SubUnLock();
	UnLock();
	if (m_param.m_bHasSubStream == FALSE)
	{
		StartRaw();
	}else
	{
		StartSubRaw();
	}
	return TRUE;
}
Exemplo n.º 11
0
BOOL Device::SubRawHandler1(RawFrame& frame)
{
	SubLock();
	
	/* 1. Send to client */
	DeviceRawCallbackMap::iterator it = m_SubRawMap.begin();

	for(; it!=m_SubRawMap.end(); ++it)
	{
	    void *pParam = (*it).first;
	    DeviceRawCallbackFunctionPtr pFunc = (*it).second;
	    if (pFunc)
	    {
	        pFunc(frame, pParam);
	    }
	}

	SubUnLock();
	return TRUE;
}