How to play a UDP MPEG2 Stream with DVR Buffering
The following VB subroutine demonstrates how to use the ltmmPlayCtrl object to play a UDP MPEG2 source stream with modified DVR buffer settings.
Private Sub PlayUDPSourceWithDVRBuffer()
Dim ltmmPlayCtrl1 As LTMMPlayCtrl
Set ltmmPlayCtrl1 = MainForm.ltmmPlayCtrl
On Error GoTo HandleError
'' Open the UDP Stream, but dont auto start
ltmmPlayCtrl1.AutoStart
= False
ltmmPlayCtrl1.SourceFile
= "udp://127.0.0.1:9005"
Dim DVRSink As LMDVRSinkLib.LMDVRSink
Set DVRSink = ltmmPlayCtrl1.GetSubObject(ltmmPlay_Object.ltmmPlay_Object_SourceFilter)
'' Tell the DVR Sink that settings are about to change
DVRSink.StartChangingAttributes
'' Set only one DVR buffer folder
DVRSink.FolderCount
= 1
'' Set the buffer base file name to 'Capture.LBL'
DVRSink.BaseName
= "Capture.LBL"
'' Set the buffer folder location to 'C:\Temp'
DVRSink.FolderName(0)
= "C:\Temp"
'' Set the buffer folder to have 5 buffer data files, each
at 100MB max size
Call DVRSink.SetBufferSize(0,
5, 102400000)
'' Commit the changed settings now
DVRSink.StopChangingAttributes(False)
'' Run the stream
ltmmPlayCtrl1.Run
Exit Sub
HandleError:
If Err.Number <> 0 Then MsgBox Err.Description + "
Error code = " + str(Err.Number) + "."
End Sub