本文整理汇总了Java中com.google.android.exoplayer2.util.MimeTypes.APPLICATION_TTML属性的典型用法代码示例。如果您正苦于以下问题:Java MimeTypes.APPLICATION_TTML属性的具体用法?Java MimeTypes.APPLICATION_TTML怎么用?Java MimeTypes.APPLICATION_TTML使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.google.android.exoplayer2.util.MimeTypes
的用法示例。
在下文中一共展示了MimeTypes.APPLICATION_TTML属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDecoder
@Override
public SubtitleDecoder createDecoder(Format format) {
switch (format.sampleMimeType) {
case MimeTypes.TEXT_VTT:
return new WebvttDecoder();
case MimeTypes.APPLICATION_MP4VTT:
return new Mp4WebvttDecoder();
case MimeTypes.APPLICATION_TTML:
return new TtmlDecoder();
case MimeTypes.APPLICATION_SUBRIP:
return new SubripDecoder();
case MimeTypes.APPLICATION_TX3G:
return new Tx3gDecoder(format.initializationData);
case MimeTypes.APPLICATION_CEA608:
case MimeTypes.APPLICATION_MP4CEA608:
return new Cea608Decoder(format.sampleMimeType, format.accessibilityChannel);
case MimeTypes.APPLICATION_CEA708:
return new Cea708Decoder(format.accessibilityChannel);
case MimeTypes.APPLICATION_DVBSUBS:
return new DvbDecoder(format.initializationData);
default:
throw new IllegalArgumentException("Attempted to create decoder for unsupported format");
}
}
示例2: getSampleMimeType
/**
* Derives a sample mimeType from a container mimeType and codecs attribute.
*
* @param containerMimeType The mimeType of the container.
* @param codecs The codecs attribute.
* @return The derived sample mimeType, or null if it could not be derived.
*/
private static String getSampleMimeType(String containerMimeType, String codecs) {
if (MimeTypes.isAudio(containerMimeType)) {
return MimeTypes.getAudioMediaMimeType(codecs);
} else if (MimeTypes.isVideo(containerMimeType)) {
return MimeTypes.getVideoMediaMimeType(codecs);
} else if (mimeTypeIsRawText(containerMimeType)) {
return containerMimeType;
} else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
if ("stpp".equals(codecs)) {
return MimeTypes.APPLICATION_TTML;
} else if ("wvtt".equals(codecs)) {
return MimeTypes.APPLICATION_MP4VTT;
}
} else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
if (codecs != null) {
if (codecs.contains("cea708")) {
return MimeTypes.APPLICATION_CEA708;
} else if (codecs.contains("eia608") || codecs.contains("cea608")) {
return MimeTypes.APPLICATION_CEA608;
}
}
return null;
}
return null;
}
示例3: fourCCToMimeType
private static String fourCCToMimeType(String fourCC) {
if (fourCC.equalsIgnoreCase("H264") || fourCC.equalsIgnoreCase("X264")
|| fourCC.equalsIgnoreCase("AVC1") || fourCC.equalsIgnoreCase("DAVC")) {
return MimeTypes.VIDEO_H264;
} else if (fourCC.equalsIgnoreCase("AAC") || fourCC.equalsIgnoreCase("AACL")
|| fourCC.equalsIgnoreCase("AACH") || fourCC.equalsIgnoreCase("AACP")) {
return MimeTypes.AUDIO_AAC;
} else if (fourCC.equalsIgnoreCase("TTML")) {
return MimeTypes.APPLICATION_TTML;
} else if (fourCC.equalsIgnoreCase("ac-3") || fourCC.equalsIgnoreCase("dac3")) {
return MimeTypes.AUDIO_AC3;
} else if (fourCC.equalsIgnoreCase("ec-3") || fourCC.equalsIgnoreCase("dec3")) {
return MimeTypes.AUDIO_E_AC3;
} else if (fourCC.equalsIgnoreCase("dtsc")) {
return MimeTypes.AUDIO_DTS;
} else if (fourCC.equalsIgnoreCase("dtsh") || fourCC.equalsIgnoreCase("dtsl")) {
return MimeTypes.AUDIO_DTS_HD;
} else if (fourCC.equalsIgnoreCase("dtse")) {
return MimeTypes.AUDIO_DTS_EXPRESS;
} else if (fourCC.equalsIgnoreCase("opus")) {
return MimeTypes.AUDIO_OPUS;
}
return null;
}
示例4: getDecoderClass
private Class<?> getDecoderClass(String mimeType) {
try {
switch (mimeType) {
case MimeTypes.TEXT_VTT:
return Class.forName("com.google.android.exoplayer2.text.webvtt.WebvttDecoder");
case MimeTypes.APPLICATION_TTML:
return Class.forName("com.google.android.exoplayer2.text.ttml.TtmlDecoder");
case MimeTypes.APPLICATION_MP4VTT:
return Class.forName("com.google.android.exoplayer2.text.webvtt.Mp4WebvttDecoder");
case MimeTypes.APPLICATION_SUBRIP:
return Class.forName("com.google.android.exoplayer2.text.subrip.SubripDecoder");
case MimeTypes.APPLICATION_TX3G:
return Class.forName("com.google.android.exoplayer2.text.tx3g.Tx3gDecoder");
case MimeTypes.APPLICATION_CEA608:
return Class.forName("com.google.android.exoplayer2.text.cea.Cea608Decoder");
default:
return null;
}
} catch (ClassNotFoundException e) {
return null;
}
}
示例5: getSampleMimeType
/**
* Derives a sample mimeType from a container mimeType and codecs attribute.
*
* @param containerMimeType The mimeType of the container.
* @param codecs The codecs attribute.
* @return The derived sample mimeType, or null if it could not be derived.
*/
private static String getSampleMimeType(String containerMimeType, String codecs) {
if (MimeTypes.isAudio(containerMimeType)) {
return MimeTypes.getAudioMediaMimeType(codecs);
} else if (MimeTypes.isVideo(containerMimeType)) {
return MimeTypes.getVideoMediaMimeType(codecs);
} else if (MimeTypes.APPLICATION_RAWCC.equals(containerMimeType)) {
if (codecs != null) {
if (codecs.contains("cea708")) {
return MimeTypes.APPLICATION_CEA708;
} else if (codecs.contains("eia608") || codecs.contains("cea608")) {
return MimeTypes.APPLICATION_CEA608;
}
}
return null;
} else if (mimeTypeIsRawText(containerMimeType)) {
return containerMimeType;
} else if (MimeTypes.APPLICATION_MP4.equals(containerMimeType)) {
if ("stpp".equals(codecs)) {
return MimeTypes.APPLICATION_TTML;
} else if ("wvtt".equals(codecs)) {
return MimeTypes.APPLICATION_MP4VTT;
}
}
return null;
}
示例6: parseTextSampleEntry
private static void parseTextSampleEntry(ParsableByteArray parent, int atomType, int position,
int atomSize, int trackId, String language, DrmInitData drmInitData, StsdData out)
throws ParserException {
parent.setPosition(position + Atom.HEADER_SIZE + StsdData.STSD_HEADER_SIZE);
// Default values.
List<byte[]> initializationData = null;
long subsampleOffsetUs = Format.OFFSET_SAMPLE_RELATIVE;
String mimeType;
if (atomType == Atom.TYPE_TTML) {
mimeType = MimeTypes.APPLICATION_TTML;
} else if (atomType == Atom.TYPE_tx3g) {
mimeType = MimeTypes.APPLICATION_TX3G;
int sampleDescriptionLength = atomSize - Atom.HEADER_SIZE - 8;
byte[] sampleDescriptionData = new byte[sampleDescriptionLength];
parent.readBytes(sampleDescriptionData, 0, sampleDescriptionLength);
initializationData = Collections.singletonList(sampleDescriptionData);
} else if (atomType == Atom.TYPE_wvtt) {
mimeType = MimeTypes.APPLICATION_MP4VTT;
} else if (atomType == Atom.TYPE_stpp) {
mimeType = MimeTypes.APPLICATION_TTML;
subsampleOffsetUs = 0; // Subsample timing is absolute.
} else if (atomType == Atom.TYPE_c608) {
// Defined by the QuickTime File Format specification.
mimeType = MimeTypes.APPLICATION_MP4CEA608;
out.requiredSampleTransformation = Track.TRANSFORMATION_CEA608_CDAT;
} else {
// Never happens.
throw new IllegalStateException();
}
out.format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, null,
Format.NO_VALUE, 0, language, Format.NO_VALUE, drmInitData, subsampleOffsetUs,
initializationData);
}
示例7: getDecoderClass
private Class<?> getDecoderClass(String mimeType) {
if (mimeType == null) {
return null;
}
try {
switch (mimeType) {
case MimeTypes.TEXT_VTT:
return Class.forName("com.google.android.exoplayer2.text.webvtt.WebvttDecoder");
case MimeTypes.APPLICATION_TTML:
return Class.forName("com.google.android.exoplayer2.text.ttml.TtmlDecoder");
case MimeTypes.APPLICATION_MP4VTT:
return Class.forName("com.google.android.exoplayer2.text.webvtt.Mp4WebvttDecoder");
case MimeTypes.APPLICATION_SUBRIP:
return Class.forName("com.google.android.exoplayer2.text.subrip.SubripDecoder");
case MimeTypes.APPLICATION_TX3G:
return Class.forName("com.google.android.exoplayer2.text.tx3g.Tx3gDecoder");
case MimeTypes.APPLICATION_CEA608:
case MimeTypes.APPLICATION_MP4CEA608:
return Class.forName("com.google.android.exoplayer2.text.cea.Cea608Decoder");
case MimeTypes.APPLICATION_CEA708:
return Class.forName("com.google.android.exoplayer2.text.cea.Cea708Decoder");
default:
return null;
}
} catch (ClassNotFoundException e) {
return null;
}
}