/** * Skips forward until the first packet with a Sequence Number of equal or greater than that * specified. Call {@link #getNextPacket()} to retrieve this packet. This method advances across * all streams, but only searches the specified one. * * @param sid The ID of the stream who's packets we will search * @param sequenceNumber The sequence number we're looking for */ public void skipToSequenceNumber(int sid, int sequenceNumber) throws IOException { OggPacket p = null; while ((p = getNextPacket()) != null) { if (p.getSid() == sid && p.getSequenceNumber() >= sequenceNumber) { nextPacket = p; break; } } }
/** * Skips forward until the first packet with a Granule Position of equal or greater than that * specified. Call {@link #getNextPacket()} to retrieve this packet. This method advances across * all streams, but only searches the specified one. * * @param sid The ID of the stream who's packets we will search * @param granulePosition The granule position we're looking for */ public void skipToGranulePosition(int sid, long granulePosition) throws IOException { OggPacket p = null; while ((p = getNextPacket()) != null) { if (p.getSid() == sid && p.getGranulePosition() >= granulePosition) { nextPacket = p; break; } } }
/** * Returns the next packet with the given SID (Stream ID), or null if no more packets remain. Any * packets from other streams will be silently discarded. */ public OggPacket getNextPacketWithSid(int sid) throws IOException { OggPacket p = null; while ((p = getNextPacket()) != null) { if (p.getSid() == sid) { return p; } } return null; }