PHP:/**************************************************************************** While the underlying libraries are covered by LGPL, this sample is released as public domain. It is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *****************************************************************************/ using System; using System.Runtime.InteropServices; //*****ADDED THE FOLLOWING LINE***** using System.Threading; using DirectShowLib.SBE; namespace DirectShowLib.Sample { public class SBECutter : IDisposable { // SBE provide an utility object for cutting SBE files IStreamBufferRecComp recComp; public SBECutter() { // Create this object recComp = (IStreamBufferRecComp) new StreamBufferComposeRecording(); } ~SBECutter() { Dispose(); } public void Dispose() { // Realease it if (recComp != null) Marshal.ReleaseComObject(recComp); GC.SuppressFinalize(this); } public void DoCut(string srcFile, string dstFile, int cnt, TimeSpan[] start, TimeSpan [] stop) { int hr = 0; // Initialize a destination file with the same profil as source file hr = recComp.Initialize(dstFile, srcFile); DsError.ThrowExceptionForHR(hr); // Copy source file into destination file int i = 0; while (i < cnt) { hr = recComp.AppendEx(srcFile, start[i].Ticks, stop[i].Ticks); DsError.ThrowExceptionForHR(hr); i++; //*****ADDED THE FOLLOWING LINE***** Thread.Sleep(500); //Prevents application from hanging when handling large files. } // Close destination file hr = recComp.Close(); DsError.ThrowExceptionForHR(hr); } } }
Nice!, thanks.
As I no longer have the CS development environment (I am a plain old C guy), can someone compile an updated DVRCut for me?