LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Capture frames with PlayCtrl using LEAD Video Callback in VB.NET
#1
Posted
:
Tuesday, July 18, 2017 3:25:00 PM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
The attached Visual Studio 2017 project illustrates the use of the LEAD Video Callback filter with the LEADTOOLS 19 PlayCtrl in VB.NET. The callback implementation waits until the user indicates they would like a frame, and saves that frame using the LEADTOOLS 19 .NET RasterCodecs class. This project assumes you have installed the
LEADTOOLS Imaging Pro SDK and integrated the
LEADTOOLS Multimedia SDK into the existing installation. To run the project, please extract it to the following location:
C:\LEADTOOLS 19\Examples\posts\t12246
Note: If you have changed the default installation location, you will need to update the output path to one of the following:
[LEADTOOLS 19]\Bin\Dotnet4\Win32
[LEADTOOLS 19]\Bin\Dotnet4\x64
The project uses a global instance of the callback implementation:
Code:Private lmvMyUserCallBk As New CallbackFilterClass()
Private lmvMyCallBk As LMVCallbackLib.ILMVCallback
It sets some defaults in the main form load event:
Code:lmvMyUserCallBk.codecsEngine = codecs
lmvMyUserCallBk.imageCounter = 1
lmvMyUserCallBk.SaveDirectory = txtSaveDirectory.Text
And then adds the callback filter to the PlayCtrl like this:
Code: Private Function insertCallbackFilter() As Boolean
Dim success As Boolean = False
Dim nIndex As Integer = -1
Try
_playctrl.SelectedVideoProcessors.Add(_playctrl.VideoProcessors.Callback)
lmvMyCallBk = DirectCast(_playctrl.GetSubObject(PlayObject.SelVideoProcessor), LMVCallbackLib.LMVCallback)
If lmvMyCallBk IsNot Nothing Then
lmvMyCallBk.ReceiveProcObj = lmvMyUserCallBk
End If
success = True
Catch addFilterException As Exception
MessageBox.Show("An error has occured in adding the filter" & vbLf & vbLf & addFilterException.Message)
End Try
Return success
End Function
The basic
ILMVUserCallback filter implementation looks like this:
Code:Friend Class CallbackFilterClass
Implements ILMVUserCallback
Public Sub ReceiveProc(ByVal pData As Integer, ByVal lWidth As Integer, ByVal lHeight As Integer, ByVal lBitCount As Integer, ByVal lSize As Integer, ByVal bTopDown As Integer) Implements LMVCallbackLib.ILMVUserCallback.ReceiveProc
End Sub
End Class
A similar example using C# with the CaptureCtrl can be found here:
HOW TO: Capture to MPEG2 with Video Callback Filter for StillsWalter Bates
Senior Support Engineer
LEAD Technologies, Inc.
LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Capture frames with PlayCtrl using LEAD Video Callback in VB.NET
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.