Using Memory Targets (Visual Basic)
The ltmmCaptureCtrl and ltmmConvertCtrl objects allow the user to write media data to memory instead of a file.
|
1. |
Define the memory target by declaring an array; the declaration is performed using the following code: |
Dim TargetArray() As Byte
|
2. |
Now you have to allocate the array to be 1 element size as follows: |
ReDim TargetArray(0)
|
3. |
Assign the Convert Control TargetType property to Array, and Assign our array to the Convert Control Target Array property as follows: |
'Set The TargetType Property to Array.
ltmmConvertCtrl1.TargetType = ltmmConvert_Target_Array
'Assign TargetArray property to our TargetArray
ltmmConvertCtrl1.TargetArray = TargetArray
|
4. |
The array will be resized and filled with the object’s outputted data when you start converting data, you can start converting use the following code: |
'Set the input file.
ltmmConvertCtrl1.SourceFile = "c:\source.avi"
' Start Converting
ltmmConvertCtrl1.StartConvert
|
5. |
As long as the array is assigned to object, the array data and descriptor should not be accessed. The user can unassign the target by calling the ResetTarget method: |
ltmmConvertCtrl1.ResetTarget
|
6. |
Once the target has been reset, the user may access or free the memory. |