Commit 461751b1 by aquilescanta Committed by Oliver Woodman

Add codec profiles for video container/sample formats.

This allows better decoding support checking.
-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=124550351
parent ca9bd5e8
Showing with 84 additions and 82 deletions
......@@ -63,7 +63,7 @@ public final class FfmpegAudioTrackRenderer extends AudioDecoderTrackRenderer {
public Format getOutputFormat() {
int channelCount = decoder.getChannelCount();
int sampleRate = decoder.getSampleRate();
return Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, Format.NO_VALUE,
return Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, null, Format.NO_VALUE,
Format.NO_VALUE, channelCount, sampleRate, C.ENCODING_PCM_16BIT, null, null, 0, null);
}
......
......@@ -111,7 +111,7 @@ public final class FlacExtractor implements Extractor {
});
Format mediaFormat = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW,
Format mediaFormat = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, null,
streamInfo.bitRate(), Format.NO_VALUE, streamInfo.channels, streamInfo.sampleRate,
C.ENCODING_PCM_16BIT, null, null, 0, null);
trackOutput.format(mediaFormat);
......
......@@ -59,8 +59,8 @@ public final class FormatTest extends TestCase {
TestUtil.buildTestData(128, 1 /* data seed */));
DrmInitData drmInitData = new DrmInitData(DRM_DATA_1, DRM_DATA_2);
Format formatToParcel = new Format("id", MimeTypes.VIDEO_MP4, MimeTypes.VIDEO_H264, 1024, 2048,
1920, 1080, 24, 90, 2, 6, 44100, C.ENCODING_PCM_24BIT, 1001, 1002, 0, "und",
Format formatToParcel = new Format("id", MimeTypes.VIDEO_MP4, MimeTypes.VIDEO_H264, null,
1024, 2048, 1920, 1080, 24, 90, 2, 6, 44100, C.ENCODING_PCM_24BIT, 1001, 1002, 0, "und",
Format.OFFSET_SAMPLE_RELATIVE, INIT_DATA, drmInitData, false);
Parcel parcel = Parcel.obtain();
......@@ -79,17 +79,17 @@ public final class FormatTest extends TestCase {
return;
}
testConversionToFrameworkMediaFormatV16(Format.createVideoSampleFormat(null, "video/xyz", 5000,
102400, 1280, 720, 30, INIT_DATA, null));
testConversionToFrameworkMediaFormatV16(Format.createVideoSampleFormat(null, "video/xyz", 5000,
Format.NO_VALUE, 1280, 720, 30, null, null));
testConversionToFrameworkMediaFormatV16(Format.createAudioSampleFormat(null, "audio/xyz", 500,
128, 5, 44100, INIT_DATA, null, 0, null));
testConversionToFrameworkMediaFormatV16(Format.createAudioSampleFormat(null, "audio/xyz", 500,
Format.NO_VALUE, 5, 44100, null, null, 0, null));
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz",
testConversionToFrameworkMediaFormatV16(Format.createVideoSampleFormat(null, "video/xyz", null,
5000, 102400, 1280, 720, 30, INIT_DATA, null));
testConversionToFrameworkMediaFormatV16(Format.createVideoSampleFormat(null, "video/xyz", null,
5000, Format.NO_VALUE, 1280, 720, 30, null, null));
testConversionToFrameworkMediaFormatV16(Format.createAudioSampleFormat(null, "audio/xyz", null,
500, 128, 5, 44100, INIT_DATA, null, 0, null));
testConversionToFrameworkMediaFormatV16(Format.createAudioSampleFormat(null, "audio/xyz", null,
500, Format.NO_VALUE, 5, 44100, null, null, 0, null));
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", null,
Format.NO_VALUE, 0, "eng", null));
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz",
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", null,
Format.NO_VALUE, 0, null, null));
}
......
......@@ -44,12 +44,13 @@ public class DashChunkSourceTest extends InstrumentationTestCase {
private static final int WIDE_WIDTH = 400;
private static final Format REGULAR_VIDEO = Format.createVideoContainerFormat("1",
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, 1000, 480, 240, Format.NO_VALUE, null);
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, null, 1000, 480, 240, Format.NO_VALUE, null);
private static final Format TALL_VIDEO = Format.createVideoContainerFormat("2",
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, 1000, 100, TALL_HEIGHT, Format.NO_VALUE,
null);
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, null, 1000, 100, TALL_HEIGHT,
Format.NO_VALUE, null);
private static final Format WIDE_VIDEO = Format.createVideoContainerFormat("3",
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, 1000, WIDE_WIDTH, 50, Format.NO_VALUE, null);
MimeTypes.APPLICATION_MP4, MimeTypes.VIDEO_H264, null, 1000, WIDE_WIDTH, 50, Format.NO_VALUE,
null);
@Override
public void setUp() throws Exception {
......
......@@ -29,12 +29,12 @@ public class RepresentationTest extends TestCase {
public void testGetCacheKey() {
String uri = "http://www.google.com";
SegmentBase base = new SingleSegmentBase(new RangedUri(uri, null, 0, 1), 1, 0, uri, 1, 1);
Format format = Format.createVideoContainerFormat("0", MimeTypes.APPLICATION_MP4,
Format format = Format.createVideoContainerFormat("0", MimeTypes.APPLICATION_MP4, null,
MimeTypes.VIDEO_H264, 2500000, 1920, 1080, Format.NO_VALUE, null);
Representation representation = Representation.newInstance("test_stream_1", 3, format, base);
assertEquals("test_stream_1.0.3", representation.getCacheKey());
format = Format.createVideoContainerFormat("150", MimeTypes.APPLICATION_MP4,
format = Format.createVideoContainerFormat("150", MimeTypes.APPLICATION_MP4, null,
MimeTypes.VIDEO_H264, 2500000, 1920, 1080, Format.NO_VALUE, null);
representation = Representation.newInstance("test_stream_1", -1, format, base);
assertEquals("test_stream_1.150.-1", representation.getCacheKey());
......
......@@ -331,7 +331,7 @@ public final class FrameworkSampleSource implements SampleSource {
buffer.flip();
}
int pcmEncoding = MimeTypes.AUDIO_RAW.equals(mimeType) ? C.ENCODING_PCM_16BIT : Format.NO_VALUE;
Format format = new Format(Integer.toString(index), null, mimeType, Format.NO_VALUE,
Format format = new Format(Integer.toString(index), null, mimeType, null, Format.NO_VALUE,
maxInputSize, width, height, frameRate, rotationDegrees, Format.NO_VALUE, channelCount,
sampleRate, pcmEncoding, encoderDelay, encoderPadding, 0, language,
Format.OFFSET_SAMPLE_RELATIVE, initializationData, drmInitData, false);
......
......@@ -405,14 +405,14 @@ public class MediaPresentationDescriptionParser extends DefaultHandler
String sampleMimeType = getSampleMimeType(containerMimeType, codecs);
if (sampleMimeType != null) {
if (MimeTypes.isVideo(sampleMimeType)) {
return Format.createVideoContainerFormat(id, containerMimeType, sampleMimeType, bitrate,
width, height, frameRate, null);
return Format.createVideoContainerFormat(id, containerMimeType, sampleMimeType, null,
bitrate, width, height, frameRate, null);
} else if (MimeTypes.isAudio(sampleMimeType)) {
return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, bitrate,
audioChannels, audioSamplingRate, null, 0, language);
return Format.createAudioContainerFormat(id, containerMimeType, sampleMimeType, null,
bitrate, audioChannels, audioSamplingRate, null, 0, language);
} else if (mimeTypeIsRawText(sampleMimeType)) {
return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, bitrate, 0,
language);
return Format.createTextContainerFormat(id, containerMimeType, sampleMimeType, null,
bitrate, 0, language);
} else {
return Format.createContainerFormat(id, containerMimeType, sampleMimeType, bitrate);
}
......
......@@ -140,7 +140,7 @@ public abstract class AudioDecoderTrackRenderer extends TrackRenderer implements
* rate as the input.
*/
protected Format getOutputFormat() {
return Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, Format.NO_VALUE,
return Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, null, Format.NO_VALUE,
Format.NO_VALUE, inputFormat.channelCount, inputFormat.sampleRate, C.ENCODING_PCM_16BIT,
null, null, 0, null);
}
......
......@@ -86,7 +86,7 @@ import java.util.Collections;
data.readBytes(audioSpecifiConfig, 0, audioSpecifiConfig.length);
Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
audioSpecifiConfig);
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC,
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC, null,
Format.NO_VALUE, Format.NO_VALUE, audioParams.second, audioParams.first,
Collections.singletonList(audioSpecifiConfig), null, 0, null);
output.format(format);
......
......@@ -93,7 +93,7 @@ import java.util.List;
nalUnitLengthFieldLength = avcData.nalUnitLengthFieldLength;
// Construct and output the format.
Format format = Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H264,
Format format = Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H264, null,
Format.NO_VALUE, Format.NO_VALUE, avcData.width, avcData.height,
Format.NO_VALUE, avcData.initializationData, Format.NO_VALUE,
avcData.pixelWidthAspectRatio, null);
......
......@@ -1337,7 +1337,7 @@ public final class MatroskaExtractor implements Extractor {
// TODO: Consider reading the name elements of the tracks and, if present, incorporating them
// into the trackId passed when creating the formats.
if (MimeTypes.isAudio(mimeType)) {
format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType,
format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, maxInputSize, channelCount, sampleRate, pcmEncoding,
initializationData, drmInitData, selectionFlags, language);
} else if (MimeTypes.isVideo(mimeType)) {
......@@ -1349,15 +1349,15 @@ public final class MatroskaExtractor implements Extractor {
if (displayWidth != Format.NO_VALUE && displayHeight != Format.NO_VALUE) {
pixelWidthHeightRatio = ((float) (height * displayWidth)) / (width * displayHeight);
}
format = Format.createVideoSampleFormat(Integer.toString(trackId), mimeType,
format = Format.createVideoSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, maxInputSize, width, height, Format.NO_VALUE, initializationData,
Format.NO_VALUE, pixelWidthHeightRatio, drmInitData);
} else if (MimeTypes.APPLICATION_SUBRIP.equals(mimeType)) {
format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, Format.NO_VALUE,
selectionFlags, language, drmInitData);
format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, selectionFlags, language, drmInitData);
} else if (MimeTypes.APPLICATION_VOBSUB.equals(mimeType)
|| MimeTypes.APPLICATION_PGS.equals(mimeType)) {
format = Format.createImageSampleFormat(Integer.toString(trackId), mimeType,
format = Format.createImageSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, initializationData, language, drmInitData);
} else {
throw new ParserException("Unexpected MIME type.");
......
......@@ -125,7 +125,7 @@ public final class Mp3Extractor implements Extractor {
if (seeker == null) {
seeker = setupSeeker(input);
extractorOutput.seekMap(seeker);
trackOutput.format(Format.createAudioSampleFormat(null, synchronizedHeader.mimeType,
trackOutput.format(Format.createAudioSampleFormat(null, synchronizedHeader.mimeType, null,
Format.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES, synchronizedHeader.channels,
synchronizedHeader.sampleRate, Format.NO_VALUE, gaplessInfoHolder.encoderDelay,
gaplessInfoHolder.encoderPadding, null, null, 0, null));
......
......@@ -610,16 +610,16 @@ import java.util.List;
language, isQuickTime, drmInitData, out, i);
} else if (childAtomType == Atom.TYPE_TTML) {
out.format = Format.createTextSampleFormat(Integer.toString(trackId),
MimeTypes.APPLICATION_TTML, Format.NO_VALUE, 0, language, drmInitData);
MimeTypes.APPLICATION_TTML, null, Format.NO_VALUE, 0, language, drmInitData);
} else if (childAtomType == Atom.TYPE_tx3g) {
out.format = Format.createTextSampleFormat(Integer.toString(trackId),
MimeTypes.APPLICATION_TX3G, Format.NO_VALUE, 0, language, drmInitData);
MimeTypes.APPLICATION_TX3G, null, Format.NO_VALUE, 0, language, drmInitData);
} else if (childAtomType == Atom.TYPE_wvtt) {
out.format = Format.createTextSampleFormat(Integer.toString(trackId),
MimeTypes.APPLICATION_MP4VTT, Format.NO_VALUE, 0, language, drmInitData);
MimeTypes.APPLICATION_MP4VTT, null, Format.NO_VALUE, 0, language, drmInitData);
} else if (childAtomType == Atom.TYPE_stpp) {
out.format = Format.createTextSampleFormat(Integer.toString(trackId),
MimeTypes.APPLICATION_TTML, Format.NO_VALUE, 0, language, drmInitData,
MimeTypes.APPLICATION_TTML, null, Format.NO_VALUE, 0, language, drmInitData,
0 /* subsample timing is absolute */);
}
stsd.setPosition(childStartPosition + childAtomSize);
......@@ -696,7 +696,7 @@ import java.util.List;
return;
}
out.format = Format.createVideoSampleFormat(Integer.toString(trackId), mimeType,
out.format = Format.createVideoSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, Format.NO_VALUE, width, height, Format.NO_VALUE, initializationData,
rotationDegrees, pixelWidthHeightRatio, drmInitData);
}
......@@ -908,7 +908,7 @@ import java.util.List;
out.format = Ac3Util.parseEAc3AnnexFFormat(parent, Integer.toString(trackId), language,
drmInitData);
} else if (childAtomType == Atom.TYPE_ddts) {
out.format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType,
out.format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, Format.NO_VALUE, channelCount, sampleRate, null, drmInitData, 0,
language);
}
......@@ -919,7 +919,7 @@ import java.util.List;
// TODO: Determine the correct PCM encoding.
int pcmEncoding =
MimeTypes.AUDIO_RAW.equals(mimeType) ? C.ENCODING_PCM_16BIT : Format.NO_VALUE;
out.format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType,
out.format = Format.createAudioSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, Format.NO_VALUE, channelCount, sampleRate, pcmEncoding,
initializationData == null ? null : Collections.singletonList(initializationData),
drmInitData, 0, language);
......
......@@ -76,9 +76,9 @@ import java.util.List;
byte[] metadata = Arrays.copyOfRange(data, 9, packet.limit());
metadata[4] = (byte) 0x80; // Set the last metadata block flag, ignore the other blocks
List<byte[]> initializationData = Collections.singletonList(metadata);
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_FLAC, Format.NO_VALUE,
streamInfo.bitRate(), streamInfo.channels, streamInfo.sampleRate, initializationData,
null, 0, null);
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_FLAC, null,
Format.NO_VALUE, streamInfo.bitRate(), streamInfo.channels, streamInfo.sampleRate,
initializationData, null, 0, null);
} else if ((data[0] & 0x7F) == SEEKTABLE_PACKET_TYPE) {
flacOggSeeker = new FlacOggSeeker();
flacOggSeeker.parseSeekTable(packet);
......
......@@ -80,8 +80,9 @@ import java.util.List;
putNativeOrderLong(initializationData, preskip);
putNativeOrderLong(initializationData, DEFAULT_SEEK_PRE_ROLL_SAMPLES);
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_OPUS, Format.NO_VALUE,
Format.NO_VALUE, channelCount, SAMPLE_RATE, initializationData, null, 0, "und");
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_OPUS, null,
Format.NO_VALUE, Format.NO_VALUE, channelCount, SAMPLE_RATE, initializationData, null, 0,
"und");
headerRead = true;
} else {
boolean headerPacket = packet.readInt() == OPUS_CODE;
......
......@@ -101,7 +101,7 @@ import java.util.ArrayList;
codecInitialisationData.add(vorbisSetup.idHeader.data);
codecInitialisationData.add(vorbisSetup.setupHeaderData);
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_VORBIS,
setupData.format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_VORBIS, null,
this.vorbisSetup.idHeader.bitrateNominal, OggPageHeader.MAX_PAGE_PAYLOAD,
this.vorbisSetup.idHeader.channels, (int) this.vorbisSetup.idHeader.sampleRate,
codecInitialisationData, null, 0, null);
......
......@@ -84,8 +84,8 @@ import java.util.Collections;
public AdtsReader(TrackOutput output, TrackOutput id3Output) {
super(output);
this.id3Output = id3Output;
id3Output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_ID3, Format.NO_VALUE,
null));
id3Output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_ID3, null,
Format.NO_VALUE, null));
adtsScratch = new ParsableBitArray(new byte[HEADER_SIZE + CRC_SIZE]);
id3HeaderBuffer = new ParsableByteArray(Arrays.copyOf(ID3_IDENTIFIER, ID3_HEADER_SIZE));
setFindingSampleState();
......@@ -278,8 +278,8 @@ import java.util.Collections;
Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
audioSpecificConfig);
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC, Format.NO_VALUE,
Format.NO_VALUE, audioParams.second, audioParams.first,
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_AAC, null,
Format.NO_VALUE, Format.NO_VALUE, audioParams.second, audioParams.first,
Collections.singletonList(audioSpecificConfig), null, 0, null);
// In this class a sample is an access unit, but the MediaFormat sample rate specifies the
// number of PCM audio samples per second.
......
......@@ -189,9 +189,9 @@ import java.util.Collections;
break;
}
Format format = Format.createVideoSampleFormat(null, MimeTypes.VIDEO_MPEG2, Format.NO_VALUE,
Format.NO_VALUE, width, height, Format.NO_VALUE, Collections.singletonList(csdData),
Format.NO_VALUE, pixelWidthHeightRatio, null);
Format format = Format.createVideoSampleFormat(null, MimeTypes.VIDEO_MPEG2, null,
Format.NO_VALUE, Format.NO_VALUE, width, height, Format.NO_VALUE,
Collections.singletonList(csdData), Format.NO_VALUE, pixelWidthHeightRatio, null);
long frameDurationUs = 0;
int frameRateCodeMinusOne = (csdData[7] & 0x0F) - 1;
......
......@@ -169,9 +169,9 @@ import java.util.List;
initializationData.add(Arrays.copyOf(pps.nalData, pps.nalLength));
NalUnitUtil.SpsData spsData = NalUnitUtil.parseSpsNalUnit(sps.nalData, 3, sps.nalLength);
NalUnitUtil.PpsData ppsData = NalUnitUtil.parsePpsNalUnit(pps.nalData, 3, pps.nalLength);
output.format(Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H264, Format.NO_VALUE,
Format.NO_VALUE, spsData.width, spsData.height, Format.NO_VALUE, initializationData,
Format.NO_VALUE, spsData.pixelWidthAspectRatio, null));
output.format(Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H264, null,
Format.NO_VALUE, Format.NO_VALUE, spsData.width, spsData.height, Format.NO_VALUE,
initializationData, Format.NO_VALUE, spsData.pixelWidthAspectRatio, null));
hasOutputFormat = true;
sampleReader.putSps(spsData);
sampleReader.putPps(ppsData);
......
......@@ -308,7 +308,7 @@ import java.util.Collections;
}
}
return Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H265, Format.NO_VALUE,
return Format.createVideoSampleFormat(null, MimeTypes.VIDEO_H265, null, Format.NO_VALUE,
Format.NO_VALUE, picWidthInLumaSamples, picHeightInLumaSamples, Format.NO_VALUE,
Collections.singletonList(csd), Format.NO_VALUE, pixelWidthHeightRatio, null);
}
......
......@@ -40,7 +40,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
public Id3Reader(TrackOutput output) {
super(output);
output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_ID3, Format.NO_VALUE,
output.format(Format.createSampleFormat(null, MimeTypes.APPLICATION_ID3, null, Format.NO_VALUE,
null));
id3Header = new ParsableByteArray(ID3_HEADER_SIZE);
}
......
......@@ -162,7 +162,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
frameSize = header.frameSize;
if (!hasOutputFormat) {
frameDurationUs = (C.MICROS_PER_SECOND * header.samplesPerFrame) / header.sampleRate;
Format format = Format.createAudioSampleFormat(null, header.mimeType, Format.NO_VALUE,
Format format = Format.createAudioSampleFormat(null, header.mimeType, null, Format.NO_VALUE,
MpegAudioHeader.MAX_FRAME_SIZE_BYTES, header.channels, header.sampleRate, null, null, 0,
null);
output.format(format);
......
......@@ -31,8 +31,8 @@ import com.google.android.exoplayer.util.ParsableByteArray;
public SeiReader(TrackOutput output) {
this.output = output;
output.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_EIA608, Format.NO_VALUE,
0, null, null));
output.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_EIA608, null,
Format.NO_VALUE, 0, null, null));
}
public void consume(long pesTimeUs, ParsableByteArray seiBuffer) {
......
......@@ -72,7 +72,7 @@ public final class WavExtractor implements Extractor, SeekMap {
// Should only happen if the media wasn't sniffed.
throw new ParserException("Unsupported or unrecognized wav header.");
}
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW,
Format format = Format.createAudioSampleFormat(null, MimeTypes.AUDIO_RAW, null,
wavHeader.getBitrate(), MAX_INPUT_SIZE, wavHeader.getNumChannels(),
wavHeader.getSampleRateHz(), wavHeader.getEncoding(), null, null, 0, null);
trackOutput.format(format);
......
......@@ -165,8 +165,8 @@ import java.util.regex.Pattern;
private TrackOutput buildTrackOutput(long subsampleOffsetUs) {
TrackOutput trackOutput = output.track(0);
trackOutput.format(Format.createTextSampleFormat(null, MimeTypes.TEXT_VTT, Format.NO_VALUE, 0,
language, null, subsampleOffsetUs));
trackOutput.format(Format.createTextSampleFormat(null, MimeTypes.TEXT_VTT, null,
Format.NO_VALUE, 0, language, null, subsampleOffsetUs));
output.endTracks();
return trackOutput;
}
......
......@@ -168,7 +168,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
String captionName = HlsParserUtil.parseStringAttr(line, NAME_ATTR_REGEX, NAME_ATTR);
String language = HlsParserUtil.parseOptionalStringAttr(line, LANGUAGE_ATTR_REGEX);
muxedCaptionFormat = Format.createTextContainerFormat(captionName,
MimeTypes.APPLICATION_M3U8, MimeTypes.APPLICATION_EIA608, -1, 0, language);
MimeTypes.APPLICATION_M3U8, MimeTypes.APPLICATION_EIA608, null, -1, 0, language);
}
} else if (SUBTITLES_TYPE.equals(type)) {
// We assume all subtitles belong to the same group.
......@@ -176,7 +176,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
String uri = HlsParserUtil.parseStringAttr(line, URI_ATTR_REGEX, URI_ATTR);
String language = HlsParserUtil.parseOptionalStringAttr(line, LANGUAGE_ATTR_REGEX);
Format format = Format.createTextContainerFormat(subtitleName, MimeTypes.APPLICATION_M3U8,
MimeTypes.TEXT_VTT, bitrate, 0, language);
MimeTypes.TEXT_VTT, null, bitrate, 0, language);
subtitles.add(new Variant(uri, format, codecs));
} else if (AUDIO_TYPE.equals(type)) {
// We assume all audios belong to the same group.
......@@ -185,7 +185,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
String audioName = HlsParserUtil.parseStringAttr(line, NAME_ATTR_REGEX, NAME_ATTR);
int audioBitrate = uri != null ? bitrate : -1;
Format format = Format.createAudioContainerFormat(audioName, MimeTypes.APPLICATION_M3U8,
null, audioBitrate, -1, -1, null, 0, language);
null, null, audioBitrate, -1, -1, null, 0, language);
if (uri != null) {
audios.add(new Variant(uri, format, codecs));
} else {
......@@ -220,7 +220,7 @@ public final class HlsPlaylistParser implements UriLoadable.Parser<HlsPlaylist>
name = Integer.toString(variants.size());
}
Format format = Format.createVideoContainerFormat(name, MimeTypes.APPLICATION_M3U8, null,
bitrate, width, height, Format.NO_VALUE, null);
null, bitrate, width, height, Format.NO_VALUE, null);
variants.add(new Variant(line, format, codecs));
bitrate = 0;
codecs = null;
......
......@@ -631,8 +631,8 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
int height = parseRequiredInt(parser, KEY_MAX_HEIGHT);
List<byte[]> codecSpecificData = buildCodecSpecificData(
parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA));
format = Format.createVideoContainerFormat(id, MimeTypes.VIDEO_MP4, sampleMimeType, bitrate,
width, height, Format.NO_VALUE, codecSpecificData);
format = Format.createVideoContainerFormat(id, MimeTypes.VIDEO_MP4, sampleMimeType, null,
bitrate, width, height, Format.NO_VALUE, codecSpecificData);
} else if (type == C.TRACK_TYPE_AUDIO) {
sampleMimeType = sampleMimeType == null ? MimeTypes.AUDIO_AAC : sampleMimeType;
int channels = parseRequiredInt(parser, KEY_CHANNELS);
......@@ -640,12 +640,12 @@ public class SmoothStreamingManifestParser implements UriLoadable.Parser<SmoothS
List<byte[]> codecSpecificData = buildCodecSpecificData(
parser.getAttributeValue(null, KEY_CODEC_PRIVATE_DATA));
String language = (String) getNormalizedAttribute(KEY_LANGUAGE);
format = Format.createAudioContainerFormat(id, MimeTypes.AUDIO_MP4, sampleMimeType, bitrate,
channels, samplingRate, codecSpecificData, 0, language);
format = Format.createAudioContainerFormat(id, MimeTypes.AUDIO_MP4, sampleMimeType, null,
bitrate, channels, samplingRate, codecSpecificData, 0, language);
} else if (type == C.TRACK_TYPE_TEXT) {
String language = (String) getNormalizedAttribute(KEY_LANGUAGE);
format = Format.createTextContainerFormat(id, MimeTypes.APPLICATION_MP4, sampleMimeType,
bitrate, 0, language);
null, bitrate, 0, language);
} else {
format = Format.createContainerFormat(id, MimeTypes.APPLICATION_MP4, sampleMimeType,
bitrate);
......
......@@ -79,7 +79,7 @@ public final class Ac3Util {
if ((nextByte & 0x04) != 0) { // lfeon
channelCount++;
}
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_AC3, Format.NO_VALUE,
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_AC3, null, Format.NO_VALUE,
Format.NO_VALUE, channelCount, sampleRate, null, drmInitData, 0, language);
}
......@@ -106,7 +106,7 @@ public final class Ac3Util {
if ((nextByte & 0x01) != 0) { // lfeon
channelCount++;
}
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_E_AC3, Format.NO_VALUE,
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_E_AC3, null, Format.NO_VALUE,
Format.NO_VALUE, channelCount, sampleRate, null, drmInitData, 0, language);
}
......@@ -136,7 +136,7 @@ public final class Ac3Util {
data.skipBits(2); // dsurmod
}
boolean lfeon = data.readBit();
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_AC3, Format.NO_VALUE,
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_AC3, null, Format.NO_VALUE,
Format.NO_VALUE, CHANNEL_COUNT_BY_ACMOD[acmod] + (lfeon ? 1 : 0),
SAMPLE_RATE_BY_FSCOD[fscod], null, drmInitData, 0, language);
}
......@@ -164,7 +164,7 @@ public final class Ac3Util {
}
int acmod = data.readBits(3);
boolean lfeon = data.readBit();
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_E_AC3, Format.NO_VALUE,
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_E_AC3, null, Format.NO_VALUE,
Format.NO_VALUE, CHANNEL_COUNT_BY_ACMOD[acmod] + (lfeon ? 1 : 0), sampleRate, null,
drmInitData, 0, language);
}
......
......@@ -72,8 +72,8 @@ public final class DtsUtil {
: TWICE_BITRATE_KBPS_BY_RATE[rate] * 1000 / 2;
frameBits.skipBits(10); // MIX, DYNF, TIMEF, AUXF, HDCD, EXT_AUDIO_ID, EXT_AUDIO, ASPF
channelCount += frameBits.readBits(2) > 0 ? 1 : 0; // LFF
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_DTS, bitrate, Format.NO_VALUE,
channelCount, sampleRate, null, drmInitData, 0, language);
return Format.createAudioSampleFormat(trackId, MimeTypes.AUDIO_DTS, null, bitrate,
Format.NO_VALUE, channelCount, sampleRate, null, drmInitData, 0, language);
}
/**
......
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