Using Memory Targets (Delphi 6.0)

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:

var
 OleTargetArray: OleVariant;

2.

Now you have to Allocate the array to be 1 element size as follows:

OleTargetArray:= VarArrayCreate([0, 0], varByte);

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:= OleTargetArray;

4.

The array will be resized and filled with the object’s outputted data when you start converting data, you can start converting using 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.