/// <summary>Initializes the splicer.</summary>
        /// <param name="target">The output file.</param>
        /// <param name="spans">The collection of spans to be spliced together.</param>
        /// <param name="copyMetadata">Whether to copy metadata from a source span's file to the output file.</param>
        public DvrmsSplicer(FileInfo target, VideoSpanCollection spans, bool copyMetadata)
            : base(null, target.FullName)
        {
            if (target == null) throw new ArgumentNullException("target");
            if (spans == null) throw new ArgumentNullException("spans");
            if (spans.Count == 0) throw new ArgumentOutOfRangeException("spans");

            if (target.Exists) target.Delete();

            _target = target;
            _spans = spans;
            _copyMetadata = copyMetadata;

            // Compute the length of the output file
            double length = 0;
            foreach(VideoSpan span in spans)
            {
                length += (span.StopPosition - span.StartPosition);
            }
            if (length <= 0) throw new ArgumentOutOfRangeException("spans");
            _length = length;
        }
Example #2
0
        /// <summary>Initializes the splicer.</summary>
        /// <param name="target">The output file.</param>
        /// <param name="spans">The collection of spans to be spliced together.</param>
        /// <param name="copyMetadata">Whether to copy metadata from a source span's file to the output file.</param>
        public DvrmsSplicer(FileInfo target, VideoSpanCollection spans, bool copyMetadata) : base(null, target.FullName)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }
            if (spans == null)
            {
                throw new ArgumentNullException("spans");
            }
            if (spans.Count == 0)
            {
                throw new ArgumentOutOfRangeException("spans");
            }

            if (target.Exists)
            {
                target.Delete();
            }

            _target       = target;
            _spans        = spans;
            _copyMetadata = copyMetadata;

            // Compute the length of the output file
            double length = 0;

            foreach (VideoSpan span in spans)
            {
                length += (span.StopPosition - span.StartPosition);
            }
            if (length <= 0)
            {
                throw new ArgumentOutOfRangeException("spans");
            }
            _length = length;
        }