I can get video to stream but when i set up a stream buffer for Time shifting i get an error.
For anyone who is interested in helping me out here is the code.
- Code: Select all
The Video Control can pause a live video stream using the Stream Buffer Engine.
To do so, create two instances of the Video Control.
The first instance is for creating the tune request and recording the content into the stream buffer.
The second instance is for playing back the content from the stream buffer.
Using the first instance of the Video Control, do the following:
1. Create a tune request.
2. Pass the tune request to the Video Control by calling the View method.
3. Add the video encoder feature (CLSID_MSVidEncoder) to the active features collection.
4. Enumerate the available output devices in the GUID_NULL category.
Find the Stream Buffer Sink device and set it to be the active output device.
5. Specify a file name for the output device.
6. Disable video and audio rendering.
7. Run the Video Control.
Using the second instance of the Video Control, do the following:
1. Enumerate the available input devices in the GUID_NULL category.
Set the Stream Buffer Source device as the active input device.
2. Specify the same file name used previously in step 5 of the first instance of the Video Control.
3. Run the Video Control.
I´ve followed the instructions and created some (quite sloppy) code. I get an error at MSVidCtl_Sink.Run (object has not been initialized). Don´t use Option Explicit if you want to try the code. As I said, the code is a mess.
'Using the first instance of the Video Control:
Dim objTSContainer As New SystemTuningSpaces
Dim objTuneRequest As IChannelTuneRequest
Dim objTuneSpace As ITuningSpace
Dim objAnalogTuneSpace As New AnalogTVTuningSpace
'1. Create a tune request.
For Each objTuneSpace In objTSContainer
If objTuneSpace.UniqueName = "MyTV" Then
objTSContainer.Remove "MyTV"
End If
Next
objAnalogTuneSpace.CountryCode = 46
objAnalogTuneSpace.UniqueName = "MyTV"
objAnalogTuneSpace.FriendlyName = "My Television"
objAnalogTuneSpace.MaxChannel = 69
objAnalogTuneSpace.MinChannel = 1
objAnalogTuneSpace.NetworkType = "{a799a800-a46d-11d0-a18c-00a02401dcd4}"
objAnalogTuneSpace.InputType = TunerInputAntenna
Set objTuneSpace = objAnalogTuneSpace
objTSContainer.Add objAnalogTuneSpace
Set objTuneRequest = objTSContainer("MyTV").CreateTuneRequest
intChannel = 10
objTuneRequest.Channel = intChannel
MSVidCtl_Sink.MaintainAspectRatio = True
'2. Pass the tune request to the Video Control by calling the View method.
MSVidCtl_Sink.View objTuneRequest
'3. Add the video encoder feature (CLSID_MSVidEncoder) to the active features collection.
ENC_CLSID = "{BB530C63-D9DF-4B49-9439-63453962E598}"
' Create an empty Features collection
Dim MyFeatures As New MSVidFeatures
' Enumerate the available features
For Each feature In MSVidCtl_Sink.FeaturesAvailable
' Look for the MSVidEncoder feature
If (feature.ClassID = ENC_CLSID) Then
MyFeatures.Add feature
End If
' Optionally, add other features (not shown).
Next
' Use this as the active features collection.
MSVidCtl_Sink.FeaturesActive = MyFeatures
'4. Enumerate the available output devices in the GUID_NULL category.
' Find the Stream Buffer Sink device and set it to be the active output device.
GUID_NULL = "{00000000-0000-0000-0000-000000000000}"
SINK_CLSID = "{9E77AAC4-35E5-42A1-BDC2-8F3FF399847C}"
' Create an empty output device collection.
'Set MyOutputs = CreateObject("MSVidCtl.MSVidOutputDevices")
Dim MyOutputs As New MSVidOutputDevices
' Enumerate the available output devices.
Dim objStreamBufferSink
For Each output In MSVidCtl_Sink.OutputsAvailable(GUID_NULL)
If output.ClassID = SINK_CLSID Then
' This is the one we want.
MyOutputs.Add output
Set objStreamBufferSink = output ' Store this for later use.
End If
Next
' Set the active outputs collection.
MSVidCtl_Sink.OutputsActive = MyOutputs
'5. Specify a file name for the output device.
strFilename = "C:\Example.wmv"
objStreamBufferSink.SinkName = strFilename
'6. Disable video and audio rendering.
MSVidCtl_Sink.DisableVideo
MSVidCtl_Sink.DisableAudio
'7. Run the Video Control.
MSVidCtl_Sink.Run
'Using the second instance of the Video Control:
'1. Enumerate the available input devices in the GUID_NULL category.
' Set the Stream Buffer Source device as the active input device.
DVR_CLSID = "{AD8E510D-217F-409B-8076-29C5E73B98E8}"
Dim objStreamBufferSource
' Enumerate the available inputs
For Each objinput In MSVidCtl_Src.InputsAvailable(GUID_NULL)
If objinput.ClassID = DVR_CLSID Then
' This is the one we want.
MSVidCtl_Src.InputActive = objinput
Set objStreamBufferSource = objinput ' Store this for later use.
End If
Next
'2. Specify the same file name used previously in step 5 of the first instance of the Video Control.
objStreamBufferSource.FileName = strFilename
'3. Run the Video Control.
MSVidCtl_Src.Run
when i run it i get an error that the msvidctl_src is not initialised at the very end of loading this code