Java Code Examples for com.google.android.exoplayer2.C#TRACK_TYPE_UNKNOWN
The following examples show how to use
com.google.android.exoplayer2.C#TRACK_TYPE_UNKNOWN .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MimeTypes.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. * {@link C#TRACK_TYPE_UNKNOWN} if the MIME type is not known or the mapping cannot be * established. * * @param mimeType The MIME type. * @return The {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. */ public static int getTrackType(@Nullable String mimeType) { if (TextUtils.isEmpty(mimeType)) { return C.TRACK_TYPE_UNKNOWN; } else if (isAudio(mimeType)) { return C.TRACK_TYPE_AUDIO; } else if (isVideo(mimeType)) { return C.TRACK_TYPE_VIDEO; } else if (isText(mimeType) || APPLICATION_CEA608.equals(mimeType) || APPLICATION_CEA708.equals(mimeType) || APPLICATION_MP4CEA608.equals(mimeType) || APPLICATION_SUBRIP.equals(mimeType) || APPLICATION_TTML.equals(mimeType) || APPLICATION_TX3G.equals(mimeType) || APPLICATION_MP4VTT.equals(mimeType) || APPLICATION_RAWCC.equals(mimeType) || APPLICATION_VOBSUB.equals(mimeType) || APPLICATION_PGS.equals(mimeType) || APPLICATION_DVBSUBS.equals(mimeType)) { return C.TRACK_TYPE_TEXT; } else if (APPLICATION_ID3.equals(mimeType) || APPLICATION_EMSG.equals(mimeType) || APPLICATION_SCTE35.equals(mimeType) || APPLICATION_CAMERA_MOTION.equals(mimeType)) { return C.TRACK_TYPE_METADATA; } else { return getTrackTypeForCustomMimeType(mimeType); } }
Example 2
Source File: AtomParsers.java From K-Sonic with MIT License | 6 votes |
/** * Parses an hdlr atom. * * @param hdlr The hdlr atom to decode. * @return The track type. */ private static int parseHdlr(ParsableByteArray hdlr) { hdlr.setPosition(Atom.FULL_HEADER_SIZE + 4); int trackType = hdlr.readInt(); if (trackType == TYPE_soun) { return C.TRACK_TYPE_AUDIO; } else if (trackType == TYPE_vide) { return C.TRACK_TYPE_VIDEO; } else if (trackType == TYPE_text || trackType == TYPE_sbtl || trackType == TYPE_subt || trackType == TYPE_clcp) { return C.TRACK_TYPE_TEXT; } else if (trackType == TYPE_meta) { return C.TRACK_TYPE_METADATA; } else { return C.TRACK_TYPE_UNKNOWN; } }
Example 3
Source File: AtomParsers.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Parses an hdlr atom. * * @param hdlr The hdlr atom to decode. * @return The track type. */ private static int parseHdlr(ParsableByteArray hdlr) { hdlr.setPosition(Atom.FULL_HEADER_SIZE + 4); int trackType = hdlr.readInt(); if (trackType == TYPE_soun) { return C.TRACK_TYPE_AUDIO; } else if (trackType == TYPE_vide) { return C.TRACK_TYPE_VIDEO; } else if (trackType == TYPE_text || trackType == TYPE_sbtl || trackType == TYPE_subt || trackType == TYPE_clcp) { return C.TRACK_TYPE_TEXT; } else if (trackType == TYPE_meta) { return C.TRACK_TYPE_METADATA; } else { return C.TRACK_TYPE_UNKNOWN; } }
Example 4
Source File: MimeTypes.java From Telegram with GNU General Public License v2.0 | 6 votes |
/** * Returns the {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. * {@link C#TRACK_TYPE_UNKNOWN} if the MIME type is not known or the mapping cannot be * established. * * @param mimeType The MIME type. * @return The {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. */ public static int getTrackType(@Nullable String mimeType) { if (TextUtils.isEmpty(mimeType)) { return C.TRACK_TYPE_UNKNOWN; } else if (isAudio(mimeType)) { return C.TRACK_TYPE_AUDIO; } else if (isVideo(mimeType)) { return C.TRACK_TYPE_VIDEO; } else if (isText(mimeType) || APPLICATION_CEA608.equals(mimeType) || APPLICATION_CEA708.equals(mimeType) || APPLICATION_MP4CEA608.equals(mimeType) || APPLICATION_SUBRIP.equals(mimeType) || APPLICATION_TTML.equals(mimeType) || APPLICATION_TX3G.equals(mimeType) || APPLICATION_MP4VTT.equals(mimeType) || APPLICATION_RAWCC.equals(mimeType) || APPLICATION_VOBSUB.equals(mimeType) || APPLICATION_PGS.equals(mimeType) || APPLICATION_DVBSUBS.equals(mimeType)) { return C.TRACK_TYPE_TEXT; } else if (APPLICATION_ID3.equals(mimeType) || APPLICATION_EMSG.equals(mimeType) || APPLICATION_SCTE35.equals(mimeType)) { return C.TRACK_TYPE_METADATA; } else if (APPLICATION_CAMERA_MOTION.equals(mimeType)) { return C.TRACK_TYPE_CAMERA_MOTION; } else { return getTrackTypeForCustomMimeType(mimeType); } }
Example 5
Source File: MimeTypes.java From TelePlus-Android with GNU General Public License v2.0 | 6 votes |
/** * Returns the {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. * {@link C#TRACK_TYPE_UNKNOWN} if the MIME type is not known or the mapping cannot be * established. * * @param mimeType The MIME type. * @return The {@link C}{@code .TRACK_TYPE_*} constant that corresponds to a specified MIME type. */ public static int getTrackType(@Nullable String mimeType) { if (TextUtils.isEmpty(mimeType)) { return C.TRACK_TYPE_UNKNOWN; } else if (isAudio(mimeType)) { return C.TRACK_TYPE_AUDIO; } else if (isVideo(mimeType)) { return C.TRACK_TYPE_VIDEO; } else if (isText(mimeType) || APPLICATION_CEA608.equals(mimeType) || APPLICATION_CEA708.equals(mimeType) || APPLICATION_MP4CEA608.equals(mimeType) || APPLICATION_SUBRIP.equals(mimeType) || APPLICATION_TTML.equals(mimeType) || APPLICATION_TX3G.equals(mimeType) || APPLICATION_MP4VTT.equals(mimeType) || APPLICATION_RAWCC.equals(mimeType) || APPLICATION_VOBSUB.equals(mimeType) || APPLICATION_PGS.equals(mimeType) || APPLICATION_DVBSUBS.equals(mimeType)) { return C.TRACK_TYPE_TEXT; } else if (APPLICATION_ID3.equals(mimeType) || APPLICATION_EMSG.equals(mimeType) || APPLICATION_SCTE35.equals(mimeType) || APPLICATION_CAMERA_MOTION.equals(mimeType)) { return C.TRACK_TYPE_METADATA; } else { return getTrackTypeForCustomMimeType(mimeType); } }
Example 6
Source File: AtomParsers.java From MediaSDK with Apache License 2.0 | 5 votes |
/** Returns the track type for a given handler value. */ private static int getTrackTypeForHdlr(int hdlr) { if (hdlr == TYPE_soun) { return C.TRACK_TYPE_AUDIO; } else if (hdlr == TYPE_vide) { return C.TRACK_TYPE_VIDEO; } else if (hdlr == TYPE_text || hdlr == TYPE_sbtl || hdlr == TYPE_subt || hdlr == TYPE_clcp) { return C.TRACK_TYPE_TEXT; } else if (hdlr == TYPE_meta) { return C.TRACK_TYPE_METADATA; } else { return C.TRACK_TYPE_UNKNOWN; } }
Example 7
Source File: ExoMediaPlayer.java From ExoMedia with Apache License 2.0 | 5 votes |
protected int getExoPlayerTrackType(@NonNull RendererType type) { switch (type) { case AUDIO: return C.TRACK_TYPE_AUDIO; case VIDEO: return C.TRACK_TYPE_VIDEO; case CLOSED_CAPTION: return C.TRACK_TYPE_TEXT; case METADATA: return C.TRACK_TYPE_METADATA; } return C.TRACK_TYPE_UNKNOWN; }
Example 8
Source File: MimeTypes.java From Telegram with GNU General Public License v2.0 | 5 votes |
private static int getTrackTypeForCustomMimeType(String mimeType) { int customMimeTypeCount = customMimeTypes.size(); for (int i = 0; i < customMimeTypeCount; i++) { CustomMimeType customMimeType = customMimeTypes.get(i); if (mimeType.equals(customMimeType.mimeType)) { return customMimeType.trackType; } } return C.TRACK_TYPE_UNKNOWN; }
Example 9
Source File: DashManifestParser.java From TelePlus-Android with GNU General Public License v2.0 | 5 votes |
protected int parseContentType(XmlPullParser xpp) { String contentType = xpp.getAttributeValue(null, "contentType"); return TextUtils.isEmpty(contentType) ? C.TRACK_TYPE_UNKNOWN : MimeTypes.BASE_TYPE_AUDIO.equals(contentType) ? C.TRACK_TYPE_AUDIO : MimeTypes.BASE_TYPE_VIDEO.equals(contentType) ? C.TRACK_TYPE_VIDEO : MimeTypes.BASE_TYPE_TEXT.equals(contentType) ? C.TRACK_TYPE_TEXT : C.TRACK_TYPE_UNKNOWN; }
Example 10
Source File: AtomParsers.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** Returns the track type for a given handler value. */ private static int getTrackTypeForHdlr(int hdlr) { if (hdlr == TYPE_soun) { return C.TRACK_TYPE_AUDIO; } else if (hdlr == TYPE_vide) { return C.TRACK_TYPE_VIDEO; } else if (hdlr == TYPE_text || hdlr == TYPE_sbtl || hdlr == TYPE_subt || hdlr == TYPE_clcp) { return C.TRACK_TYPE_TEXT; } else if (hdlr == TYPE_meta) { return C.TRACK_TYPE_METADATA; } else { return C.TRACK_TYPE_UNKNOWN; } }
Example 11
Source File: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
protected int getContentType(Format format) { String sampleMimeType = format.sampleMimeType; if (TextUtils.isEmpty(sampleMimeType)) { return C.TRACK_TYPE_UNKNOWN; } else if (MimeTypes.isVideo(sampleMimeType)) { return C.TRACK_TYPE_VIDEO; } else if (MimeTypes.isAudio(sampleMimeType)) { return C.TRACK_TYPE_AUDIO; } else if (mimeTypeIsRawText(sampleMimeType)) { return C.TRACK_TYPE_TEXT; } return C.TRACK_TYPE_UNKNOWN; }
Example 12
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 5 votes |
protected int parseContentType(XmlPullParser xpp) { String contentType = xpp.getAttributeValue(null, "contentType"); return TextUtils.isEmpty(contentType) ? C.TRACK_TYPE_UNKNOWN : MimeTypes.BASE_TYPE_AUDIO.equals(contentType) ? C.TRACK_TYPE_AUDIO : MimeTypes.BASE_TYPE_VIDEO.equals(contentType) ? C.TRACK_TYPE_VIDEO : MimeTypes.BASE_TYPE_TEXT.equals(contentType) ? C.TRACK_TYPE_TEXT : C.TRACK_TYPE_UNKNOWN; }
Example 13
Source File: MimeTypes.java From MediaSDK with Apache License 2.0 | 5 votes |
private static int getTrackTypeForCustomMimeType(String mimeType) { int customMimeTypeCount = customMimeTypes.size(); for (int i = 0; i < customMimeTypeCount; i++) { CustomMimeType customMimeType = customMimeTypes.get(i); if (mimeType.equals(customMimeType.mimeType)) { return customMimeType.trackType; } } return C.TRACK_TYPE_UNKNOWN; }
Example 14
Source File: DashManifestParser.java From K-Sonic with MIT License | 5 votes |
protected int getContentType(Format format) { String sampleMimeType = format.sampleMimeType; if (TextUtils.isEmpty(sampleMimeType)) { return C.TRACK_TYPE_UNKNOWN; } else if (MimeTypes.isVideo(sampleMimeType)) { return C.TRACK_TYPE_VIDEO; } else if (MimeTypes.isAudio(sampleMimeType)) { return C.TRACK_TYPE_AUDIO; } else if (mimeTypeIsRawText(sampleMimeType)) { return C.TRACK_TYPE_TEXT; } return C.TRACK_TYPE_UNKNOWN; }
Example 15
Source File: AtomParsers.java From Telegram-FOSS with GNU General Public License v2.0 | 5 votes |
/** * Parses a trak atom (defined in 14496-12). * * @param trak Atom to decode. * @param mvhd Movie header atom, used to get the timescale. * @param duration The duration in units of the timescale declared in the mvhd atom, or * {@link C#TIME_UNSET} if the duration should be parsed from the tkhd atom. * @param drmInitData {@link DrmInitData} to be included in the format. * @param ignoreEditLists Whether to ignore any edit lists in the trak box. * @param isQuickTime True for QuickTime media. False otherwise. * @return A {@link Track} instance, or {@code null} if the track's type isn't supported. */ public static Track parseTrak(Atom.ContainerAtom trak, Atom.LeafAtom mvhd, long duration, DrmInitData drmInitData, boolean ignoreEditLists, boolean isQuickTime) throws ParserException { Atom.ContainerAtom mdia = trak.getContainerAtomOfType(Atom.TYPE_mdia); int trackType = getTrackTypeForHdlr(parseHdlr(mdia.getLeafAtomOfType(Atom.TYPE_hdlr).data)); if (trackType == C.TRACK_TYPE_UNKNOWN) { return null; } TkhdData tkhdData = parseTkhd(trak.getLeafAtomOfType(Atom.TYPE_tkhd).data); if (duration == C.TIME_UNSET) { duration = tkhdData.duration; } long movieTimescale = parseMvhd(mvhd.data); long durationUs; if (duration == C.TIME_UNSET) { durationUs = C.TIME_UNSET; } else { durationUs = Util.scaleLargeTimestamp(duration, C.MICROS_PER_SECOND, movieTimescale); } Atom.ContainerAtom stbl = mdia.getContainerAtomOfType(Atom.TYPE_minf) .getContainerAtomOfType(Atom.TYPE_stbl); Pair<Long, String> mdhdData = parseMdhd(mdia.getLeafAtomOfType(Atom.TYPE_mdhd).data); StsdData stsdData = parseStsd(stbl.getLeafAtomOfType(Atom.TYPE_stsd).data, tkhdData.id, tkhdData.rotationDegrees, mdhdData.second, drmInitData, isQuickTime); long[] editListDurations = null; long[] editListMediaTimes = null; if (!ignoreEditLists) { Pair<long[], long[]> edtsData = parseEdts(trak.getContainerAtomOfType(Atom.TYPE_edts)); editListDurations = edtsData.first; editListMediaTimes = edtsData.second; } return stsdData.format == null ? null : new Track(tkhdData.id, trackType, mdhdData.first, movieTimescale, durationUs, stsdData.format, stsdData.requiredSampleTransformation, stsdData.trackEncryptionBoxes, stsdData.nalUnitLengthFieldLength, editListDurations, editListMediaTimes); }
Example 16
Source File: DashManifestParser.java From TelePlus-Android with GNU General Public License v2.0 | 3 votes |
/** * Checks two adaptation set content types for consistency, returning the consistent type, or * throwing an {@link IllegalStateException} if the types are inconsistent. * <p> * Two types are consistent if they are equal, or if one is {@link C#TRACK_TYPE_UNKNOWN}. * Where one of the types is {@link C#TRACK_TYPE_UNKNOWN}, the other is returned. * * @param firstType The first type. * @param secondType The second type. * @return The consistent type. */ private static int checkContentTypeConsistency(int firstType, int secondType) { if (firstType == C.TRACK_TYPE_UNKNOWN) { return secondType; } else if (secondType == C.TRACK_TYPE_UNKNOWN) { return firstType; } else { Assertions.checkState(firstType == secondType); return firstType; } }
Example 17
Source File: DashManifestParser.java From K-Sonic with MIT License | 3 votes |
/** * Checks two adaptation set content types for consistency, returning the consistent type, or * throwing an {@link IllegalStateException} if the types are inconsistent. * <p> * Two types are consistent if they are equal, or if one is {@link C#TRACK_TYPE_UNKNOWN}. * Where one of the types is {@link C#TRACK_TYPE_UNKNOWN}, the other is returned. * * @param firstType The first type. * @param secondType The second type. * @return The consistent type. */ private static int checkContentTypeConsistency(int firstType, int secondType) { if (firstType == C.TRACK_TYPE_UNKNOWN) { return secondType; } else if (secondType == C.TRACK_TYPE_UNKNOWN) { return firstType; } else { Assertions.checkState(firstType == secondType); return firstType; } }
Example 18
Source File: DashManifestParser.java From Telegram with GNU General Public License v2.0 | 3 votes |
/** * Checks two adaptation set content types for consistency, returning the consistent type, or * throwing an {@link IllegalStateException} if the types are inconsistent. * <p> * Two types are consistent if they are equal, or if one is {@link C#TRACK_TYPE_UNKNOWN}. * Where one of the types is {@link C#TRACK_TYPE_UNKNOWN}, the other is returned. * * @param firstType The first type. * @param secondType The second type. * @return The consistent type. */ private static int checkContentTypeConsistency(int firstType, int secondType) { if (firstType == C.TRACK_TYPE_UNKNOWN) { return secondType; } else if (secondType == C.TRACK_TYPE_UNKNOWN) { return firstType; } else { Assertions.checkState(firstType == secondType); return firstType; } }
Example 19
Source File: DashManifestParser.java From MediaSDK with Apache License 2.0 | 3 votes |
/** * Checks two adaptation set content types for consistency, returning the consistent type, or * throwing an {@link IllegalStateException} if the types are inconsistent. * <p> * Two types are consistent if they are equal, or if one is {@link C#TRACK_TYPE_UNKNOWN}. * Where one of the types is {@link C#TRACK_TYPE_UNKNOWN}, the other is returned. * * @param firstType The first type. * @param secondType The second type. * @return The consistent type. */ private static int checkContentTypeConsistency(int firstType, int secondType) { if (firstType == C.TRACK_TYPE_UNKNOWN) { return secondType; } else if (secondType == C.TRACK_TYPE_UNKNOWN) { return firstType; } else { Assertions.checkState(firstType == secondType); return firstType; } }
Example 20
Source File: DashManifestParser.java From Telegram-FOSS with GNU General Public License v2.0 | 3 votes |
/** * Checks two adaptation set content types for consistency, returning the consistent type, or * throwing an {@link IllegalStateException} if the types are inconsistent. * <p> * Two types are consistent if they are equal, or if one is {@link C#TRACK_TYPE_UNKNOWN}. * Where one of the types is {@link C#TRACK_TYPE_UNKNOWN}, the other is returned. * * @param firstType The first type. * @param secondType The second type. * @return The consistent type. */ private static int checkContentTypeConsistency(int firstType, int secondType) { if (firstType == C.TRACK_TYPE_UNKNOWN) { return secondType; } else if (secondType == C.TRACK_TYPE_UNKNOWN) { return firstType; } else { Assertions.checkState(firstType == secondType); return firstType; } }