Example #1
0
 public void GoToPreviousChapter (PlayBin2 playbin)
 {
     long index;
     Format format = Util.FormatGetByNick ("chapter");
     playbin.QueryPosition (ref format, out index);
     playbin.Seek (1.0, format, SeekFlags.Flush, SeekType.Set, index - 1, SeekType.None, 0l);
 }
Example #2
0
        bool SeekToTrack (PlayBin2 playbin, int track)
        {
            Format format = Format.Undefined;
            CddaBaseSrc cdda_src = null;
            State state;

            format = Util.FormatGetByNick ("track");
            if (format == Format.Undefined) {
                return false;
            }

            playbin.GetState (out state, 0);
            if (state < State.Paused) {
                // We can only seek if the pipeline is playing or paused, otherwise
                // we just allow playbin to do its thing, which will re-start the
                // device and start at the desired track
                return false;
            }

            cdda_src = GetCddaSource (playbin);
            if (cdda_src == null) {
                return false;
            }

            if (playbin.Seek (1.0, format, SeekFlags.Flush,
                SeekType.Set, track - 1, SeekType.None, -1)) {
                Log.DebugFormat ("cdda: seeking to track {0}, avoiding playbin", track);
                return true;
            }

            return false;
        }