Example #1
0
        static void FadeAudio(SourceReaderSample sample, double fadeout)
        {
            using (var buffer = sample.Sample.ConvertToContiguousBuffer())
            using (var data = buffer.Lock())
            {
                fadeout = Math.Min(1.0, fadeout);
                fadeout = Math.Max(0.0, fadeout);

                unsafe
                {
                    var pData = (short*)data.Buffer.ToPointer();

                    int length;
                    buffer.instance.GetMaxLength(out length);

                    for (int i = 0; i < length / 2; i++)
                        pData[i] = (short)((double)pData[i] * fadeout);
                }
            }
        }
        bool showClosingFlashCard( SourceReaderSample sample)
        {
            if (!leaderBoard.OverlayData.TimeForOutroOverlay.HasValue)
                return false;

            return sample.Timestamp >= leaderBoard.OverlayData.TimeForOutroOverlay.Value.FromSecondsToNano();
        }
 public SourceReaderSampleWithBitmap(SourceReaderSample sample, float width = 1920f, float height = 1080f)
     : base(sample.Reader, sample.Stream, sample.Flags, sample.Timestamp, sample.Duration, sample.Sample, sample.Count)
 {
     this.imageWidth = width;
     this.imageHeight = height;
 }
Example #4
0
        private void CheckForReposition(long offsetV, int readerIndex, SourceReaderSample sample, ref bool isContinue, ref bool isBreak)
        {
            if (reposReqeusted && sample.SampleTime + offsetV < startPosition)
            {
                var newPos = startPosition - offsetV;

                Trace.WriteLine(string.Format("File index: {0}, Reposition: {1}-{2} = {3}",
                    readerIndex,
                    startPosition.FromNanoToSeconds(),
                    offsetV.FromNanoToSeconds(),
                    (newPos).FromNanoToSeconds()
                    ));

                if (newPos > sample.Duration)
                {
                    //nextOffsetA = nextOffsetV = sample.Duration;
                    Trace.WriteLine(string.Format(
                        "File index: {0}, Skipping remainder of file. sampleDuration: {1}",
                        readerIndex, sample.Duration));
                    isBreak = true;
                }
                else
                {
                    sample.Reader.SetCurrentPosition(newPos);
                    reposReqeusted = false;
                    isContinue = true;
                }
            }
        }
Example #5
0
        private void ResequenceSample(long offsetV, long duration, SourceReaderSample sample)
        {
            if (sample.Stream.NativeMediaType.IsVideo)
                sample.Resequence(offsetV, duration, this);

            if (sample.Stream.NativeMediaType.IsAudio)
                sample.Resequence(offsetV, duration, this);
        }
Example #6
0
 private bool isEndOfStream(ref SourceReaderSample last, SourceReaderSample sample)
 {
     var endOfStream = sample.Flags.EndOfStream;
     if (endOfStream)
         last = sample;
     return endOfStream;
 }