Ejemplo n.º 1
0
// this is the drawproc that vfw calls.  It basically just hands
// stuff off to other functions later in this file.  A few things
// are handled here.  This is message-handling proc just like a
// Window Proc or a VBX Control Proc...
LONG FAR PASCAL _export ICAVIDrawProc(DWORD id, HDRVR hDriver,
	UINT uiMessage, LPARAM lParam1, LPARAM lParam2)
{
	PINSTINFO pi = (PINSTINFO)id;

	switch (uiMessage)
	{
	case DRV_LOAD:
	case DRV_FREE:
		return 1;
	
	case DRV_OPEN:
		if (lParam2 == 0L)
		{
			// Uh-oh, no data to use...
			return 1;
		}
		return AVIDrawOpen((ICOPEN FAR *)lParam2);
	
	case DRV_CLOSE:
		return AVIDrawClose(pi);
	
	case DRV_QUERYCONFIGURE:
		return 0;
	case DRV_CONFIGURE:
		return 1;
	case ICM_CONFIGURE:
	case ICM_ABOUT:
		return ICERR_UNSUPPORTED;
	case ICM_GETSTATE:
		return 0L;
		
	case ICM_GETINFO:
		return AVIDrawGetInfo((ICINFO FAR *)lParam1, lParam2);
	
	case ICM_DRAW_QUERY:
		return AVIDrawQuery(pi, (LPBITMAPINFOHEADER)lParam1);
	
	case ICM_DRAW_SUGGESTFORMAT:
		return AVIDrawSuggestFormat(pi, (ICDRAWSUGGEST FAR *) lParam1, lParam2);
	
	case ICM_DRAW_BEGIN:
		return AVIDrawBegin(pi, (ICDRAWBEGIN FAR *) lParam1, lParam2);
	
	case ICM_DRAW_REALIZE:
		pi->hdc = (HDC) lParam1;
		if (!pi->hdc || !pi->hdd)
		{
			// we aren't initialized yet.
			break;
		}
		return DrawDibRealize(pi->hdd, pi->hdc, (BOOL) lParam2);
	
	case ICM_DRAW_GET_PALETTE:
		if (!pi->hdd)
		{
			break;
		}
		return (LONG) (UINT) DrawDibGetPalette(pi->hdd);
	
	case ICM_DRAW:
		return AVIDraw(pi, (ICDRAW FAR *)lParam1, lParam2);
	
	case ICM_DRAW_CHANGEPALETTE:
		return AVIDrawChangePalette(pi, (LPBITMAPINFOHEADER) lParam1);
	
	case ICM_DRAW_END:
		return AVIDrawEnd(pi);
	
	case DRV_DISABLE:
	case DRV_ENABLE:
		return 1;
	case DRV_INSTALL:
	case DRV_REMOVE:
		return 1;
	}
	if (uiMessage < DRV_USER)
	{
		return DefDriverProc(id,hDriver,uiMessage,lParam1,lParam2);
	}
	else
	{
		return ICERR_UNSUPPORTED;
	}
}
Ejemplo n.º 2
0
//***************************************************************************
long FAR PASCAL EXPORT MCIDrawProc(DWORD id, HDRVR hDriver, UINT message, LPARAM lParam1, LPARAM lParam2)
//***************************************************************************
{
	PINSTINFO pi;

	switch (message)
	{
	// First, all the messages we ignore
	case DRV_LOAD:
	case DRV_FREE:
	case DRV_CONFIGURE:
	case DRV_DISABLE:
	case DRV_ENABLE:
	case DRV_INSTALL:
	case DRV_REMOVE:
		return 1L; //ICERR_UNSUPPORTED; // JMM try unsupported instead of 1L
	
	case ICM_CONFIGURE:
	case ICM_ABOUT:
	case ICM_DRAW_START_PLAY:
		return ICERR_UNSUPPORTED;
		
	// Next, all the messages we ignore and just return ICERR_OK (0):
	// Note, these may be used to store state information.
	// It is unclear if they will definitetly be called.
	case DRV_QUERYCONFIGURE:
	case ICM_GETSTATE:
	case ICM_SETSTATE:
	case ICM_DRAW_QUERY: // Determine if the input can be processed
	case ICM_DRAW_SUGGESTFORMAT: // Suggest the output format
	case ICM_DRAW_END: // Cleanup after a draw operation
		return ICERR_OK;

	// The draw messages we care about
	case DRV_OPEN: // Open the rendering driver
		return AVIDrawOpen((ICOPEN FAR *)lParam2);
	case ICM_DRAW_BEGIN: // Prepare to draw the video data
		return AVIDrawBegin((PINSTINFO)id, (ICDRAWBEGIN FAR *) lParam1, lParam2);
	case ICM_GETINFO:
		return AVIDrawGetInfo((ICINFO FAR *)lParam1, lParam2);
	case ICM_DRAW: // Draw the video data
		return AVIDraw((PINSTINFO)id, (ICDRAW FAR *)lParam1, lParam2);
	case ICM_DRAW_CHANGEPALETTE:
		return AVIDrawChangePalette((PINSTINFO)id, (LPBITMAPINFOHEADER) lParam1);
	case ICM_DRAW_GET_PALETTE:
		if ( !(pi = (PINSTINFO)id) )	return ICERR_UNSUPPORTED;
		if (!pi->hdc || !pi->hdd)		return ICERR_UNSUPPORTED;
		return (UINT)DrawDibGetPalette(pi->hdd);
	case ICM_DRAW_REALIZE:
		if ( !(pi = (PINSTINFO)id) )	return ICERR_UNSUPPORTED;
		pi->hdc = (HDC)lParam1;
		if (!pi->hdc || !pi->hdd)		return ICERR_UNSUPPORTED;
		return DrawDibRealize(pi->hdd, pi->hdc, (BOOL) lParam2);
	case DRV_CLOSE: // Close the rendering driver
		return AVIDrawClose((PINSTINFO)id);

	default:
		if (message < DRV_USER)
			return DefDriverProc(id, hDriver, message, lParam1, lParam2);
		else
			return ICERR_UNSUPPORTED;
	}

	return ICERR_UNSUPPORTED;
}