public override PopTimeline.StreamDataItem GetNearestOrNextStreamData(PopTimeline.DataStreamMeta _StreamMeta, ref PopTimeline.TimeUnit Time)
    {
        var StreamMeta  = (VideoStreamMeta)_StreamMeta;
        var BlockStream = VideoStreams[StreamMeta.StreamIndex];
        var NextData    = BlockStream.GetNearestStreamDataGreaterThanEqual(Time);
        var Next        = NextData.Value;

        Time = Next.GetStartTime();
        return(Next);
    }
    public override PopTimeline.StreamDataItem GetNearestOrPrevStreamData(PopTimeline.DataStreamMeta _StreamMeta, ref PopTimeline.TimeUnit Time)
    {
        var StreamMeta  = (VideoStreamMeta)_StreamMeta;
        var BlockStream = VideoStreams[StreamMeta.StreamIndex];
        var PrevData    = BlockStream.GetNearestStreamDataLessThanEqual(Time);
        var Prev        = PrevData.Value;

        Time = Prev.GetStartTime();
        return(Prev);
    }
    public override List <PopTimeline.StreamDataItem> GetStreamData(PopTimeline.DataStreamMeta _StreamMeta, PopTimeline.TimeUnit MinTime, PopTimeline.TimeUnit MaxTime)
    {
        var StreamMeta  = (VideoStreamMeta)_StreamMeta;
        var BlockStream = VideoStreams[StreamMeta.StreamIndex];
        var Data        = new List <PopTimeline.StreamDataItem>();
        var Blocks      = BlockStream.Blocks;

        if (Blocks.Count == 0)
        {
            return(Data);
        }

        //	find start with binary chop.
        //	find TAIL and work backwards as nearestprev will be last time, but if we do min we can start out of range
        System.Func <int, VideoPacket> GetAt = (Index) =>
        {
            return(Blocks[Index]);
        };
        System.Func <VideoPacket, BinaryChop.CompareDirection> Compare = (OtherBlock) =>
        {
            return(OtherBlock.GetTimeDirection(MaxTime));
        };
        int?MaxMatch;
        int?MaxNearestPrev;

        BinaryChop.Search(0, Blocks.Count - 1, GetAt, Compare, out MaxNearestPrev, out MaxMatch);
        int Last = MaxNearestPrev.Value;

        //	go earlier
        for (int b = Last; b >= 0; b--)
        {
            var Block      = Blocks[b];
            var CompareDir = Block.GetTimeDirection(MinTime);
            //	if min time is AFTER block, block is before min
            if (CompareDir == BinaryChop.CompareDirection.After)
            {
                break;
            }
            Data.Insert(0, Block);
        }

        return(Data);
    }
Esempio n. 4
0
 public StreamAndTime(DataStreamMeta Stream, TimeUnit Time)
 {
     this.Stream = Stream;
     this.Time   = Time;
 }
Esempio n. 5
0
 public abstract StreamDataItem                  GetNearestOrNextStreamData(DataStreamMeta StreamMeta, ref TimeUnit Time);
Esempio n. 6
0
 public abstract List <StreamDataItem> GetStreamData(DataStreamMeta StreamMeta, TimeUnit MinTime, TimeUnit MaxTime);