下午回家,把笔记放上来,虽然很乱,但很有其价值所在。真的想了解这些东西的还要自己去看资料!
MFC只视频流
下载
AVI文件和BMP文件在结构上似乎很相近
1.AVIFileInfo()
The AVIFileInfo function obtains information about an AVI file.
STDAPI AVIFileInfo(
PAVIFILE pfile, // Handle of an open AVI file.
AVIFILEINFO * pfi, //Address of the structure used to return file information.
LONG lSize // Size, in bytes, of the structure.
);
2.结构
AVIFILEINFO
The AVIFILEINFO structure contains global information for an entire AVI file.
typedef struct {
DWORD dwMaxBytesPerSec;
DWORD dwFlags;
DWORD dwCaps;
DWORD dwStreams;
DWORD dwSuggestedBufferSize;
DWORD dwWidth;
DWORD dwHeight;
DWORD dwScale;
DWORD dwRate;
DWORD dwLength;
DWORD dwEditCount;
char szFileType[64];
} AVIFILEINFO;
AVISTREAMINFO
The AVISTREAMINFO structure contains information for a single stream.
typedef struct {
DWORD fccType;
DWORD fccHandler;
DWORD dwFlags;
DWORD dwCaps;
WORD wPriority;
WORD wLanguage;
DWORD dwScale;
DWORD dwRate;
DWORD dwStart;
DWORD dwLength;
DWORD dwInitialFrames;
DWORD dwSuggestedBufferSize;
DWORD dwQuality;
DWORD dwSampleSize;
RECT rcFrame; //Dimensions of the video destination rectangle.
//The values represent the coordinates of upper left corner,
// the height, and the width of the rectangle.
DWORD dwEditCount;
DWORD dwFormatChangeCount;
char szName[64];
} AVISTREAMINFO;
AVICOMPRESSOPTIONS
The AVICOMPRESSOPTIONS structure contains information about a stream and how it is compressed and saved.
This structure passes data to the AVIMakeCompressedStream function (or the AVISave function, which uses
AVIMakeCompressedStream).
typedef struct {
DWORD fccType;
DWORD fccHandler;
DWORD dwKeyFrameEvery;
DWORD dwQuality;
DWORD dwBytesPerSecond;
DWORD dwFlags;
LPVOID lpFormat;
DWORD cbFormat;
LPVOID lpParms;
DWORD cbParms;
DWORD dwInterleaveEvery;
} AVICOMPRESSOPTIONS;
3.AVIFileInit在使用其他AVI函数前,使用它初始化AVI函数库
The AVIFileInit function initializes the AVIFile library.
The AVIFile library maintains a count of the number of times it is initialized,
but not the number of times it was released.
Use the AVIFileExit function to release the AVIFile library and decrement the reference count.
Call AVIFileInit before using any other AVIFile functions.
This function supersedes the obsolete AVIStreamInit function.
4.
AVIFileOpen
The AVIFileOpen function opens an AVI file and returns the address of a file interface used to access it.
The AVIFile library maintains a count of the number of times a file is opened, but not the number of times it was released.
Use the AVIFileRelease function to release the file and decrement the count.
STDAPI AVIFileOpen(
PAVIFILE * ppfile,
LPCTSTR szFile,
UINT mode,
CLSID * pclsidHandler
);
AVIFileCreateStream
The AVIFileCreateStream function creates a new stream in an existing file and creates
an interface to the new stream.
STDAPI AVIFileCreateStream(
PAVIFILE pfile,
PAVISTREAM * ppavi,
AVISTREAMINFO * psi
);
This function starts a reference count for the new stream.
AVIMakeCompressedStream
The AVIMakeCompressedStream function creates a compressed stream from an uncompressed stream
and a compression filter, and returns the address of a pointer to the compressed stream.
This function supports audio and video compression.
STDAPI AVIMakeCompressedStream(
PAVISTREAM * ppsCompressed, //Address to contain the compressed stream pointer.
PAVISTREAM psSource,
AVICOMPRESSOPTIONS * lpOptions, // Address of a structure that identifies the type of compression to use and the options to apply
CLSID * pclsidHandler //Address of a class identifier used to create the stream
);
AVISaveOptions
The AVISaveOptions function retrieves the save options for a file and returns them in a buffer.
BOOL AVISaveOptions(
HWND hwnd, //vHandle of the parent window for the Compression Options dialog box.
UINT uiFlags, //Flags for displaying the Compression Options dialog box.
int nStreams, //
PAVISTREAM * ppavi, //Address of an array of stream interface pointers
LPAVICOMPRESSOPTIONS * plpOptions //Address of an array of pointers to AVICOMPRESSOPTIONS
//structures. These structures hold the compression options
//set by the dialog box. The nStreams parameter indicates
//the number of pointers in the array.
);
AVIStreamSetFormat //设置视频流格式
The AVIStreamSetFormat function sets the format of a stream at the specified position.
STDAPI AVIStreamSetFormat(
PAVISTREAM pavi, //Handle of an open stream.
LONG lPos, //Position in the stream to receive the format.
LPVOID lpFormat, //Position in the stream to receive the format.
LONG cbFormat //Size, in bytes, of the block of memory referenced by lpFormat.
);
AVIStreamWrite
The AVIStreamWrite function writes data to a stream.
STDAPI AVIStreamWrite(
PAVISTREAM pavi, //Handle of an open stream.
LONG lStart, //First sample to write
LONG lSamples, //Number of samples to write
LPVOID lpBuffer,//Address of a buffer containing the data to write
LONG cbBuffer, //Size of the buffer referenced by lpBuffer.
DWORD dwFlags,
LONG * plSampWritten, //Address to contain the number of samples written. This can be set to NULL.
LONG * plBytesWritten //Address to contain the number of bytes written. This can be set to NULL.
);
界面更新
CCmdUI does not have a base class.
The CCmdUI class is used only within an ON_UPDATE_COMMAND_UI handler in a CCmdTarget-derived class.
When a user of your application pulls down a menu, each menu item needs to know whether it should be
displayed as enabled or disabled. The target of a menu command provides this information by implementing
an ON_UPDATE_COMMAND_UI handler. Use ClassWizard to browse the command user-intetrface objects in your
application and create a message-map entry and function prototype for each handler.
When the menu is pulled down, the framework searches for and calls each ON_UPDATE_COMMAND_UI handler,
each handler calls CCmdUI member functions such as Enable and Check, and the framework then appropriately
displays each menu item.
A menu item can be replaced with a control-bar button or other command user-interface objec without changing
the code within the ON_UPDATE_COMMAND_UI handler.
When it routes an update command to its handler, the framework passes the handler a pointer to
a CCmdUI object (or to an object of a CCmdUI-derived class). This object represents the menu item
or toolbar button or other user-interface object that generated the command. The update handler
calls member functions of the CCmdUI structure through the pointer to update the user-interface
object. For example, here is an update handler for the Clear All menu item:
void CMyClass::OnUpdateToolsMyTool( CCmdUI* pCmdUI )
{
if( ToolAvailable() )
pCmdUI->Enable( TRUE );
}
This handler calls the Enable member function of an object with access to the menu item.
Enable makes the item available for use.
CCmdUI::Enable
virtual void Enable( BOOL bOn = TRUE );
TRUE to enable the item, FALSE to disable it.
Remarks:
Call this member function to enable or disable the user-interface item for this command.
CCmdUI::SetCheck
virtual void SetCheck( int nCheck = 1 );
Specifies the check state to set. If 0, unchecks; if 1, checks; and if 2, sets indeterminate.
Remarks:
Call this member function to set the user-interface item for this command to the appropriate check state.
This member function works for menu items and toolbar buttons. The indeterminate state applies only to toolbar buttons.
memset
Sets buffers to a specified character.
void *memset( void *dest,//Pointer to destination
int c, //Character to set
size_t count
);
returns the value of dest.
用户312121 2011-1-7 19:10