mirror of
https://github.com/samsonjs/media.git
synced 2026-03-29 10:05:48 +00:00
Merge updates from GitHub.
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=117808998
This commit is contained in:
parent
5b06bfd5a8
commit
27ab1a2e65
4 changed files with 29 additions and 4 deletions
|
|
@ -226,6 +226,15 @@ public final class Format {
|
|||
subsampleOffsetUs, null, false);
|
||||
}
|
||||
|
||||
// Image.
|
||||
|
||||
public static Format createImageSampleFormat(String id, String sampleMimeType, int bitrate,
|
||||
List<byte[]> initializationData, String language) {
|
||||
return new Format(id, null, sampleMimeType, bitrate, NO_VALUE, NO_VALUE, NO_VALUE,
|
||||
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, language,
|
||||
OFFSET_SAMPLE_RELATIVE, initializationData, false);
|
||||
}
|
||||
|
||||
// Generic.
|
||||
|
||||
public static Format createContainerFormat(String id, String containerMimeType,
|
||||
|
|
|
|||
|
|
@ -82,6 +82,8 @@ public final class WebmExtractor implements Extractor {
|
|||
private static final String CODEC_ID_DTS_LOSSLESS = "A_DTS/LOSSLESS";
|
||||
private static final String CODEC_ID_FLAC = "A_FLAC";
|
||||
private static final String CODEC_ID_SUBRIP = "S_TEXT/UTF8";
|
||||
private static final String CODEC_ID_VOBSUB = "S_VOBSUB";
|
||||
private static final String CODEC_ID_PGS = "S_HDMV/PGS";
|
||||
|
||||
private static final int VORBIS_MAX_INPUT_SIZE = 8192;
|
||||
private static final int OPUS_MAX_INPUT_SIZE = 5760;
|
||||
|
|
@ -1068,7 +1070,9 @@ public final class WebmExtractor implements Extractor {
|
|||
|| CODEC_ID_DTS_EXPRESS.equals(codecId)
|
||||
|| CODEC_ID_DTS_LOSSLESS.equals(codecId)
|
||||
|| CODEC_ID_FLAC.equals(codecId)
|
||||
|| CODEC_ID_SUBRIP.equals(codecId);
|
||||
|| CODEC_ID_SUBRIP.equals(codecId)
|
||||
|| CODEC_ID_VOBSUB.equals(codecId)
|
||||
|| CODEC_ID_PGS.equals(codecId);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1253,6 +1257,13 @@ public final class WebmExtractor implements Extractor {
|
|||
case CODEC_ID_SUBRIP:
|
||||
mimeType = MimeTypes.APPLICATION_SUBRIP;
|
||||
break;
|
||||
case CODEC_ID_VOBSUB:
|
||||
mimeType = MimeTypes.APPLICATION_VOBSUB;
|
||||
initializationData = Collections.singletonList(codecPrivate);
|
||||
break;
|
||||
case CODEC_ID_PGS:
|
||||
mimeType = MimeTypes.APPLICATION_PGS;
|
||||
break;
|
||||
default:
|
||||
throw new ParserException("Unrecognized codec identifier.");
|
||||
}
|
||||
|
|
@ -1278,6 +1289,10 @@ public final class WebmExtractor implements Extractor {
|
|||
} else if (MimeTypes.APPLICATION_SUBRIP.equals(mimeType)) {
|
||||
format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, Format.NO_VALUE,
|
||||
language);
|
||||
} else if (MimeTypes.APPLICATION_VOBSUB.equals(mimeType)
|
||||
|| MimeTypes.APPLICATION_PGS.equals(mimeType)) {
|
||||
format = Format.createImageSampleFormat(Integer.toString(trackId), mimeType,
|
||||
Format.NO_VALUE, initializationData, language);
|
||||
} else {
|
||||
throw new ParserException("Unexpected MIME type.");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,9 +82,8 @@ public final class UdpDataSource implements UriDataSource {
|
|||
@Override
|
||||
public long open(DataSpec dataSpec) throws UdpDataSourceException {
|
||||
this.dataSpec = dataSpec;
|
||||
String uri = dataSpec.uri.toString();
|
||||
String host = uri.substring(0, uri.indexOf(':'));
|
||||
int port = Integer.parseInt(uri.substring(uri.indexOf(':') + 1));
|
||||
String host = dataSpec.uri.getHost();
|
||||
int port = dataSpec.uri.getPort();
|
||||
|
||||
try {
|
||||
address = InetAddress.getByName(host);
|
||||
|
|
|
|||
|
|
@ -65,6 +65,8 @@ public final class MimeTypes {
|
|||
public static final String APPLICATION_M3U8 = BASE_TYPE_APPLICATION + "/x-mpegURL";
|
||||
public static final String APPLICATION_TX3G = BASE_TYPE_APPLICATION + "/x-quicktime-tx3g";
|
||||
public static final String APPLICATION_MP4VTT = BASE_TYPE_APPLICATION + "/x-mp4vtt";
|
||||
public static final String APPLICATION_VOBSUB = BASE_TYPE_APPLICATION + "/vobsub";
|
||||
public static final String APPLICATION_PGS = BASE_TYPE_APPLICATION + "/pgs";
|
||||
|
||||
private MimeTypes() {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue