TV Tunner program

Xlobby plugin development

TV Tunner program

Postby jmitchel on Sun Jul 11, 2004 5:16 am

Hi i am trying to write my own tv tuner ap, but i am having some difivulty. I am using msvidctl.dll with VB 6.0

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
jmitchel
 
Posts: 3
Joined: Sun Jul 11, 2004 5:12 am

Postby jmitchel on Tue Jul 13, 2004 3:34 am

ok i updated my code slightly, now when i run it i get it to play the audio but no video, i still get the error too, but with ans on error resume next statement it gets through
Code: Select all
Dim objTuneSpace  As ITuningSpace
Dim objTuneRequest As IChannelTuneRequest
Dim objTSContainer As New SystemTuningSpaces
Dim objTuner
Dim strFilename
Dim recording As MSVidStreamBufferRecordingControl
Dim objTuningSpaces As ITuningSpaces
Dim objStreamBufferSource As New MSVidStreamBufferSource
Dim objStreamBufferSink As New MSVidStreamBufferSink

Private Sub Form_Load()
    Const AnalogRadioCLSID As String = "{8A674B4C-1F63-11d3-B64C-00C04F79498E}"
    Const AnalogTVCLSID As String = "{8A674B4D-1F63-11D3-B64C-00C04F79498E}"
    Const AtscCLSID As String = "{A2E30750-6C3D-11D3-B653-00C04F79498E}"
    Const DvbcLSID As String = "{C6B14B32-76AA-4A86-A7AC-5C79AAF58DA7}"
    Const DVBSCLSID As String = "{B64016F3-C9A2-4066-96F0-BD9563314726}"
   
    Set objTuningSpaces = objTSContainer.TuningSpacesForCLSID(AnalogTVCLSID)
    Set objtuningspace = objTuningSpaces.Item(1)
    Set objTuneRequest = objtuningspace.CreateTuneRequest
    objTuneRequest.Channel = 11
    chanNum.Caption = objTuneRequest.Channel
    TvBuffer.View objTuneRequest

    Set MyFeatures = CreateObject("MSVidCtl.MSVidFeatures")
    For Each feature In TvBuffer.FeaturesAvailable
        If (InStr(feature.Name, "Encoder") <> 0) Then
            MyFeatures.Add feature
        End If
    Next
    TvBuffer.FeaturesActive = MyFeatures

    GUID_NULL = "{00000000-0000-0000-0000-000000000000}"
    SINK_CLSID = "{9E77AAC4-35E5-42A1-BDC2-8F3FF399847C}"
    Set MyOutputs = CreateObject("MSVidCtl.MSVidOutputDevices")
   
    For Each output In TvBuffer.OutputsAvailable(GUID_NULL)
        If output.ClassID = SINK_CLSID Then
            MyOutputs.Add output
            Set objStreamBufferSink = output
        End If
    Next
     
    strFilename = "c:\Example.mpg"
    objStreamBufferSink.SinkName = strFilename
    TvBuffer.OutputsActive = MyOutputs
   
    DVR_CLSID = "{AD8E510D-217F-409B-8076-29C5E73B98E8}"
    For Each inputs In tvVIDEO.InputsAvailable(GUID_NULL)
        If inputs.ClassID = DVR_CLSID Then
            Set objStreamBufferSource = inputs
        End If
    Next
    objStreamBufferSource.FileName = strFilename
    tvVIDEO.InputActive = objStreamBufferSource

    TvBuffer.DisableAudio
    TvBuffer.DisableVideo
   
    TvBuffer.Run
    objStreamBufferSink.NameSetLock

    On Error Resume Next
   
    tvVIDEO.Build
    tvVIDEO.Run
   

End Sub
jmitchel
 
Posts: 3
Joined: Sun Jul 11, 2004 5:12 am

Postby Arthur on Tue Jul 13, 2004 6:00 pm

I really can't help you. But I hop eyou'll worke it out.
Arthur
Arthur
 
Posts: 207
Joined: Thu Dec 25, 2003 8:52 am
Location: The Hague, The Netherlands

Postby jpoveda on Wed Dec 15, 2004 11:46 am

Hi jmitchel,

Did you found the problem?. I'm interested in doing a little program to reset my bt878 tunner or changing my tv viewer (DScaler).
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby jmitchel on Thu Dec 16, 2004 3:33 am

I changed to using Direct show instead. I will put the code up on a web site soon and post the site here for you. I changed cause the msvidctl has problems, windows has stoped development on it too
jmitchel
 
Posts: 3
Joined: Sun Jul 11, 2004 5:12 am

Postby lar282 on Thu Dec 16, 2004 6:51 am

I really recommend taking a look at the code in MP. MediaPortals tv module is GREAT and why not copy and paste alittle?

I know that code alittle so if u want help mail me

mailto:lasse10@telia.com


//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden

Postby jpoveda on Thu Dec 16, 2004 7:32 am

Hi Lasse,

Where is the code?. I tried MP and tv module desn't work for me (I have a Pinnacle PCTV Studio Pro) but we can try.
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby lar282 on Thu Dec 16, 2004 8:48 am

code is in the cvs

How large mail can u recieve?

I think that issue u had with MP is fixed in 0.1.0.2 and if not it is fixed in cvs.. U want cvs from me or do u wanna download yourself
Of course one must respect the gnu license.
//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden

Postby jpoveda on Thu Dec 16, 2004 12:23 pm

Hi Lasse,

I think I have 1.0.3 but it will be better if you could send me them by email (I have a 10 Mb restriction), so we will start with the same code. My email is mailto:poveda@esade.edu.

Thanks a lot.
jpoveda
 
Posts: 111
Joined: Mon May 17, 2004 6:45 am
Location: Spain

Postby lar282 on Wed Jan 05, 2005 11:11 pm

jmitchel wrote:I changed to using Direct show instead. I will put the code up on a web site soon and post the site here for you. I changed cause the msvidctl has problems, windows has stoped development on it too


Did u give up on the project or is it coming along?


//Lasse
lar282
 
Posts: 1624
Joined: Thu Apr 01, 2004 4:13 pm
Location: Helsingborg, Sweden