Commit 288aa52d by olly Committed by Oliver Woodman

Clean up some Ogg comments & document granulePosition

PiperOrigin-RevId: 260947018
parent 80ab7474
...@@ -147,12 +147,12 @@ import java.io.IOException; ...@@ -147,12 +147,12 @@ import java.io.IOException;
* which it is sensible to just skip pages to the target granule and pre-roll instead of doing * which it is sensible to just skip pages to the target granule and pre-roll instead of doing
* another seek request. * another seek request.
* *
* @param targetGranule the target granule position to seek to. * @param targetGranule The target granule position to seek to.
* @param input the {@link ExtractorInput} to read from. * @param input The {@link ExtractorInput} to read from.
* @return the position to seek the {@link ExtractorInput} to for a next call or -(currentGranule * @return The position to seek the {@link ExtractorInput} to for a next call or -(currentGranule
* + 2) if it's close enough to skip to the target page. * + 2) if it's close enough to skip to the target page.
* @throws IOException thrown if reading from the input fails. * @throws IOException If reading from the input fails.
* @throws InterruptedException thrown if interrupted while reading from the input. * @throws InterruptedException If interrupted while reading from the input.
*/ */
@VisibleForTesting @VisibleForTesting
public long getNextSeekPosition(long targetGranule, ExtractorInput input) public long getNextSeekPosition(long targetGranule, ExtractorInput input)
...@@ -263,8 +263,8 @@ import java.io.IOException; ...@@ -263,8 +263,8 @@ import java.io.IOException;
* @param input The {@code ExtractorInput} to skip to the next page. * @param input The {@code ExtractorInput} to skip to the next page.
* @param limit The limit up to which the search should take place. * @param limit The limit up to which the search should take place.
* @return Whether the next page was found. * @return Whether the next page was found.
* @throws IOException thrown if peeking/reading from the input fails. * @throws IOException If peeking/reading from the input fails.
* @throws InterruptedException thrown if interrupted while peeking/reading from the input. * @throws InterruptedException If interrupted while peeking/reading from the input.
*/ */
@VisibleForTesting @VisibleForTesting
boolean skipToNextPage(ExtractorInput input, long limit) boolean skipToNextPage(ExtractorInput input, long limit)
...@@ -321,14 +321,14 @@ import java.io.IOException; ...@@ -321,14 +321,14 @@ import java.io.IOException;
* Skips to the position of the start of the page containing the {@code targetGranule} and returns * Skips to the position of the start of the page containing the {@code targetGranule} and returns
* the granule of the page previous to the target page. * the granule of the page previous to the target page.
* *
* @param input the {@link ExtractorInput} to read from. * @param input The {@link ExtractorInput} to read from.
* @param targetGranule the target granule. * @param targetGranule The target granule.
* @param currentGranule the current granule or -1 if it's unknown. * @param currentGranule The current granule or -1 if it's unknown.
* @return the granule of the prior page or the {@code currentGranule} if there isn't a prior * @return The granule of the prior page or the {@code currentGranule} if there isn't a prior
* page. * page.
* @throws ParserException thrown if populating the page header fails. * @throws ParserException If populating the page header fails.
* @throws IOException thrown if reading from the input fails. * @throws IOException If reading from the input fails.
* @throws InterruptedException thrown if interrupted while reading from the input. * @throws InterruptedException If interrupted while reading from the input.
*/ */
@VisibleForTesting @VisibleForTesting
long skipToPageOfGranule(ExtractorInput input, long targetGranule, long currentGranule) long skipToPageOfGranule(ExtractorInput input, long targetGranule, long currentGranule)
......
...@@ -37,7 +37,13 @@ import java.io.IOException; ...@@ -37,7 +37,13 @@ import java.io.IOException;
public int revision; public int revision;
public int type; public int type;
/**
* The absolute granule position of the page. This is the total number of samples from the start
* of the file up to the <em>end</em> of the page. Samples partially in the page that continue on
* the next page do not count.
*/
public long granulePosition; public long granulePosition;
public long streamSerialNumber; public long streamSerialNumber;
public long pageSequenceNumber; public long pageSequenceNumber;
public long pageChecksum; public long pageChecksum;
...@@ -71,10 +77,10 @@ import java.io.IOException; ...@@ -71,10 +77,10 @@ import java.io.IOException;
* Peeks an Ogg page header and updates this {@link OggPageHeader}. * Peeks an Ogg page header and updates this {@link OggPageHeader}.
* *
* @param input The {@link ExtractorInput} to read from. * @param input The {@link ExtractorInput} to read from.
* @param quiet If {@code true}, no exceptions are thrown but {@code false} is returned if * @param quiet Whether to return {@code false} rather than throwing an exception if the header
* something goes wrong. * cannot be populated.
* @return {@code true} if the read was successful. The read fails if the end of the input is * @return Whether the read was successful. The read fails if the end of the input is encountered
* encountered without reading data. * without reading data.
* @throws IOException If reading data fails or the stream is invalid. * @throws IOException If reading data fails or the stream is invalid.
* @throws InterruptedException If the thread is interrupted. * @throws InterruptedException If the thread is interrupted.
*/ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment