示例#1
0
void CLiveCameraDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	DrawDibClose(m_drawdib);

	CDialog::OnClose();
}
示例#2
0
VideoComponent::~VideoComponent()
{
	VideoManager::instance()->removeComponent(this);
	closeAvi();
	DrawDibClose(m_hdd);			// Closes The DrawDib Device Context
	DeleteDC(m_hdc);				// Delete the Dc
	CoUninitialize();
}
示例#3
0
// This frees our instance structure, and everything within the structure.
//***************************************************************************
static long AVIDrawClose(PINSTINFO pi)
//***************************************************************************
{
	if (pi->hdd)
		DrawDibClose(pi->hdd);
	FreeUp((LPTR)pi);
	return ICERR_OK;
}
示例#4
0
void MemoryMapView_DoneBitmap()
{
    if (m_hMemoryMapBitmap != NULL)
    {
        DeleteObject(m_hMemoryMapBitmap);  m_hMemoryMapBitmap = NULL;
    }

    DrawDibClose( m_hMemoryMapDrawDib );
}
示例#5
0
BExtractorDoc::~BExtractorDoc()
{
	if (m_hdd)
	{
		DrawDibClose(m_hdd);
		m_hdd = NULL;
	}
	DeleteContents();
}
示例#6
0
CTimeEv::~CTimeEv()
{
	if(m_oAVIR.IsOpen())
		m_oAVIR.Close();
	if(m_hdd)
		DrawDibClose(m_hdd);
	if(m_pDIBFrame)
		delete [] m_pDIBFrame;
}
示例#7
0
文件: AVI.cpp 项目: DCubix/1.4.0
void CAvi::cleanUp(void)												// Properly Closes The Avi File
{
	glDeleteTextures( 1, &m_textureId );
	DeleteObject(m_hBitmap);										// Delete The Device Dependant Bitmap Object
	DrawDibClose(m_hdd);											// Closes The DrawDib Device Context
	AVIStreamGetFrameClose(m_pgf);								// Deallocates The GetFrame Resources
	AVIStreamRelease(m_pavi);										// Release The Stream
	AVIFileExit();												// Release The File
}
//////////////////
// Delete Object. Delete DIB and palette.
//
BOOL CDib::DeleteObject()
{
	m_pal.DeleteObject();
	if (m_hdd) {
		DrawDibClose(m_hdd);
		m_hdd = NULL;
	}
	memset(&m_bm, 0, sizeof(m_bm));
	return CBitmap::DeleteObject();
}
示例#9
0
void CWebCamDlg::OnClose() 
{
	// TODO: Add your message handler code here and/or call default
	// 销毁时移除自己在视图中的数据

	::ReleaseDC(m_hWnd, m_hDC);
	DrawDibClose(m_hDD);
	m_pContext->m_Dialog[0] = 0;
	closesocket(m_pContext->m_Socket);	
	CDialog::OnClose();
}
示例#10
0
/*
---------------------------------------------------------------------------------------
- Properly Closes The Avi File
---------------------------------------------------------------------------------------
*/
void AviVideoRenderer::CloseAVI(void)
{
	if(_avi_opened)
	{
		DeleteObject(_AVR_hBitmap);							// Delete The Device Dependant Bitmap Object
		DrawDibClose(_AVR_hdd);								// Closes The DrawDib Device Context
		AVIStreamGetFrameClose(_AVR_pgf);					// Deallocates The GetFrame Resources
		AVIStreamRelease(_AVR_pavi);						// Release The Stream
	}

	_avi_opened = false;
}
示例#11
0
// This frees our instance structure, and everything within the
// structure.
static LONG NEAR PASCAL AVIDrawClose(PINSTINFO pi)
{
	if (pi->hdd)
	{
		DrawDibClose(pi->hdd);
	}
	if (pi->hddb)
	{
		DisintegrateMemoryDC(pi);
	}
	GlobalFreePtr(pi);
	return 1;
}
示例#12
0
void AVIOBJ::CloseAVI(void)												// Properly Closes The Avi File
{

    DeleteObject(hBitmap);										// Delete The Device Dependant Bitmap Object
    if (hdd) DrawDibClose(hdd);											// Closes The DrawDib Device Context
    if (pgf)
    {
        AVIStreamGetFrameClose(pgf);								// Deallocates The GetFrame Resources
        AVIStreamRelease(pavi);										// Release The Stream
        AVIFileExit();												// Release The File
    }

}
void Movie::close()
{
    if (DataPointer_)
    {
        /* Delete each movie object data */
        DeleteObject(mcrAVIData->hBitmap);
        DrawDibClose(mcrAVIData->hDrawDIB);
        
        AVIStreamGetFrameClose(mcrAVIData->pGetFrame);
        AVIStreamRelease(mcrAVIData->pVideoStream);
        AVIFileExit();
        
        /* Delete the movie data */
        delete mcrAVIData;
    }
}
示例#14
0
static void	__fastcall Repaint(HWND	hWnd,RECT & updata,RECT& upbmp,HDC hdc)
{
	PAINTSTRUCT ps={0};
	HDRAWDIB	hdd;
	HBITMAP		hbmp;
	BITMAPINFOHEADER	bi={sizeof(bi)};
	void*		bits=LocalAlloc(LPTR,4096*4096*5);
	
	POINTS	bmprc;
	*((DWORD*)(&bmprc))= GetWindowLong(hWnd,FIELD_OFFSET(ShowPicClass,bmRC));

	hdd=DrawDibOpen();

	if(!hdc)
		hdc =BeginPaint(hWnd,&ps);

	hbmp=(HBITMAP)GetWindowLong(hWnd,FIELD_OFFSET(ShowPicClass,hbmp));
	
	BITMAP	bm;

	GetObject(hbmp,sizeof(bm),&bm);
	bi.biBitCount=32;
	bi.biWidth = bm.bmWidth;
	bi.biPlanes = 1;
	bi.biHeight = bm.bmHeight ;
	
	ExcludeClipRect(hdc,updata.left,updata.top,updata.right,updata.bottom);

	FillRect(hdc,&ps.rcPaint,(HBRUSH)1);
	
	SelectClipRgn(hdc,NULL);

	GetDIBits(hdc,hbmp,0,bi.biHeight,bits,(LPBITMAPINFO)&bi,DIB_RGB_COLORS);

	DrawDibDraw(hdd,hdc,updata.left,updata.top,updata.right-updata.left,updata.bottom-updata.top,
		&bi,bits,upbmp.left,upbmp.top,upbmp.right-upbmp.left,upbmp.bottom-upbmp.top,0);
	
	LocalFree(bits);

	DrawDibClose(hdd);
	
	if(ps.hdc)
		EndPaint(hWnd,&ps);
	
}
示例#15
0
void AVI :: Close(void)												// Properly Closes The Avi File
{
	if(mpf)
	{
		DeleteObject(hBitmap);										// Delete The Device Dependant Bitmap Object
		DrawDibClose(hdd);											// Closes The DrawDib Device Context
		AVIStreamGetFrameClose(pgf);								// Deallocates The GetFrame Resources
		AVIStreamRelease(pavi);										// Release The Stream
		AVIFileExit();												// Release The File
	}

	// clear everything else
	pos=0;
	width=height=0;
	mpf=0;
	pdata=NULL;
	loop=false;
}
示例#16
0
void CVideoDlg::OnClose()
{
	if (m_lpScreenDIB==NULL)
	{
		CDialog::OnClose();
	}
	if (!m_aviFile.IsEmpty())
	{
		SaveAvi();
	}


	::ReleaseDC(m_hWnd, m_hDC);
	DrawDibClose(m_hDD);

	m_pContext->m_Dialog[0] = 0;
	closesocket(m_pContext->m_Socket);

	if (m_lpbmi!=NULL){ 
		delete [] m_lpbmi;
		m_lpbmi=NULL;
	}
	if (m_lpScreenDIB)
	{
		delete [] m_lpScreenDIB;
		m_lpScreenDIB=NULL;
	}
	if (m_lpCompressDIB){
		delete [] m_lpCompressDIB;
		m_lpCompressDIB=NULL;
	}
	if (m_pVideoCodec)
	{
		delete m_pVideoCodec;
		m_pVideoCodec=NULL;
	}
	CDialog::OnClose();
}
示例#17
0
/***********************************************************************
 *		DrawDibClose		[MSVIDEO.103]
 */
BOOL16 VFWAPI DrawDibClose16(HDRAWDIB16 hdd)
{
    return DrawDibClose(HDRAWDIB_32(hdd));
}
示例#18
0
VideoDlg::~VideoDlg()
{
	m_oAVIReader.Close();
	DrawDibClose(m_hdd);
}
示例#19
0
static FIMULTIBITMAP* ReadFromAvi(const char* filename) {
	int err=0;
	AVIFileInit();
	
	PAVISTREAM pavi; // Handle To An Open Stream
	if( AVIStreamOpenFromFile(&pavi, filename, streamtypeVIDEO, 0, OF_READ, NULL) != 0) {
		AVIFileExit();
		return NULL;
	}



	AVISTREAMINFO		psi;				// Pointer To A Structure Containing Stream Info
	AVIStreamInfo(pavi, &psi, sizeof(psi));				// Reads Information About The Stream Into psi
	int width  = psi.rcFrame.right-psi.rcFrame.left;			// Width Is Right Side Of Frame Minus Left
	int height = psi.rcFrame.bottom-psi.rcFrame.top;			// Height Is Bottom Of Frame Minus Top
	int frameCount = AVIStreamLength(pavi);							// The Last Frame Of The Stream

	double mpf = AVIStreamSampleToTime(pavi, frameCount) / (double)frameCount;		// Calculate Rough Milliseconds Per Frame

	PGETFRAME pgf = AVIStreamGetFrameOpen(pavi, NULL);				// Create The PGETFRAME Using Our Request Mode
	if (pgf==NULL)
	{
		// An Error Occurred Opening The Frame
		error("Failed To Open frame from AVI");
	}

	//HDC hdc = GetDC(0);

	HDRAWDIB hdd = DrawDibOpen();													// Handle For Our Dib

	BITMAPINFOHEADER bmih;										// Header Information For DrawDibDraw Decoding
	bmih.biSize = sizeof (BITMAPINFOHEADER);					// Size Of The BitmapInfoHeader
	bmih.biPlanes = 1;											// Bitplanes	
	bmih.biBitCount = 24;										// Bits Format We Want (24 Bit, 3 Bytes)
	bmih.biWidth = width;										// Width We Want (256 Pixels)
	bmih.biHeight = height;										// Height We Want (256 Pixels)
	bmih.biCompression = BI_RGB;								// Requested Mode = RGB

	char		*data;						// Pointer To Texture Data
	HBITMAP hBitmap = CreateDIBSection(hdc, (BITMAPINFO*)(&bmih), DIB_RGB_COLORS, (void**)(&data), NULL, NULL);
	SelectObject(hdc, hBitmap);								// Select hBitmap Into Our Device Context (hdc)

	// create a new freeimage anim
	someError=false;
	FIMULTIBITMAP* ret = FreeImage_OpenMultiBitmap(FIF_TIFF, "temp.tiff", TRUE, FALSE);
	if (!ret || someError) {
		error("Couldnt create multibitmap");
	}

	for (int frame=0; frame<frameCount; frame++) {
		fprintf(stderr, "Loading frame %i\n", frame);
		// Grab Data From The AVI Stream
		LPBITMAPINFOHEADER lpbi = (LPBITMAPINFOHEADER)AVIStreamGetFrame(pgf, frame);	
		// Pointer To Data Returned By AVIStreamGetFrame
		// (Skip The Header Info To Get To The Data)
		char* pdata = (char *)lpbi + lpbi->biSize + lpbi->biClrUsed * sizeof(RGBQUAD);	
		
		// Convert Data To Requested Bitmap Format
		DrawDibDraw(hdd, hdc, 0, 0, width, height, lpbi, pdata, 0, 0, width, height, 0);

		// copy into the freeimage thing
		FIBITMAP* fiBitmap = FreeImage_ConvertFromRawBits((BYTE*)data, width, height, width*3, 24, 0xFF0000, 0x00FF00, 0x0000FF);
/*		BYTE* src = (BYTE*)data;
		for (int y=0; y<height; y++) {
			BYTE* dst = FreeImage_GetScanLine(fiBitmap, y);
			for (int x=0; x<width; x++) {
				//src++;
				*dst++ = *src++;
				*dst++ = *src++;
				*dst++ = *src++;
			}
		}
*/
		FIBITMAP* grayBitmap = FreeImage_ConvertToGreyscale(fiBitmap);
		FreeImage_Unload(fiBitmap);

		FreeImage_AppendPage(ret, grayBitmap);
	}
	FreeImage_CloseMultiBitmap(ret);
	ret = FreeImage_OpenMultiBitmap(FIF_TIFF, "temp.tiff", FALSE, TRUE);

	DeleteObject(hBitmap);										// Delete The Device Dependant Bitmap Object
	DrawDibClose(hdd);											// Closes The DrawDib Device Context
	AVIStreamGetFrameClose(pgf);								// Deallocates The GetFrame Resources
	AVIStreamRelease(pavi);										// Release The Stream
	AVIFileExit();												// Release The File

	return ret;
}