bool SeekToTrack(Element playbin, int track) { Format format = Format.Undefined; Element cdda_src = null; State state, pending; format = Util.FormatGetByNick ("track"); if (format == Format.Undefined) { return false; } playbin.GetState (out state, out pending, 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; }
public void GoToPreviousChapter(Element playbin) { long index; Format format = Util.FormatGetByNick ("chapter"); playbin.QueryPosition (format, out index); playbin.Seek (1.0, format, SeekFlags.Flush, SeekType.Set, index - 1, SeekType.None, 0L); }