Gets or sets a value that determines whether the toolkit is currently caching filters.
public bool UseFilterCache {get; set;} Public Property UseFilterCache As Boolean true to enable caching filters; otherwise, it is false to disable caching filters. The default value is false.
Setting this property to true will enable caching for the current target format object. The target format object is the format that will be used for the converted file. This includes the file format, any special settings used by the format, which audio/video codec is used for the conversion and any special settings used by the codec. Additionally, setting this property to true will force the toolkit to preload and reuse the filters specified for the particular format. If an object isn't currently created, one will be created. Setting the value of this property to false will disable the caching for the current target format object. If an object currently exists, it will destroy it.
Use the TargetFormat.GetCacheObject method to retrieve the caching filter object. Use the TargetFormat.ShowCacheDialog method to display a specific property dialog for the caching filter.
Use the TargetFormat.HasCacheDialog method to query whether the specified property dialog for the caching filter is available.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public LMMpg2MxTLib.LMMpg2MxT _pMpgMux;// This example will show you the correct way to set up a muxer's properties during capture// Normally, the muxer is added only after the capture graph has been build with ReadyCapture or StartCapture// But at this point, the graph is in running mode, so some muxer operations might fail// If you need to make changes to the muxer in stopped state (like adding KLV data stream, for example),// then you need to change the muxer before the graph is fully built. You can do so by instructing the toolkit// to cache the target filters by setting the the TargetFormat.UseFilterCache property to true// In this situation, the filters used to implement a certain target format are created and used whenever// you set that target format.//// This example will show you how to add KLV data to a MPEG-2 Transport Stream in a capture situation.public void UseFilterCacheExample(){// reference the capture controlCaptureCtrl capturectrl = _form.CaptureCtrl;string outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureKLV.mpg");try{// select the capture devicecapturectrl.VideoDevices.Selection = 0; /* Use a different video device if you want *//* capturectrl.Preview = true; -- enable this if you want *//* set the video compressor (only if the capture device is not already capturing compressed video) */capturectrl.VideoCompressors.Mpeg2.Selected = true;// set the target output filecapturectrl.TargetFile = outFile;// subscribe to the started eventcapturectrl.Started += new System.EventHandler(this.CaptureCtrl_Started);// just 10 seconds of capture timecapturectrl.TimeLimit = 10;capturectrl.UseTimeLimit = true;// subscribe to the complete eventcapturectrl.Complete += new EventHandler(CaptureCtrl_Complete);// IN a capture situation//in order to get the mux in a capture situation, set the UseFilterCache property for the target format to TRUE// This tells the toolkit to create a Mux object and keep it around when building or rebuilding graphscapturectrl.TargetFormats[Leadtools.Multimedia.TargetFormatType.MPEG2Transport].UseFilterCache = true;capturectrl.TargetFormat = Leadtools.Multimedia.TargetFormatType.MPEG2Transport;_pMpgMux = (LMMpg2MxTLib.LMMpg2MxT)capturectrl.TargetFormats[Leadtools.Multimedia.TargetFormatType.MPEG2Transport].GetCacheObject(TargetFormatObject.Mux);if (_pMpgMux != null){_pMpgMux.PrivateDataPID = 0x70;_pMpgMux.PrivateDataFormatID = 0x41564c4b;_pMpgMux.EnablePrivateData = true;}// start capturecapturectrl.StartCapture(Leadtools.Multimedia.CaptureMode.Video);_result = true;}catch (Exception){_result = false;}}private void WriteKLVData(LMMpg2MxTLib.LMMpg2MxT pMpgMux){// get the current time since Jan 1, 1970TimeSpan basetime = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0);// get the number of microseconds since Jan 1, 1970Int64 timestamp = (Int64)basetime.TotalSeconds * 1000000;// do not really need to do this, since I am writing only one itempMpgMux.KlvBuilder.Clear();// write the UDS timestamp (number of microseconds since Jan 1, 1970)pMpgMux.KlvBuilder.InsertUInt64(-1, "06 0E 2B 34 01 01 01 03 07 02 01 01 01 05 00 00", (ulong)timestamp);// write one KLV data at the beginningpMpgMux.WritePrivateData((int)LMMpg2MxTLib.Mpg2MxT_WriteFlags.Mpg2MxT_WriteFlag_PTSValid |(int)LMMpg2MxTLib.Mpg2MxT_WriteFlags.Mpg2MxT_WriteFlag_PTSInSeconds,0.0, pMpgMux.KlvBuilder.GetData(),-1);// close the streampMpgMux.ClosePrivateData();}private void CaptureCtrl_Started(object sender, EventArgs e){WriteKLVData(_pMpgMux);}private void CaptureCtrl_Complete(object sender, EventArgs e){// set result_result = true;}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public _pMpgMux As LMMpg2MxTLib.LMMpg2MxT' This example will show you the correct way to set up a muxer's properties during capture' Normally, the muxer is added only after the capture graph has been build with ReadyCapture or StartCapture' But at this point, the graph is in running mode, so some muxer operations might fail' If you need to make changes to the muxer in stopped state (like adding KLV data stream, for example),' then you need to change the muxer before the graph is fully built. You can do so by instructing the toolkit' to cache the target filters by setting the the TargetFormat.UseFilterCache property to true' In this situation, the filters used to implement a certain target format are created and used whenever' you set that target format.' This example will show you how to add KLV data to a MPEG-2 Transport Stream in a capture situation.Public Sub UseFilterCacheExample()' reference the capture controlDim capturectrl As CaptureCtrl = _form.CaptureCtrlDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureKLV.mpg")Try' select the capture devicecapturectrl.VideoDevices.Selection = 0 ' Use a different video device if you want' capturectrl.Preview = true; -- enable this if you want' set the video compressor (only if the capture device is not already capturing compressed video)capturectrl.VideoCompressors.Mpeg2.Selected = True' set the target output filecapturectrl.TargetFile = outFile' subscribe to the compete eventAddHandler capturectrl.Started, AddressOf CaptureCtrl_Started' just 10 seconds of capture timecapturectrl.TimeLimit = 10capturectrl.UseTimeLimit = True' subscribe to the compete eventAddHandler capturectrl.Complete, AddressOf CaptureCtrl_Complete' IN a capture situation'in order to get the mux in a capture situation, set the UseFilterCache property for the target format to TRUE' This tells the toolkit to create a Mux object and keep it around when building or rebuilding graphscapturectrl.TargetFormats(Leadtools.Multimedia.TargetFormatType.MPEG2Transport).UseFilterCache = Truecapturectrl.TargetFormat = Leadtools.Multimedia.TargetFormatType.MPEG2Transport_pMpgMux = DirectCast(capturectrl.TargetFormats(Leadtools.Multimedia.TargetFormatType.MPEG2Transport).GetCacheObject(TargetFormatObject.Mux), LMMpg2MxTLib.LMMpg2MxT)If _pMpgMux IsNot Nothing Then_pMpgMux.PrivateDataPID = &H70_pMpgMux.PrivateDataFormatID = &H41564C4B_pMpgMux.EnablePrivateData = TrueEnd If' start capturecapturectrl.StartCapture(Leadtools.Multimedia.CaptureMode.Video)_result = TrueCatch generatedExceptionName As Exception_result = FalseEnd TryEnd SubPrivate Sub WriteKLVData(ByVal pMpgMux As LMMpg2MxTLib.LMMpg2MxT)' get the current time since Jan 1, 1970Dim basetime As TimeSpan = DateTime.UtcNow - New DateTime(1970, 1, 1, 0, 0, 0)' get the number of microseconds since Jan 1, 1970Dim timestamp As Int64 = CLng(basetime.TotalSeconds) * 1000000' don't really need to do this, since I am writing only one itempMpgMux.KlvBuilder.Clear()' write the UDS timestamp (number of microseconds since Jan 1, 1970)pMpgMux.KlvBuilder.InsertUInt64(-1, "06 0E 2B 34 01 01 01 03 07 02 01 01 01 05 00 00", CULng(timestamp))' write one KLV data at the beginningpMpgMux.WritePrivateData(CInt(LMMpg2MxTLib.Mpg2MxT_WriteFlags.Mpg2MxT_WriteFlag_PTSValid) _Or CInt(LMMpg2MxTLib.Mpg2MxT_WriteFlags.Mpg2MxT_WriteFlag_PTSInSeconds),0.0, pMpgMux.KlvBuilder.GetData(), -1)' close the streampMpgMux.ClosePrivateData()End SubPublic Sub CaptureCtrl_Started(ByVal sender As Object, ByVal e As EventArgs)WriteKLVData(_pMpgMux)End SubPublic Sub CaptureCtrl_Complete(ByVal sender As Object, ByVal e As EventArgs)' set result_result = TrueEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
|
Products |
Support |
Feedback: UseFilterCache Property - Leadtools.Multimedia |
Introduction |
Help Version 19.0.2017.6.16
|

Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.