Hello guys. I just rewrite a VB6 code to Xojo, where it receives MPEG coming from IP Camera. Then a manipulation is made to get only the JPEG of each frame and display it. It works very well in VB6 but in Xojo it only shows the images if I put a break point and then I proceed. It also stops displaying after a few seconds. I tried several things but nothing worked … could anyone help me? Here is the main section from socket_DataAvailable:
Dim ContentLength, i1, i2 As Integer
Static sBuffer As String
Dim oDt As New Date
lbl.Text = oDt.ShortDate + " " + oDt.ShortTime
sBuffer = sBuffer + socket.ReadAll
If ContentLength = 0 Then
i1 = InStr(1, sBuffer, "Content-Length: ")
If i1 > 0 Then
i1 = i1 + 16
i2 = InStr(i1, sBuffer, Chr(13) + Chr(10))
If i2 > 0 Then
ContentLength = Val(Mid(sBuffer, i1, i2 - i1))
sBuffer = Mid(sBuffer, i2 + 4)
End If
End If
End If
If ContentLength > 0 Then
If Len(sBuffer) >= ContentLength Then
FPS = FPS + 1
lblFPS.Text = FPS
Dim mb As memoryblock = sBuffer
Dim bmap As Picture
bmap = Picture.FromData(mb)
Self.Width = bmap.Width + 8
Self.Height = bmap.Height + 24
canv.Backdrop = bmap
sBuffer = Mid(sBuffer, ContentLength + 1)
ContentLength = 0
End If
End If