mirror of
https://github.com/androidx/media.git
synced 2025-05-21 23:56:32 +08:00
Update code based on code review result
* remove field mimeType in Ac4Util.java * change constant CHANNEL_COUNT_2 to private in Ac4Util.java
This commit is contained in:
parent
3ea71f8ab8
commit
8f32c29cc6
@ -33,10 +33,6 @@ public final class Ac4Util {
|
||||
*/
|
||||
public static final class SyncFrameInfo {
|
||||
|
||||
/**
|
||||
* The sample mime type of the bitstream is {@link MimeTypes#AUDIO_AC4}.
|
||||
*/
|
||||
public final String mimeType;
|
||||
/**
|
||||
* The bitstream version.
|
||||
*/
|
||||
@ -59,13 +55,11 @@ public final class Ac4Util {
|
||||
public final int sampleCount;
|
||||
|
||||
private SyncFrameInfo(
|
||||
String mimeType,
|
||||
int bitstreamVersion,
|
||||
int channelCount,
|
||||
int sampleRate,
|
||||
int frameSize,
|
||||
int sampleCount) {
|
||||
this.mimeType = mimeType;
|
||||
this.bitstreamVersion = bitstreamVersion;
|
||||
this.channelCount = channelCount;
|
||||
this.sampleRate = sampleRate;
|
||||
@ -78,7 +72,7 @@ public final class Ac4Util {
|
||||
* The channel count of AC-4 stream.
|
||||
*/
|
||||
// TODO: Parse AC-4 stream channel count.
|
||||
public static final int CHANNEL_COUNT_2 = 2;
|
||||
private static final int CHANNEL_COUNT_2 = 2;
|
||||
/**
|
||||
* The header size for AC-4 parser. Only needs to be as big as we need to read, not the full
|
||||
* header size.
|
||||
@ -207,8 +201,7 @@ public final class Ac4Util {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return new SyncFrameInfo(
|
||||
MimeTypes.AUDIO_AC4, bitstreamVersion, CHANNEL_COUNT_2, sampleRate, frameSize, sampleCount);
|
||||
return new SyncFrameInfo(bitstreamVersion, CHANNEL_COUNT_2, sampleRate, frameSize, sampleCount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -23,6 +23,7 @@ import com.google.android.exoplayer2.audio.Ac4Util.SyncFrameInfo;
|
||||
import com.google.android.exoplayer2.extractor.ExtractorOutput;
|
||||
import com.google.android.exoplayer2.extractor.TrackOutput;
|
||||
import com.google.android.exoplayer2.extractor.ts.TsPayloadReader.TrackIdGenerator;
|
||||
import com.google.android.exoplayer2.util.MimeTypes;
|
||||
import com.google.android.exoplayer2.util.ParsableBitArray;
|
||||
import com.google.android.exoplayer2.util.ParsableByteArray;
|
||||
import java.lang.annotation.Documented;
|
||||
@ -198,8 +199,8 @@ public final class Ac4Reader implements ElementaryStreamReader {
|
||||
SyncFrameInfo frameInfo = Ac4Util.parseAc4SyncframeInfo(headerScratchBits);
|
||||
if (format == null || frameInfo.channelCount != format.channelCount
|
||||
|| frameInfo.sampleRate != format.sampleRate
|
||||
|| frameInfo.mimeType != format.sampleMimeType) {
|
||||
format = Format.createAudioSampleFormat(trackFormatId, frameInfo.mimeType, null,
|
||||
|| !MimeTypes.AUDIO_AC4.equals(format.sampleMimeType)) {
|
||||
format = Format.createAudioSampleFormat(trackFormatId, MimeTypes.AUDIO_AC4, null,
|
||||
Format.NO_VALUE, Format.NO_VALUE, frameInfo.channelCount, frameInfo.sampleRate, null,
|
||||
null, 0, language);
|
||||
output.format(format);
|
||||
|
Loading…
x
Reference in New Issue
Block a user