public int AudioSubChannel { get; } Public ReadOnly Property AudioSubChannel As Integer public:property int AudioSubChannel {int get();}
A TunerSubChannel enumeration value if default or not tuned; otherwise the current audio subchannel. For a list of frequencies for channels, refer to the Microsoft documentation on International Analog TV Tuning.
Gets the currently set audio subchannel. This property is valid only for ATSC digital TV broadcasts.
using Leadtools;using Leadtools.MediaFoundation;using LeadtoolsMediaFoundationExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public void DigitalTVTunerExample(){// reference the forms capture control and tv tunerCaptureCtrl capturectrl = _form.CaptureCtrl;string outFile = Path.Combine(LEAD_VARS.MediaDir, "TVTuner_DigitalTVTunerExample.wmv");int mainChannel = 27;int subChannel = -1;int newSubChannel = -1;int[] subChannelList = null;try{capturectrl.Preview = true;// select the first digital tuner device with BDA in it's name// Replace "BDA" with your video capture device nameif (capturectrl.VideoDevices["BDA"] != null)capturectrl.VideoDevices["BDA"].Selected = true;// get the TV Tuner deviceTVTuner tvTuner = capturectrl.TVTuner;// Check if TV tuner is validif (tvTuner != null){// set the input type to cable and set the channeltvTuner.SetInputType(0, TunerInputType.Antenna);tvTuner.SetChannel(mainChannel, -1, -1);// get the current video sub channelsubChannel = tvTuner.VideoSubChannel;// list the sub-channels for the main channle firstif (tvTuner.VideoSubChannelCount > 0){System.Diagnostics.Debug.WriteLine(" Main Channel: " + mainChannel);subChannelList = new int[tvTuner.VideoSubChannelCount];for (int i = 0; i < tvTuner.VideoSubChannelCount; i++){subChannelList[i] = tvTuner.VideoSubChannelValue(i);System.Diagnostics.Debug.WriteLine(" Sub Channel: " + subChannelList[i]);}}// select the first sub-channel in the listif (subChannelList != null && subChannelList.Length > 0){tvTuner.SetChannel(mainChannel, subChannelList[0], -1);mainChannel = tvTuner.Channel;newSubChannel = tvTuner.VideoSubChannel;System.Diagnostics.Debug.WriteLine("Selected Channel: " + mainChannel + "." + subChannel);}// if the Main and Sub channel value are postive,// it means tv tuner is happay and dandy, let starts captureif (mainChannel > 0 && subChannel > 0){System.Diagnostics.Debug.WriteLine("Start Capturing");capturectrl.TimeLimit = 30; // just 30 seconds of capture timecapturectrl.UseTimeLimit = true;capturectrl.TargetFormat = TargetFormatType.WMV;capturectrl.TargetFile = outFile;capturectrl.StartCapture(CaptureMode.VideoAndAudio);}}// we'll loop on the state and pump messages for this example.// but you should not need to if running from a Windows Forms application.while (capturectrl.State == CaptureState.Running)Application.DoEvents();System.Diagnostics.Debug.WriteLine("Finish Capturing");// if TV tuner is validif (tvTuner != null){// and set the result to what we expect_result = (subChannel != newSubChannel);}}catch (Exception ex){_result = false;System.Diagnostics.Debug.WriteLine(ex);}}static class LEAD_VARS{public const string MediaDir = @"C:\LEADTOOLS21\Media";}
Imports LeadtoolsImports Leadtools.MediaFoundationImports LeadtoolsMediaFoundationExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public Sub DigitalTVTunerExample()' reference the forms capture control and tv tunerDim capturectrl As CaptureCtrl = _form.CaptureCtrlDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "TVTuner_DigitalTVTunerExample.wmv")Dim mainChannel As Integer = 27Dim subChannel As Integer = -1Dim newSubChannel As Integer = -1Dim subChannelList As Integer() = NothingTrycapturectrl.Preview = True' select the first digital tuner device with BDA in it's name' Replace "BDA" with your video capture device nameIf Not capturectrl.VideoDevices("BDA") Is Nothing Thencapturectrl.VideoDevices("BDA").Selected = TrueEnd If' get the TV Tuner deviceDim tvTuner As TVTuner = capturectrl.TVTuner' Check if TV tuner is validIf Not tvTuner Is Nothing Then' set the input type to cable and set the channeltvTuner.SetInputType(0, TunerInputType.Antenna)tvTuner.SetChannel(mainChannel, -1, -1)' get the current video sub channelsubChannel = tvTuner.VideoSubChannel' list the sub-channels for the main channle firstIf tvTuner.VideoSubChannelCount > 0 ThenSystem.Diagnostics.Debug.WriteLine(" Main Channel: " & mainChannel)subChannelList = New Integer(tvTuner.VideoSubChannelCount - 1) {}Dim i As Integer = 0Do While i < tvTuner.VideoSubChannelCountsubChannelList(i) = tvTuner.VideoSubChannelValue(i)System.Diagnostics.Debug.WriteLine(" Sub Channel: " & subChannelList(i))i += 1LoopEnd If' select the first sub-channel in the listIf Not subChannelList Is Nothing AndAlso subChannelList.Length > 0 ThentvTuner.SetChannel(mainChannel, subChannelList(0), -1)mainChannel = tvTuner.ChannelnewSubChannel = tvTuner.VideoSubChannelSystem.Diagnostics.Debug.WriteLine("Selected Channel: " & mainChannel & "." & subChannel)End If' if the Main and Sub channel value are postive, it means tv tuner is happay and dandy, let starts captureIf mainChannel > 0 AndAlso subChannel > 0 ThenSystem.Diagnostics.Debug.WriteLine("Start Capturing")capturectrl.TimeLimit = 30 ' just 30 seconds of capture timecapturectrl.UseTimeLimit = Truecapturectrl.TargetFormat = TargetFormatType.WMVcapturectrl.TargetFile = outFilecapturectrl.StartCapture(CaptureMode.VideoAndAudio)End IfEnd If' we'll loop on the state and pump messages for this example.' but you should not need to if running from a Windows Forms application.Do While capturectrl.State = CaptureState.RunningApplication.DoEvents()LoopSystem.Diagnostics.Debug.WriteLine("Finish Capturing")' if TV tuner is validIf Not tvTuner Is Nothing Then' and set the result to what we expect_result = (subChannel <> newSubChannel)End IfCatch ex As Exception_result = FalseSystem.Diagnostics.Debug.WriteLine(ex)End TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\LEADTOOLS21\Media"End Class
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document
