Jump to content

Control the TV tuner programmatically via WM messages?


Recommended Posts

Posted

Is it possible to control the TV tuner to which DVBViewer is connected (switching LCN channels, receiving information about the presence of a stream, etc.) programmatically via WM messages?

Posted

Assuming WM Messages means Windows Messages that can be sent with SendMessage or PostMessage to DVBViewer: Yes, there are such messages that can be used to control DVBViewer and let it perform certain actions. But maybe not to the exent that you want/need. Specifically, there are no messages that deal with LCN.

 

It would be easier to answer your question if you would explain in more detail what you want to do / acheive.

 

Posted

The Behold TV tuner has a way to control the tuner and receive data from it via WM messages (Windows Message).
That is, the user can send commands (messages) to the tuner and receive data about their parameters from it in response.

For example,
We are sending a request to the tuner about which channel the tuner is currently working on.
He sends us the channel number in response.

We send a message to the tuner - a command to switch to channel No. 2.
He switches to channel 2.

We send a request message to the tuner asking if there is a carrier frequency at the input of the tuner (sync pulses in the video signal).
In response, it sends the value 0 or 1 (True or False).

Here are examples of how this is done in the language VisualBasic.Net.
 

Imports System.Runtime.InteropServices    'For receiving messages via WM_


'====To work with the Behold TV tuner =================================
    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Public Shared Function FindWindow(<MarshalAs(UnmanagedType.LPTStr)> ByVal lpClassName As String, <MarshalAs(UnmanagedType.LPTStr)> ByVal lpWindowName As String) As IntPtr
    End Function

    <DllImport("user32.dll", CharSet:=CharSet.Auto)> _
    Public Shared Function SendMessageA(ByVal hBhWnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As UInteger) As Integer
    End Function

    <DllImport("User32.dll")> _
    Public Shared Function PostMessage(ByVal hBhWnd As IntPtr, ByVal msg As Int32, ByVal wParam As Int32, ByVal lParam As Int32) As Integer
    End Function

    Const WIN_CLASS As String = "TMain"
    Const APP_NAME As String = "BeholdTV" 'or "BeholdTV.Inst2" 'While writing the main Instance Behold, because APP_NAME cannot be changed, it is a constant.
    Private hBhWnd As IntPtr = FindWindow(WIN_CLASS, APP_NAME) 'Then when uploading the form here, instead of APP_NAME, we will enter the Instance from the list.
    Const WM_USER As Integer = &H400
    Const WM_BHCMD As Integer = WM_USER + 200
  '====To work with the Behold  TV tuner =================================
  
  
  hBhWnd = FindWindow(WIN_CLASS, "BeholdTV")    'We are defining an instance of the Behold  TV tuner.

'==== Examples of WM messages to the Behold  TV tuner ====================================
            Dim WMBH_GETCHNLN As Integer = WM_USER + 287    'Get the channel number    
            Dim ChnlNB As Integer = SendMessageA(hBhWnd, WM_BHCMD, WMBH_GETCHNLN, 0)    'Get the channel number

            Dim WMBH_CHNLN As Integer = WM_USER + 201    'Switch to channel with absolute sequence number 1....999
            Dim CHNLN As Integer = SendMessageA(hBhWnd, WM_BHCMD, WMBH_CHNLN, Channal_N)    'Switch to channel no. Channal_N.

            Dim WMBH_CHNLUP2 As Integer = WM_USER + 203    'Switch to the next channel
            Dim NextChnnl2 As Integer = SendMessageA(hBhWnd, WM_BHCMD, WMBH_CHNLUP2, 0)    'Switch to the next channel

            Dim WMBH_GETPLOCK As Integer = WM_USER + 286   'Get the status of a video signal
            Dim Fn As Integer = SendMessageA(hBhWnd, WM_BHCMD, WMBH_GETPLOCK, 0)
'==== Examples of WM messages to the Behold  TV tuner ====================================

My question.
If it is possible to control TV tuners via DVBViewer through such messages,
please provide examples of how to do the following.

1. Set the TV tuner to the frequency of 618 MHz digital DVB-T2 broadcasting.
2. Switch the TV tuner to LCN channel 2 of the first multiplex of terrestrial television broadcasting.
3. Switch the TV tuner to the next channel.
4. Display the image of the TV channel on the DVBViewer screen itself.
5. Display the image of the TV channel on the Control "Panel1" of the project form.
6. Get information from the tuner or DVBViewer about the presence of the carrier frequency of the current TV channel at the input of the tuner.
7. Get information from the tuner or DVBViewer about the availability of the current TV channel stream.
8. Get information from the tuner or DVBViewer about the availability of an image of the current TV channel.
9. Get information from the tuner or DVBViewer about the sound availability of the current TV channel.

It would be very nice if these examples were given in the language VisualBasic.Net .
If you give examples in the language VisualBasic.Net there is no way, they can be given in the Delphi language.

Thank you very much in advance!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...