Exemplo n.º 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));
        }
Exemplo n.º 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));
            }
Exemplo n.º 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));
            }
        }
Exemplo n.º 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;
        }
Exemplo n.º 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);
        }
Exemplo n.º 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));
            }
Exemplo n.º 7
0
        internal static PlaybillItem CreateAutoPadding(TimeSpan duration)
        {
            PlaySource source = FCSPlayout.NormalPlaySource.CreateAutoPadding(duration);

            return(CreateAuto(source));
        }