示例#1
0
        public override PlaybillItem Merge(PlaybillItem nextItem)
        {
            if (!CanMerge(nextItem))
            {
                throw new InvalidOperationException();
            }

            // Note: 是否在自动垫片上操作?

            PlaySource mergedSource = ((PlaySourceSegment)this.PlaySource).Merge(nextItem.PlaySource);

            return(CreateInternal(mergedSource));
        }
示例#2
0
            internal PlaySource Merge(PlaySource nextSource)
            {
                if (!CanMerge(nextSource))
                {
                    throw new InvalidOperationException();
                }

                PlayRange range = this.MediaSource.Merge(this.PlayRange, ((PlaySourceSegment)nextSource).PlayRange);

                range = this.PlaySource.Adjust(range); // 确保范围不超出this.PlaySource.PlayRange

                return(Create(this.PlaySource, range));
            }
示例#3
0
        private static AutoPlaybillItem CreateInternal(PlaySource playSource)
        {
            var segment = playSource as PlaySourceSegment;

            if (segment != null)
            {
                return(new AutoPlaybillItem(segment));
            }
            else
            {
                return(new AutoPlaybillItem((NormalPlaySource)playSource));
            }
        }
示例#4
0
        // 设为internal来阻止外部派生。
        internal PlaybillItem(PlaySource playSource, ScheduleMode scheduleMode)
        {
            if (playSource == null)
            {
                throw new ArgumentNullException("playSource");
            }

            if (!Enum.IsDefined(typeof(ScheduleMode), scheduleMode))
            {
                throw new System.ComponentModel.InvalidEnumArgumentException("scheduleMode", (int)scheduleMode, typeof(ScheduleMode));
            }
            this.PlaySource   = playSource;
            this.ScheduleMode = scheduleMode;
        }
示例#5
0
        internal static void Break(this PlaySource playSource, TimeSpan duration, out PlayRange first, out PlayRange second)
        {
            if (duration <= TimeSpan.Zero)
            {
                throw new ArgumentOutOfRangeException("duration",
                                                      string.Format("<{0}>无效,必须大于TimeSpan.Zero。", duration));
            }
            if (duration >= playSource.PlayRange.Duration)
            {
                throw new ArgumentOutOfRangeException("duration",
                                                      string.Format("<{0}>无效,必须小于{1}。", duration, playSource.PlayRange.Duration));
            }

            PlayRange.Break(playSource.PlayRange, duration, out first, out second);

            first  = playSource.Adjust(first);
            second = playSource.Adjust(second);
        }
示例#6
0
            internal bool CanMerge(PlaySource nextSource)
            {
                var nextSegment = nextSource as PlaySourceSegment;

                if (nextSegment == null)
                {
                    return(false);
                }

                Debug.Assert(nextSegment != this);

                if (nextSegment.PlaySource != nextSegment.PlaySource)
                {
                    return(false);
                }

                return(this.MediaSource.CanMerge(this.PlayRange, nextSegment.PlayRange));
            }
示例#7
0
        internal static PlaybillItem CreateAutoPadding(TimeSpan duration)
        {
            PlaySource source = FCSPlayout.NormalPlaySource.CreateAutoPadding(duration);

            return(CreateAuto(source));
        }