Ejemplo n.º 1
0
        /// <summary>
        /// Loads a video segment defined by a <see cref="TimelineEvent"/> in the player.
        /// </summary>
        /// <param name="fileSet">File set.</param>
        /// <param name="start">Start time.</param>
        /// <param name="stop">Stop time.</param>
        /// <param name="seekTime">Position to seek after loading the segment.</param>
        /// <param name="rate">Playback rate.</param>
        /// <param name="camerasConfig">Cameras configuration.</param>
        /// <param name="camerasLayout">Cameras layout.</param>
        /// <param name="playing">If set to <c>true</c> starts playing.</param>
        void LoadSegment(MediaFileSet fileSet, Time start, Time stop, Time seekTime,
                         float rate, List <CameraConfig> camerasConfig, object camerasLayout,
                         bool playing)
        {
            Log.Debug(String.Format("Update player segment {0} {1} {2}",
                                    start, stop, rate));

            if (!SegmentLoaded)
            {
                defaultCamerasConfig = CamerasConfig;
                defaultCamerasLayout = CamerasLayout;
            }

            UpdateCamerasConfig(camerasConfig, camerasLayout);

            if (fileSet != this.FileSet)
            {
                InternalOpen(fileSet, false);
            }
            else
            {
                ApplyCamerasConfig();
            }

            Pause();
            loadedSegment.Start = start;
            loadedSegment.Stop  = stop;
            StillImageLoaded    = false;
            if (readyToSeek)
            {
                Log.Debug("Player is ready to seek, seeking to " +
                          seekTime.ToMSecondsString());
                SetRate(rate);
                Seek(seekTime, true);
                if (playing)
                {
                    Play();
                }
            }
            else
            {
                Log.Debug("Delaying seek until player is ready");
                pendingSeek = new PendingSeek {
                    time     = seekTime,
                    rate     = 1.0f,
                    playing  = playing,
                    accurate = true,
                };
            }
        }
Ejemplo n.º 2
0
 void HandleReadyToSeek(object sender)
 {
     Config.GUIToolkit.Invoke(delegate {
         readyToSeek  = true;
         streamLength = player.StreamLength;
         if (pendingSeek != null)
         {
             SetRate(pendingSeek.rate);
             player.Seek(pendingSeek.time, pendingSeek.accurate, pendingSeek.syncrhonous);
             if (pendingSeek.playing)
             {
                 Play();
             }
             pendingSeek = null;
         }
         Tick();
         player.Expose();
     });
 }
Ejemplo n.º 3
0
 public bool Seek(Time time, bool accurate, bool synchronous = false, bool throtlled = false)
 {
     if (StillImageLoaded)
     {
         imageLoadedTS = time;
     }
     else
     {
         EmitLoadDrawings(null);
         if (readyToSeek)
         {
             if (throtlled)
             {
                 Log.Debug("Throttled seek");
                 seeker.Seek(accurate ? SeekType.Accurate : SeekType.Keyframe, time);
             }
             else
             {
                 Log.Debug(string.Format("Seeking to {0} accurate:{1} synchronous:{2} throttled:{3}",
                                         time, accurate, synchronous, throtlled));
                 player.Seek(time, accurate, synchronous);
                 Tick();
             }
         }
         else
         {
             Log.Debug("Delaying seek until player is ready");
             pendingSeek = new PendingSeek {
                 time        = time,
                 rate        = 1.0f,
                 accurate    = accurate,
                 syncrhonous = synchronous,
                 throttled   = throtlled
             };
         }
     }
     return(true);
 }