mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Format with google-java-format
This commit is contained in:
parent
71673d65f3
commit
cfa7f1f0a7
2 changed files with 21 additions and 24 deletions
|
|
@ -51,8 +51,8 @@ public final class MpeghUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses an MHAS packet header. See ISO_IEC_23008-3;2022, 14.2.1, Table 222.
|
* Parses an MHAS packet header. See ISO_IEC_23008-3;2022, 14.2.1, Table 222. The reading position
|
||||||
* The reading position of {@code data} will be modified.
|
* of {@code data} will be modified.
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the MHAS packet header.
|
* @param data The data to parse, positioned at the start of the MHAS packet header.
|
||||||
* @return The {@link MhasPacketHeader} info.
|
* @return The {@link MhasPacketHeader} info.
|
||||||
|
|
@ -97,7 +97,7 @@ public final class MpeghUtil {
|
||||||
* The reading position of {@code data} will be modified.
|
* The reading position of {@code data} will be modified.
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the fields to obtain the sampling
|
* @param data The data to parse, positioned at the start of the fields to obtain the sampling
|
||||||
* rate from.
|
* rate from.
|
||||||
* @return The sampling frequency.
|
* @return The sampling frequency.
|
||||||
* @throws ParserException if sampling frequency could not be obtained.
|
* @throws ParserException if sampling frequency could not be obtained.
|
||||||
*/
|
*/
|
||||||
|
|
@ -277,11 +277,10 @@ public final class MpeghUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the necessary info of the Mpegh3daConfig from an MPEG-H bit stream. See
|
* Obtains the necessary info of the Mpegh3daConfig from an MPEG-H bit stream. See
|
||||||
* ISO_IEC_23008-3;2022, 5.2.2.1, Table 15.
|
* ISO_IEC_23008-3;2022, 5.2.2.1, Table 15. The reading position of {@code data} will be modified.
|
||||||
* The reading position of {@code data} will be modified.
|
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the payload of an Mpegh3daConfig
|
* @param data The data to parse, positioned at the start of the payload of an Mpegh3daConfig
|
||||||
* packet.
|
* packet.
|
||||||
* @return The {@link Mpegh3daConfig}.
|
* @return The {@link Mpegh3daConfig}.
|
||||||
* @throws ParserException if a valid {@link Mpegh3daConfig} cannot be parsed.
|
* @throws ParserException if a valid {@link Mpegh3daConfig} cannot be parsed.
|
||||||
*/
|
*/
|
||||||
|
|
@ -337,11 +336,11 @@ public final class MpeghUtil {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Obtains the number of truncated samples of the AudioTruncationInfo from an MPEG-H bit stream.
|
* Obtains the number of truncated samples of the AudioTruncationInfo from an MPEG-H bit stream.
|
||||||
* See ISO_IEC_23008-3;2022, 14.2.2, Table 225.
|
* See ISO_IEC_23008-3;2022, 14.2.2, Table 225. The reading position of {@code data} will be
|
||||||
* The reading position of {@code data} will be modified.
|
* modified.
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the payload of an AudioTruncation
|
* @param data The data to parse, positioned at the start of the payload of an AudioTruncation
|
||||||
* packet.
|
* packet.
|
||||||
* @return The number of truncated samples.
|
* @return The number of truncated samples.
|
||||||
*/
|
*/
|
||||||
public static int parseAudioTruncationInfo(ParsableBitArray data) {
|
public static int parseAudioTruncationInfo(ParsableBitArray data) {
|
||||||
|
|
@ -378,7 +377,7 @@ public final class MpeghUtil {
|
||||||
* 5.2.2.2, Table 19. The reading position of {@code data} will be modified.
|
* 5.2.2.2, Table 19. The reading position of {@code data} will be modified.
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the Mpegh3daFlexibleSpeakerConfig
|
* @param data The data to parse, positioned at the start of the Mpegh3daFlexibleSpeakerConfig
|
||||||
* field.
|
* field.
|
||||||
*/
|
*/
|
||||||
private static void skipMpegh3daFlexibleSpeakerConfig(
|
private static void skipMpegh3daFlexibleSpeakerConfig(
|
||||||
ParsableBitArray data, int numberOfSpeakers) {
|
ParsableBitArray data, int numberOfSpeakers) {
|
||||||
|
|
@ -545,8 +544,8 @@ public final class MpeghUtil {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Skips the SbrConfig from an MPEG-H bit stream. See ISO_IEC_23003-3;2020, 5.2, Table 14.
|
* Skips the SbrConfig from an MPEG-H bit stream. See ISO_IEC_23003-3;2020, 5.2, Table 14. The
|
||||||
* The reading position of {@code data} will be modified.
|
* reading position of {@code data} will be modified.
|
||||||
*
|
*
|
||||||
* @param data The data to parse, positioned at the start of the SbrConfig field.
|
* @param data The data to parse, positioned at the start of the SbrConfig field.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -221,8 +221,7 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
* @param target The target into which data is to be read.
|
* @param target The target into which data is to be read.
|
||||||
* @param targetLength The target length of the read.
|
* @param targetLength The target length of the read.
|
||||||
*/
|
*/
|
||||||
private void copyData(
|
private void copyData(ParsableByteArray source, ParsableByteArray target, int targetLength) {
|
||||||
ParsableByteArray source, ParsableByteArray target, int targetLength) {
|
|
||||||
int sourcePosition = source.getPosition();
|
int sourcePosition = source.getPosition();
|
||||||
int bytesToRead = min(source.bytesLeft(), targetLength - target.getPosition());
|
int bytesToRead = min(source.bytesLeft(), targetLength - target.getPosition());
|
||||||
source.readBytes(target.getData(), target.getPosition(), bytesToRead);
|
source.readBytes(target.getData(), target.getPosition(), bytesToRead);
|
||||||
|
|
@ -261,8 +260,9 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Parses the MHAS packet header.
|
/**
|
||||||
*
|
* Parses the MHAS packet header.
|
||||||
|
*
|
||||||
* @throws ParserException if a valid {@link MpeghUtil.Mpegh3daConfig} cannot be parsed.
|
* @throws ParserException if a valid {@link MpeghUtil.Mpegh3daConfig} cannot be parsed.
|
||||||
*/
|
*/
|
||||||
private void parseHeader() throws ParserException {
|
private void parseHeader() throws ParserException {
|
||||||
|
|
@ -304,8 +304,8 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
/**
|
/**
|
||||||
* Copies data to the data scratch buffer.
|
* Copies data to the data scratch buffer.
|
||||||
*
|
*
|
||||||
* @param data A {@link ParsableByteArray} from which to read the sample data. Its position
|
* @param data A {@link ParsableByteArray} from which to read the sample data. Its position will
|
||||||
* will not be changed.
|
* not be changed.
|
||||||
*/
|
*/
|
||||||
private void maybeCopyToDataScratchBuffer(ParsableByteArray data) {
|
private void maybeCopyToDataScratchBuffer(ParsableByteArray data) {
|
||||||
if (header.packetType == MpeghUtil.MhasPacketHeader.PACTYP_MPEGH3DACFG
|
if (header.packetType == MpeghUtil.MhasPacketHeader.PACTYP_MPEGH3DACFG
|
||||||
|
|
@ -328,8 +328,7 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
int bytesToRead;
|
int bytesToRead;
|
||||||
// read bytes from header scratch buffer and write them into the output
|
// read bytes from header scratch buffer and write them into the output
|
||||||
if (headerScratchBytes.getPosition() != MpeghUtil.MAX_MHAS_PACKET_HEADER_SIZE) {
|
if (headerScratchBytes.getPosition() != MpeghUtil.MAX_MHAS_PACKET_HEADER_SIZE) {
|
||||||
bytesToRead =
|
bytesToRead = min(headerScratchBytes.bytesLeft(), header.packetLength - payloadBytesRead);
|
||||||
min(headerScratchBytes.bytesLeft(), header.packetLength - payloadBytesRead);
|
|
||||||
output.sampleData(headerScratchBytes, bytesToRead);
|
output.sampleData(headerScratchBytes, bytesToRead);
|
||||||
payloadBytesRead += bytesToRead;
|
payloadBytesRead += bytesToRead;
|
||||||
}
|
}
|
||||||
|
|
@ -342,8 +341,8 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
/**
|
/**
|
||||||
* Parses the config and sets the output format.
|
* Parses the config and sets the output format.
|
||||||
*
|
*
|
||||||
* @param bitArray The data to parse, positioned at the start of the
|
* @param bitArray The data to parse, positioned at the start of the {@link
|
||||||
* {@link MpeghUtil.Mpegh3daConfig} field.
|
* MpeghUtil.Mpegh3daConfig} field.
|
||||||
* @throws ParserException if a valid {@link MpeghUtil.Mpegh3daConfig} cannot be parsed.
|
* @throws ParserException if a valid {@link MpeghUtil.Mpegh3daConfig} cannot be parsed.
|
||||||
*/
|
*/
|
||||||
private void parseConfig(ParsableBitArray bitArray) throws ParserException {
|
private void parseConfig(ParsableBitArray bitArray) throws ParserException {
|
||||||
|
|
@ -358,8 +357,7 @@ public final class MpeghReader implements ElementaryStreamReader {
|
||||||
codecs += String.format(".%02X", config.profileLevelIndication);
|
codecs += String.format(".%02X", config.profileLevelIndication);
|
||||||
}
|
}
|
||||||
@Nullable List<byte[]> initializationData = null;
|
@Nullable List<byte[]> initializationData = null;
|
||||||
if (config.compatibleProfileLevelSet != null
|
if (config.compatibleProfileLevelSet != null && config.compatibleProfileLevelSet.length > 0) {
|
||||||
&& config.compatibleProfileLevelSet.length > 0) {
|
|
||||||
// The first entry in initializationData is reserved for the audio specific
|
// The first entry in initializationData is reserved for the audio specific
|
||||||
// config.
|
// config.
|
||||||
initializationData =
|
initializationData =
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue