SetCodec
Top  Previous  Next

Description

Sets the name of the codec (video compressor) to be used during the AVI capture.


Syntax


[VB]
objActiveGige.SetCodec Name [, Quality, Datarate, Keyframe ])


[C/C++]
HRESULT GetCodec(bstr Name [, long Quality = 0, long Datarate = 0, long Keyframe = 0 ]);


Data Types
[VB]

Name: String
Quality
: Integer
Datarate: Integer
Keyframe: Integer

Parameters
[C/C++]

Name [in]  
String specifying the name of the feature  
Quality [out, retval]  
Numerical value of the quality parameter used by the codec, if supported.  
Datarate [out, retval]  
Datarate in kb/sec used by the codec, if supported.  
Keyframe [out, retval]  
The amount of frames after which a key frame is recorded, if supported.  


Return Values


S_OK  
Success  
E_FAIL  
Failure to set the codec  
 

Example


The following VB example demonstrates the use of the DivX codec:

Private Sub
Form_Load()
ActiveGige1.SetCodec "DivX 5.0.2 Codec"
ActiveGige1.Acquire=
True

End Sub


Private Sub
StartButton_Click()
ActiveGige1.StartCapture "c:\mycapture.avi"

End Sub


Private Sub
StopButton_Click()
ActiveGige1.StopCapture

End Sub


The following VB example demonstrates how to set up a codec by its index in the system:

CodecList=ActiveGige1.GetCodecList
CodecName=CodecList(9)
ActiveGige1.SetCodec CodecName
 

Remarks


This method allows you to set only the basic compression parameters which may not be supported by certain codecs. To adjust the internal parameters of a codec, use ShowCodecDialog.

The name of the codec must be precise in order for SetCodec to work. An extra space in the name of the codec may cause this function to fail. To avoid errors, It is recommended to use an index of the codec rather than its name, as shown in the second example above.