/// <summary>Adds a span to the collection.</summary> /// <param name="span">The span to be added.</param> /// <returns>The index of the added span.</returns> public int Add(VideoSpan span) { if (span == null) { throw new ArgumentNullException("span"); } return(base.InnerList.Add(span)); }
/// <summary>Removes a span from the collection.</summary> /// <param name="span">The span to be removed.</param> public void Remove(VideoSpan span) { base.InnerList.Remove(span); }
/// <summary>Inserts a span into the collection at the specified index.</summary> /// <param name="index">The index at which to insert the span.</param> /// <param name="span">The span to be inserted.</param> public void Insert(int index, VideoSpan span) { base.InnerList.Insert(index, span); }
/// <summary>Copies the collection of spans to the specified array.</summary> /// <param name="spans">The target array.</param> /// <param name="arrayIndex">The starting index to which items should be copied.</param> public void CopyTo(VideoSpan [] spans, int arrayIndex) { base.InnerList.CopyTo(spans, arrayIndex); }
/// <summary>Adds a span to the collection.</summary> /// <param name="span">The span to be added.</param> /// <returns>The index of the added span.</returns> public int Add(VideoSpan span) { if (span == null) throw new ArgumentNullException("span"); return base.InnerList.Add(span); }
/// <summary>Inserts a span into the collection at the specified index.</summary> /// <param name="index">The index at which to insert the span.</param> /// <param name="span">The span to be inserted.</param> public void Insert(int index, VideoSpan span) { base.InnerList.Insert(index, span); }
/// <summary>Removes a span from the collection.</summary> /// <param name="span">The span to be removed.</param> public void Remove(VideoSpan span) { base.InnerList.Remove(span); }
/// <summary>Splices together all of the spans.</summary> /// <returns></returns> protected override object DoWork() { IStreamBufferRecComp recComp = null; Timer timer = null; try { // Timer used for updating progress timer = new Timer(new TimerCallback(HandleProgressUpdate), null, PollFrequency, PollFrequency); // Create the RecComp and initialize it recComp = (IStreamBufferRecComp)ClassId.CoCreateInstance(ClassId.RecComp); if (File.Exists(_target.FullName)) { File.Delete(_target.FullName); } recComp.Initialize(_target.FullName, _spans[0].File.FullName); _recComp = recComp; // only valid during this call // Add each span to the output file FileInfo dvrTarget = _target; for (int i = 0; i < _spans.Count; i++) { // If the user has requested cancellation, stop processing if (CancellationPending) { break; } // Do the append VideoSpan span = _spans[i]; ulong start = VideoSpan.SecondsToHundredNanoseconds(span.StartPosition); ulong stop = VideoSpan.SecondsToHundredNanoseconds(span.StopPosition); recComp.AppendEx(span.File.FullName, start, stop); } } finally { // Clean up after the RecComp object and the timer if (timer != null) { timer.Dispose(); } if (recComp != null) { recComp.Close(); } while (Marshal.ReleaseComObject(recComp) > 0) { ; } } // Copy the metadata if requested... use that from the first span. if (_copyMetadata) { using (MetadataEditor sourceEditor = new DvrmsMetadataEditor(_spans[0].File.FullName)) { using (MetadataEditor destEditor = new AsfMetadataEditor(_target.FullName)) { MetadataEditor.MigrateMetadata(sourceEditor, destEditor); } } } // Notify that we're done OnProgressChanged(100); return(null); }